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

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
@@ -380,6 +380,7 @@ var AddMoreTable = (props) => {
380
380
  ...lastRow,
381
381
  id: newId
382
382
  };
383
+ console.log(rows);
383
384
  setRows((prevData) => [...prevData, newRow]);
384
385
  };
385
386
  const onHandleDelete = (index) => {
@@ -411,6 +412,20 @@ var AddMoreTable = (props) => {
411
412
  });
412
413
  });
413
414
  };
415
+ const onHandleSubRowsDelete = (rowIndex, subIndex) => {
416
+ setRows((prevRows) => {
417
+ return prevRows.map((row, index) => {
418
+ if (index === rowIndex) {
419
+ const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
420
+ return {
421
+ ...row,
422
+ variable_data: updatedVariableData
423
+ };
424
+ }
425
+ return row;
426
+ });
427
+ });
428
+ };
414
429
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
415
430
  title: eachHeadEl.label,
416
431
  dataIndex: eachHeadEl.name,
@@ -440,7 +455,7 @@ var AddMoreTable = (props) => {
440
455
  const subRowElements = {};
441
456
  Object.entries(variable).forEach(([key, value]) => {
442
457
  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)));
458
+ 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
459
  } else if (value && value.element && value.label) {
445
460
  subRowElements[value.label] = renderInputElement(value);
446
461
  }
package/dist/index.mjs CHANGED
@@ -333,6 +333,7 @@ var AddMoreTable = (props) => {
333
333
  ...lastRow,
334
334
  id: newId
335
335
  };
336
+ console.log(rows);
336
337
  setRows((prevData) => [...prevData, newRow]);
337
338
  };
338
339
  const onHandleDelete = (index) => {
@@ -364,6 +365,20 @@ var AddMoreTable = (props) => {
364
365
  });
365
366
  });
366
367
  };
368
+ const onHandleSubRowsDelete = (rowIndex, subIndex) => {
369
+ setRows((prevRows) => {
370
+ return prevRows.map((row, index) => {
371
+ if (index === rowIndex) {
372
+ const updatedVariableData = row.variable_data.filter((_, i) => i !== subIndex);
373
+ return {
374
+ ...row,
375
+ variable_data: updatedVariableData
376
+ };
377
+ }
378
+ return row;
379
+ });
380
+ });
381
+ };
367
382
  const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
368
383
  title: eachHeadEl.label,
369
384
  dataIndex: eachHeadEl.name,
@@ -393,7 +408,7 @@ var AddMoreTable = (props) => {
393
408
  const subRowElements = {};
394
409
  Object.entries(variable).forEach(([key, value]) => {
395
410
  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)));
411
+ 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
412
  } else if (value && value.element && value.label) {
398
413
  subRowElements[value.label] = renderInputElement(value);
399
414
  }
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-Beta44",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",