@apexcura/ui-components 0.0.11-Beta60 → 0.0.11-Beta62
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 +25 -33
- package/dist/index.mjs +25 -33
- 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: "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: "
|
|
391
|
+
icons: { delete: "plusOutlined", add: "plusOutlined" }
|
|
392
392
|
}
|
|
393
393
|
]
|
|
394
394
|
};
|
|
@@ -445,45 +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.
|
|
456
|
-
const rowData = [];
|
|
455
|
+
const dataSource = rows.map((eachRow, index) => {
|
|
457
456
|
const mainRow = {
|
|
458
|
-
key:
|
|
457
|
+
key: eachRow.id.toString(),
|
|
459
458
|
"#": index + 1,
|
|
460
|
-
|
|
461
|
-
|
|
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
|
-
|
|
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
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}),
|
|
483
|
-
"sub rows": subRowElements
|
|
484
|
-
});
|
|
485
|
-
console.log("rowData++++++++++", rowData);
|
|
486
|
-
return rowData;
|
|
472
|
+
...eachRow,
|
|
473
|
+
subRows: /* @__PURE__ */ import_react13.default.createElement("div", null, mainRow.subRows)
|
|
474
|
+
};
|
|
487
475
|
});
|
|
488
476
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
|
489
477
|
columns.push({
|
|
@@ -498,7 +486,11 @@ var AddMoreTable = (props) => {
|
|
|
498
486
|
columns,
|
|
499
487
|
dataSource,
|
|
500
488
|
pagination: false,
|
|
501
|
-
bordered: true
|
|
489
|
+
bordered: true,
|
|
490
|
+
expandable: {
|
|
491
|
+
expandedRowRender: (record) => /* @__PURE__ */ import_react13.default.createElement("div", null, record.subRows),
|
|
492
|
+
rowExpandable: (record) => record.subRows.length > 0
|
|
493
|
+
}
|
|
502
494
|
}
|
|
503
495
|
);
|
|
504
496
|
};
|
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: "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: "
|
|
344
|
+
icons: { delete: "plusOutlined", add: "plusOutlined" }
|
|
345
345
|
}
|
|
346
346
|
]
|
|
347
347
|
};
|
|
@@ -398,45 +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.
|
|
409
|
-
const rowData = [];
|
|
408
|
+
const dataSource = rows.map((eachRow, index) => {
|
|
410
409
|
const mainRow = {
|
|
411
|
-
key:
|
|
410
|
+
key: eachRow.id.toString(),
|
|
412
411
|
"#": index + 1,
|
|
413
|
-
|
|
414
|
-
|
|
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
|
-
|
|
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
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}),
|
|
436
|
-
"sub rows": subRowElements
|
|
437
|
-
});
|
|
438
|
-
console.log("rowData++++++++++", rowData);
|
|
439
|
-
return rowData;
|
|
425
|
+
...eachRow,
|
|
426
|
+
subRows: /* @__PURE__ */ React12.createElement("div", null, mainRow.subRows)
|
|
427
|
+
};
|
|
440
428
|
});
|
|
441
429
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
|
442
430
|
columns.push({
|
|
@@ -451,7 +439,11 @@ var AddMoreTable = (props) => {
|
|
|
451
439
|
columns,
|
|
452
440
|
dataSource,
|
|
453
441
|
pagination: false,
|
|
454
|
-
bordered: true
|
|
442
|
+
bordered: true,
|
|
443
|
+
expandable: {
|
|
444
|
+
expandedRowRender: (record) => /* @__PURE__ */ React12.createElement("div", null, record.subRows),
|
|
445
|
+
rowExpandable: (record) => record.subRows.length > 0
|
|
446
|
+
}
|
|
455
447
|
}
|
|
456
448
|
);
|
|
457
449
|
};
|