@apexcura/ui-components 0.0.11-Beta70 → 0.0.11-Beta72

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
@@ -363,7 +363,7 @@ var import_react13 = __toESM(require("react"));
363
363
  var import_antd11 = require("antd");
364
364
  var import_icons2 = require("@ant-design/icons");
365
365
  var AddMoreTable = (props) => {
366
- const { thead, tbody } = props;
366
+ const { thead = [], tbody } = props;
367
367
  const [tableData, setTableData] = (0, import_react13.useState)({});
368
368
  const [rows, setRows] = (0, import_react13.useState)(tbody || []);
369
369
  const onHandleChange = (name, value) => {
@@ -446,28 +446,25 @@ var AddMoreTable = (props) => {
446
446
  }
447
447
  };
448
448
  const dataSource = rows.map((eachRow, index) => {
449
- console.log("eachrow---------", eachRow);
450
- const subRow = eachRow.variable_data.map((variable, subIndex) => ({
451
- key: `${eachRow.id}-${subIndex}`,
452
- ...Object.fromEntries(Object.entries(variable).map(([key, value]) => {
453
- if (key === "icons") {
454
- return ["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)))];
455
- } else {
456
- return [key, renderInputElement(value)];
457
- }
458
- }))
459
- }));
460
- const rowData = {
461
- "#": index + 1,
462
- "Medicine": renderInputElement({
449
+ const subRowElements = eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex, style: { display: "flex", marginBottom: 8 } }, Object.entries(variable).map(([key, value]) => {
450
+ if (key !== "icons") {
451
+ return /* @__PURE__ */ import_react13.default.createElement("div", { key, style: { marginRight: 8 } }, renderInputElement(value));
452
+ }
453
+ return null;
454
+ }), /* @__PURE__ */ import_react13.default.createElement("div", null, 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)))));
455
+ return {
456
+ key: eachRow.id,
457
+ index: index + 1,
458
+ medicine: renderInputElement({
463
459
  element: eachRow.element,
464
460
  label: eachRow.label
465
461
  }),
466
- subRow: [...subRow],
462
+ ...Object.fromEntries(
463
+ thead.map((eachHeadEl) => [eachHeadEl.name, subRowElements])
464
+ ),
467
465
  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
466
  };
469
- return [rowData];
470
- }).flat();
467
+ });
471
468
  if (!columns.some((col) => col.dataIndex === "actions")) {
472
469
  columns.push({
473
470
  title: "Actions",
package/dist/index.mjs CHANGED
@@ -316,7 +316,7 @@ import React12, { 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) => {
319
- const { thead, tbody } = props;
319
+ const { thead = [], tbody } = props;
320
320
  const [tableData, setTableData] = useState3({});
321
321
  const [rows, setRows] = useState3(tbody || []);
322
322
  const onHandleChange = (name, value) => {
@@ -399,28 +399,25 @@ var AddMoreTable = (props) => {
399
399
  }
400
400
  };
401
401
  const dataSource = rows.map((eachRow, index) => {
402
- console.log("eachrow---------", eachRow);
403
- const subRow = eachRow.variable_data.map((variable, subIndex) => ({
404
- key: `${eachRow.id}-${subIndex}`,
405
- ...Object.fromEntries(Object.entries(variable).map(([key, value]) => {
406
- if (key === "icons") {
407
- return ["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)))];
408
- } else {
409
- return [key, renderInputElement(value)];
410
- }
411
- }))
412
- }));
413
- const rowData = {
414
- "#": index + 1,
415
- "Medicine": renderInputElement({
402
+ const subRowElements = eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ React12.createElement("div", { key: subIndex, style: { display: "flex", marginBottom: 8 } }, Object.entries(variable).map(([key, value]) => {
403
+ if (key !== "icons") {
404
+ return /* @__PURE__ */ React12.createElement("div", { key, style: { marginRight: 8 } }, renderInputElement(value));
405
+ }
406
+ return null;
407
+ }), /* @__PURE__ */ React12.createElement("div", null, 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)))));
408
+ return {
409
+ key: eachRow.id,
410
+ index: index + 1,
411
+ medicine: renderInputElement({
416
412
  element: eachRow.element,
417
413
  label: eachRow.label
418
414
  }),
419
- subRow: [...subRow],
415
+ ...Object.fromEntries(
416
+ thead.map((eachHeadEl) => [eachHeadEl.name, subRowElements])
417
+ ),
420
418
  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
419
  };
422
- return [rowData];
423
- }).flat();
420
+ });
424
421
  if (!columns.some((col) => col.dataIndex === "actions")) {
425
422
  columns.push({
426
423
  title: "Actions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta70",
3
+ "version": "0.0.11-Beta72",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",