@apexcura/ui-components 0.0.11-Beta93 → 0.0.11-Beta94

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
@@ -369,12 +369,10 @@ var AddMoreTable = (props) => {
369
369
  const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
370
370
  let newRow = {
371
371
  id: newId,
372
- label: "Medicine",
373
- name: "Medicine",
374
- type: "text",
375
372
  variable_data: [
376
373
  {
377
374
  id: 1,
375
+ Medicine: { label: "Medicine", element: "single-select", type: "text" },
378
376
  Route: { label: "Route", element: "single-select", type: "text" },
379
377
  Dose: { label: "Dose", element: "single-select", type: "text" },
380
378
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
@@ -396,6 +394,7 @@ var AddMoreTable = (props) => {
396
394
  if (index === rowIndex) {
397
395
  const newSubRow = {
398
396
  id: row.variable_data.length + 1,
397
+ Medicine: { label: "Medicine", element: "single-select", type: "text" },
399
398
  Route: { label: "Route", element: "single-select", type: "text" },
400
399
  Dose: { label: "Dose", element: "single-select", type: "text" },
401
400
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
@@ -443,23 +442,23 @@ var AddMoreTable = (props) => {
443
442
  return null;
444
443
  }
445
444
  };
446
- const dataSource = rows.map((eachRow, rowIndex) => {
447
- const rowData = {
448
- key: eachRow.id,
449
- "#": rowIndex + 1,
450
- "Medicine": renderInputElement(eachRow.name, eachRow.label)
451
- };
452
- eachRow.variable_data.map((variable, subIndex) => {
445
+ const dataSource = rows.flatMap((eachRow, rowIndex) => {
446
+ return eachRow.variable_data.map((variable, subIndex) => {
447
+ const rowData = {
448
+ key: `${eachRow.id}-${variable.id}`,
449
+ "#": rowIndex + 1,
450
+ "Medicine": renderInputElement(variable.Medicine)
451
+ };
453
452
  Object.keys(variable).forEach((key) => {
454
453
  if (key === "SubRows") {
455
454
  rowData[`${key}`] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsDelete(rowIndex, 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(rowIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
456
- } else {
455
+ } else if (key !== "Medicine") {
457
456
  rowData[`${key}`] = renderInputElement(variable[key]);
458
457
  }
459
458
  });
459
+ rowData.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)), rowIndex === rows.length - 1 && subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
460
+ return rowData;
460
461
  });
461
- rowData.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)), rowIndex === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
462
- return rowData;
463
462
  });
464
463
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
465
464
  title: eachHeadEl.label,
package/dist/index.mjs CHANGED
@@ -322,12 +322,10 @@ var AddMoreTable = (props) => {
322
322
  const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
323
323
  let newRow = {
324
324
  id: newId,
325
- label: "Medicine",
326
- name: "Medicine",
327
- type: "text",
328
325
  variable_data: [
329
326
  {
330
327
  id: 1,
328
+ Medicine: { label: "Medicine", element: "single-select", type: "text" },
331
329
  Route: { label: "Route", element: "single-select", type: "text" },
332
330
  Dose: { label: "Dose", element: "single-select", type: "text" },
333
331
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
@@ -349,6 +347,7 @@ var AddMoreTable = (props) => {
349
347
  if (index === rowIndex) {
350
348
  const newSubRow = {
351
349
  id: row.variable_data.length + 1,
350
+ Medicine: { label: "Medicine", element: "single-select", type: "text" },
352
351
  Route: { label: "Route", element: "single-select", type: "text" },
353
352
  Dose: { label: "Dose", element: "single-select", type: "text" },
354
353
  Frequency: { label: "Frequency", element: "single-select", type: "text" },
@@ -396,23 +395,23 @@ var AddMoreTable = (props) => {
396
395
  return null;
397
396
  }
398
397
  };
399
- const dataSource = rows.map((eachRow, rowIndex) => {
400
- const rowData = {
401
- key: eachRow.id,
402
- "#": rowIndex + 1,
403
- "Medicine": renderInputElement(eachRow.name, eachRow.label)
404
- };
405
- eachRow.variable_data.map((variable, subIndex) => {
398
+ const dataSource = rows.flatMap((eachRow, rowIndex) => {
399
+ return eachRow.variable_data.map((variable, subIndex) => {
400
+ const rowData = {
401
+ key: `${eachRow.id}-${variable.id}`,
402
+ "#": rowIndex + 1,
403
+ "Medicine": renderInputElement(variable.Medicine)
404
+ };
406
405
  Object.keys(variable).forEach((key) => {
407
406
  if (key === "SubRows") {
408
407
  rowData[`${key}`] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsDelete(rowIndex, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(rowIndex) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
409
- } else {
408
+ } else if (key !== "Medicine") {
410
409
  rowData[`${key}`] = renderInputElement(variable[key]);
411
410
  }
412
411
  });
412
+ rowData.actions = /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), rowIndex === rows.length - 1 && subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
413
+ return rowData;
413
414
  });
414
- rowData.actions = /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), rowIndex === rows.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
415
- return rowData;
416
415
  });
417
416
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
418
417
  title: eachHeadEl.label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta93",
3
+ "version": "0.0.11-Beta94",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",