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

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,38 @@ 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);
456
+ const dataSource = rows.flatMap((eachRow, index) => {
457
+ const rowData = [];
458
+ if (thead && Array.isArray(thead)) {
459
+ const mainRow2 = {};
460
+ thead.forEach((theadItem) => {
461
+ if (theadItem.element && theadItem.label) {
462
+ mainRow2[theadItem.label] = renderInputElement(theadItem);
463
+ }
464
+ });
465
+ rowData.push(mainRow2);
459
466
  }
467
+ const mainRow = {
468
+ key: index.toString(),
469
+ "#": index + 1,
470
+ ...eachRow,
471
+ 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)))
472
+ };
473
+ rowData.push(mainRow);
460
474
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
461
475
  eachRow.variable_data.forEach((variable, subIndex) => {
476
+ const subRowElements = {};
462
477
  Object.entries(variable).forEach(([key, value]) => {
463
478
  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)));
479
+ 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
480
  } else if (value && value.element && value.label) {
466
- rowElements[value.label] = renderInputElement(value);
481
+ subRowElements[value.label] = renderInputElement(value);
467
482
  }
468
483
  });
484
+ rowData.push(subRowElements);
469
485
  });
470
486
  }
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
- };
487
+ return rowData;
478
488
  });
479
489
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
480
490
  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,38 @@ 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);
409
+ const dataSource = rows.flatMap((eachRow, index) => {
410
+ const rowData = [];
411
+ if (thead && Array.isArray(thead)) {
412
+ const mainRow2 = {};
413
+ thead.forEach((theadItem) => {
414
+ if (theadItem.element && theadItem.label) {
415
+ mainRow2[theadItem.label] = renderInputElement(theadItem);
416
+ }
417
+ });
418
+ rowData.push(mainRow2);
412
419
  }
420
+ const mainRow = {
421
+ key: index.toString(),
422
+ "#": index + 1,
423
+ ...eachRow,
424
+ 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)))
425
+ };
426
+ rowData.push(mainRow);
413
427
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
414
428
  eachRow.variable_data.forEach((variable, subIndex) => {
429
+ const subRowElements = {};
415
430
  Object.entries(variable).forEach(([key, value]) => {
416
431
  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)));
432
+ 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
433
  } else if (value && value.element && value.label) {
419
- rowElements[value.label] = renderInputElement(value);
434
+ subRowElements[value.label] = renderInputElement(value);
420
435
  }
421
436
  });
437
+ rowData.push(subRowElements);
422
438
  });
423
439
  }
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
- };
440
+ return rowData;
431
441
  });
432
442
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
433
443
  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-Beta47",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",