@apexcura/ui-components 0.0.11-Beta82 → 0.0.11-Beta84

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
@@ -430,6 +430,9 @@ var AddMoreTable = (props) => {
430
430
  });
431
431
  });
432
432
  };
433
+ (0, import_react13.useEffect)(() => {
434
+ console.log(rows);
435
+ }, [rows]);
433
436
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
434
437
  title: eachHeadEl.label,
435
438
  dataIndex: eachHeadEl.name,
@@ -453,22 +456,22 @@ var AddMoreTable = (props) => {
453
456
  element: eachRow.element,
454
457
  label: eachRow.label
455
458
  }),
456
- ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
457
- Object.keys(variable).forEach((key) => {
458
- console.log("key------", key);
459
- if (key === "SubRows") {
460
- acc[`${key}`] = /* @__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)));
461
- } else {
462
- acc[`${key}`] = renderInputElement(variable[key]);
463
- }
464
- });
465
- return acc;
466
- }, {}),
467
459
  actions: /* @__PURE__ */ import_react13.default.createElement("div", 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)))
468
460
  };
469
- console.log(rowData);
470
- return rowData;
471
- });
461
+ const subRowData = eachRow.variable_data.map((variable, subIndex) => ({
462
+ key: `${eachRow.id}-${subIndex}`,
463
+ "#": `${index + 1}.${subIndex + 1}`,
464
+ ...Object.keys(variable).reduce((acc, key) => {
465
+ if (key === "SubRows") {
466
+ acc[`${key}`] = /* @__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)));
467
+ } else {
468
+ acc[`${key}`] = renderInputElement(variable[key]);
469
+ }
470
+ return acc;
471
+ }, {})
472
+ }));
473
+ return [rowData, ...subRowData];
474
+ }).flat();
472
475
  if (!columns.some((col) => col.dataIndex === "actions")) {
473
476
  columns.push({
474
477
  title: "Actions",
package/dist/index.mjs CHANGED
@@ -312,7 +312,7 @@ import { Button as Button2, Flex as Flex2 } from "antd";
312
312
  var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
313
313
 
314
314
  // src/Components/AddMoreTable.tsx
315
- import React12, { useState as useState3 } from "react";
315
+ import React12, { useEffect, useState as useState3 } from "react";
316
316
  import { Table, Button as Button3 } from "antd";
317
317
  import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
318
318
  var AddMoreTable = (props) => {
@@ -383,6 +383,9 @@ var AddMoreTable = (props) => {
383
383
  });
384
384
  });
385
385
  };
386
+ useEffect(() => {
387
+ console.log(rows);
388
+ }, [rows]);
386
389
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
387
390
  title: eachHeadEl.label,
388
391
  dataIndex: eachHeadEl.name,
@@ -406,22 +409,22 @@ var AddMoreTable = (props) => {
406
409
  element: eachRow.element,
407
410
  label: eachRow.label
408
411
  }),
409
- ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
410
- Object.keys(variable).forEach((key) => {
411
- console.log("key------", key);
412
- if (key === "SubRows") {
413
- acc[`${key}`] = /* @__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)));
414
- } else {
415
- acc[`${key}`] = renderInputElement(variable[key]);
416
- }
417
- });
418
- return acc;
419
- }, {}),
420
412
  actions: /* @__PURE__ */ React12.createElement("div", 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)))
421
413
  };
422
- console.log(rowData);
423
- return rowData;
424
- });
414
+ const subRowData = eachRow.variable_data.map((variable, subIndex) => ({
415
+ key: `${eachRow.id}-${subIndex}`,
416
+ "#": `${index + 1}.${subIndex + 1}`,
417
+ ...Object.keys(variable).reduce((acc, key) => {
418
+ if (key === "SubRows") {
419
+ acc[`${key}`] = /* @__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)));
420
+ } else {
421
+ acc[`${key}`] = renderInputElement(variable[key]);
422
+ }
423
+ return acc;
424
+ }, {})
425
+ }));
426
+ return [rowData, ...subRowData];
427
+ }).flat();
425
428
  if (!columns.some((col) => col.dataIndex === "actions")) {
426
429
  columns.push({
427
430
  title: "Actions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta82",
3
+ "version": "0.0.11-Beta84",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",