@apexcura/ui-components 0.0.11-Beta44 → 0.0.11-Beta46

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 CHANGED
@@ -378,9 +378,20 @@ var AddMoreTable = (props) => {
378
378
  const newId = lastRow ? lastRow.id + 1 : 1;
379
379
  let newRow = {
380
380
  ...lastRow,
381
- id: newId
381
+ id: newId,
382
+ variable_data: [
383
+ {
384
+ id: 1,
385
+ Route: { label: "Route", element: "single-select", type: "text" },
386
+ Dose: { label: "Dose", element: "single-select", type: "text" },
387
+ Frequency: { label: "Frequency", element: "single-select", type: "text" },
388
+ When: { label: "When", element: "textarea", type: "text" },
389
+ Duration: { label: "Duration", element: "textarea", type: "text" },
390
+ Instructions: { label: "Instructions", element: "textarea", type: "text" },
391
+ icons: { delete: "plusOutlined", add: "plusOutlined" }
392
+ }
393
+ ]
382
394
  };
383
- console.log(rows);
384
395
  setRows((prevData) => [...prevData, newRow]);
385
396
  };
386
397
  const onHandleDelete = (index) => {
@@ -441,29 +452,29 @@ var AddMoreTable = (props) => {
441
452
  return null;
442
453
  }
443
454
  };
444
- const dataSource = rows.flatMap((eachRow, index) => {
445
- const rowData = [];
446
- const mainRow = {
447
- key: index.toString(),
448
- "#": index + 1,
449
- ...eachRow,
450
- actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, 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)))
451
- };
452
- rowData.push(mainRow);
455
+ const dataSource = rows.map((eachRow, index) => {
456
+ const rowElements = {};
457
+ if (eachRow.element && eachRow.label) {
458
+ rowElements[eachRow.label] = renderInputElement(eachRow);
459
+ }
453
460
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
454
461
  eachRow.variable_data.forEach((variable, subIndex) => {
455
- const subRowElements = {};
456
462
  Object.entries(variable).forEach(([key, value]) => {
457
463
  if (key === "icons" && value) {
458
- subRowElements["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)));
464
+ rowElements["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)));
459
465
  } else if (value && value.element && value.label) {
460
- subRowElements[value.label] = renderInputElement(value);
466
+ rowElements[value.label] = renderInputElement(value);
461
467
  }
462
468
  });
463
- rowData.push(subRowElements);
464
469
  });
465
470
  }
466
- return rowData;
471
+ return {
472
+ key: index.toString(),
473
+ "#": index + 1,
474
+ ...eachRow,
475
+ ...rowElements,
476
+ actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, 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)))
477
+ };
467
478
  });
468
479
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
469
480
  columns.push({
package/dist/index.mjs CHANGED
@@ -331,9 +331,20 @@ var AddMoreTable = (props) => {
331
331
  const newId = lastRow ? lastRow.id + 1 : 1;
332
332
  let newRow = {
333
333
  ...lastRow,
334
- id: newId
334
+ id: newId,
335
+ variable_data: [
336
+ {
337
+ id: 1,
338
+ Route: { label: "Route", element: "single-select", type: "text" },
339
+ Dose: { label: "Dose", element: "single-select", type: "text" },
340
+ Frequency: { label: "Frequency", element: "single-select", type: "text" },
341
+ When: { label: "When", element: "textarea", type: "text" },
342
+ Duration: { label: "Duration", element: "textarea", type: "text" },
343
+ Instructions: { label: "Instructions", element: "textarea", type: "text" },
344
+ icons: { delete: "plusOutlined", add: "plusOutlined" }
345
+ }
346
+ ]
335
347
  };
336
- console.log(rows);
337
348
  setRows((prevData) => [...prevData, newRow]);
338
349
  };
339
350
  const onHandleDelete = (index) => {
@@ -394,29 +405,29 @@ var AddMoreTable = (props) => {
394
405
  return null;
395
406
  }
396
407
  };
397
- const dataSource = rows.flatMap((eachRow, index) => {
398
- const rowData = [];
399
- const mainRow = {
400
- key: index.toString(),
401
- "#": index + 1,
402
- ...eachRow,
403
- actions: /* @__PURE__ */ React12.createElement(React12.Fragment, 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)))
404
- };
405
- rowData.push(mainRow);
408
+ const dataSource = rows.map((eachRow, index) => {
409
+ const rowElements = {};
410
+ if (eachRow.element && eachRow.label) {
411
+ rowElements[eachRow.label] = renderInputElement(eachRow);
412
+ }
406
413
  if (eachRow.variable_data && Array.isArray(eachRow.variable_data)) {
407
414
  eachRow.variable_data.forEach((variable, subIndex) => {
408
- const subRowElements = {};
409
415
  Object.entries(variable).forEach(([key, value]) => {
410
416
  if (key === "icons" && value) {
411
- subRowElements["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)));
417
+ rowElements["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)));
412
418
  } else if (value && value.element && value.label) {
413
- subRowElements[value.label] = renderInputElement(value);
419
+ rowElements[value.label] = renderInputElement(value);
414
420
  }
415
421
  });
416
- rowData.push(subRowElements);
417
422
  });
418
423
  }
419
- return rowData;
424
+ return {
425
+ key: index.toString(),
426
+ "#": index + 1,
427
+ ...eachRow,
428
+ ...rowElements,
429
+ actions: /* @__PURE__ */ React12.createElement(React12.Fragment, 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)))
430
+ };
420
431
  });
421
432
  if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
422
433
  columns.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta44",
3
+ "version": "0.0.11-Beta46",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",