@apexcura/ui-components 0.0.11-Beta42 → 0.0.11-Beta43

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
@@ -411,6 +411,20 @@ var AddMoreTable = (props) => {
411
411
  });
412
412
  });
413
413
  };
414
+ const onHandleSubRowsDelete = (rowIndex, subIndex) => {
415
+ setRows((prevRows) => {
416
+ return prevRows.map((row, index) => {
417
+ if (index === rowIndex) {
418
+ const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
419
+ return {
420
+ ...row,
421
+ variable_data: updatedVariableData
422
+ };
423
+ }
424
+ return row;
425
+ });
426
+ });
427
+ };
414
428
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
415
429
  title: eachHeadEl.label,
416
430
  dataIndex: eachHeadEl.name,
@@ -440,7 +454,7 @@ var AddMoreTable = (props) => {
440
454
  const subRowElements = {};
441
455
  Object.entries(variable).forEach(([key, value]) => {
442
456
  if (key === "icons" && value) {
443
- subRowElements["sub rows"] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd11.Button, null, /* @__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)));
457
+ subRowElements["sub rows"] = /* @__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)));
444
458
  } else if (value && value.element && value.label) {
445
459
  subRowElements[value.label] = renderInputElement(value);
446
460
  }
package/dist/index.mjs CHANGED
@@ -364,6 +364,20 @@ var AddMoreTable = (props) => {
364
364
  });
365
365
  });
366
366
  };
367
+ const onHandleSubRowsDelete = (rowIndex, subIndex) => {
368
+ setRows((prevRows) => {
369
+ return prevRows.map((row, index) => {
370
+ if (index === rowIndex) {
371
+ const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
372
+ return {
373
+ ...row,
374
+ variable_data: updatedVariableData
375
+ };
376
+ }
377
+ return row;
378
+ });
379
+ });
380
+ };
367
381
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
368
382
  title: eachHeadEl.label,
369
383
  dataIndex: eachHeadEl.name,
@@ -393,7 +407,7 @@ var AddMoreTable = (props) => {
393
407
  const subRowElements = {};
394
408
  Object.entries(variable).forEach(([key, value]) => {
395
409
  if (key === "icons" && value) {
396
- subRowElements["sub rows"] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button3, null, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button3, { onClick: () => onHandleSubRowsAdd(index) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
410
+ subRowElements["sub rows"] = /* @__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)));
397
411
  } else if (value && value.element && value.label) {
398
412
  subRowElements[value.label] = renderInputElement(value);
399
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.11-Beta42",
3
+ "version": "0.0.11-Beta43",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",