@apexcura/ui-components 0.0.11-Beta41 → 0.0.11-Beta42

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
@@ -426,33 +426,29 @@ var AddMoreTable = (props) => {
426
426
  return null;
427
427
  }
428
428
  };
429
- const dataSource = rows.map((eachRow, index) => {
430
- const rowElements = {};
431
- if (eachRow.element && eachRow.label) {
432
- rowElements[eachRow.label] = renderInputElement(eachRow);
433
- }
429
+ const dataSource = rows.flatMap((eachRow, index) => {
430
+ const rowData = [];
431
+ const mainRow = {
432
+ key: index.toString(),
433
+ "#": index + 1,
434
+ ...eachRow,
435
+ 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)))
436
+ };
437
+ rowData.push(mainRow);
434
438
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
435
- eachRow.variable_data.forEach((variable) => {
439
+ eachRow.variable_data.forEach((variable, subIndex) => {
440
+ const subRowElements = {};
436
441
  Object.entries(variable).forEach(([key, value]) => {
437
442
  if (key === "icons" && value) {
438
- {
439
- eachRow.variable_data.map((variable2, subIndex) => {
440
- rowElements["sub rows"] = /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement("button", null, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
441
- });
442
- }
443
+ subRowElements["sub rows"] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, null, /* @__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)));
443
444
  } else if (value && value.element && value.label) {
444
- rowElements[value.label] = renderInputElement(value);
445
+ subRowElements[value.label] = renderInputElement(value);
445
446
  }
446
447
  });
448
+ rowData.push(subRowElements);
447
449
  });
448
450
  }
449
- return {
450
- key: index.toString(),
451
- "#": index + 1,
452
- ...eachRow,
453
- ...rowElements,
454
- actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
455
- };
451
+ return rowData;
456
452
  });
457
453
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
458
454
  columns.push({
@@ -461,14 +457,15 @@ var AddMoreTable = (props) => {
461
457
  key: "actions"
462
458
  });
463
459
  }
464
- return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
460
+ return /* @__PURE__ */ import_react13.default.createElement(
465
461
  import_antd11.Table,
466
462
  {
467
463
  columns,
468
- expandable: { defaultExpandedRowKeys: ["0"] },
469
- dataSource
464
+ dataSource,
465
+ pagination: false,
466
+ bordered: true
470
467
  }
471
- ));
468
+ );
472
469
  };
473
470
  // Annotate the CommonJS export names for ESM import in node:
474
471
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -313,7 +313,7 @@ var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "s
313
313
 
314
314
  // src/Components/AddMoreTable.tsx
315
315
  import React12, { useState as useState3 } from "react";
316
- import { Table } from "antd";
316
+ import { Table, Button as Button3 } from "antd";
317
317
  import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
318
318
  var AddMoreTable = (props) => {
319
319
  const { thead, tbody } = props;
@@ -379,33 +379,29 @@ var AddMoreTable = (props) => {
379
379
  return null;
380
380
  }
381
381
  };
382
- const dataSource = rows.map((eachRow, index) => {
383
- const rowElements = {};
384
- if (eachRow.element && eachRow.label) {
385
- rowElements[eachRow.label] = renderInputElement(eachRow);
386
- }
382
+ const dataSource = rows.flatMap((eachRow, index) => {
383
+ const rowData = [];
384
+ const mainRow = {
385
+ key: index.toString(),
386
+ "#": index + 1,
387
+ ...eachRow,
388
+ 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)))
389
+ };
390
+ rowData.push(mainRow);
387
391
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
388
- eachRow.variable_data.forEach((variable) => {
392
+ eachRow.variable_data.forEach((variable, subIndex) => {
393
+ const subRowElements = {};
389
394
  Object.entries(variable).forEach(([key, value]) => {
390
395
  if (key === "icons" && value) {
391
- {
392
- eachRow.variable_data.map((variable2, subIndex) => {
393
- rowElements["sub rows"] = /* @__PURE__ */ React12.createElement(React12.Fragment, null, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement("button", null, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
394
- });
395
- }
396
+ subRowElements["sub rows"] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button3, null, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
396
397
  } else if (value && value.element && value.label) {
397
- rowElements[value.label] = renderInputElement(value);
398
+ subRowElements[value.label] = renderInputElement(value);
398
399
  }
399
400
  });
401
+ rowData.push(subRowElements);
400
402
  });
401
403
  }
402
- return {
403
- key: index.toString(),
404
- "#": index + 1,
405
- ...eachRow,
406
- ...rowElements,
407
- actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
408
- };
404
+ return rowData;
409
405
  });
410
406
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
411
407
  columns.push({
@@ -414,14 +410,15 @@ var AddMoreTable = (props) => {
414
410
  key: "actions"
415
411
  });
416
412
  }
417
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
413
+ return /* @__PURE__ */ React12.createElement(
418
414
  Table,
419
415
  {
420
416
  columns,
421
- expandable: { defaultExpandedRowKeys: ["0"] },
422
- dataSource
417
+ dataSource,
418
+ pagination: false,
419
+ bordered: true
423
420
  }
424
- ));
421
+ );
425
422
  };
426
423
  export {
427
424
  AddMoreTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta41",
3
+ "version": "0.0.11-Beta42",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",