@apexcura/ui-components 0.0.11-Beta85 → 0.0.11-Beta86
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 -35
- package/dist/index.mjs +25 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -364,12 +364,7 @@ var import_antd11 = require("antd");
|
|
|
364
364
|
var import_icons2 = require("@ant-design/icons");
|
|
365
365
|
var AddMoreTable = (props) => {
|
|
366
366
|
const { thead, tbody } = props;
|
|
367
|
-
const [tableData, setTableData] = (0, import_react13.useState)({});
|
|
368
367
|
const [rows, setRows] = (0, import_react13.useState)(tbody || []);
|
|
369
|
-
const onHandleChange = (name, value) => {
|
|
370
|
-
setTableData((prev) => ({ ...prev, [name]: value }));
|
|
371
|
-
console.log(tableData);
|
|
372
|
-
};
|
|
373
368
|
const onHandleRows = () => {
|
|
374
369
|
const lastRow = rows[rows.length - 1];
|
|
375
370
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
@@ -433,17 +428,20 @@ var AddMoreTable = (props) => {
|
|
|
433
428
|
(0, import_react13.useEffect)(() => {
|
|
434
429
|
console.log(rows);
|
|
435
430
|
}, [rows]);
|
|
436
|
-
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
437
|
-
title: eachHeadEl.label,
|
|
438
|
-
dataIndex: eachHeadEl.name,
|
|
439
|
-
key: eachHeadEl.id
|
|
440
|
-
})) : [];
|
|
441
431
|
const renderInputElement = (element) => {
|
|
442
432
|
const { element: type, label } = element;
|
|
443
433
|
if (type === "single-select") {
|
|
444
|
-
|
|
434
|
+
let onHandleChange2 = function(label2, value) {
|
|
435
|
+
throw new Error("Function not implemented.");
|
|
436
|
+
};
|
|
437
|
+
var onHandleChange = onHandleChange2;
|
|
438
|
+
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value) => onHandleChange2(label, value) });
|
|
445
439
|
} else if (type === "textarea") {
|
|
446
|
-
|
|
440
|
+
let onHandleChange2 = function(label2, value) {
|
|
441
|
+
throw new Error("Function not implemented.");
|
|
442
|
+
};
|
|
443
|
+
var onHandleChange = onHandleChange2;
|
|
444
|
+
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value) => onHandleChange2(label, value) });
|
|
447
445
|
} else {
|
|
448
446
|
return null;
|
|
449
447
|
}
|
|
@@ -452,17 +450,25 @@ var AddMoreTable = (props) => {
|
|
|
452
450
|
const rowData = {
|
|
453
451
|
key: eachRow.id,
|
|
454
452
|
"#": index + 1,
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
453
|
+
...eachRow.variable_data.reduce((acc, variable, subIndex) => {
|
|
454
|
+
Object.keys(variable).forEach((key) => {
|
|
455
|
+
if (key === "SubRows") {
|
|
456
|
+
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)));
|
|
457
|
+
} else {
|
|
458
|
+
acc[`${key}`] = renderInputElement(variable[key]);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
return acc;
|
|
462
|
+
}, {}),
|
|
459
463
|
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
464
|
};
|
|
461
|
-
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
462
|
-
rowData[`subRow-${subIndex}`] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex, style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Route)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Dose)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Frequency)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.When)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Duration)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Instructions)), /* @__PURE__ */ import_react13.default.createElement("div", { style: { flex: 1 } }, 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
465
|
return rowData;
|
|
465
466
|
});
|
|
467
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
468
|
+
title: eachHeadEl.label,
|
|
469
|
+
dataIndex: eachHeadEl.name,
|
|
470
|
+
key: eachHeadEl.id
|
|
471
|
+
})) : [];
|
|
466
472
|
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
467
473
|
columns.push({
|
|
468
474
|
title: "Actions",
|
|
@@ -470,22 +476,6 @@ var AddMoreTable = (props) => {
|
|
|
470
476
|
key: "actions"
|
|
471
477
|
});
|
|
472
478
|
}
|
|
473
|
-
const subRowColumns = [
|
|
474
|
-
{ title: "Route", dataIndex: "Route", key: "Route" },
|
|
475
|
-
{ title: "Dose", dataIndex: "Dose", key: "Dose" },
|
|
476
|
-
{ title: "Frequency", dataIndex: "Frequency", key: "Frequency" },
|
|
477
|
-
{ title: "When", dataIndex: "When", key: "When" },
|
|
478
|
-
{ title: "Duration", dataIndex: "Duration", key: "Duration" },
|
|
479
|
-
{ title: "Instructions", dataIndex: "Instructions", key: "Instructions" },
|
|
480
|
-
{ title: "SubRows", dataIndex: "SubRows", key: "SubRows" }
|
|
481
|
-
];
|
|
482
|
-
subRowColumns.forEach((col, index) => {
|
|
483
|
-
columns.push({
|
|
484
|
-
title: col.title,
|
|
485
|
-
dataIndex: `subRow-${index}`,
|
|
486
|
-
key: `subRow-${index}`
|
|
487
|
-
});
|
|
488
|
-
});
|
|
489
479
|
return /* @__PURE__ */ import_react13.default.createElement(
|
|
490
480
|
import_antd11.Table,
|
|
491
481
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -317,12 +317,7 @@ import { Table, Button as Button3 } from "antd";
|
|
|
317
317
|
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
318
318
|
var AddMoreTable = (props) => {
|
|
319
319
|
const { thead, tbody } = props;
|
|
320
|
-
const [tableData, setTableData] = useState3({});
|
|
321
320
|
const [rows, setRows] = useState3(tbody || []);
|
|
322
|
-
const onHandleChange = (name, value) => {
|
|
323
|
-
setTableData((prev) => ({ ...prev, [name]: value }));
|
|
324
|
-
console.log(tableData);
|
|
325
|
-
};
|
|
326
321
|
const onHandleRows = () => {
|
|
327
322
|
const lastRow = rows[rows.length - 1];
|
|
328
323
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
@@ -386,17 +381,20 @@ var AddMoreTable = (props) => {
|
|
|
386
381
|
useEffect(() => {
|
|
387
382
|
console.log(rows);
|
|
388
383
|
}, [rows]);
|
|
389
|
-
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
390
|
-
title: eachHeadEl.label,
|
|
391
|
-
dataIndex: eachHeadEl.name,
|
|
392
|
-
key: eachHeadEl.id
|
|
393
|
-
})) : [];
|
|
394
384
|
const renderInputElement = (element) => {
|
|
395
385
|
const { element: type, label } = element;
|
|
396
386
|
if (type === "single-select") {
|
|
397
|
-
|
|
387
|
+
let onHandleChange2 = function(label2, value) {
|
|
388
|
+
throw new Error("Function not implemented.");
|
|
389
|
+
};
|
|
390
|
+
var onHandleChange = onHandleChange2;
|
|
391
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value) => onHandleChange2(label, value) });
|
|
398
392
|
} else if (type === "textarea") {
|
|
399
|
-
|
|
393
|
+
let onHandleChange2 = function(label2, value) {
|
|
394
|
+
throw new Error("Function not implemented.");
|
|
395
|
+
};
|
|
396
|
+
var onHandleChange = onHandleChange2;
|
|
397
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value) => onHandleChange2(label, value) });
|
|
400
398
|
} else {
|
|
401
399
|
return null;
|
|
402
400
|
}
|
|
@@ -405,17 +403,25 @@ var AddMoreTable = (props) => {
|
|
|
405
403
|
const rowData = {
|
|
406
404
|
key: eachRow.id,
|
|
407
405
|
"#": index + 1,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
406
|
+
...eachRow.variable_data.reduce((acc, variable, subIndex) => {
|
|
407
|
+
Object.keys(variable).forEach((key) => {
|
|
408
|
+
if (key === "SubRows") {
|
|
409
|
+
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)));
|
|
410
|
+
} else {
|
|
411
|
+
acc[`${key}`] = renderInputElement(variable[key]);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
return acc;
|
|
415
|
+
}, {}),
|
|
412
416
|
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
417
|
};
|
|
414
|
-
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
415
|
-
rowData[`subRow-${subIndex}`] = /* @__PURE__ */ React12.createElement("div", { key: subIndex, style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Route)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Dose)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Frequency)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.When)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Duration)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, renderInputElement(variable.Instructions)), /* @__PURE__ */ React12.createElement("div", { style: { flex: 1 } }, 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
418
|
return rowData;
|
|
418
419
|
});
|
|
420
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
421
|
+
title: eachHeadEl.label,
|
|
422
|
+
dataIndex: eachHeadEl.name,
|
|
423
|
+
key: eachHeadEl.id
|
|
424
|
+
})) : [];
|
|
419
425
|
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
420
426
|
columns.push({
|
|
421
427
|
title: "Actions",
|
|
@@ -423,22 +429,6 @@ var AddMoreTable = (props) => {
|
|
|
423
429
|
key: "actions"
|
|
424
430
|
});
|
|
425
431
|
}
|
|
426
|
-
const subRowColumns = [
|
|
427
|
-
{ title: "Route", dataIndex: "Route", key: "Route" },
|
|
428
|
-
{ title: "Dose", dataIndex: "Dose", key: "Dose" },
|
|
429
|
-
{ title: "Frequency", dataIndex: "Frequency", key: "Frequency" },
|
|
430
|
-
{ title: "When", dataIndex: "When", key: "When" },
|
|
431
|
-
{ title: "Duration", dataIndex: "Duration", key: "Duration" },
|
|
432
|
-
{ title: "Instructions", dataIndex: "Instructions", key: "Instructions" },
|
|
433
|
-
{ title: "SubRows", dataIndex: "SubRows", key: "SubRows" }
|
|
434
|
-
];
|
|
435
|
-
subRowColumns.forEach((col, index) => {
|
|
436
|
-
columns.push({
|
|
437
|
-
title: col.title,
|
|
438
|
-
dataIndex: `subRow-${index}`,
|
|
439
|
-
key: `subRow-${index}`
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
432
|
return /* @__PURE__ */ React12.createElement(
|
|
443
433
|
Table,
|
|
444
434
|
{
|