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

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