@apexcura/ui-components 0.0.11-Beta63 → 0.0.11-Beta65
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 +31 -20
- package/dist/index.mjs +31 -20
- package/package.json +1 -1
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: "
|
|
385
|
+
Route: { label: "Route", element: "singleselect", 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: "
|
|
391
|
+
icons: { delete: "plusOutlined", add: "plusOut-lined" }
|
|
392
392
|
}
|
|
393
393
|
]
|
|
394
394
|
};
|
|
@@ -445,33 +445,44 @@ 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, {
|
|
448
|
+
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
|
|
449
449
|
} else if (type === "textarea") {
|
|
450
|
-
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, {
|
|
450
|
+
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
|
|
451
451
|
} else {
|
|
452
452
|
return null;
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
|
-
const dataSource = rows.
|
|
455
|
+
const dataSource = rows.flatMap((eachRow, index) => {
|
|
456
|
+
const rowData = [];
|
|
456
457
|
const mainRow = {
|
|
457
|
-
key:
|
|
458
|
+
key: index.toString(),
|
|
458
459
|
"#": index + 1,
|
|
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
|
-
})))
|
|
469
|
-
};
|
|
470
|
-
return {
|
|
471
|
-
...mainRow,
|
|
472
460
|
...eachRow,
|
|
473
|
-
|
|
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)))
|
|
474
462
|
};
|
|
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({
|
|
478
|
+
...mainRow,
|
|
479
|
+
"Medicine": renderInputElement({
|
|
480
|
+
element: eachRow.element,
|
|
481
|
+
label: eachRow.label
|
|
482
|
+
}),
|
|
483
|
+
"sub rows": subRowElements
|
|
484
|
+
});
|
|
485
|
+
return rowData;
|
|
475
486
|
});
|
|
476
487
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
|
477
488
|
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: "
|
|
338
|
+
Route: { label: "Route", element: "singleselect", 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: "
|
|
344
|
+
icons: { delete: "plusOutlined", add: "plusOut-lined" }
|
|
345
345
|
}
|
|
346
346
|
]
|
|
347
347
|
};
|
|
@@ -398,33 +398,44 @@ 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, {
|
|
401
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
|
|
402
402
|
} else if (type === "textarea") {
|
|
403
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, {
|
|
403
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
|
|
404
404
|
} else {
|
|
405
405
|
return null;
|
|
406
406
|
}
|
|
407
407
|
};
|
|
408
|
-
const dataSource = rows.
|
|
408
|
+
const dataSource = rows.flatMap((eachRow, index) => {
|
|
409
|
+
const rowData = [];
|
|
409
410
|
const mainRow = {
|
|
410
|
-
key:
|
|
411
|
+
key: index.toString(),
|
|
411
412
|
"#": index + 1,
|
|
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
|
-
})))
|
|
422
|
-
};
|
|
423
|
-
return {
|
|
424
|
-
...mainRow,
|
|
425
413
|
...eachRow,
|
|
426
|
-
|
|
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)))
|
|
427
415
|
};
|
|
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({
|
|
431
|
+
...mainRow,
|
|
432
|
+
"Medicine": renderInputElement({
|
|
433
|
+
element: eachRow.element,
|
|
434
|
+
label: eachRow.label
|
|
435
|
+
}),
|
|
436
|
+
"sub rows": subRowElements
|
|
437
|
+
});
|
|
438
|
+
return rowData;
|
|
428
439
|
});
|
|
429
440
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
|
430
441
|
columns.push({
|