@apexcura/ui-components 0.0.11-Beta84 → 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 +27 -30
- package/dist/index.mjs +27 -30
- 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,26 +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
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
acc[`${key}`] = renderInputElement(variable[key]);
|
|
469
|
-
}
|
|
470
|
-
return acc;
|
|
471
|
-
}, {})
|
|
472
|
-
}));
|
|
473
|
-
return [rowData, ...subRowData];
|
|
474
|
-
}).flat();
|
|
465
|
+
return rowData;
|
|
466
|
+
});
|
|
467
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
468
|
+
title: eachHeadEl.label,
|
|
469
|
+
dataIndex: eachHeadEl.name,
|
|
470
|
+
key: eachHeadEl.id
|
|
471
|
+
})) : [];
|
|
475
472
|
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
476
473
|
columns.push({
|
|
477
474
|
title: "Actions",
|
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,26 +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
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
acc[`${key}`] = renderInputElement(variable[key]);
|
|
422
|
-
}
|
|
423
|
-
return acc;
|
|
424
|
-
}, {})
|
|
425
|
-
}));
|
|
426
|
-
return [rowData, ...subRowData];
|
|
427
|
-
}).flat();
|
|
418
|
+
return rowData;
|
|
419
|
+
});
|
|
420
|
+
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
421
|
+
title: eachHeadEl.label,
|
|
422
|
+
dataIndex: eachHeadEl.name,
|
|
423
|
+
key: eachHeadEl.id
|
|
424
|
+
})) : [];
|
|
428
425
|
if (!columns.some((col) => col.dataIndex === "actions")) {
|
|
429
426
|
columns.push({
|
|
430
427
|
title: "Actions",
|