@apexcura/ui-components 0.0.11-Beta61 → 0.0.11-Beta63

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
@@ -382,13 +382,13 @@ var AddMoreTable = (props) => {
382
382
  variable_data: [
383
383
  {
384
384
  id: 1,
385
- Route: { label: "Route", element: "singleselect", type: "text" },
385
+ Route: { label: "Route", element: "single-select", type: "text" },
386
386
  Dose: { label: "Dose", element: "single-select", type: "text" },
387
387
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
388
388
  When: { label: "When", element: "textarea", type: "text" },
389
389
  Duration: { label: "Duration", element: "textarea", type: "text" },
390
390
  Instructions: { label: "Instructions", element: "textarea", type: "text" },
391
- icons: { delete: "plusOutlined", add: "plusOut-lined" }
391
+ icons: { delete: "plusOutlined", add: "plusOutlined" }
392
392
  }
393
393
  ]
394
394
  };
@@ -445,44 +445,33 @@ var AddMoreTable = (props) => {
445
445
  const renderInputElement = (element) => {
446
446
  const { element: type, label } = element;
447
447
  if (type === "single-select") {
448
- return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
448
+ return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { key: label, onChange: (value) => onHandleChange(label, value) });
449
449
  } else if (type === "textarea") {
450
- return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
450
+ return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { key: label, onChange: (value) => onHandleChange(label, value) });
451
451
  } else {
452
452
  return null;
453
453
  }
454
454
  };
455
- const dataSource = rows.flatMap((eachRow, index) => {
456
- const rowData = [];
455
+ const dataSource = rows.map((eachRow, index) => {
457
456
  const mainRow = {
458
- key: index.toString(),
457
+ key: eachRow.id.toString(),
459
458
  "#": index + 1,
460
- ...eachRow,
461
- 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)))
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))),
460
+ subRows: eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex, style: { marginBottom: "10px" } }, Object.entries(variable).map(([key, value]) => {
461
+ if (key === "icons") {
462
+ return /* @__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)));
463
+ }
464
+ if (value && value.element && value.label) {
465
+ return renderInputElement(value);
466
+ }
467
+ return null;
468
+ })))
462
469
  };
463
- const subRowElements = [];
464
- if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
465
- eachRow.variable_data.forEach((variable, subIndex) => {
466
- const subRowElement = {};
467
- Object.entries(variable).forEach(([key, value]) => {
468
- if (key === "icons" && value) {
469
- subRowElement["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)));
470
- } else if (value && value.element && value.label) {
471
- subRowElement[value.label] = renderInputElement(value);
472
- }
473
- });
474
- subRowElements.push(subRowElement);
475
- });
476
- }
477
- rowData.push({
470
+ return {
478
471
  ...mainRow,
479
- "Medicine": renderInputElement({
480
- element: eachRow.element,
481
- label: eachRow.label
482
- }),
483
- "sub rows": subRowElements
484
- });
485
- return rowData;
472
+ ...eachRow,
473
+ subRows: /* @__PURE__ */ import_react13.default.createElement("div", null, mainRow.subRows)
474
+ };
486
475
  });
487
476
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
488
477
  columns.push({
package/dist/index.mjs CHANGED
@@ -335,13 +335,13 @@ var AddMoreTable = (props) => {
335
335
  variable_data: [
336
336
  {
337
337
  id: 1,
338
- Route: { label: "Route", element: "singleselect", type: "text" },
338
+ Route: { label: "Route", element: "single-select", type: "text" },
339
339
  Dose: { label: "Dose", element: "single-select", type: "text" },
340
340
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
341
341
  When: { label: "When", element: "textarea", type: "text" },
342
342
  Duration: { label: "Duration", element: "textarea", type: "text" },
343
343
  Instructions: { label: "Instructions", element: "textarea", type: "text" },
344
- icons: { delete: "plusOutlined", add: "plusOut-lined" }
344
+ icons: { delete: "plusOutlined", add: "plusOutlined" }
345
345
  }
346
346
  ]
347
347
  };
@@ -398,44 +398,33 @@ var AddMoreTable = (props) => {
398
398
  const renderInputElement = (element) => {
399
399
  const { element: type, label } = element;
400
400
  if (type === "single-select") {
401
- return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
401
+ return /* @__PURE__ */ React12.createElement(SingleSelectElement, { key: label, onChange: (value) => onHandleChange(label, value) });
402
402
  } else if (type === "textarea") {
403
- return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
403
+ return /* @__PURE__ */ React12.createElement(TextareaElement, { key: label, onChange: (value) => onHandleChange(label, value) });
404
404
  } else {
405
405
  return null;
406
406
  }
407
407
  };
408
- const dataSource = rows.flatMap((eachRow, index) => {
409
- const rowData = [];
408
+ const dataSource = rows.map((eachRow, index) => {
410
409
  const mainRow = {
411
- key: index.toString(),
410
+ key: eachRow.id.toString(),
412
411
  "#": index + 1,
413
- ...eachRow,
414
- 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)))
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))),
413
+ subRows: eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ React12.createElement("div", { key: subIndex, style: { marginBottom: "10px" } }, Object.entries(variable).map(([key, value]) => {
414
+ if (key === "icons") {
415
+ return /* @__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)));
416
+ }
417
+ if (value && value.element && value.label) {
418
+ return renderInputElement(value);
419
+ }
420
+ return null;
421
+ })))
415
422
  };
416
- const subRowElements = [];
417
- if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
418
- eachRow.variable_data.forEach((variable, subIndex) => {
419
- const subRowElement = {};
420
- Object.entries(variable).forEach(([key, value]) => {
421
- if (key === "icons" && value) {
422
- subRowElement["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)));
423
- } else if (value && value.element && value.label) {
424
- subRowElement[value.label] = renderInputElement(value);
425
- }
426
- });
427
- subRowElements.push(subRowElement);
428
- });
429
- }
430
- rowData.push({
423
+ return {
431
424
  ...mainRow,
432
- "Medicine": renderInputElement({
433
- element: eachRow.element,
434
- label: eachRow.label
435
- }),
436
- "sub rows": subRowElements
437
- });
438
- return rowData;
425
+ ...eachRow,
426
+ subRows: /* @__PURE__ */ React12.createElement("div", null, mainRow.subRows)
427
+ };
439
428
  });
440
429
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
441
430
  columns.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta61",
3
+ "version": "0.0.11-Beta63",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",