@apexcura/ui-components 0.0.11-Beta87 → 0.0.11-Beta89

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
@@ -402,9 +402,10 @@ var AddMoreTable = (props) => {
402
402
  Instructions: { label: "Instructions", element: "textarea", type: "text" },
403
403
  SubRows: { delete: "delete", add: "plus" }
404
404
  };
405
+ const updatedVariableData = [...row.variable_data, newSubRow];
405
406
  return {
406
407
  ...row,
407
- variable_data: [...row.variable_data, newSubRow]
408
+ variable_data: updatedVariableData
408
409
  };
409
410
  }
410
411
  return row;
@@ -428,42 +429,43 @@ var AddMoreTable = (props) => {
428
429
  (0, import_react13.useEffect)(() => {
429
430
  console.log(rows);
430
431
  }, [rows]);
431
- const renderInputElement = (element) => {
432
+ const renderInputElement = (element, value) => {
432
433
  const { element: type, label } = element;
433
434
  if (type === "single-select") {
434
- let onHandleChange2 = function(label2, value) {
435
+ let onHandleChange2 = function(label2, value2) {
435
436
  throw new Error("Function not implemented.");
436
437
  };
437
438
  var onHandleChange = onHandleChange2;
438
- return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value) => onHandleChange2(label, value) });
439
+ return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
439
440
  } else if (type === "textarea") {
440
- let onHandleChange2 = function(label2, value) {
441
+ let onHandleChange2 = function(label2, value2) {
441
442
  throw new Error("Function not implemented.");
442
443
  };
443
444
  var onHandleChange = onHandleChange2;
444
- return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value) => onHandleChange2(label, value) });
445
+ return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
445
446
  } else {
446
447
  return null;
447
448
  }
448
449
  };
449
450
  const dataSource = rows.map((eachRow, index) => {
451
+ console.log(...eachRow.variable_data);
450
452
  const rowData = {
451
453
  key: eachRow.id,
452
454
  "#": index + 1,
455
+ "Medicine": renderInputElement(eachRow.element, eachRow.value),
453
456
  ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
457
+ console.log("variable", variable);
454
458
  Object.keys(variable).forEach((key) => {
455
459
  if (key === "SubRows") {
456
- return;
460
+ acc[`${key}`] = /* @__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)));
461
+ } else {
462
+ acc[`${key}`] = renderInputElement(variable[key]);
457
463
  }
458
- acc[`${key}_${subIndex}`] = renderInputElement(variable[key]);
459
464
  });
460
465
  return acc;
461
466
  }, {}),
462
467
  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)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
463
468
  };
464
- if (eachRow.variable_data.length > 1) {
465
- rowData[`SubRows`] = /* @__PURE__ */ import_react13.default.createElement("div", null, eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)))), /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
466
- }
467
469
  return rowData;
468
470
  });
469
471
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
package/dist/index.mjs CHANGED
@@ -355,9 +355,10 @@ var AddMoreTable = (props) => {
355
355
  Instructions: { label: "Instructions", element: "textarea", type: "text" },
356
356
  SubRows: { delete: "delete", add: "plus" }
357
357
  };
358
+ const updatedVariableData = [...row.variable_data, newSubRow];
358
359
  return {
359
360
  ...row,
360
- variable_data: [...row.variable_data, newSubRow]
361
+ variable_data: updatedVariableData
361
362
  };
362
363
  }
363
364
  return row;
@@ -381,42 +382,43 @@ var AddMoreTable = (props) => {
381
382
  useEffect(() => {
382
383
  console.log(rows);
383
384
  }, [rows]);
384
- const renderInputElement = (element) => {
385
+ const renderInputElement = (element, value) => {
385
386
  const { element: type, label } = element;
386
387
  if (type === "single-select") {
387
- let onHandleChange2 = function(label2, value) {
388
+ let onHandleChange2 = function(label2, value2) {
388
389
  throw new Error("Function not implemented.");
389
390
  };
390
391
  var onHandleChange = onHandleChange2;
391
- return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value) => onHandleChange2(label, value) });
392
+ return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
392
393
  } else if (type === "textarea") {
393
- let onHandleChange2 = function(label2, value) {
394
+ let onHandleChange2 = function(label2, value2) {
394
395
  throw new Error("Function not implemented.");
395
396
  };
396
397
  var onHandleChange = onHandleChange2;
397
- return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value) => onHandleChange2(label, value) });
398
+ return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
398
399
  } else {
399
400
  return null;
400
401
  }
401
402
  };
402
403
  const dataSource = rows.map((eachRow, index) => {
404
+ console.log(...eachRow.variable_data);
403
405
  const rowData = {
404
406
  key: eachRow.id,
405
407
  "#": index + 1,
408
+ "Medicine": renderInputElement(eachRow.element, eachRow.value),
406
409
  ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
410
+ console.log("variable", variable);
407
411
  Object.keys(variable).forEach((key) => {
408
412
  if (key === "SubRows") {
409
- return;
413
+ acc[`${key}`] = /* @__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)));
414
+ } else {
415
+ acc[`${key}`] = renderInputElement(variable[key]);
410
416
  }
411
- acc[`${key}_${subIndex}`] = renderInputElement(variable[key]);
412
417
  });
413
418
  return acc;
414
419
  }, {}),
415
420
  actions: /* @__PURE__ */ React12.createElement("div", 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)))
416
421
  };
417
- if (eachRow.variable_data.length > 1) {
418
- rowData[`SubRows`] = /* @__PURE__ */ React12.createElement("div", null, eachRow.variable_data.map((variable, subIndex) => /* @__PURE__ */ React12.createElement("div", { key: subIndex }, /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsDelete(index, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)))), /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
419
- }
420
422
  return rowData;
421
423
  });
422
424
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta87",
3
+ "version": "0.0.11-Beta89",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",