react-table-edit 0.5.1 → 0.5.3
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.d.mts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +245 -204
- package/dist/index.mjs +220 -179
- package/package.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// test-app/src/component/table/index.tsx
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { Button as Button3, DropdownMenu as DropdownMenu2, DropdownToggle as DropdownToggle2, Input as Input6, UncontrolledDropdown } from "reactstrap";
|
|
2
|
+
import { Fragment as Fragment13, forwardRef as forwardRef2, useEffect as useEffect7, useImperativeHandle, useRef as useRef2, useState as useState6 } from "react";
|
|
3
|
+
import { Button as Button3, DropdownMenu as DropdownMenu2, DropdownToggle as DropdownToggle2, Input as Input6, UncontrolledDropdown, UncontrolledTooltip } from "reactstrap";
|
|
4
4
|
import classnames6 from "classnames";
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import
|
|
7
|
-
import { PagerComponent } from "@syncfusion/ej2-react-grids";
|
|
5
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
6
|
+
import Select3 from "react-select";
|
|
8
7
|
import AsyncSelect from "react-select/async";
|
|
9
8
|
import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
|
|
10
9
|
|
|
@@ -295,7 +294,6 @@ var icon_default = IconCustom;
|
|
|
295
294
|
|
|
296
295
|
// test-app/src/component/table/index.tsx
|
|
297
296
|
import moment from "moment";
|
|
298
|
-
import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
|
|
299
297
|
|
|
300
298
|
// test-app/src/component/edit-form/index.tsx
|
|
301
299
|
import { forwardRef, useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
@@ -1441,10 +1439,70 @@ var SidebarSetColumn = (props) => {
|
|
|
1441
1439
|
var sidebar_setting_column_default = SidebarSetColumn;
|
|
1442
1440
|
|
|
1443
1441
|
// test-app/src/component/table/index.tsx
|
|
1444
|
-
import {
|
|
1445
|
-
|
|
1446
|
-
|
|
1442
|
+
import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
|
|
1443
|
+
|
|
1444
|
+
// test-app/src/component/paging/index.tsx
|
|
1445
|
+
import { ChevronRight as ChevronRight2, ChevronLeft as ChevronLeft2, ChevronsLeft, ChevronsRight } from "becoxy-icons";
|
|
1446
|
+
import classNames5 from "classnames";
|
|
1447
|
+
import { Fragment as Fragment12, useEffect as useEffect6, useState as useState5 } from "react";
|
|
1448
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1449
|
+
import Select2 from "react-select";
|
|
1450
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1451
|
+
var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
1447
1452
|
const { t } = useTranslation8();
|
|
1453
|
+
const [countPage, setCountPage] = useState5(0);
|
|
1454
|
+
useEffect6(() => {
|
|
1455
|
+
const count = Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1);
|
|
1456
|
+
setCountPage(count);
|
|
1457
|
+
}, [totalItem, pageSize]);
|
|
1458
|
+
const renderPageNumber = () => {
|
|
1459
|
+
const arr = [];
|
|
1460
|
+
for (let index = 1; index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
|
|
1461
|
+
arr.push(
|
|
1462
|
+
/* @__PURE__ */ jsx12(
|
|
1463
|
+
"div",
|
|
1464
|
+
{
|
|
1465
|
+
className: classNames5("r-number", { "r-active": index === currentPage }),
|
|
1466
|
+
onClick: () => {
|
|
1467
|
+
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
1468
|
+
},
|
|
1469
|
+
children: index
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
return arr;
|
|
1475
|
+
};
|
|
1476
|
+
return /* @__PURE__ */ jsx12(Fragment12, { children: /* @__PURE__ */ jsxs11("div", { className: "r-pager", children: [
|
|
1477
|
+
/* @__PURE__ */ jsxs11("div", { className: "r-pagercontainer", children: [
|
|
1478
|
+
/* @__PURE__ */ jsx12("button", { className: "r-button", type: "button", disabled: countPage === 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ jsx12(ChevronsLeft, { fontSize: 16 }) }),
|
|
1479
|
+
/* @__PURE__ */ jsx12("button", { className: "r-button", type: "button", disabled: countPage === 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ jsx12(ChevronLeft2, { fontSize: 16 }) }),
|
|
1480
|
+
renderPageNumber(),
|
|
1481
|
+
/* @__PURE__ */ jsx12("button", { className: "r-button", type: "button", disabled: countPage === 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ jsx12(ChevronRight2, { fontSize: 16 }) }),
|
|
1482
|
+
/* @__PURE__ */ jsx12("button", { className: "r-button", type: "button", disabled: countPage === 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1), old: currentPage }), children: /* @__PURE__ */ jsx12(ChevronsRight, { fontSize: 16 }) }),
|
|
1483
|
+
/* @__PURE__ */ jsx12("div", { className: "r-pagesize", children: /* @__PURE__ */ jsx12(
|
|
1484
|
+
Select2,
|
|
1485
|
+
{
|
|
1486
|
+
value: { value: pageSize, label: pageSize },
|
|
1487
|
+
options: pageOptions.map((item) => ({ value: item, label: item })),
|
|
1488
|
+
onChange: (val) => {
|
|
1489
|
+
onChangePageSize({ totalItem, pageSize: val?.value });
|
|
1490
|
+
},
|
|
1491
|
+
menuPosition: "fixed",
|
|
1492
|
+
placeholder: t("Select"),
|
|
1493
|
+
classNamePrefix: "select-pagesize"
|
|
1494
|
+
}
|
|
1495
|
+
) }),
|
|
1496
|
+
/* @__PURE__ */ jsx12("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
|
|
1497
|
+
] }),
|
|
1498
|
+
/* @__PURE__ */ jsx12("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
|
|
1499
|
+
] }) });
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
// test-app/src/component/table/index.tsx
|
|
1503
|
+
import { Fragment as Fragment14, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1504
|
+
var TableEdit = forwardRef2((props, ref) => {
|
|
1505
|
+
const { t } = useTranslation9();
|
|
1448
1506
|
const {
|
|
1449
1507
|
idTable,
|
|
1450
1508
|
dataSource,
|
|
@@ -1477,33 +1535,31 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1477
1535
|
refeshFocusRow: handleRefeshRow
|
|
1478
1536
|
};
|
|
1479
1537
|
});
|
|
1480
|
-
const [refreshRow, setRefreshRow] =
|
|
1481
|
-
const [indexFocus, setIndexFocus] =
|
|
1482
|
-
const [selectedRows, setSelectedRows] =
|
|
1483
|
-
const [headerColumns, setHeaderColumns] =
|
|
1484
|
-
const [contentColumns, setContentColumns] =
|
|
1485
|
-
const [levelCol, setLevelCol] =
|
|
1486
|
-
const [columnFistEdit, setColumnFistEdit] =
|
|
1487
|
-
const [columnLastEdit, setColumnlastEdit] =
|
|
1488
|
-
const [objWidthFix, setObjWidthFix] =
|
|
1489
|
-
const [openPopupTree, setOpenPopupTree] =
|
|
1490
|
-
const [openPopupSetupColumn, setOpenPopupSetupColumn] =
|
|
1491
|
-
const [searchTerm, setSearchTerm] =
|
|
1538
|
+
const [refreshRow, setRefreshRow] = useState6(false);
|
|
1539
|
+
const [indexFocus, setIndexFocus] = useState6();
|
|
1540
|
+
const [selectedRows, setSelectedRows] = useState6([]);
|
|
1541
|
+
const [headerColumns, setHeaderColumns] = useState6([[]]);
|
|
1542
|
+
const [contentColumns, setContentColumns] = useState6([]);
|
|
1543
|
+
const [levelCol, setLevelCol] = useState6(0);
|
|
1544
|
+
const [columnFistEdit, setColumnFistEdit] = useState6(0);
|
|
1545
|
+
const [columnLastEdit, setColumnlastEdit] = useState6(0);
|
|
1546
|
+
const [objWidthFix, setObjWidthFix] = useState6({});
|
|
1547
|
+
const [openPopupTree, setOpenPopupTree] = useState6(false);
|
|
1548
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState6(false);
|
|
1549
|
+
const [searchTerm, setSearchTerm] = useState6("");
|
|
1492
1550
|
const tableElement = useRef2(null);
|
|
1493
1551
|
const gridRef = useRef2();
|
|
1494
|
-
const lag = window.localStorage.getItem("i18nextLng");
|
|
1495
|
-
const lang = lag ? lag : "vi";
|
|
1496
1552
|
let totalCount = dataSource.length;
|
|
1497
1553
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
1498
1554
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
1499
1555
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
1500
1556
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
1501
|
-
|
|
1557
|
+
useEffect7(() => {
|
|
1502
1558
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
1503
1559
|
pagingSetting.setCurrentPage(1);
|
|
1504
1560
|
}
|
|
1505
1561
|
}, [dataSource]);
|
|
1506
|
-
|
|
1562
|
+
useEffect7(() => {
|
|
1507
1563
|
let indexFirst = -1;
|
|
1508
1564
|
let indexlast = -1;
|
|
1509
1565
|
let letfWidthFix = 0;
|
|
@@ -1536,7 +1592,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1536
1592
|
setColumnFistEdit(indexFirst + 1);
|
|
1537
1593
|
setColumnlastEdit(indexlast + 1);
|
|
1538
1594
|
}, [contentColumns]);
|
|
1539
|
-
|
|
1595
|
+
useEffect7(() => {
|
|
1540
1596
|
const arrHeaderColumns = [];
|
|
1541
1597
|
const arrContentColumns = [];
|
|
1542
1598
|
let headerLevelRow = 0;
|
|
@@ -1553,7 +1609,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1553
1609
|
setHeaderColumns(arrHeaderColumns);
|
|
1554
1610
|
setContentColumns(arrContentColumns);
|
|
1555
1611
|
}, [columns]);
|
|
1556
|
-
|
|
1612
|
+
useEffect7(() => {
|
|
1557
1613
|
const arrHeaderColumns = [];
|
|
1558
1614
|
const arrContentColumns = [];
|
|
1559
1615
|
let headerLevelRow = 0;
|
|
@@ -1664,7 +1720,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1664
1720
|
}
|
|
1665
1721
|
};
|
|
1666
1722
|
const searchTemplate = () => {
|
|
1667
|
-
return /* @__PURE__ */
|
|
1723
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: /* @__PURE__ */ jsx13("div", { className: "me-50 r-search", children: /* @__PURE__ */ jsx13(
|
|
1668
1724
|
react_input_default,
|
|
1669
1725
|
{
|
|
1670
1726
|
style: { width: "230px" },
|
|
@@ -1685,7 +1741,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1685
1741
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
1686
1742
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
1687
1743
|
case "date":
|
|
1688
|
-
return /* @__PURE__ */
|
|
1744
|
+
return /* @__PURE__ */ jsx13(
|
|
1689
1745
|
Input6,
|
|
1690
1746
|
{
|
|
1691
1747
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1708,7 +1764,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1708
1764
|
}
|
|
1709
1765
|
);
|
|
1710
1766
|
case "datetime":
|
|
1711
|
-
return /* @__PURE__ */
|
|
1767
|
+
return /* @__PURE__ */ jsx13(
|
|
1712
1768
|
Input6,
|
|
1713
1769
|
{
|
|
1714
1770
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1741,8 +1797,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1741
1797
|
if (!valueAsyncSelect && col.selectSettings?.defaultValue) {
|
|
1742
1798
|
valueAsyncSelect = col.selectSettings?.defaultValue(row);
|
|
1743
1799
|
}
|
|
1744
|
-
return /* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ jsxs12("div", { className: classnames6("d-flex select-group", { "is-invalid": col.validate && col.validate(row[col.field], row) }), children: [
|
|
1801
|
+
/* @__PURE__ */ jsx13(
|
|
1746
1802
|
AsyncSelect,
|
|
1747
1803
|
{
|
|
1748
1804
|
menuPosition: "fixed",
|
|
@@ -1768,7 +1824,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1768
1824
|
}
|
|
1769
1825
|
}
|
|
1770
1826
|
),
|
|
1771
|
-
/* @__PURE__ */
|
|
1827
|
+
/* @__PURE__ */ jsx13(
|
|
1772
1828
|
"span",
|
|
1773
1829
|
{
|
|
1774
1830
|
onClick: () => {
|
|
@@ -1777,7 +1833,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1777
1833
|
}
|
|
1778
1834
|
},
|
|
1779
1835
|
className: classnames6("input-group-text", { "d-none": !col.selectSettings?.iconGroup }),
|
|
1780
|
-
children: /* @__PURE__ */
|
|
1836
|
+
children: /* @__PURE__ */ jsx13(icon_default, { iconName: col.selectSettings?.iconGroup ?? "", size: 16 })
|
|
1781
1837
|
}
|
|
1782
1838
|
)
|
|
1783
1839
|
] });
|
|
@@ -1794,8 +1850,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1794
1850
|
} else {
|
|
1795
1851
|
valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? options?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
1796
1852
|
}
|
|
1797
|
-
return /* @__PURE__ */
|
|
1798
|
-
|
|
1853
|
+
return /* @__PURE__ */ jsx13(
|
|
1854
|
+
Select3,
|
|
1799
1855
|
{
|
|
1800
1856
|
menuPosition: "fixed",
|
|
1801
1857
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1835,14 +1891,14 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1835
1891
|
}
|
|
1836
1892
|
}
|
|
1837
1893
|
};
|
|
1838
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsx13(
|
|
1839
1895
|
"div",
|
|
1840
1896
|
{
|
|
1841
1897
|
onKeyDown: (e) => {
|
|
1842
1898
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1843
1899
|
}
|
|
1844
1900
|
},
|
|
1845
|
-
children: /* @__PURE__ */
|
|
1901
|
+
children: /* @__PURE__ */ jsx13(
|
|
1846
1902
|
DropDownTreeComponent,
|
|
1847
1903
|
{
|
|
1848
1904
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1881,7 +1937,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1881
1937
|
}
|
|
1882
1938
|
);
|
|
1883
1939
|
case "checkbox":
|
|
1884
|
-
return /* @__PURE__ */
|
|
1940
|
+
return /* @__PURE__ */ jsx13(
|
|
1885
1941
|
Input6,
|
|
1886
1942
|
{
|
|
1887
1943
|
checked: row[col.field],
|
|
@@ -1904,7 +1960,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1904
1960
|
);
|
|
1905
1961
|
case "numeric":
|
|
1906
1962
|
let valueCurrency = row[col.field];
|
|
1907
|
-
return /* @__PURE__ */
|
|
1963
|
+
return /* @__PURE__ */ jsx13(
|
|
1908
1964
|
Input6,
|
|
1909
1965
|
{
|
|
1910
1966
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1994,7 +2050,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1994
2050
|
}
|
|
1995
2051
|
);
|
|
1996
2052
|
case "color":
|
|
1997
|
-
return /* @__PURE__ */
|
|
2053
|
+
return /* @__PURE__ */ jsx13("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx13(
|
|
1998
2054
|
Input6,
|
|
1999
2055
|
{
|
|
2000
2056
|
type: "color",
|
|
@@ -2017,7 +2073,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2017
2073
|
`col-${indexRow}-${indexCol}`
|
|
2018
2074
|
) });
|
|
2019
2075
|
case "form":
|
|
2020
|
-
return /* @__PURE__ */
|
|
2076
|
+
return /* @__PURE__ */ jsx13(
|
|
2021
2077
|
edit_form_default,
|
|
2022
2078
|
{
|
|
2023
2079
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2039,7 +2095,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2039
2095
|
}
|
|
2040
2096
|
);
|
|
2041
2097
|
default:
|
|
2042
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ jsx13(
|
|
2043
2099
|
Input6,
|
|
2044
2100
|
{
|
|
2045
2101
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2083,10 +2139,11 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2083
2139
|
}
|
|
2084
2140
|
};
|
|
2085
2141
|
const renderCommand = (commandItems, rowData, i) => {
|
|
2086
|
-
return /* @__PURE__ */
|
|
2087
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: /* @__PURE__ */ jsx13("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2143
|
+
return /* @__PURE__ */ jsxs12(
|
|
2088
2144
|
Button3,
|
|
2089
2145
|
{
|
|
2146
|
+
id: `command-item-${i}`,
|
|
2090
2147
|
tabIndex: -1,
|
|
2091
2148
|
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2092
2149
|
className: classnames6("command-item", {
|
|
@@ -2100,7 +2157,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2100
2157
|
}
|
|
2101
2158
|
e.preventDefault();
|
|
2102
2159
|
},
|
|
2103
|
-
children:
|
|
2160
|
+
children: [
|
|
2161
|
+
item.icon && /* @__PURE__ */ jsx13(icon_default, { iconName: item.icon, size: 16 }),
|
|
2162
|
+
/* @__PURE__ */ jsx13(UncontrolledTooltip, { target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2163
|
+
]
|
|
2104
2164
|
},
|
|
2105
2165
|
`command-${index}`
|
|
2106
2166
|
);
|
|
@@ -2224,13 +2284,14 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2224
2284
|
};
|
|
2225
2285
|
const onChangePage = (args) => {
|
|
2226
2286
|
if (pagingSetting?.setCurrentPage) {
|
|
2227
|
-
if (args.
|
|
2287
|
+
if (args.currentPage === args.oldPage) {
|
|
2228
2288
|
return;
|
|
2229
2289
|
}
|
|
2230
2290
|
pagingSetting.setCurrentPage(args.currentPage);
|
|
2231
2291
|
}
|
|
2232
2292
|
};
|
|
2233
2293
|
const onChangePageSize = (args) => {
|
|
2294
|
+
console.log(args.pageSize);
|
|
2234
2295
|
if (pagingSetting?.allowPaging) {
|
|
2235
2296
|
if (pagingSetting?.pageSize !== args.pageSize) {
|
|
2236
2297
|
if (pagingSetting?.setPageSize) {
|
|
@@ -2355,7 +2416,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2355
2416
|
}
|
|
2356
2417
|
}
|
|
2357
2418
|
};
|
|
2358
|
-
|
|
2419
|
+
useEffect7(() => {
|
|
2359
2420
|
setIndexFocus(-1);
|
|
2360
2421
|
if (setSelectedItem) {
|
|
2361
2422
|
if (isMulti) {
|
|
@@ -2382,7 +2443,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2382
2443
|
}
|
|
2383
2444
|
}
|
|
2384
2445
|
}, [selectedRows]);
|
|
2385
|
-
|
|
2446
|
+
useEffect7(() => {
|
|
2386
2447
|
if (!isMulti) {
|
|
2387
2448
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
2388
2449
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -2399,7 +2460,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2399
2460
|
}, [selectedItem]);
|
|
2400
2461
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
2401
2462
|
if (col.field === "command") {
|
|
2402
|
-
return col.visible !== false && /* @__PURE__ */
|
|
2463
|
+
return col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2403
2464
|
"td",
|
|
2404
2465
|
{
|
|
2405
2466
|
className: classnames6(
|
|
@@ -2412,12 +2473,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2412
2473
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2413
2474
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2414
2475
|
},
|
|
2415
|
-
children: /* @__PURE__ */
|
|
2476
|
+
children: /* @__PURE__ */ jsx13("div", { className: "r-rowcell-div ", children: renderCommand(col.commandItems, row, indexRow) })
|
|
2416
2477
|
},
|
|
2417
2478
|
`col-${indexRow}-${indexCol}`
|
|
2418
2479
|
);
|
|
2419
2480
|
} else if (col.field === "#") {
|
|
2420
|
-
return col.visible !== false && /* @__PURE__ */
|
|
2481
|
+
return col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2421
2482
|
"td",
|
|
2422
2483
|
{
|
|
2423
2484
|
className: classnames6(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
@@ -2464,12 +2525,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2464
2525
|
e.stopPropagation();
|
|
2465
2526
|
}
|
|
2466
2527
|
},
|
|
2467
|
-
children: /* @__PURE__ */
|
|
2528
|
+
children: /* @__PURE__ */ jsx13("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
2468
2529
|
},
|
|
2469
2530
|
`col-${indexRow}-${indexCol}`
|
|
2470
2531
|
);
|
|
2471
2532
|
} else if (col.field === "checkbox") {
|
|
2472
|
-
return /* @__PURE__ */
|
|
2533
|
+
return /* @__PURE__ */ jsx13(
|
|
2473
2534
|
"td",
|
|
2474
2535
|
{
|
|
2475
2536
|
className: classnames6(
|
|
@@ -2482,7 +2543,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2482
2543
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2483
2544
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
2484
2545
|
},
|
|
2485
|
-
children: /* @__PURE__ */
|
|
2546
|
+
children: /* @__PURE__ */ jsx13(
|
|
2486
2547
|
"div",
|
|
2487
2548
|
{
|
|
2488
2549
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -2506,7 +2567,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2506
2567
|
e.stopPropagation();
|
|
2507
2568
|
}
|
|
2508
2569
|
},
|
|
2509
|
-
children: /* @__PURE__ */
|
|
2570
|
+
children: /* @__PURE__ */ jsx13(
|
|
2510
2571
|
Input6,
|
|
2511
2572
|
{
|
|
2512
2573
|
checked: isSelected,
|
|
@@ -2533,7 +2594,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2533
2594
|
}
|
|
2534
2595
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
2535
2596
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
2536
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2537
2598
|
"td",
|
|
2538
2599
|
{
|
|
2539
2600
|
className: classnames6(
|
|
@@ -2578,14 +2639,14 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2578
2639
|
e.stopPropagation();
|
|
2579
2640
|
}
|
|
2580
2641
|
},
|
|
2581
|
-
children: /* @__PURE__ */
|
|
2642
|
+
children: /* @__PURE__ */ jsx13(
|
|
2582
2643
|
"div",
|
|
2583
2644
|
{
|
|
2584
2645
|
className: classnames6("r-rowcell-div"),
|
|
2585
2646
|
style: {
|
|
2586
2647
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width
|
|
2587
2648
|
},
|
|
2588
|
-
children: /* @__PURE__ */
|
|
2649
|
+
children: /* @__PURE__ */ jsxs12(
|
|
2589
2650
|
"div",
|
|
2590
2651
|
{
|
|
2591
2652
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
@@ -2595,19 +2656,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2595
2656
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
2596
2657
|
},
|
|
2597
2658
|
children: [
|
|
2598
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) :
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
className: "r-cell-text",
|
|
2603
|
-
style: {
|
|
2604
|
-
display: "block",
|
|
2605
|
-
maxWidth: (col.editType ?? "text") === "text" ? col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto" : "auto"
|
|
2606
|
-
},
|
|
2607
|
-
children: typeDis === 2 ? col.template(row, indexRow) : value
|
|
2608
|
-
}
|
|
2609
|
-
),
|
|
2610
|
-
/* @__PURE__ */ jsx12("span", { className: "icon-table", children: /* @__PURE__ */ jsx12(TooltipComponent, { className: classnames6("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage?.toString() ?? "", children: /* @__PURE__ */ jsx12(AlertCircle, { fontSize: 15.5 }) }) })
|
|
2659
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx13("div", { id: `content-${indexRow}-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
2660
|
+
/* @__PURE__ */ jsx13("span", { id: `error-${indexRow}-${indexCol}`, className: classnames6("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx13(AlertCircle, { fontSize: 15.5 }) }),
|
|
2661
|
+
!(typeDis === 1 && !refreshRow) && col.haveToolTip && /* @__PURE__ */ jsx13(UncontrolledTooltip, { style: { fontSize: 11 }, autohide: false, target: `content-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
2662
|
+
/* @__PURE__ */ jsx13(UncontrolledTooltip, { target: `error-${indexRow}-${indexCol}`, children: errorMessage?.toString() ?? "" })
|
|
2611
2663
|
]
|
|
2612
2664
|
}
|
|
2613
2665
|
)
|
|
@@ -2620,7 +2672,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2620
2672
|
};
|
|
2621
2673
|
const renderHeaderCol = (col, indexCol, indexParent) => {
|
|
2622
2674
|
if (col.field === "checkbox") {
|
|
2623
|
-
return /* @__PURE__ */
|
|
2675
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2624
2676
|
"th",
|
|
2625
2677
|
{
|
|
2626
2678
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2637,15 +2689,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2637
2689
|
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2638
2690
|
maxWidth: col.maxWidth
|
|
2639
2691
|
},
|
|
2640
|
-
children: /* @__PURE__ */
|
|
2692
|
+
children: /* @__PURE__ */ jsx13(
|
|
2641
2693
|
"div",
|
|
2642
2694
|
{
|
|
2643
|
-
style: {
|
|
2644
|
-
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2645
|
-
justifyContent: col.textAlign ?? "left"
|
|
2646
|
-
},
|
|
2695
|
+
style: { justifyContent: col.textAlign ?? "left" },
|
|
2647
2696
|
className: classnames6("r-headercell-div"),
|
|
2648
|
-
children: /* @__PURE__ */
|
|
2697
|
+
children: /* @__PURE__ */ jsx13(
|
|
2649
2698
|
Input6,
|
|
2650
2699
|
{
|
|
2651
2700
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
@@ -2670,10 +2719,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2670
2719
|
}
|
|
2671
2720
|
) }, `header-${indexCol}`);
|
|
2672
2721
|
} else if (col.field === "#") {
|
|
2673
|
-
return /* @__PURE__ */
|
|
2674
|
-
|
|
2722
|
+
return /* @__PURE__ */ jsx13(
|
|
2723
|
+
Fragment13,
|
|
2675
2724
|
{
|
|
2676
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2725
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2677
2726
|
"th",
|
|
2678
2727
|
{
|
|
2679
2728
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2690,14 +2739,11 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2690
2739
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2691
2740
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
2692
2741
|
},
|
|
2693
|
-
children: /* @__PURE__ */
|
|
2742
|
+
children: /* @__PURE__ */ jsx13(
|
|
2694
2743
|
"div",
|
|
2695
2744
|
{
|
|
2696
2745
|
title: t(col.headerText ?? ""),
|
|
2697
|
-
style: {
|
|
2698
|
-
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2699
|
-
justifyContent: col.textAlign ?? "left"
|
|
2700
|
-
},
|
|
2746
|
+
style: { justifyContent: col.textAlign ?? "left" },
|
|
2701
2747
|
className: "r-headercell-div",
|
|
2702
2748
|
children: t(col.headerText ?? "")
|
|
2703
2749
|
}
|
|
@@ -2708,10 +2754,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2708
2754
|
`header-${indexCol}`
|
|
2709
2755
|
);
|
|
2710
2756
|
} else {
|
|
2711
|
-
return /* @__PURE__ */
|
|
2712
|
-
|
|
2757
|
+
return /* @__PURE__ */ jsx13(
|
|
2758
|
+
Fragment13,
|
|
2713
2759
|
{
|
|
2714
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2760
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2715
2761
|
"th",
|
|
2716
2762
|
{
|
|
2717
2763
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2728,15 +2774,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2728
2774
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2729
2775
|
maxWidth: col.maxWidth
|
|
2730
2776
|
},
|
|
2731
|
-
children: /* @__PURE__ */
|
|
2777
|
+
children: /* @__PURE__ */ jsx13(
|
|
2732
2778
|
"div",
|
|
2733
2779
|
{
|
|
2734
2780
|
role: "textbox",
|
|
2735
2781
|
title: t(col.headerText ?? ""),
|
|
2736
|
-
style: {
|
|
2737
|
-
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2738
|
-
justifyContent: col.textAlign ?? "left"
|
|
2739
|
-
},
|
|
2782
|
+
style: { justifyContent: col.textAlign ?? "left" },
|
|
2740
2783
|
className: "r-headercell-div",
|
|
2741
2784
|
children: t(col.headerText ?? "")
|
|
2742
2785
|
}
|
|
@@ -2749,7 +2792,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2749
2792
|
}
|
|
2750
2793
|
};
|
|
2751
2794
|
const renderFooterCol = (col, indexCol) => {
|
|
2752
|
-
return /* @__PURE__ */
|
|
2795
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2753
2796
|
"td",
|
|
2754
2797
|
{
|
|
2755
2798
|
className: classnames6(
|
|
@@ -2764,56 +2807,56 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2764
2807
|
maxWidth: col.maxWidth,
|
|
2765
2808
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2766
2809
|
},
|
|
2767
|
-
children: /* @__PURE__ */
|
|
2810
|
+
children: /* @__PURE__ */ jsx13("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
2768
2811
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2769
2812
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2770
2813
|
}
|
|
2771
2814
|
) }, `summarycell-${indexCol}`);
|
|
2772
2815
|
};
|
|
2773
2816
|
const renderToolbarTop = () => {
|
|
2774
|
-
return /* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
2817
|
+
return /* @__PURE__ */ jsx13("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs12("div", { className: "r-toolbar-items", children: [
|
|
2818
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
2819
|
+
return item.align === "left" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
2777
2820
|
}) }),
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
2822
|
+
return item.align === "center" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
2780
2823
|
}) }),
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
2825
|
+
return item.align === "right" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
2783
2826
|
}) })
|
|
2784
2827
|
] }) });
|
|
2785
2828
|
};
|
|
2786
2829
|
const renderToolbarBottom = () => {
|
|
2787
|
-
return /* @__PURE__ */
|
|
2788
|
-
/* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */
|
|
2790
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */
|
|
2791
|
-
/* @__PURE__ */
|
|
2830
|
+
return /* @__PURE__ */ jsx13("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs12("div", { className: "r-toolbar-items", children: [
|
|
2831
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-toolbar-left", children: [
|
|
2832
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Button3, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
2833
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs12(Fragment14, { children: [
|
|
2834
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Button3, { color: "success", outline: true, onClick: () => {
|
|
2792
2835
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
2793
2836
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
] }) : /* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2837
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Button3, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
2838
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Button3, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
2839
|
+
] }) : /* @__PURE__ */ jsx13(Fragment14, { children: " " }),
|
|
2840
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Button3, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
2798
2841
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2799
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
2842
|
+
return item.align === "left" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
2800
2843
|
})
|
|
2801
2844
|
] }),
|
|
2802
|
-
/* @__PURE__ */
|
|
2803
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
2845
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2846
|
+
return item.align === "center" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
2804
2847
|
}) }),
|
|
2805
|
-
/* @__PURE__ */
|
|
2848
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-toolbar-right", children: [
|
|
2806
2849
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2807
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
2850
|
+
return item.align === "right" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
2808
2851
|
}),
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ jsx13(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
2853
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs12(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
2854
|
+
/* @__PURE__ */ jsx13(DropdownToggle2, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx13(Info2, { className: "cursor-pointer" }) }),
|
|
2855
|
+
/* @__PURE__ */ jsx13(DropdownMenu2, { children: /* @__PURE__ */ jsxs12("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
2856
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\xE2n b\u1EA3n" }),
|
|
2857
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
2858
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\xE9p h\xE0ng" }),
|
|
2859
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\xE1n h\xE0ng" })
|
|
2817
2860
|
] }) })
|
|
2818
2861
|
] }) })
|
|
2819
2862
|
] })
|
|
@@ -2842,7 +2885,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2842
2885
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2843
2886
|
if (flagDisplay) {
|
|
2844
2887
|
countDisplay++;
|
|
2845
|
-
return /* @__PURE__ */
|
|
2888
|
+
return /* @__PURE__ */ jsx13(
|
|
2846
2889
|
"tr",
|
|
2847
2890
|
{
|
|
2848
2891
|
className: classnames6("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
@@ -2856,43 +2899,41 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2856
2899
|
}
|
|
2857
2900
|
});
|
|
2858
2901
|
};
|
|
2859
|
-
|
|
2902
|
+
useEffect7(() => {
|
|
2860
2903
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
2861
2904
|
pagingSetting?.setCurrentPage(1);
|
|
2862
2905
|
}
|
|
2863
2906
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
return /* @__PURE__ */
|
|
2907
|
+
return /* @__PURE__ */ jsxs12(Fragment13, { children: [
|
|
2908
|
+
/* @__PURE__ */ jsxs12("div", { className: "react-table-edit", children: [
|
|
2909
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-grid", ref: gridRef, children: [
|
|
2910
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx13(Fragment14, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx13(Fragment14, {}),
|
|
2911
|
+
/* @__PURE__ */ jsx13("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs12("table", { style: { width: "100%" }, children: [
|
|
2912
|
+
/* @__PURE__ */ jsx13("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
2913
|
+
return /* @__PURE__ */ jsx13("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
2871
2914
|
return renderHeaderCol(col, index, indexParent);
|
|
2872
2915
|
}) }, indexParent);
|
|
2873
2916
|
}) }),
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx13("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
2918
|
+
/* @__PURE__ */ jsx13("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx13("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
2876
2919
|
return renderFooterCol(col, index);
|
|
2877
|
-
}) }) : /* @__PURE__ */
|
|
2920
|
+
}) }) : /* @__PURE__ */ jsx13(Fragment14, {}) })
|
|
2878
2921
|
] }) }),
|
|
2879
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */
|
|
2922
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx13(Fragment14, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2880
2923
|
] }),
|
|
2881
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */
|
|
2882
|
-
|
|
2924
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx13(
|
|
2925
|
+
PagingComponent,
|
|
2883
2926
|
{
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
pageCount: 5,
|
|
2891
|
-
dropDownChanged: onChangePageSize
|
|
2927
|
+
onChangePage,
|
|
2928
|
+
pageSize: pagingSetting?.pageSize ?? 0,
|
|
2929
|
+
currentPage: pagingSetting?.currentPage ?? 0,
|
|
2930
|
+
pageOptions: [20, 30, 50, 100],
|
|
2931
|
+
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
2932
|
+
onChangePageSize
|
|
2892
2933
|
}
|
|
2893
|
-
) : /* @__PURE__ */
|
|
2934
|
+
) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2894
2935
|
] }),
|
|
2895
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsx13(
|
|
2896
2937
|
sidebar_setting_column_default,
|
|
2897
2938
|
{
|
|
2898
2939
|
handleSidebar: () => {
|
|
@@ -2908,12 +2949,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2908
2949
|
var table_default = TableEdit;
|
|
2909
2950
|
|
|
2910
2951
|
// test-app/src/component/tab-menu/index.tsx
|
|
2911
|
-
import { ChevronLeft as
|
|
2912
|
-
import
|
|
2913
|
-
import { Fragment as
|
|
2952
|
+
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight3 } from "becoxy-icons";
|
|
2953
|
+
import classNames6 from "classnames";
|
|
2954
|
+
import { Fragment as Fragment15, useEffect as useEffect8, useState as useState7 } from "react";
|
|
2914
2955
|
import { Link, useNavigate } from "react-router-dom";
|
|
2915
2956
|
import { DropdownItem as DropdownItem2, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
2916
|
-
import { jsx as
|
|
2957
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2917
2958
|
var TabsMenuComponent = ({
|
|
2918
2959
|
buttonWidth,
|
|
2919
2960
|
tabParent,
|
|
@@ -2925,14 +2966,14 @@ var TabsMenuComponent = ({
|
|
|
2925
2966
|
renderModal
|
|
2926
2967
|
}) => {
|
|
2927
2968
|
const navigate = useNavigate();
|
|
2928
|
-
const [dataMenu, setDataMenu] =
|
|
2929
|
-
const [openMenu, setOpenMenu] =
|
|
2930
|
-
const [url, setUrl] =
|
|
2931
|
-
const [contentWidth, setContentWidth] =
|
|
2932
|
-
const [componentWidth, setComponentWidth] =
|
|
2933
|
-
const [scrollPosition, setScrollPosition] =
|
|
2934
|
-
const [dataItem, setDataItem] =
|
|
2935
|
-
const [openModal, setOpenModal] =
|
|
2969
|
+
const [dataMenu, setDataMenu] = useState7([]);
|
|
2970
|
+
const [openMenu, setOpenMenu] = useState7(false);
|
|
2971
|
+
const [url, setUrl] = useState7("");
|
|
2972
|
+
const [contentWidth, setContentWidth] = useState7(0);
|
|
2973
|
+
const [componentWidth, setComponentWidth] = useState7(0);
|
|
2974
|
+
const [scrollPosition, setScrollPosition] = useState7(0);
|
|
2975
|
+
const [dataItem, setDataItem] = useState7([]);
|
|
2976
|
+
const [openModal, setOpenModal] = useState7({});
|
|
2936
2977
|
const handleWindowResize = () => {
|
|
2937
2978
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
2938
2979
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -2941,7 +2982,7 @@ var TabsMenuComponent = ({
|
|
|
2941
2982
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
2942
2983
|
}
|
|
2943
2984
|
};
|
|
2944
|
-
|
|
2985
|
+
useEffect8(() => {
|
|
2945
2986
|
setUrl(window.location.pathname);
|
|
2946
2987
|
window.addEventListener("resize", handleWindowResize);
|
|
2947
2988
|
setTimeout(() => {
|
|
@@ -2957,7 +2998,7 @@ var TabsMenuComponent = ({
|
|
|
2957
2998
|
window.removeEventListener("resize", handleWindowResize);
|
|
2958
2999
|
};
|
|
2959
3000
|
}, []);
|
|
2960
|
-
|
|
3001
|
+
useEffect8(() => {
|
|
2961
3002
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
2962
3003
|
if (item) {
|
|
2963
3004
|
if (resourceCodeParent) {
|
|
@@ -2988,22 +3029,22 @@ var TabsMenuComponent = ({
|
|
|
2988
3029
|
const handleModal = (name) => {
|
|
2989
3030
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
2990
3031
|
};
|
|
2991
|
-
return /* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ jsxs13(Fragment15, { children: [
|
|
2992
3033
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3034
|
+
/* @__PURE__ */ jsxs13("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3035
|
+
/* @__PURE__ */ jsx14(
|
|
2995
3036
|
"div",
|
|
2996
3037
|
{
|
|
2997
3038
|
onClick: () => handleScroll(-200),
|
|
2998
|
-
className:
|
|
2999
|
-
children: /* @__PURE__ */
|
|
3039
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3040
|
+
children: /* @__PURE__ */ jsx14(ChevronLeft3, {})
|
|
3000
3041
|
}
|
|
3001
3042
|
),
|
|
3002
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsx14("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx14("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3003
3044
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3004
|
-
return /* @__PURE__ */
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
/* @__PURE__ */
|
|
3045
|
+
return /* @__PURE__ */ jsxs13(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3046
|
+
/* @__PURE__ */ jsx14(DropdownToggle3, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx14("div", { children: item.name }) }),
|
|
3047
|
+
/* @__PURE__ */ jsx14(DropdownMenu3, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx14(
|
|
3007
3048
|
DropdownItem2,
|
|
3008
3049
|
{
|
|
3009
3050
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
@@ -3020,23 +3061,23 @@ var TabsMenuComponent = ({
|
|
|
3020
3061
|
)) })
|
|
3021
3062
|
] }, item.code);
|
|
3022
3063
|
} else {
|
|
3023
|
-
return /* @__PURE__ */
|
|
3064
|
+
return /* @__PURE__ */ jsx14(
|
|
3024
3065
|
Link,
|
|
3025
3066
|
{
|
|
3026
3067
|
to: item.url,
|
|
3027
|
-
className:
|
|
3068
|
+
className: classNames6("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3028
3069
|
children: item.name
|
|
3029
3070
|
},
|
|
3030
3071
|
item.code
|
|
3031
3072
|
);
|
|
3032
3073
|
}
|
|
3033
3074
|
}) }) }),
|
|
3034
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ jsx14(
|
|
3035
3076
|
"div",
|
|
3036
3077
|
{
|
|
3037
3078
|
onClick: () => handleScroll(200),
|
|
3038
|
-
className:
|
|
3039
|
-
children: /* @__PURE__ */
|
|
3079
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3080
|
+
children: /* @__PURE__ */ jsx14(ChevronRight3, {})
|
|
3040
3081
|
}
|
|
3041
3082
|
)
|
|
3042
3083
|
] })
|