react-table-edit 0.5.2 → 0.5.4
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 +247 -190
- package/dist/index.mjs +222 -165
- 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, { className: "r-tooltip", 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,17 @@ 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
|
-
|
|
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, { className: "r-tooltip", autohide: false, target: `content-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
2662
|
+
/* @__PURE__ */ jsx13(
|
|
2663
|
+
UncontrolledTooltip,
|
|
2600
2664
|
{
|
|
2601
|
-
|
|
2602
|
-
className: "r-
|
|
2603
|
-
|
|
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
|
|
2665
|
+
target: `error-${indexRow}-${indexCol}`,
|
|
2666
|
+
className: "r-tooltip tooltip-error",
|
|
2667
|
+
children: errorMessage?.toString() ?? ""
|
|
2608
2668
|
}
|
|
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 }) }) })
|
|
2669
|
+
)
|
|
2611
2670
|
]
|
|
2612
2671
|
}
|
|
2613
2672
|
)
|
|
@@ -2620,7 +2679,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2620
2679
|
};
|
|
2621
2680
|
const renderHeaderCol = (col, indexCol, indexParent) => {
|
|
2622
2681
|
if (col.field === "checkbox") {
|
|
2623
|
-
return /* @__PURE__ */
|
|
2682
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2624
2683
|
"th",
|
|
2625
2684
|
{
|
|
2626
2685
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2637,12 +2696,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2637
2696
|
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2638
2697
|
maxWidth: col.maxWidth
|
|
2639
2698
|
},
|
|
2640
|
-
children: /* @__PURE__ */
|
|
2699
|
+
children: /* @__PURE__ */ jsx13(
|
|
2641
2700
|
"div",
|
|
2642
2701
|
{
|
|
2643
2702
|
style: { justifyContent: col.textAlign ?? "left" },
|
|
2644
2703
|
className: classnames6("r-headercell-div"),
|
|
2645
|
-
children: /* @__PURE__ */
|
|
2704
|
+
children: /* @__PURE__ */ jsx13(
|
|
2646
2705
|
Input6,
|
|
2647
2706
|
{
|
|
2648
2707
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
@@ -2667,10 +2726,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2667
2726
|
}
|
|
2668
2727
|
) }, `header-${indexCol}`);
|
|
2669
2728
|
} else if (col.field === "#") {
|
|
2670
|
-
return /* @__PURE__ */
|
|
2671
|
-
|
|
2729
|
+
return /* @__PURE__ */ jsx13(
|
|
2730
|
+
Fragment13,
|
|
2672
2731
|
{
|
|
2673
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2732
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2674
2733
|
"th",
|
|
2675
2734
|
{
|
|
2676
2735
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2687,7 +2746,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2687
2746
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2688
2747
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
2689
2748
|
},
|
|
2690
|
-
children: /* @__PURE__ */
|
|
2749
|
+
children: /* @__PURE__ */ jsx13(
|
|
2691
2750
|
"div",
|
|
2692
2751
|
{
|
|
2693
2752
|
title: t(col.headerText ?? ""),
|
|
@@ -2702,10 +2761,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2702
2761
|
`header-${indexCol}`
|
|
2703
2762
|
);
|
|
2704
2763
|
} else {
|
|
2705
|
-
return /* @__PURE__ */
|
|
2706
|
-
|
|
2764
|
+
return /* @__PURE__ */ jsx13(
|
|
2765
|
+
Fragment13,
|
|
2707
2766
|
{
|
|
2708
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
2767
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2709
2768
|
"th",
|
|
2710
2769
|
{
|
|
2711
2770
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
@@ -2722,7 +2781,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2722
2781
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2723
2782
|
maxWidth: col.maxWidth
|
|
2724
2783
|
},
|
|
2725
|
-
children: /* @__PURE__ */
|
|
2784
|
+
children: /* @__PURE__ */ jsx13(
|
|
2726
2785
|
"div",
|
|
2727
2786
|
{
|
|
2728
2787
|
role: "textbox",
|
|
@@ -2740,7 +2799,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2740
2799
|
}
|
|
2741
2800
|
};
|
|
2742
2801
|
const renderFooterCol = (col, indexCol) => {
|
|
2743
|
-
return /* @__PURE__ */
|
|
2802
|
+
return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
2744
2803
|
"td",
|
|
2745
2804
|
{
|
|
2746
2805
|
className: classnames6(
|
|
@@ -2755,56 +2814,56 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2755
2814
|
maxWidth: col.maxWidth,
|
|
2756
2815
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2757
2816
|
},
|
|
2758
|
-
children: /* @__PURE__ */
|
|
2817
|
+
children: /* @__PURE__ */ jsx13("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
2759
2818
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2760
2819
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2761
2820
|
}
|
|
2762
2821
|
) }, `summarycell-${indexCol}`);
|
|
2763
2822
|
};
|
|
2764
2823
|
const renderToolbarTop = () => {
|
|
2765
|
-
return /* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
2824
|
+
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: [
|
|
2825
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
2826
|
+
return item.align === "left" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
2768
2827
|
}) }),
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
2829
|
+
return item.align === "center" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
2771
2830
|
}) }),
|
|
2772
|
-
/* @__PURE__ */
|
|
2773
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
2832
|
+
return item.align === "right" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
2774
2833
|
}) })
|
|
2775
2834
|
] }) });
|
|
2776
2835
|
};
|
|
2777
2836
|
const renderToolbarBottom = () => {
|
|
2778
|
-
return /* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2837
|
+
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: [
|
|
2838
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-toolbar-left", children: [
|
|
2839
|
+
/* @__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") }) }),
|
|
2840
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs12(Fragment14, { children: [
|
|
2841
|
+
/* @__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
2842
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
2784
2843
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
] }) : /* @__PURE__ */
|
|
2788
|
-
/* @__PURE__ */
|
|
2844
|
+
/* @__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") }) }),
|
|
2845
|
+
/* @__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") }) })
|
|
2846
|
+
] }) : /* @__PURE__ */ jsx13(Fragment14, { children: " " }),
|
|
2847
|
+
/* @__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
2848
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2790
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
2849
|
+
return item.align === "left" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
2791
2850
|
})
|
|
2792
2851
|
] }),
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsx13("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2853
|
+
return item.align === "center" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
2795
2854
|
}) }),
|
|
2796
|
-
/* @__PURE__ */
|
|
2855
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-toolbar-right", children: [
|
|
2797
2856
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2798
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
2857
|
+
return item.align === "right" ? /* @__PURE__ */ jsx13("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
2799
2858
|
}),
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2802
|
-
/* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
/* @__PURE__ */
|
|
2807
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__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) }) }),
|
|
2860
|
+
/* @__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: [
|
|
2861
|
+
/* @__PURE__ */ jsx13(DropdownToggle2, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx13(Info2, { className: "cursor-pointer" }) }),
|
|
2862
|
+
/* @__PURE__ */ jsx13(DropdownMenu2, { children: /* @__PURE__ */ jsxs12("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
2863
|
+
/* @__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" }),
|
|
2864
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
2865
|
+
/* @__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" }),
|
|
2866
|
+
/* @__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
2867
|
] }) })
|
|
2809
2868
|
] }) })
|
|
2810
2869
|
] })
|
|
@@ -2833,7 +2892,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2833
2892
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2834
2893
|
if (flagDisplay) {
|
|
2835
2894
|
countDisplay++;
|
|
2836
|
-
return /* @__PURE__ */
|
|
2895
|
+
return /* @__PURE__ */ jsx13(
|
|
2837
2896
|
"tr",
|
|
2838
2897
|
{
|
|
2839
2898
|
className: classnames6("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
@@ -2847,43 +2906,41 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2847
2906
|
}
|
|
2848
2907
|
});
|
|
2849
2908
|
};
|
|
2850
|
-
|
|
2909
|
+
useEffect7(() => {
|
|
2851
2910
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
2852
2911
|
pagingSetting?.setCurrentPage(1);
|
|
2853
2912
|
}
|
|
2854
2913
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
2855
|
-
return /* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
return /* @__PURE__ */
|
|
2914
|
+
return /* @__PURE__ */ jsxs12(Fragment13, { children: [
|
|
2915
|
+
/* @__PURE__ */ jsxs12("div", { className: "react-table-edit", children: [
|
|
2916
|
+
/* @__PURE__ */ jsxs12("div", { className: "r-grid", ref: gridRef, children: [
|
|
2917
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx13(Fragment14, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx13(Fragment14, {}),
|
|
2918
|
+
/* @__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: [
|
|
2919
|
+
/* @__PURE__ */ jsx13("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
2920
|
+
return /* @__PURE__ */ jsx13("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
2862
2921
|
return renderHeaderCol(col, index, indexParent);
|
|
2863
2922
|
}) }, indexParent);
|
|
2864
2923
|
}) }),
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx13("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
2925
|
+
/* @__PURE__ */ jsx13("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx13("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
2867
2926
|
return renderFooterCol(col, index);
|
|
2868
|
-
}) }) : /* @__PURE__ */
|
|
2927
|
+
}) }) : /* @__PURE__ */ jsx13(Fragment14, {}) })
|
|
2869
2928
|
] }) }),
|
|
2870
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */
|
|
2929
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx13(Fragment14, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2871
2930
|
] }),
|
|
2872
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */
|
|
2873
|
-
|
|
2931
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx13(
|
|
2932
|
+
PagingComponent,
|
|
2874
2933
|
{
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
pageCount: 5,
|
|
2882
|
-
dropDownChanged: onChangePageSize
|
|
2934
|
+
onChangePage,
|
|
2935
|
+
pageSize: pagingSetting?.pageSize ?? 0,
|
|
2936
|
+
currentPage: pagingSetting?.currentPage ?? 0,
|
|
2937
|
+
pageOptions: [20, 30, 50, 100],
|
|
2938
|
+
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
2939
|
+
onChangePageSize
|
|
2883
2940
|
}
|
|
2884
|
-
) : /* @__PURE__ */
|
|
2941
|
+
) : /* @__PURE__ */ jsx13(Fragment14, {})
|
|
2885
2942
|
] }),
|
|
2886
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx13(
|
|
2887
2944
|
sidebar_setting_column_default,
|
|
2888
2945
|
{
|
|
2889
2946
|
handleSidebar: () => {
|
|
@@ -2899,12 +2956,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2899
2956
|
var table_default = TableEdit;
|
|
2900
2957
|
|
|
2901
2958
|
// test-app/src/component/tab-menu/index.tsx
|
|
2902
|
-
import { ChevronLeft as
|
|
2903
|
-
import
|
|
2904
|
-
import { Fragment as
|
|
2959
|
+
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight3 } from "becoxy-icons";
|
|
2960
|
+
import classNames6 from "classnames";
|
|
2961
|
+
import { Fragment as Fragment15, useEffect as useEffect8, useState as useState7 } from "react";
|
|
2905
2962
|
import { Link, useNavigate } from "react-router-dom";
|
|
2906
2963
|
import { DropdownItem as DropdownItem2, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
2907
|
-
import { jsx as
|
|
2964
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2908
2965
|
var TabsMenuComponent = ({
|
|
2909
2966
|
buttonWidth,
|
|
2910
2967
|
tabParent,
|
|
@@ -2916,14 +2973,14 @@ var TabsMenuComponent = ({
|
|
|
2916
2973
|
renderModal
|
|
2917
2974
|
}) => {
|
|
2918
2975
|
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] =
|
|
2976
|
+
const [dataMenu, setDataMenu] = useState7([]);
|
|
2977
|
+
const [openMenu, setOpenMenu] = useState7(false);
|
|
2978
|
+
const [url, setUrl] = useState7("");
|
|
2979
|
+
const [contentWidth, setContentWidth] = useState7(0);
|
|
2980
|
+
const [componentWidth, setComponentWidth] = useState7(0);
|
|
2981
|
+
const [scrollPosition, setScrollPosition] = useState7(0);
|
|
2982
|
+
const [dataItem, setDataItem] = useState7([]);
|
|
2983
|
+
const [openModal, setOpenModal] = useState7({});
|
|
2927
2984
|
const handleWindowResize = () => {
|
|
2928
2985
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
2929
2986
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -2932,7 +2989,7 @@ var TabsMenuComponent = ({
|
|
|
2932
2989
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
2933
2990
|
}
|
|
2934
2991
|
};
|
|
2935
|
-
|
|
2992
|
+
useEffect8(() => {
|
|
2936
2993
|
setUrl(window.location.pathname);
|
|
2937
2994
|
window.addEventListener("resize", handleWindowResize);
|
|
2938
2995
|
setTimeout(() => {
|
|
@@ -2948,7 +3005,7 @@ var TabsMenuComponent = ({
|
|
|
2948
3005
|
window.removeEventListener("resize", handleWindowResize);
|
|
2949
3006
|
};
|
|
2950
3007
|
}, []);
|
|
2951
|
-
|
|
3008
|
+
useEffect8(() => {
|
|
2952
3009
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
2953
3010
|
if (item) {
|
|
2954
3011
|
if (resourceCodeParent) {
|
|
@@ -2979,22 +3036,22 @@ var TabsMenuComponent = ({
|
|
|
2979
3036
|
const handleModal = (name) => {
|
|
2980
3037
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
2981
3038
|
};
|
|
2982
|
-
return /* @__PURE__ */
|
|
3039
|
+
return /* @__PURE__ */ jsxs13(Fragment15, { children: [
|
|
2983
3040
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
3041
|
+
/* @__PURE__ */ jsxs13("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3042
|
+
/* @__PURE__ */ jsx14(
|
|
2986
3043
|
"div",
|
|
2987
3044
|
{
|
|
2988
3045
|
onClick: () => handleScroll(-200),
|
|
2989
|
-
className:
|
|
2990
|
-
children: /* @__PURE__ */
|
|
3046
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3047
|
+
children: /* @__PURE__ */ jsx14(ChevronLeft3, {})
|
|
2991
3048
|
}
|
|
2992
3049
|
),
|
|
2993
|
-
/* @__PURE__ */
|
|
3050
|
+
/* @__PURE__ */ jsx14("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx14("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
2994
3051
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
2995
|
-
return /* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ jsxs13(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3053
|
+
/* @__PURE__ */ jsx14(DropdownToggle3, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx14("div", { children: item.name }) }),
|
|
3054
|
+
/* @__PURE__ */ jsx14(DropdownMenu3, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx14(
|
|
2998
3055
|
DropdownItem2,
|
|
2999
3056
|
{
|
|
3000
3057
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
@@ -3011,23 +3068,23 @@ var TabsMenuComponent = ({
|
|
|
3011
3068
|
)) })
|
|
3012
3069
|
] }, item.code);
|
|
3013
3070
|
} else {
|
|
3014
|
-
return /* @__PURE__ */
|
|
3071
|
+
return /* @__PURE__ */ jsx14(
|
|
3015
3072
|
Link,
|
|
3016
3073
|
{
|
|
3017
3074
|
to: item.url,
|
|
3018
|
-
className:
|
|
3075
|
+
className: classNames6("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3019
3076
|
children: item.name
|
|
3020
3077
|
},
|
|
3021
3078
|
item.code
|
|
3022
3079
|
);
|
|
3023
3080
|
}
|
|
3024
3081
|
}) }) }),
|
|
3025
|
-
/* @__PURE__ */
|
|
3082
|
+
/* @__PURE__ */ jsx14(
|
|
3026
3083
|
"div",
|
|
3027
3084
|
{
|
|
3028
3085
|
onClick: () => handleScroll(200),
|
|
3029
|
-
className:
|
|
3030
|
-
children: /* @__PURE__ */
|
|
3086
|
+
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3087
|
+
children: /* @__PURE__ */ jsx14(ChevronRight3, {})
|
|
3031
3088
|
}
|
|
3032
3089
|
)
|
|
3033
3090
|
] })
|