@apexcura/ui-components 0.0.11-Beta89 → 0.0.11-Beta91
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 +5 -15
- package/dist/index.mjs +5 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -366,8 +366,7 @@ var AddMoreTable = (props) => {
|
|
|
366
366
|
const { thead, tbody } = props;
|
|
367
367
|
const [rows, setRows] = (0, import_react13.useState)(tbody || []);
|
|
368
368
|
const onHandleRows = () => {
|
|
369
|
-
const
|
|
370
|
-
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
369
|
+
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
371
370
|
let newRow = {
|
|
372
371
|
id: newId,
|
|
373
372
|
variable_data: [
|
|
@@ -430,31 +429,22 @@ var AddMoreTable = (props) => {
|
|
|
430
429
|
console.log(rows);
|
|
431
430
|
}, [rows]);
|
|
432
431
|
const renderInputElement = (element, value) => {
|
|
432
|
+
if (!element)
|
|
433
|
+
return null;
|
|
433
434
|
const { element: type, label } = element;
|
|
434
435
|
if (type === "single-select") {
|
|
435
|
-
|
|
436
|
-
throw new Error("Function not implemented.");
|
|
437
|
-
};
|
|
438
|
-
var onHandleChange = onHandleChange2;
|
|
439
|
-
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
|
|
436
|
+
return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2) });
|
|
440
437
|
} else if (type === "textarea") {
|
|
441
|
-
|
|
442
|
-
throw new Error("Function not implemented.");
|
|
443
|
-
};
|
|
444
|
-
var onHandleChange = onHandleChange2;
|
|
445
|
-
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
|
|
438
|
+
return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2) });
|
|
446
439
|
} else {
|
|
447
440
|
return null;
|
|
448
441
|
}
|
|
449
442
|
};
|
|
450
443
|
const dataSource = rows.map((eachRow, index) => {
|
|
451
|
-
console.log(...eachRow.variable_data);
|
|
452
444
|
const rowData = {
|
|
453
445
|
key: eachRow.id,
|
|
454
446
|
"#": index + 1,
|
|
455
|
-
"Medicine": renderInputElement(eachRow.element, eachRow.value),
|
|
456
447
|
...eachRow.variable_data.reduce((acc, variable, subIndex) => {
|
|
457
|
-
console.log("variable", variable);
|
|
458
448
|
Object.keys(variable).forEach((key) => {
|
|
459
449
|
if (key === "SubRows") {
|
|
460
450
|
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)));
|
package/dist/index.mjs
CHANGED
|
@@ -319,8 +319,7 @@ var AddMoreTable = (props) => {
|
|
|
319
319
|
const { thead, tbody } = props;
|
|
320
320
|
const [rows, setRows] = useState3(tbody || []);
|
|
321
321
|
const onHandleRows = () => {
|
|
322
|
-
const
|
|
323
|
-
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
322
|
+
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
324
323
|
let newRow = {
|
|
325
324
|
id: newId,
|
|
326
325
|
variable_data: [
|
|
@@ -383,31 +382,22 @@ var AddMoreTable = (props) => {
|
|
|
383
382
|
console.log(rows);
|
|
384
383
|
}, [rows]);
|
|
385
384
|
const renderInputElement = (element, value) => {
|
|
385
|
+
if (!element)
|
|
386
|
+
return null;
|
|
386
387
|
const { element: type, label } = element;
|
|
387
388
|
if (type === "single-select") {
|
|
388
|
-
|
|
389
|
-
throw new Error("Function not implemented.");
|
|
390
|
-
};
|
|
391
|
-
var onHandleChange = onHandleChange2;
|
|
392
|
-
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
|
|
389
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2) });
|
|
393
390
|
} else if (type === "textarea") {
|
|
394
|
-
|
|
395
|
-
throw new Error("Function not implemented.");
|
|
396
|
-
};
|
|
397
|
-
var onHandleChange = onHandleChange2;
|
|
398
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
|
|
391
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2) });
|
|
399
392
|
} else {
|
|
400
393
|
return null;
|
|
401
394
|
}
|
|
402
395
|
};
|
|
403
396
|
const dataSource = rows.map((eachRow, index) => {
|
|
404
|
-
console.log(...eachRow.variable_data);
|
|
405
397
|
const rowData = {
|
|
406
398
|
key: eachRow.id,
|
|
407
399
|
"#": index + 1,
|
|
408
|
-
"Medicine": renderInputElement(eachRow.element, eachRow.value),
|
|
409
400
|
...eachRow.variable_data.reduce((acc, variable, subIndex) => {
|
|
410
|
-
console.log("variable", variable);
|
|
411
401
|
Object.keys(variable).forEach((key) => {
|
|
412
402
|
if (key === "SubRows") {
|
|
413
403
|
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)));
|