@apexcura/ui-components 0.0.11-Beta46 → 0.0.11-Beta48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -392,6 +392,7 @@ var AddMoreTable = (props) => {
392
392
  }
393
393
  ]
394
394
  };
395
+ console.log(rows);
395
396
  setRows((prevData) => [...prevData, newRow]);
396
397
  };
397
398
  const onHandleDelete = (index) => {
@@ -452,29 +453,31 @@ var AddMoreTable = (props) => {
452
453
  return null;
453
454
  }
454
455
  };
455
- const dataSource = rows.map((eachRow, index) => {
456
- const rowElements = {};
457
- if (eachRow.element && eachRow.label) {
458
- rowElements[eachRow.label] = renderInputElement(eachRow);
459
- }
456
+ const dataSource = rows.flatMap((eachRow, index) => {
457
+ const rowData = [];
458
+ const mainRow = {
459
+ key: index.toString(),
460
+ "#": index + 1,
461
+ ...eachRow,
462
+ actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
463
+ };
464
+ rowData.push(mainRow);
465
+ console.log("eachrow", ...eachRow);
466
+ console.log(thead);
460
467
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
461
468
  eachRow.variable_data.forEach((variable, subIndex) => {
469
+ const subRowElements = {};
462
470
  Object.entries(variable).forEach(([key, value]) => {
463
471
  if (key === "icons" && value) {
464
- rowElements["sub rows"] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
472
+ subRowElements["sub rows"] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
465
473
  } else if (value && value.element && value.label) {
466
- rowElements[value.label] = renderInputElement(value);
474
+ subRowElements[value.label] = renderInputElement(value);
467
475
  }
468
476
  });
477
+ rowData.push(subRowElements);
469
478
  });
470
479
  }
471
- return {
472
- key: index.toString(),
473
- "#": index + 1,
474
- ...eachRow,
475
- ...rowElements,
476
- actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
477
- };
480
+ return rowData;
478
481
  });
479
482
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
480
483
  columns.push({
package/dist/index.mjs CHANGED
@@ -345,6 +345,7 @@ var AddMoreTable = (props) => {
345
345
  }
346
346
  ]
347
347
  };
348
+ console.log(rows);
348
349
  setRows((prevData) => [...prevData, newRow]);
349
350
  };
350
351
  const onHandleDelete = (index) => {
@@ -405,29 +406,31 @@ var AddMoreTable = (props) => {
405
406
  return null;
406
407
  }
407
408
  };
408
- const dataSource = rows.map((eachRow, index) => {
409
- const rowElements = {};
410
- if (eachRow.element && eachRow.label) {
411
- rowElements[eachRow.label] = renderInputElement(eachRow);
412
- }
409
+ const dataSource = rows.flatMap((eachRow, index) => {
410
+ const rowData = [];
411
+ const mainRow = {
412
+ key: index.toString(),
413
+ "#": index + 1,
414
+ ...eachRow,
415
+ actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
416
+ };
417
+ rowData.push(mainRow);
418
+ console.log("eachrow", ...eachRow);
419
+ console.log(thead);
413
420
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
414
421
  eachRow.variable_data.forEach((variable, subIndex) => {
422
+ const subRowElements = {};
415
423
  Object.entries(variable).forEach(([key, value]) => {
416
424
  if (key === "icons" && value) {
417
- rowElements["sub rows"] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
425
+ subRowElements["sub rows"] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
418
426
  } else if (value && value.element && value.label) {
419
- rowElements[value.label] = renderInputElement(value);
427
+ subRowElements[value.label] = renderInputElement(value);
420
428
  }
421
429
  });
430
+ rowData.push(subRowElements);
422
431
  });
423
432
  }
424
- return {
425
- key: index.toString(),
426
- "#": index + 1,
427
- ...eachRow,
428
- ...rowElements,
429
- actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
430
- };
433
+ return rowData;
431
434
  });
432
435
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
433
436
  columns.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta46",
3
+ "version": "0.0.11-Beta48",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",