@apexcura/ui-components 0.0.11-Beta71 → 0.0.11-Beta73
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 +22 -56
- package/dist/index.mjs +22 -56
- package/package.json +1 -1
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
|
|
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) => {
|
|
@@ -430,32 +430,11 @@ var AddMoreTable = (props) => {
|
|
|
430
430
|
});
|
|
431
431
|
});
|
|
432
432
|
};
|
|
433
|
-
const columns =
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
title: "Medicine",
|
|
441
|
-
dataIndex: "medicine",
|
|
442
|
-
key: "medicine"
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
title: "Actions",
|
|
446
|
-
dataIndex: "actions",
|
|
447
|
-
key: "actions"
|
|
448
|
-
}
|
|
449
|
-
];
|
|
450
|
-
if (thead) {
|
|
451
|
-
thead.forEach((eachHeadEl) => {
|
|
452
|
-
columns.push({
|
|
453
|
-
title: eachHeadEl.label,
|
|
454
|
-
dataIndex: eachHeadEl.name,
|
|
455
|
-
key: eachHeadEl.id
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
}
|
|
433
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
434
|
+
title: eachHeadEl.label,
|
|
435
|
+
dataIndex: eachHeadEl.name,
|
|
436
|
+
key: eachHeadEl.id
|
|
437
|
+
})) : [];
|
|
459
438
|
const renderInputElement = (element) => {
|
|
460
439
|
const { element: type, label } = element;
|
|
461
440
|
if (type === "single-select") {
|
|
@@ -471,50 +450,37 @@ var AddMoreTable = (props) => {
|
|
|
471
450
|
key: `${eachRow.id}-${subIndex}`,
|
|
472
451
|
...Object.fromEntries(Object.entries(variable).map(([key, value]) => {
|
|
473
452
|
if (key === "icons") {
|
|
474
|
-
return ["
|
|
453
|
+
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)))];
|
|
475
454
|
} else {
|
|
476
455
|
return [key, renderInputElement(value)];
|
|
477
456
|
}
|
|
478
457
|
}))
|
|
479
458
|
}));
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
medicine: renderInputElement({
|
|
459
|
+
const rowData = {
|
|
460
|
+
"#": index + 1,
|
|
461
|
+
"Medicine": renderInputElement({
|
|
484
462
|
element: eachRow.element,
|
|
485
463
|
label: eachRow.label
|
|
486
464
|
}),
|
|
487
|
-
|
|
488
|
-
|
|
465
|
+
subRow,
|
|
466
|
+
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)))
|
|
489
467
|
};
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
})).concat([{
|
|
500
|
-
title: "SubRow Actions",
|
|
501
|
-
dataIndex: "subRowActions",
|
|
502
|
-
key: "subRowActions"
|
|
503
|
-
}]),
|
|
504
|
-
dataSource: record.subRows,
|
|
505
|
-
pagination: false,
|
|
506
|
-
bordered: true
|
|
507
|
-
}
|
|
508
|
-
);
|
|
509
|
-
};
|
|
468
|
+
return [rowData];
|
|
469
|
+
}).flat();
|
|
470
|
+
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
471
|
+
columns.push({
|
|
472
|
+
title: "Actions",
|
|
473
|
+
dataIndex: "actions",
|
|
474
|
+
key: "actions"
|
|
475
|
+
});
|
|
476
|
+
}
|
|
510
477
|
return /* @__PURE__ */ import_react13.default.createElement(
|
|
511
478
|
import_antd11.Table,
|
|
512
479
|
{
|
|
513
480
|
columns,
|
|
514
481
|
dataSource,
|
|
515
482
|
pagination: false,
|
|
516
|
-
bordered: true
|
|
517
|
-
expandable: { expandedRowRender }
|
|
483
|
+
bordered: true
|
|
518
484
|
}
|
|
519
485
|
);
|
|
520
486
|
};
|
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
|
|
319
|
+
const { thead, tbody } = props;
|
|
320
320
|
const [tableData, setTableData] = useState3({});
|
|
321
321
|
const [rows, setRows] = useState3(tbody || []);
|
|
322
322
|
const onHandleChange = (name, value) => {
|
|
@@ -383,32 +383,11 @@ var AddMoreTable = (props) => {
|
|
|
383
383
|
});
|
|
384
384
|
});
|
|
385
385
|
};
|
|
386
|
-
const columns =
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
title: "Medicine",
|
|
394
|
-
dataIndex: "medicine",
|
|
395
|
-
key: "medicine"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
title: "Actions",
|
|
399
|
-
dataIndex: "actions",
|
|
400
|
-
key: "actions"
|
|
401
|
-
}
|
|
402
|
-
];
|
|
403
|
-
if (thead) {
|
|
404
|
-
thead.forEach((eachHeadEl) => {
|
|
405
|
-
columns.push({
|
|
406
|
-
title: eachHeadEl.label,
|
|
407
|
-
dataIndex: eachHeadEl.name,
|
|
408
|
-
key: eachHeadEl.id
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
}
|
|
386
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
387
|
+
title: eachHeadEl.label,
|
|
388
|
+
dataIndex: eachHeadEl.name,
|
|
389
|
+
key: eachHeadEl.id
|
|
390
|
+
})) : [];
|
|
412
391
|
const renderInputElement = (element) => {
|
|
413
392
|
const { element: type, label } = element;
|
|
414
393
|
if (type === "single-select") {
|
|
@@ -424,50 +403,37 @@ var AddMoreTable = (props) => {
|
|
|
424
403
|
key: `${eachRow.id}-${subIndex}`,
|
|
425
404
|
...Object.fromEntries(Object.entries(variable).map(([key, value]) => {
|
|
426
405
|
if (key === "icons") {
|
|
427
|
-
return ["
|
|
406
|
+
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)))];
|
|
428
407
|
} else {
|
|
429
408
|
return [key, renderInputElement(value)];
|
|
430
409
|
}
|
|
431
410
|
}))
|
|
432
411
|
}));
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
medicine: renderInputElement({
|
|
412
|
+
const rowData = {
|
|
413
|
+
"#": index + 1,
|
|
414
|
+
"Medicine": renderInputElement({
|
|
437
415
|
element: eachRow.element,
|
|
438
416
|
label: eachRow.label
|
|
439
417
|
}),
|
|
440
|
-
|
|
441
|
-
|
|
418
|
+
subRow,
|
|
419
|
+
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)))
|
|
442
420
|
};
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
})).concat([{
|
|
453
|
-
title: "SubRow Actions",
|
|
454
|
-
dataIndex: "subRowActions",
|
|
455
|
-
key: "subRowActions"
|
|
456
|
-
}]),
|
|
457
|
-
dataSource: record.subRows,
|
|
458
|
-
pagination: false,
|
|
459
|
-
bordered: true
|
|
460
|
-
}
|
|
461
|
-
);
|
|
462
|
-
};
|
|
421
|
+
return [rowData];
|
|
422
|
+
}).flat();
|
|
423
|
+
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
424
|
+
columns.push({
|
|
425
|
+
title: "Actions",
|
|
426
|
+
dataIndex: "actions",
|
|
427
|
+
key: "actions"
|
|
428
|
+
});
|
|
429
|
+
}
|
|
463
430
|
return /* @__PURE__ */ React12.createElement(
|
|
464
431
|
Table,
|
|
465
432
|
{
|
|
466
433
|
columns,
|
|
467
434
|
dataSource,
|
|
468
435
|
pagination: false,
|
|
469
|
-
bordered: true
|
|
470
|
-
expandable: { expandedRowRender }
|
|
436
|
+
bordered: true
|
|
471
437
|
}
|
|
472
438
|
);
|
|
473
439
|
};
|