@apexcura/ui-components 0.0.11-Beta24 → 0.0.11-Beta26
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 +75 -55
- package/dist/index.mjs +75 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -376,63 +376,71 @@ var AddMoreTable = (props) => {
|
|
|
376
376
|
const onHandleRows = () => {
|
|
377
377
|
const lastRow = rows[rows.length - 1];
|
|
378
378
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
379
|
-
let newRow
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
...lastRow.variable_data,
|
|
388
|
-
{
|
|
389
|
-
id: { id: newVariableId },
|
|
390
|
-
Route: { label: "Route", element: "single-select", type: "text" },
|
|
391
|
-
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
392
|
-
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
393
|
-
When: { label: "When", element: "textarea", type: "text" },
|
|
394
|
-
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
395
|
-
Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
396
|
-
}
|
|
397
|
-
]
|
|
398
|
-
};
|
|
399
|
-
} else {
|
|
400
|
-
newRow = {
|
|
401
|
-
...lastRow,
|
|
402
|
-
id: newId
|
|
403
|
-
};
|
|
404
|
-
}
|
|
379
|
+
let newRow = {
|
|
380
|
+
...lastRow,
|
|
381
|
+
id: newId,
|
|
382
|
+
variable_data: lastRow ? lastRow.variable_data.map((item) => ({
|
|
383
|
+
...item,
|
|
384
|
+
id: item.id + 1
|
|
385
|
+
})) : []
|
|
386
|
+
};
|
|
405
387
|
setRows((prevData) => [...prevData, newRow]);
|
|
406
388
|
};
|
|
407
389
|
const onHandleDelete = (index) => {
|
|
408
|
-
|
|
409
|
-
|
|
390
|
+
if (rows.length > 1) {
|
|
391
|
+
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
392
|
+
setRows(remainingRows);
|
|
393
|
+
}
|
|
410
394
|
};
|
|
411
|
-
const
|
|
412
|
-
setRows((prevRows) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
395
|
+
const onHandleVariableData = (rowId) => {
|
|
396
|
+
setRows((prevRows) => prevRows.map((row) => {
|
|
397
|
+
if (row.id === rowId) {
|
|
398
|
+
const newVariableDataId = row.variable_data.length > 0 ? row.variable_data[row.variable_data.length - 1].id + 1 : 1;
|
|
399
|
+
const newVariableData = {
|
|
400
|
+
id: newVariableDataId,
|
|
401
|
+
Route: {
|
|
402
|
+
label: "Route",
|
|
403
|
+
element: "single-select",
|
|
404
|
+
type: "text"
|
|
405
|
+
},
|
|
406
|
+
Dose: {
|
|
407
|
+
label: "Dose",
|
|
408
|
+
element: "single-select",
|
|
409
|
+
type: "text"
|
|
410
|
+
},
|
|
411
|
+
Frequency: {
|
|
412
|
+
label: "Frequency",
|
|
413
|
+
element: "single-select",
|
|
414
|
+
type: "text"
|
|
415
|
+
},
|
|
416
|
+
When: {
|
|
417
|
+
label: "When",
|
|
418
|
+
element: "textarea",
|
|
419
|
+
type: "text"
|
|
420
|
+
},
|
|
421
|
+
Duration: {
|
|
422
|
+
label: "Duration",
|
|
423
|
+
element: "textarea",
|
|
424
|
+
type: "text"
|
|
425
|
+
},
|
|
426
|
+
Instructions: {
|
|
427
|
+
label: "Instructions",
|
|
428
|
+
element: "textarea",
|
|
429
|
+
type: "text"
|
|
430
|
+
},
|
|
431
|
+
icons: { delete: "delete", plus: "plus" }
|
|
432
|
+
};
|
|
433
|
+
const updatedVariableData = [...row.variable_data, newVariableData].map((item, index, array) => ({
|
|
434
|
+
...item,
|
|
435
|
+
icons: { delete: "delete", plus: index === array.length - 1 ? "plus" : void 0 }
|
|
436
|
+
}));
|
|
437
|
+
return {
|
|
438
|
+
...row,
|
|
439
|
+
variable_data: updatedVariableData
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
return row;
|
|
443
|
+
}));
|
|
436
444
|
};
|
|
437
445
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
438
446
|
title: eachHeadEl.label,
|
|
@@ -455,11 +463,23 @@ var AddMoreTable = (props) => {
|
|
|
455
463
|
rowElements[eachRow.label] = renderInputElement(eachRow);
|
|
456
464
|
}
|
|
457
465
|
if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
|
|
458
|
-
eachRow.variable_data.forEach((variable) => {
|
|
466
|
+
eachRow.variable_data.forEach((variable, varIndex) => {
|
|
459
467
|
Object.entries(variable).forEach(([key, value]) => {
|
|
460
468
|
if (value && value.element && value.label) {
|
|
461
469
|
rowElements[value.label] = renderInputElement(value);
|
|
462
470
|
}
|
|
471
|
+
if (key === "icons") {
|
|
472
|
+
rowElements[`icons_${varIndex}`] = /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => {
|
|
473
|
+
const updatedRows = rows.map((row) => {
|
|
474
|
+
if (row.id === eachRow.id) {
|
|
475
|
+
const updatedVariableData = row.variable_data.filter((item) => item.id !== variable.id);
|
|
476
|
+
return { ...row, variable_data: updatedVariableData };
|
|
477
|
+
}
|
|
478
|
+
return row;
|
|
479
|
+
});
|
|
480
|
+
setRows(updatedRows);
|
|
481
|
+
} }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), value && value.plus && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleVariableData(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
|
|
482
|
+
}
|
|
463
483
|
});
|
|
464
484
|
});
|
|
465
485
|
}
|
|
@@ -468,7 +488,7 @@ var AddMoreTable = (props) => {
|
|
|
468
488
|
"#": index + 1,
|
|
469
489
|
...eachRow,
|
|
470
490
|
...rowElements,
|
|
471
|
-
actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)),
|
|
491
|
+
actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
|
|
472
492
|
};
|
|
473
493
|
});
|
|
474
494
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
package/dist/index.mjs
CHANGED
|
@@ -329,63 +329,71 @@ var AddMoreTable = (props) => {
|
|
|
329
329
|
const onHandleRows = () => {
|
|
330
330
|
const lastRow = rows[rows.length - 1];
|
|
331
331
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
332
|
-
let newRow
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
...lastRow.variable_data,
|
|
341
|
-
{
|
|
342
|
-
id: { id: newVariableId },
|
|
343
|
-
Route: { label: "Route", element: "single-select", type: "text" },
|
|
344
|
-
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
345
|
-
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
346
|
-
When: { label: "When", element: "textarea", type: "text" },
|
|
347
|
-
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
348
|
-
Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
349
|
-
}
|
|
350
|
-
]
|
|
351
|
-
};
|
|
352
|
-
} else {
|
|
353
|
-
newRow = {
|
|
354
|
-
...lastRow,
|
|
355
|
-
id: newId
|
|
356
|
-
};
|
|
357
|
-
}
|
|
332
|
+
let newRow = {
|
|
333
|
+
...lastRow,
|
|
334
|
+
id: newId,
|
|
335
|
+
variable_data: lastRow ? lastRow.variable_data.map((item) => ({
|
|
336
|
+
...item,
|
|
337
|
+
id: item.id + 1
|
|
338
|
+
})) : []
|
|
339
|
+
};
|
|
358
340
|
setRows((prevData) => [...prevData, newRow]);
|
|
359
341
|
};
|
|
360
342
|
const onHandleDelete = (index) => {
|
|
361
|
-
|
|
362
|
-
|
|
343
|
+
if (rows.length > 1) {
|
|
344
|
+
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
345
|
+
setRows(remainingRows);
|
|
346
|
+
}
|
|
363
347
|
};
|
|
364
|
-
const
|
|
365
|
-
setRows((prevRows) => {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
348
|
+
const onHandleVariableData = (rowId) => {
|
|
349
|
+
setRows((prevRows) => prevRows.map((row) => {
|
|
350
|
+
if (row.id === rowId) {
|
|
351
|
+
const newVariableDataId = row.variable_data.length > 0 ? row.variable_data[row.variable_data.length - 1].id + 1 : 1;
|
|
352
|
+
const newVariableData = {
|
|
353
|
+
id: newVariableDataId,
|
|
354
|
+
Route: {
|
|
355
|
+
label: "Route",
|
|
356
|
+
element: "single-select",
|
|
357
|
+
type: "text"
|
|
358
|
+
},
|
|
359
|
+
Dose: {
|
|
360
|
+
label: "Dose",
|
|
361
|
+
element: "single-select",
|
|
362
|
+
type: "text"
|
|
363
|
+
},
|
|
364
|
+
Frequency: {
|
|
365
|
+
label: "Frequency",
|
|
366
|
+
element: "single-select",
|
|
367
|
+
type: "text"
|
|
368
|
+
},
|
|
369
|
+
When: {
|
|
370
|
+
label: "When",
|
|
371
|
+
element: "textarea",
|
|
372
|
+
type: "text"
|
|
373
|
+
},
|
|
374
|
+
Duration: {
|
|
375
|
+
label: "Duration",
|
|
376
|
+
element: "textarea",
|
|
377
|
+
type: "text"
|
|
378
|
+
},
|
|
379
|
+
Instructions: {
|
|
380
|
+
label: "Instructions",
|
|
381
|
+
element: "textarea",
|
|
382
|
+
type: "text"
|
|
383
|
+
},
|
|
384
|
+
icons: { delete: "delete", plus: "plus" }
|
|
385
|
+
};
|
|
386
|
+
const updatedVariableData = [...row.variable_data, newVariableData].map((item, index, array) => ({
|
|
387
|
+
...item,
|
|
388
|
+
icons: { delete: "delete", plus: index === array.length - 1 ? "plus" : void 0 }
|
|
389
|
+
}));
|
|
390
|
+
return {
|
|
391
|
+
...row,
|
|
392
|
+
variable_data: updatedVariableData
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
return row;
|
|
396
|
+
}));
|
|
389
397
|
};
|
|
390
398
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
391
399
|
title: eachHeadEl.label,
|
|
@@ -408,11 +416,23 @@ var AddMoreTable = (props) => {
|
|
|
408
416
|
rowElements[eachRow.label] = renderInputElement(eachRow);
|
|
409
417
|
}
|
|
410
418
|
if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
|
|
411
|
-
eachRow.variable_data.forEach((variable) => {
|
|
419
|
+
eachRow.variable_data.forEach((variable, varIndex) => {
|
|
412
420
|
Object.entries(variable).forEach(([key, value]) => {
|
|
413
421
|
if (value && value.element && value.label) {
|
|
414
422
|
rowElements[value.label] = renderInputElement(value);
|
|
415
423
|
}
|
|
424
|
+
if (key === "icons") {
|
|
425
|
+
rowElements[`icons_${varIndex}`] = /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => {
|
|
426
|
+
const updatedRows = rows.map((row) => {
|
|
427
|
+
if (row.id === eachRow.id) {
|
|
428
|
+
const updatedVariableData = row.variable_data.filter((item) => item.id !== variable.id);
|
|
429
|
+
return { ...row, variable_data: updatedVariableData };
|
|
430
|
+
}
|
|
431
|
+
return row;
|
|
432
|
+
});
|
|
433
|
+
setRows(updatedRows);
|
|
434
|
+
} }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), value && value.plus && /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleVariableData(eachRow.id) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
|
|
435
|
+
}
|
|
416
436
|
});
|
|
417
437
|
});
|
|
418
438
|
}
|
|
@@ -421,7 +441,7 @@ var AddMoreTable = (props) => {
|
|
|
421
441
|
"#": index + 1,
|
|
422
442
|
...eachRow,
|
|
423
443
|
...rowElements,
|
|
424
|
-
actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)),
|
|
444
|
+
actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
|
|
425
445
|
};
|
|
426
446
|
});
|
|
427
447
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|