react-table-edit 0.5.2 → 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 +242 -192
- package/dist/index.mjs +217 -167
- 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,12 +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
2695
|
style: { justifyContent: col.textAlign ?? "left" },
|
|
2644
2696
|
className: classnames6("r-headercell-div"),
|
|
2645
|
-
children: /* @__PURE__ */
|
|
2697
|
+
children: /* @__PURE__ */ jsx13(
|
|
2646
2698
|
Input6,
|
|
2647
2699
|
{
|
|
2648
2700
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
@@ -2667,10 +2719,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2667
2719
|
}
|
|
2668
2720
|
) }, `header-${indexCol}`);
|
|
2669
2721
|
} else if (col.field === "#") {
|
|
2670
|
-
return /* @__PURE__ */
|
|
2671
|
-
|
|
2722
|
+
return /* @__PURE__ */ jsx13(
|
|
2723
|
+
Fragment13,
|
|
2672
2724
|
{
|
|
2673
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2725
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2674
2726
|
"th",
|
|
2675
2727
|
{
|
|
2676
2728
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2687,7 +2739,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2687
2739
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2688
2740
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
2689
2741
|
},
|
|
2690
|
-
children: /* @__PURE__ */
|
|
2742
|
+
children: /* @__PURE__ */ jsx13(
|
|
2691
2743
|
"div",
|
|
2692
2744
|
{
|
|
2693
2745
|
title: t(col.headerText ?? ""),
|
|
@@ -2702,10 +2754,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2702
2754
|
`header-${indexCol}`
|
|
2703
2755
|
);
|
|
2704
2756
|
} else {
|
|
2705
|
-
return /* @__PURE__ */
|
|
2706
|
-
|
|
2757
|
+
return /* @__PURE__ */ jsx13(
|
|
2758
|
+
Fragment13,
|
|
2707
2759
|
{
|
|
2708
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2760
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2709
2761
|
"th",
|
|
2710
2762
|
{
|
|
2711
2763
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2722,7 +2774,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2722
2774
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2723
2775
|
maxWidth: col.maxWidth
|
|
2724
2776
|
},
|
|
2725
|
-
children: /* @__PURE__ */
|
|
2777
|
+
children: /* @__PURE__ */ jsx13(
|
|
2726
2778
|
"div",
|
|
2727
2779
|
{
|
|
2728
2780
|
role: "textbox",
|
|
@@ -2740,7 +2792,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2740
2792
|
}
|
|
2741
2793
|
};
|
|
2742
2794
|
const renderFooterCol = (col, indexCol) => {
|
|
2743
|
-
return /* @__PURE__ */
|
|
2795
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2744
2796
|
"td",
|
|
2745
2797
|
{
|
|
2746
2798
|
className: classnames6(
|
|
@@ -2755,56 +2807,56 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2755
2807
|
maxWidth: col.maxWidth,
|
|
2756
2808
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2757
2809
|
},
|
|
2758
|
-
children: /* @__PURE__ */
|
|
2810
|
+
children: /* @__PURE__ */ jsx13("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
2759
2811
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2760
2812
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2761
2813
|
}
|
|
2762
2814
|
) }, `summarycell-${indexCol}`);
|
|
2763
2815
|
};
|
|
2764
2816
|
const renderToolbarTop = () => {
|
|
2765
|
-
return /* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
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}`) : "";
|
|
2768
2820
|
}) }),
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
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}`) : "";
|
|
2771
2823
|
}) }),
|
|
2772
|
-
/* @__PURE__ */
|
|
2773
|
-
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}`) : "";
|
|
2774
2826
|
}) })
|
|
2775
2827
|
] }) });
|
|
2776
2828
|
};
|
|
2777
2829
|
const renderToolbarBottom = () => {
|
|
2778
|
-
return /* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */
|
|
2782
|
-
/* @__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: () => {
|
|
2783
2835
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
2784
2836
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
] }) : /* @__PURE__ */
|
|
2788
|
-
/* @__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") }) }),
|
|
2789
2841
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2790
|
-
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}`) : "";
|
|
2791
2843
|
})
|
|
2792
2844
|
] }),
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
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}`) : "";
|
|
2795
2847
|
}) }),
|
|
2796
|
-
/* @__PURE__ */
|
|
2848
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-toolbar-right", children: [
|
|
2797
2849
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2798
|
-
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}`) : "";
|
|
2799
2851
|
}),
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2802
|
-
/* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
/* @__PURE__ */
|
|
2807
|
-
/* @__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" })
|
|
2808
2860
|
] }) })
|
|
2809
2861
|
] }) })
|
|
2810
2862
|
] })
|
|
@@ -2833,7 +2885,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2833
2885
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2834
2886
|
if (flagDisplay) {
|
|
2835
2887
|
countDisplay++;
|
|
2836
|
-
return /* @__PURE__ */
|
|
2888
|
+
return /* @__PURE__ */ jsx13(
|
|
2837
2889
|
"tr",
|
|
2838
2890
|
{
|
|
2839
2891
|
className: classnames6("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
@@ -2847,43 +2899,41 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2847
2899
|
}
|
|
2848
2900
|
});
|
|
2849
2901
|
};
|
|
2850
|
-
|
|
2902
|
+
useEffect7(() => {
|
|
2851
2903
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
2852
2904
|
pagingSetting?.setCurrentPage(1);
|
|
2853
2905
|
}
|
|
2854
2906
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
2855
|
-
return /* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
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) => {
|
|
2862
2914
|
return renderHeaderCol(col, index, indexParent);
|
|
2863
2915
|
}) }, indexParent);
|
|
2864
2916
|
}) }),
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__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) => {
|
|
2867
2919
|
return renderFooterCol(col, index);
|
|
2868
|
-
}) }) : /* @__PURE__ */
|
|
2920
|
+
}) }) : /* @__PURE__ */ jsx13(Fragment14, {}) })
|
|
2869
2921
|
] }) }),
|
|
2870
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */
|
|
2922
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx13(Fragment14, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2871
2923
|
] }),
|
|
2872
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */
|
|
2873
|
-
|
|
2924
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx13(
|
|
2925
|
+
PagingComponent,
|
|
2874
2926
|
{
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
pageCount: 5,
|
|
2882
|
-
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
|
|
2883
2933
|
}
|
|
2884
|
-
) : /* @__PURE__ */
|
|
2934
|
+
) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2885
2935
|
] }),
|
|
2886
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsx13(
|
|
2887
2937
|
sidebar_setting_column_default,
|
|
2888
2938
|
{
|
|
2889
2939
|
handleSidebar: () => {
|
|
@@ -2899,12 +2949,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2899
2949
|
var table_default = TableEdit;
|
|
2900
2950
|
|
|
2901
2951
|
// test-app/src/component/tab-menu/index.tsx
|
|
2902
|
-
import { ChevronLeft as
|
|
2903
|
-
import
|
|
2904
|
-
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";
|
|
2905
2955
|
import { Link, useNavigate } from "react-router-dom";
|
|
2906
2956
|
import { DropdownItem as DropdownItem2, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
2907
|
-
import { jsx as
|
|
2957
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2908
2958
|
var TabsMenuComponent = ({
|
|
2909
2959
|
buttonWidth,
|
|
2910
2960
|
tabParent,
|
|
@@ -2916,14 +2966,14 @@ var TabsMenuComponent = ({
|
|
|
2916
2966
|
renderModal
|
|
2917
2967
|
}) => {
|
|
2918
2968
|
const navigate = useNavigate();
|
|
2919
|
-
const [dataMenu, setDataMenu] =
|
|
2920
|
-
const [openMenu, setOpenMenu] =
|
|
2921
|
-
const [url, setUrl] =
|
|
2922
|
-
const [contentWidth, setContentWidth] =
|
|
2923
|
-
const [componentWidth, setComponentWidth] =
|
|
2924
|
-
const [scrollPosition, setScrollPosition] =
|
|
2925
|
-
const [dataItem, setDataItem] =
|
|
2926
|
-
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({});
|
|
2927
2977
|
const handleWindowResize = () => {
|
|
2928
2978
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
2929
2979
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -2932,7 +2982,7 @@ var TabsMenuComponent = ({
|
|
|
2932
2982
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
2933
2983
|
}
|
|
2934
2984
|
};
|
|
2935
|
-
|
|
2985
|
+
useEffect8(() => {
|
|
2936
2986
|
setUrl(window.location.pathname);
|
|
2937
2987
|
window.addEventListener("resize", handleWindowResize);
|
|
2938
2988
|
setTimeout(() => {
|
|
@@ -2948,7 +2998,7 @@ var TabsMenuComponent = ({
|
|
|
2948
2998
|
window.removeEventListener("resize", handleWindowResize);
|
|
2949
2999
|
};
|
|
2950
3000
|
}, []);
|
|
2951
|
-
|
|
3001
|
+
useEffect8(() => {
|
|
2952
3002
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
2953
3003
|
if (item) {
|
|
2954
3004
|
if (resourceCodeParent) {
|
|
@@ -2979,22 +3029,22 @@ var TabsMenuComponent = ({
|
|
|
2979
3029
|
const handleModal = (name) => {
|
|
2980
3030
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
2981
3031
|
};
|
|
2982
|
-
return /* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ jsxs13(Fragment15, { children: [
|
|
2983
3033
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
/* @__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(
|
|
2986
3036
|
"div",
|
|
2987
3037
|
{
|
|
2988
3038
|
onClick: () => handleScroll(-200),
|
|
2989
|
-
className:
|
|
2990
|
-
children: /* @__PURE__ */
|
|
3039
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3040
|
+
children: /* @__PURE__ */ jsx14(ChevronLeft3, {})
|
|
2991
3041
|
}
|
|
2992
3042
|
),
|
|
2993
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsx14("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx14("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
2994
3044
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
2995
|
-
return /* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__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(
|
|
2998
3048
|
DropdownItem2,
|
|
2999
3049
|
{
|
|
3000
3050
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
@@ -3011,23 +3061,23 @@ var TabsMenuComponent = ({
|
|
|
3011
3061
|
)) })
|
|
3012
3062
|
] }, item.code);
|
|
3013
3063
|
} else {
|
|
3014
|
-
return /* @__PURE__ */
|
|
3064
|
+
return /* @__PURE__ */ jsx14(
|
|
3015
3065
|
Link,
|
|
3016
3066
|
{
|
|
3017
3067
|
to: item.url,
|
|
3018
|
-
className:
|
|
3068
|
+
className: classNames6("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3019
3069
|
children: item.name
|
|
3020
3070
|
},
|
|
3021
3071
|
item.code
|
|
3022
3072
|
);
|
|
3023
3073
|
}
|
|
3024
3074
|
}) }) }),
|
|
3025
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ jsx14(
|
|
3026
3076
|
"div",
|
|
3027
3077
|
{
|
|
3028
3078
|
onClick: () => handleScroll(200),
|
|
3029
|
-
className:
|
|
3030
|
-
children: /* @__PURE__ */
|
|
3079
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3080
|
+
children: /* @__PURE__ */ jsx14(ChevronRight3, {})
|
|
3031
3081
|
}
|
|
3032
3082
|
)
|
|
3033
3083
|
] })
|