@apexcura/ui-components 0.0.12-Beta16 → 0.0.12-Beta17
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 +23 -54
- package/dist/index.mjs +23 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -377,65 +377,34 @@ var AddMoreTable = (props) => {
|
|
|
377
377
|
const lastRow = rows[rows.length - 1];
|
|
378
378
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
379
379
|
let newRow;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
id: newId
|
|
403
|
-
};
|
|
404
|
-
}
|
|
380
|
+
newRow = {
|
|
381
|
+
...lastRow,
|
|
382
|
+
id: newId
|
|
383
|
+
// variable_data: [
|
|
384
|
+
// ...lastRow.variable_data,
|
|
385
|
+
// {
|
|
386
|
+
// id: { id: newVariableId },
|
|
387
|
+
// Route: { label: "Route", element: "single-select", type: "text" },
|
|
388
|
+
// Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
389
|
+
// Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
390
|
+
// When: { label: "When", element: "textarea", type: "text" },
|
|
391
|
+
// Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
392
|
+
// Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
393
|
+
// }
|
|
394
|
+
// // ],
|
|
395
|
+
// };
|
|
396
|
+
// } else {
|
|
397
|
+
// newRow = {
|
|
398
|
+
// ...lastRow,
|
|
399
|
+
// id: newId,
|
|
400
|
+
// };
|
|
401
|
+
};
|
|
405
402
|
setRows((prevData) => [...prevData, newRow]);
|
|
406
403
|
};
|
|
407
404
|
const onHandleDelete = (index) => {
|
|
408
405
|
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
409
406
|
setRows(remainingRows);
|
|
410
407
|
};
|
|
411
|
-
const onAddVariableData = (rowIndex) => {
|
|
412
|
-
setRows((prevRows) => {
|
|
413
|
-
return prevRows.map((row, index) => {
|
|
414
|
-
console.log("row", row);
|
|
415
|
-
if (index === rowIndex && row.variable_data && row.variable_data.length > 0) {
|
|
416
|
-
const lastVariable = row.variable_data[row.variable_data.length - 1];
|
|
417
|
-
const newVariableId = lastVariable.id.id + 1;
|
|
418
|
-
return {
|
|
419
|
-
...row,
|
|
420
|
-
variable_data: [
|
|
421
|
-
...row.variable_data,
|
|
422
|
-
{
|
|
423
|
-
id: { id: newVariableId },
|
|
424
|
-
Route: { label: "Route", element: "single-select", type: "text" },
|
|
425
|
-
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
426
|
-
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
427
|
-
When: { label: "When", element: "textarea", type: "text" },
|
|
428
|
-
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
429
|
-
Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
430
|
-
}
|
|
431
|
-
]
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
return row;
|
|
435
|
-
console.log("---------------row", row);
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
408
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
440
409
|
title: eachHeadEl.label,
|
|
441
410
|
dataIndex: eachHeadEl.name,
|
|
@@ -470,7 +439,7 @@ var AddMoreTable = (props) => {
|
|
|
470
439
|
"#": index + 1,
|
|
471
440
|
...eachRow,
|
|
472
441
|
...rowElements,
|
|
473
|
-
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)),
|
|
442
|
+
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)))
|
|
474
443
|
};
|
|
475
444
|
});
|
|
476
445
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
package/dist/index.mjs
CHANGED
|
@@ -330,65 +330,34 @@ var AddMoreTable = (props) => {
|
|
|
330
330
|
const lastRow = rows[rows.length - 1];
|
|
331
331
|
const newId = lastRow ? lastRow.id + 1 : 1;
|
|
332
332
|
let newRow;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
id: newId
|
|
356
|
-
};
|
|
357
|
-
}
|
|
333
|
+
newRow = {
|
|
334
|
+
...lastRow,
|
|
335
|
+
id: newId
|
|
336
|
+
// variable_data: [
|
|
337
|
+
// ...lastRow.variable_data,
|
|
338
|
+
// {
|
|
339
|
+
// id: { id: newVariableId },
|
|
340
|
+
// Route: { label: "Route", element: "single-select", type: "text" },
|
|
341
|
+
// Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
342
|
+
// Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
343
|
+
// When: { label: "When", element: "textarea", type: "text" },
|
|
344
|
+
// Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
345
|
+
// Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
346
|
+
// }
|
|
347
|
+
// // ],
|
|
348
|
+
// };
|
|
349
|
+
// } else {
|
|
350
|
+
// newRow = {
|
|
351
|
+
// ...lastRow,
|
|
352
|
+
// id: newId,
|
|
353
|
+
// };
|
|
354
|
+
};
|
|
358
355
|
setRows((prevData) => [...prevData, newRow]);
|
|
359
356
|
};
|
|
360
357
|
const onHandleDelete = (index) => {
|
|
361
358
|
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
362
359
|
setRows(remainingRows);
|
|
363
360
|
};
|
|
364
|
-
const onAddVariableData = (rowIndex) => {
|
|
365
|
-
setRows((prevRows) => {
|
|
366
|
-
return prevRows.map((row, index) => {
|
|
367
|
-
console.log("row", row);
|
|
368
|
-
if (index === rowIndex && row.variable_data && row.variable_data.length > 0) {
|
|
369
|
-
const lastVariable = row.variable_data[row.variable_data.length - 1];
|
|
370
|
-
const newVariableId = lastVariable.id.id + 1;
|
|
371
|
-
return {
|
|
372
|
-
...row,
|
|
373
|
-
variable_data: [
|
|
374
|
-
...row.variable_data,
|
|
375
|
-
{
|
|
376
|
-
id: { id: newVariableId },
|
|
377
|
-
Route: { label: "Route", element: "single-select", type: "text" },
|
|
378
|
-
Dose: { label: "Dose", element: "single-select", type: "text" },
|
|
379
|
-
Frequency: { label: "Frequency", element: "single-select", type: "text" },
|
|
380
|
-
When: { label: "When", element: "textarea", type: "text" },
|
|
381
|
-
Duration: { label: "Duration", element: "textarea", type: "text" },
|
|
382
|
-
Instructions: { label: "Instructions", element: "textarea", type: "text" }
|
|
383
|
-
}
|
|
384
|
-
]
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
return row;
|
|
388
|
-
console.log("---------------row", row);
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
};
|
|
392
361
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
393
362
|
title: eachHeadEl.label,
|
|
394
363
|
dataIndex: eachHeadEl.name,
|
|
@@ -423,7 +392,7 @@ var AddMoreTable = (props) => {
|
|
|
423
392
|
"#": index + 1,
|
|
424
393
|
...eachRow,
|
|
425
394
|
...rowElements,
|
|
426
|
-
actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)),
|
|
395
|
+
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)))
|
|
427
396
|
};
|
|
428
397
|
});
|
|
429
398
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|