@apexcura/ui-components 0.0.12-Beta5 → 0.0.12-Beta7
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 +5 -1
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -382,6 +382,10 @@ var AddMoreTable = (props) => {
|
|
|
382
382
|
};
|
|
383
383
|
setRows((prevData) => [...prevData, newRow]);
|
|
384
384
|
};
|
|
385
|
+
const onHandleDelete = (index) => {
|
|
386
|
+
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
387
|
+
setRows(remainingRows);
|
|
388
|
+
};
|
|
385
389
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
386
390
|
title: eachHeadEl.label,
|
|
387
391
|
dataIndex: eachHeadEl.name,
|
|
@@ -417,7 +421,7 @@ var AddMoreTable = (props) => {
|
|
|
417
421
|
...eachRow,
|
|
418
422
|
...rowElements,
|
|
419
423
|
...variableData,
|
|
420
|
-
actions: index === rows.length - 1
|
|
424
|
+
actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
|
|
421
425
|
};
|
|
422
426
|
});
|
|
423
427
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|
package/dist/index.mjs
CHANGED
|
@@ -314,7 +314,7 @@ var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "s
|
|
|
314
314
|
// src/Components/AddMoreTable.tsx
|
|
315
315
|
import React12, { useState as useState3 } from "react";
|
|
316
316
|
import { Table } from "antd";
|
|
317
|
-
import { PlusOutlined } from "@ant-design/icons";
|
|
317
|
+
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
318
318
|
var AddMoreTable = (props) => {
|
|
319
319
|
const { thead, tbody } = props;
|
|
320
320
|
const [tableData, setTableData] = useState3({});
|
|
@@ -335,6 +335,10 @@ var AddMoreTable = (props) => {
|
|
|
335
335
|
};
|
|
336
336
|
setRows((prevData) => [...prevData, newRow]);
|
|
337
337
|
};
|
|
338
|
+
const onHandleDelete = (index) => {
|
|
339
|
+
const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
|
|
340
|
+
setRows(remainingRows);
|
|
341
|
+
};
|
|
338
342
|
const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
|
|
339
343
|
title: eachHeadEl.label,
|
|
340
344
|
dataIndex: eachHeadEl.name,
|
|
@@ -370,7 +374,7 @@ var AddMoreTable = (props) => {
|
|
|
370
374
|
...eachRow,
|
|
371
375
|
...rowElements,
|
|
372
376
|
...variableData,
|
|
373
|
-
actions: index === rows.length - 1
|
|
377
|
+
actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
|
|
374
378
|
};
|
|
375
379
|
});
|
|
376
380
|
if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
|