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

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,9 +369,7 @@ 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",
372
+ Medicine: { label: "Medicine", element: "textarea", type: "text" },
375
373
  variable_data: [
376
374
  {
377
375
  id: 1,
@@ -444,28 +442,41 @@ var AddMoreTable = (props) => {
444
442
  }
445
443
  };
446
444
  const dataSource = rows.map((eachRow, rowIndex) => {
447
- const rowData = {
445
+ const mainRowData = {
448
446
  key: eachRow.id,
449
447
  "#": rowIndex + 1,
450
- "Medicine": renderInputElement(eachRow.name, eachRow.label)
448
+ "Medicine": renderInputElement(eachRow.Medicine)
451
449
  };
452
- eachRow.variable_data.map((variable, subIndex) => {
450
+ eachRow.variable_data.forEach((variable, subIndex) => {
453
451
  Object.keys(variable).forEach((key) => {
454
452
  if (key === "SubRows") {
455
- 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)));
453
+ mainRowData[`${key}_${subIndex}`] = /* @__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
454
  } else {
457
- rowData[`${key}`] = renderInputElement(variable[key]);
455
+ mainRowData[`${key}_${subIndex}`] = renderInputElement(variable[key]);
458
456
  }
459
457
  });
460
458
  });
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;
459
+ mainRowData.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)));
460
+ return mainRowData;
463
461
  });
464
462
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
465
463
  title: eachHeadEl.label,
466
464
  dataIndex: eachHeadEl.name,
467
465
  key: eachHeadEl.id
468
466
  })) : [];
467
+ rows.forEach((eachRow) => {
468
+ eachRow.variable_data.forEach((variable, subIndex) => {
469
+ Object.keys(variable).forEach((key) => {
470
+ if (!columns.some((col) => col.dataIndex === `${key}_${subIndex}`)) {
471
+ columns.push({
472
+ title: `${key}`,
473
+ dataIndex: `${key}_${subIndex}`,
474
+ key: `${key}_${subIndex}`
475
+ });
476
+ }
477
+ });
478
+ });
479
+ });
469
480
  if (!columns.some((col) => col.dataIndex === "actions")) {
470
481
  columns.push({
471
482
  title: "Actions",
package/dist/index.mjs CHANGED
@@ -322,9 +322,7 @@ 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",
325
+ Medicine: { label: "Medicine", element: "textarea", type: "text" },
328
326
  variable_data: [
329
327
  {
330
328
  id: 1,
@@ -397,28 +395,41 @@ var AddMoreTable = (props) => {
397
395
  }
398
396
  };
399
397
  const dataSource = rows.map((eachRow, rowIndex) => {
400
- const rowData = {
398
+ const mainRowData = {
401
399
  key: eachRow.id,
402
400
  "#": rowIndex + 1,
403
- "Medicine": renderInputElement(eachRow.name, eachRow.label)
401
+ "Medicine": renderInputElement(eachRow.Medicine)
404
402
  };
405
- eachRow.variable_data.map((variable, subIndex) => {
403
+ eachRow.variable_data.forEach((variable, subIndex) => {
406
404
  Object.keys(variable).forEach((key) => {
407
405
  if (key === "SubRows") {
408
- 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)));
406
+ mainRowData[`${key}_${subIndex}`] = /* @__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
407
  } else {
410
- rowData[`${key}`] = renderInputElement(variable[key]);
408
+ mainRowData[`${key}_${subIndex}`] = renderInputElement(variable[key]);
411
409
  }
412
410
  });
413
411
  });
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;
412
+ mainRowData.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)));
413
+ return mainRowData;
416
414
  });
417
415
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
418
416
  title: eachHeadEl.label,
419
417
  dataIndex: eachHeadEl.name,
420
418
  key: eachHeadEl.id
421
419
  })) : [];
420
+ rows.forEach((eachRow) => {
421
+ eachRow.variable_data.forEach((variable, subIndex) => {
422
+ Object.keys(variable).forEach((key) => {
423
+ if (!columns.some((col) => col.dataIndex === `${key}_${subIndex}`)) {
424
+ columns.push({
425
+ title: `${key}`,
426
+ dataIndex: `${key}_${subIndex}`,
427
+ key: `${key}_${subIndex}`
428
+ });
429
+ }
430
+ });
431
+ });
432
+ });
422
433
  if (!columns.some((col) => col.dataIndex === "actions")) {
423
434
  columns.push({
424
435
  title: "Actions",
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-Beta95",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",