@apexcura/ui-components 0.0.11-Beta90 → 0.0.11-Beta92

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
@@ -429,41 +429,32 @@ var AddMoreTable = (props) => {
429
429
  console.log(rows);
430
430
  }, [rows]);
431
431
  const renderInputElement = (element, value) => {
432
+ if (!element)
433
+ return null;
432
434
  const { element: type, label } = element;
433
435
  if (type === "single-select") {
434
- let onHandleChange2 = function(label2, value2) {
435
- throw new Error("Function not implemented.");
436
- };
437
- var onHandleChange = onHandleChange2;
438
- return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
436
+ return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2) });
439
437
  } else if (type === "textarea") {
440
- let onHandleChange2 = function(label2, value2) {
441
- throw new Error("Function not implemented.");
442
- };
443
- var onHandleChange = onHandleChange2;
444
- return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
438
+ return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2) });
445
439
  } else {
446
440
  return null;
447
441
  }
448
442
  };
449
- const dataSource = rows.map((eachRow, index) => {
450
- console.log(...eachRow);
443
+ const dataSource = rows.map((eachRow, rowIndex) => {
451
444
  const rowData = {
452
445
  key: eachRow.id,
453
- "#": index + 1,
454
- ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
455
- console.log("variable", variable);
456
- Object.keys(variable).forEach((key) => {
457
- if (key === "SubRows") {
458
- 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)));
459
- } else {
460
- acc[`${key}`] = renderInputElement(variable[key]);
461
- }
462
- });
463
- return acc;
464
- }, {}),
465
- 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)))
446
+ "#": rowIndex + 1
466
447
  };
448
+ eachRow.variable_data.forEach((variable, subIndex) => {
449
+ Object.keys(variable).forEach((key) => {
450
+ if (key === "SubRows") {
451
+ 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)));
452
+ } else {
453
+ rowData[`${key}`] = renderInputElement(variable[key]);
454
+ }
455
+ });
456
+ });
457
+ 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)));
467
458
  return rowData;
468
459
  });
469
460
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
package/dist/index.mjs CHANGED
@@ -382,41 +382,32 @@ var AddMoreTable = (props) => {
382
382
  console.log(rows);
383
383
  }, [rows]);
384
384
  const renderInputElement = (element, value) => {
385
+ if (!element)
386
+ return null;
385
387
  const { element: type, label } = element;
386
388
  if (type === "single-select") {
387
- let onHandleChange2 = function(label2, value2) {
388
- throw new Error("Function not implemented.");
389
- };
390
- var onHandleChange = onHandleChange2;
391
- return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => onHandleChange2(label, value2) });
389
+ return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2) });
392
390
  } else if (type === "textarea") {
393
- let onHandleChange2 = function(label2, value2) {
394
- throw new Error("Function not implemented.");
395
- };
396
- var onHandleChange = onHandleChange2;
397
- return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => onHandleChange2(label, value2) });
391
+ return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2) });
398
392
  } else {
399
393
  return null;
400
394
  }
401
395
  };
402
- const dataSource = rows.map((eachRow, index) => {
403
- console.log(...eachRow);
396
+ const dataSource = rows.map((eachRow, rowIndex) => {
404
397
  const rowData = {
405
398
  key: eachRow.id,
406
- "#": index + 1,
407
- ...eachRow.variable_data.reduce((acc, variable, subIndex) => {
408
- console.log("variable", variable);
409
- Object.keys(variable).forEach((key) => {
410
- if (key === "SubRows") {
411
- 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)));
412
- } else {
413
- acc[`${key}`] = renderInputElement(variable[key]);
414
- }
415
- });
416
- return acc;
417
- }, {}),
418
- 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)))
399
+ "#": rowIndex + 1
419
400
  };
401
+ eachRow.variable_data.forEach((variable, subIndex) => {
402
+ Object.keys(variable).forEach((key) => {
403
+ if (key === "SubRows") {
404
+ 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)));
405
+ } else {
406
+ rowData[`${key}`] = renderInputElement(variable[key]);
407
+ }
408
+ });
409
+ });
410
+ 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)));
420
411
  return rowData;
421
412
  });
422
413
  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-Beta90",
3
+ "version": "0.0.11-Beta92",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",