react-table-edit 0.5.4 → 0.5.6
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 +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +790 -194
- package/dist/index.mjs +791 -187
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51,13 +51,13 @@ __export(Table_edit_exports, {
|
|
|
51
51
|
module.exports = __toCommonJS(Table_edit_exports);
|
|
52
52
|
|
|
53
53
|
// test-app/src/component/table/index.tsx
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
54
|
+
var import_react14 = require("react");
|
|
55
|
+
var import_reactstrap9 = require("reactstrap");
|
|
56
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
57
|
+
var import_react_i18next10 = require("react-i18next");
|
|
58
58
|
var import_react_select3 = __toESM(require("react-select"));
|
|
59
59
|
var import_async = __toESM(require("react-select/async"));
|
|
60
|
-
var
|
|
60
|
+
var import_becoxy_icons6 = require("becoxy-icons");
|
|
61
61
|
|
|
62
62
|
// test-app/src/component/react-input/index.tsx
|
|
63
63
|
var import_becoxy_icons = require("becoxy-icons");
|
|
@@ -345,7 +345,7 @@ var IconCustom = (props) => {
|
|
|
345
345
|
var icon_default = IconCustom;
|
|
346
346
|
|
|
347
347
|
// test-app/src/component/table/index.tsx
|
|
348
|
-
var
|
|
348
|
+
var import_moment2 = __toESM(require("moment"));
|
|
349
349
|
|
|
350
350
|
// test-app/src/component/edit-form/index.tsx
|
|
351
351
|
var import_react9 = require("react");
|
|
@@ -1493,13 +1493,16 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
1493
1493
|
var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
1494
1494
|
const { t } = (0, import_react_i18next8.useTranslation)();
|
|
1495
1495
|
const [countPage, setCountPage] = (0, import_react12.useState)(0);
|
|
1496
|
+
const [currentPageNumber, setCurrentPageNumber] = (0, import_react12.useState)(1);
|
|
1496
1497
|
(0, import_react12.useEffect)(() => {
|
|
1497
|
-
|
|
1498
|
-
setCountPage(count);
|
|
1498
|
+
setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
|
|
1499
1499
|
}, [totalItem, pageSize]);
|
|
1500
|
-
|
|
1500
|
+
(0, import_react12.useEffect)(() => {
|
|
1501
|
+
setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
|
|
1502
|
+
}, [currentPage]);
|
|
1503
|
+
const renderPageNumber = (number) => {
|
|
1501
1504
|
const arr = [];
|
|
1502
|
-
for (let index = 1; index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
|
|
1505
|
+
for (let index = (number - 1) * 5 + 1; index <= number * 5 && index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
|
|
1503
1506
|
arr.push(
|
|
1504
1507
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1505
1508
|
"div",
|
|
@@ -1509,7 +1512,8 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
1509
1512
|
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
1510
1513
|
},
|
|
1511
1514
|
children: index
|
|
1512
|
-
}
|
|
1515
|
+
},
|
|
1516
|
+
`page-${index}`
|
|
1513
1517
|
)
|
|
1514
1518
|
);
|
|
1515
1519
|
}
|
|
@@ -1519,7 +1523,31 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
1519
1523
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "r-pagercontainer", children: [
|
|
1520
1524
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "r-button", type: "button", disabled: countPage === 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.ChevronsLeft, { fontSize: 16 }) }),
|
|
1521
1525
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "r-button", type: "button", disabled: countPage === 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.ChevronLeft, { fontSize: 16 }) }),
|
|
1522
|
-
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1527
|
+
"button",
|
|
1528
|
+
{
|
|
1529
|
+
className: (0, import_classnames10.default)("r-button", { "d-none": currentPageNumber === 1 }),
|
|
1530
|
+
type: "button",
|
|
1531
|
+
onClick: () => {
|
|
1532
|
+
setCurrentPageNumber(currentPageNumber - 1);
|
|
1533
|
+
onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
|
|
1534
|
+
},
|
|
1535
|
+
children: "..."
|
|
1536
|
+
}
|
|
1537
|
+
),
|
|
1538
|
+
renderPageNumber(currentPageNumber),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1540
|
+
"button",
|
|
1541
|
+
{
|
|
1542
|
+
className: (0, import_classnames10.default)("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
|
|
1543
|
+
type: "button",
|
|
1544
|
+
onClick: () => {
|
|
1545
|
+
setCurrentPageNumber(currentPageNumber + 1);
|
|
1546
|
+
onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
|
|
1547
|
+
},
|
|
1548
|
+
children: "..."
|
|
1549
|
+
}
|
|
1550
|
+
),
|
|
1523
1551
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "r-button", type: "button", disabled: countPage === 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.ChevronRight, { fontSize: 16 }) }),
|
|
1524
1552
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.ChevronsRight, { fontSize: 16 }) }),
|
|
1525
1553
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "r-pagesize", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -1541,10 +1569,525 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
1541
1569
|
] }) });
|
|
1542
1570
|
};
|
|
1543
1571
|
|
|
1544
|
-
// test-app/src/component/table/index.tsx
|
|
1572
|
+
// test-app/src/component/select-table/index.tsx
|
|
1573
|
+
var import_react13 = require("react");
|
|
1574
|
+
var import_reactstrap8 = require("reactstrap");
|
|
1575
|
+
var import_react_i18next9 = require("react-i18next");
|
|
1576
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
1577
|
+
var import_moment = __toESM(require("moment"));
|
|
1578
|
+
var import_becoxy_icons5 = require("becoxy-icons");
|
|
1545
1579
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1546
|
-
var
|
|
1580
|
+
var defaultMaxHeight = 300;
|
|
1581
|
+
var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
|
|
1582
|
+
const {
|
|
1583
|
+
id,
|
|
1584
|
+
menuWidth,
|
|
1585
|
+
invalid,
|
|
1586
|
+
onKeyDown,
|
|
1587
|
+
placeholder,
|
|
1588
|
+
textAlign,
|
|
1589
|
+
options,
|
|
1590
|
+
columns,
|
|
1591
|
+
decimalSeparator,
|
|
1592
|
+
thousandSeparator,
|
|
1593
|
+
onChange,
|
|
1594
|
+
value,
|
|
1595
|
+
fieldValue,
|
|
1596
|
+
fieldLabel,
|
|
1597
|
+
loadOptions,
|
|
1598
|
+
maxHeight,
|
|
1599
|
+
handleAdd,
|
|
1600
|
+
isClearable,
|
|
1601
|
+
component,
|
|
1602
|
+
isMulti
|
|
1603
|
+
} = props;
|
|
1604
|
+
const selectTableRef = (0, import_react13.useRef)();
|
|
1605
|
+
const selectMenuTableRef = (0, import_react13.useRef)();
|
|
1606
|
+
const inputRef = (0, import_react13.useRef)();
|
|
1607
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react13.useState)(false);
|
|
1608
|
+
const [indexFocus, setIndexFocus] = (0, import_react13.useState)(-1);
|
|
1609
|
+
const [isFocus, setIsFocus] = (0, import_react13.useState)(false);
|
|
1610
|
+
const [searchTerm, setSearchTerm] = (0, import_react13.useState)("");
|
|
1611
|
+
const [optionsLoad, setOptionsLoad] = (0, import_react13.useState)();
|
|
1547
1612
|
const { t } = (0, import_react_i18next9.useTranslation)();
|
|
1613
|
+
const defaultColumns = [
|
|
1614
|
+
{
|
|
1615
|
+
field: "key",
|
|
1616
|
+
headerText: "Code",
|
|
1617
|
+
width: 100,
|
|
1618
|
+
maxWidth: 120,
|
|
1619
|
+
minWidth: 80
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
headerText: "Name",
|
|
1623
|
+
field: "label",
|
|
1624
|
+
width: 150,
|
|
1625
|
+
maxWidth: 200,
|
|
1626
|
+
minWidth: 250
|
|
1627
|
+
}
|
|
1628
|
+
];
|
|
1629
|
+
const closeMenu = () => {
|
|
1630
|
+
setDropdownOpen(false);
|
|
1631
|
+
};
|
|
1632
|
+
(0, import_react13.useEffect)(() => {
|
|
1633
|
+
if (dropdownOpen) {
|
|
1634
|
+
if (value) {
|
|
1635
|
+
if (selectMenuTableRef) {
|
|
1636
|
+
const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
|
|
1637
|
+
if (elementFocus) {
|
|
1638
|
+
const rect = elementFocus.getBoundingClientRect();
|
|
1639
|
+
const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
|
|
1640
|
+
if (rect.top < parentRect.top || rect.bottom > parentRect.bottom) {
|
|
1641
|
+
selectMenuTableRef.current.scrollTo({
|
|
1642
|
+
top: elementFocus.offsetTop,
|
|
1643
|
+
behavior: "smooth"
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}, [dropdownOpen]);
|
|
1651
|
+
let timeOutBlur;
|
|
1652
|
+
(0, import_react13.useEffect)(() => {
|
|
1653
|
+
if (inputRef) {
|
|
1654
|
+
inputRef.current.addEventListener("blur", function() {
|
|
1655
|
+
timeOutBlur = setTimeout(() => {
|
|
1656
|
+
if (document.activeElement?.className !== "select-input" && !selectTableRef.current?.contains(document.activeElement)) {
|
|
1657
|
+
setDropdownOpen(false);
|
|
1658
|
+
setIsFocus(false);
|
|
1659
|
+
}
|
|
1660
|
+
}, 100);
|
|
1661
|
+
});
|
|
1662
|
+
inputRef.current.addEventListener("focus", function() {
|
|
1663
|
+
if (!isFocus) {
|
|
1664
|
+
setIsFocus(true);
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
}, [inputRef]);
|
|
1669
|
+
(0, import_react13.useEffect)(() => {
|
|
1670
|
+
if (searchTerm && !dropdownOpen) {
|
|
1671
|
+
setDropdownOpen(true);
|
|
1672
|
+
setIndexFocus(0);
|
|
1673
|
+
}
|
|
1674
|
+
}, [searchTerm]);
|
|
1675
|
+
const handleOpenClose = () => {
|
|
1676
|
+
setSearchTerm("");
|
|
1677
|
+
if (dropdownOpen) {
|
|
1678
|
+
closeMenu();
|
|
1679
|
+
} else {
|
|
1680
|
+
setDropdownOpen(true);
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
|
|
1684
|
+
const handleOnKeyDown = (e) => {
|
|
1685
|
+
let key = "";
|
|
1686
|
+
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
|
|
1687
|
+
key = onKeyDown(e);
|
|
1688
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1689
|
+
closeMenu();
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
let flag = false;
|
|
1693
|
+
if (!key) {
|
|
1694
|
+
if (e.code === "F9") {
|
|
1695
|
+
handleAdd();
|
|
1696
|
+
flag = true;
|
|
1697
|
+
} else if (e.code === "Escape" || e.code === "Space") {
|
|
1698
|
+
if (dropdownOpen) {
|
|
1699
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
1700
|
+
}
|
|
1701
|
+
if (!searchTerm) {
|
|
1702
|
+
handleOpenClose();
|
|
1703
|
+
flag = true;
|
|
1704
|
+
}
|
|
1705
|
+
} else if (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter") {
|
|
1706
|
+
if (dropdownOpen) {
|
|
1707
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
1708
|
+
handleOpenClose();
|
|
1709
|
+
flag = true;
|
|
1710
|
+
}
|
|
1711
|
+
} else if (e.code === "ArrowDown") {
|
|
1712
|
+
if (dropdownOpen) {
|
|
1713
|
+
let newIndex = 0;
|
|
1714
|
+
if (indexFocus >= 0) {
|
|
1715
|
+
newIndex = indexFocus + 1;
|
|
1716
|
+
} else if (value) {
|
|
1717
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) + 1;
|
|
1718
|
+
}
|
|
1719
|
+
if (newIndex < (optionsLoad ? optionsLoad : options).length) {
|
|
1720
|
+
setIndexFocus(newIndex);
|
|
1721
|
+
checkIfElementIsOutOfScroll(0);
|
|
1722
|
+
} else {
|
|
1723
|
+
setIndexFocus(0);
|
|
1724
|
+
checkIfElementIsOutOfScroll(1);
|
|
1725
|
+
}
|
|
1726
|
+
flag = true;
|
|
1727
|
+
} else {
|
|
1728
|
+
handleOpenClose();
|
|
1729
|
+
flag = true;
|
|
1730
|
+
}
|
|
1731
|
+
} else if (e.code === "ArrowUp") {
|
|
1732
|
+
if (dropdownOpen) {
|
|
1733
|
+
let newIndex = 0;
|
|
1734
|
+
if (indexFocus >= 0) {
|
|
1735
|
+
newIndex = indexFocus - 1;
|
|
1736
|
+
} else if (value) {
|
|
1737
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) - 1;
|
|
1738
|
+
}
|
|
1739
|
+
if (newIndex >= 0) {
|
|
1740
|
+
setIndexFocus(newIndex);
|
|
1741
|
+
checkIfElementIsOutOfScroll(2);
|
|
1742
|
+
} else {
|
|
1743
|
+
setIndexFocus((optionsLoad ? optionsLoad : options).length - 1);
|
|
1744
|
+
checkIfElementIsOutOfScroll(3);
|
|
1745
|
+
}
|
|
1746
|
+
flag = true;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
if (flag) {
|
|
1751
|
+
e.stopPropagation();
|
|
1752
|
+
e.preventDefault();
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
const checkIfElementIsOutOfScroll = (flag) => {
|
|
1756
|
+
if (selectMenuTableRef) {
|
|
1757
|
+
const elementFocus = document.getElementById(`row-select-table-${indexFocus}`);
|
|
1758
|
+
if (elementFocus) {
|
|
1759
|
+
const rect = elementFocus.getBoundingClientRect();
|
|
1760
|
+
const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
|
|
1761
|
+
if (flag === 1) {
|
|
1762
|
+
scrollToElement(selectMenuTableRef.current, 0);
|
|
1763
|
+
} else if (flag === 3) {
|
|
1764
|
+
scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
|
|
1765
|
+
} else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
|
|
1766
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
|
|
1767
|
+
} else if (flag === 2 && rect.top < parentRect.top + 50) {
|
|
1768
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
let timeOutElement;
|
|
1774
|
+
const scrollToElement = (elemment, top) => {
|
|
1775
|
+
clearTimeout(timeOutElement);
|
|
1776
|
+
timeOutElement = setTimeout(() => {
|
|
1777
|
+
elemment.scrollTo({
|
|
1778
|
+
top
|
|
1779
|
+
});
|
|
1780
|
+
}, 100);
|
|
1781
|
+
};
|
|
1782
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
1783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1784
|
+
import_react13.Fragment,
|
|
1785
|
+
{
|
|
1786
|
+
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1787
|
+
"th",
|
|
1788
|
+
{
|
|
1789
|
+
className: (0, import_classnames11.default)(
|
|
1790
|
+
`r-select-headercell fix-${col.fixedType}`,
|
|
1791
|
+
{ "cell-fixed": col.fixedType }
|
|
1792
|
+
),
|
|
1793
|
+
style: {
|
|
1794
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
1795
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1796
|
+
top: `${0 * 35}px`,
|
|
1797
|
+
maxWidth: col.maxWidth
|
|
1798
|
+
},
|
|
1799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1800
|
+
"div",
|
|
1801
|
+
{
|
|
1802
|
+
role: "textbox",
|
|
1803
|
+
title: t(col.headerText ?? ""),
|
|
1804
|
+
style: {
|
|
1805
|
+
height: `${1 * 35}px`,
|
|
1806
|
+
justifyContent: col.textAlign ?? "left"
|
|
1807
|
+
},
|
|
1808
|
+
className: "r-select-headercell-div",
|
|
1809
|
+
children: t(col.headerText ?? "")
|
|
1810
|
+
}
|
|
1811
|
+
)
|
|
1812
|
+
}
|
|
1813
|
+
)
|
|
1814
|
+
},
|
|
1815
|
+
`header-select-${indexCol}`
|
|
1816
|
+
);
|
|
1817
|
+
};
|
|
1818
|
+
const checkSearch = (keyword, data, columnsSearch) => {
|
|
1819
|
+
if (!keyword || columnsSearch.length === 0) {
|
|
1820
|
+
return true;
|
|
1821
|
+
}
|
|
1822
|
+
for (let index = 0; index < columnsSearch.length; index++) {
|
|
1823
|
+
const key = columnsSearch[index].field.trim();
|
|
1824
|
+
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
1825
|
+
return true;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return false;
|
|
1829
|
+
};
|
|
1830
|
+
const callbackLoadOption = (rs) => {
|
|
1831
|
+
setOptionsLoad(rs);
|
|
1832
|
+
};
|
|
1833
|
+
(0, import_react13.useEffect)(() => {
|
|
1834
|
+
if (!searchTerm) {
|
|
1835
|
+
setOptionsLoad(void 0);
|
|
1836
|
+
}
|
|
1837
|
+
}, [searchTerm]);
|
|
1838
|
+
const checkOverflow = (element) => {
|
|
1839
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
1840
|
+
};
|
|
1841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1842
|
+
"div",
|
|
1843
|
+
{
|
|
1844
|
+
className: "react-select-table",
|
|
1845
|
+
ref,
|
|
1846
|
+
id,
|
|
1847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: selectTableRef, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1848
|
+
import_reactstrap8.Dropdown,
|
|
1849
|
+
{
|
|
1850
|
+
isOpen: dropdownOpen,
|
|
1851
|
+
toggle: () => {
|
|
1852
|
+
},
|
|
1853
|
+
children: [
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1855
|
+
import_reactstrap8.DropdownToggle,
|
|
1856
|
+
{
|
|
1857
|
+
onClick: () => {
|
|
1858
|
+
inputRef?.current.focus();
|
|
1859
|
+
clearTimeout(timeOutBlur);
|
|
1860
|
+
handleOpenClose();
|
|
1861
|
+
},
|
|
1862
|
+
tabIndex: 0,
|
|
1863
|
+
tag: "div",
|
|
1864
|
+
className: (0, import_classnames11.default)("select-table-control", { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
1865
|
+
children: [
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "select-table-container", children: [
|
|
1867
|
+
isMulti ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: (0, import_classnames11.default)("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
1869
|
+
index === 0 ? "" : ", ",
|
|
1870
|
+
ele[fieldLabel ?? "label"]
|
|
1871
|
+
] }, index);
|
|
1872
|
+
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_classnames11.default)("select-value", { "d-none": searchTerm }), children: [
|
|
1873
|
+
value ? value[fieldLabel ?? "label"] : "",
|
|
1874
|
+
" "
|
|
1875
|
+
] }) }),
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: (0, import_classnames11.default)("select-placeholder", { "d-none": (isMulti ? value?.length > 0 : value) || searchTerm }), children: placeholder }),
|
|
1877
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "input-container", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1878
|
+
"input",
|
|
1879
|
+
{
|
|
1880
|
+
style: { textAlign: textAlign ?? "left" },
|
|
1881
|
+
ref: inputRef,
|
|
1882
|
+
className: (0, import_classnames11.default)("select-input"),
|
|
1883
|
+
value: searchTerm,
|
|
1884
|
+
onChange: (val) => {
|
|
1885
|
+
if (loadOptions && val.target.value) {
|
|
1886
|
+
loadOptions(val.target.value, callbackLoadOption);
|
|
1887
|
+
}
|
|
1888
|
+
setSearchTerm(val.target.value);
|
|
1889
|
+
},
|
|
1890
|
+
onKeyDown: (e) => handleOnKeyDown(e)
|
|
1891
|
+
}
|
|
1892
|
+
) })
|
|
1893
|
+
] }),
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1895
|
+
"div",
|
|
1896
|
+
{
|
|
1897
|
+
className: (0, import_classnames11.default)("select-table-indicator cursor-pointer", { "d-none": !isClearable || !value }),
|
|
1898
|
+
onClick: (e) => {
|
|
1899
|
+
onChange(isMulti ? [] : void 0);
|
|
1900
|
+
e.stopPropagation();
|
|
1901
|
+
},
|
|
1902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { height: "20", width: "20", style: { color: "#c4c4c4" }, viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" }) })
|
|
1903
|
+
}
|
|
1904
|
+
),
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "select-table-indicator", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { height: "20", width: "20", style: { color: dropdownOpen ? "#000000af" : "#c4c4c4" }, viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) })
|
|
1906
|
+
]
|
|
1907
|
+
}
|
|
1908
|
+
),
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1910
|
+
import_reactstrap8.DropdownMenu,
|
|
1911
|
+
{
|
|
1912
|
+
container: component,
|
|
1913
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
1914
|
+
style: {
|
|
1915
|
+
width: menuWidth ? menuWidth : "min-content",
|
|
1916
|
+
position: "fixed",
|
|
1917
|
+
zIndex: 9999
|
|
1918
|
+
},
|
|
1919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_reactstrap8.DropdownItem, { className: (0, import_classnames11.default)("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1920
|
+
"div",
|
|
1921
|
+
{
|
|
1922
|
+
onMouseDown: (e) => {
|
|
1923
|
+
inputRef?.current.focus();
|
|
1924
|
+
clearTimeout(timeOutBlur);
|
|
1925
|
+
e.preventDefault();
|
|
1926
|
+
},
|
|
1927
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "r-select-grid", children: [
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { style: { width: "100%" }, children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "r-select-row", role: "row", children: [
|
|
1930
|
+
isMulti && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: (0, import_classnames11.default)(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1931
|
+
"div",
|
|
1932
|
+
{
|
|
1933
|
+
style: { justifyContent: "center" },
|
|
1934
|
+
className: (0, import_classnames11.default)("r-select-headercell-div"),
|
|
1935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1936
|
+
import_reactstrap8.Input,
|
|
1937
|
+
{
|
|
1938
|
+
checked: (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length,
|
|
1939
|
+
type: "checkbox",
|
|
1940
|
+
className: (0, import_classnames11.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
1941
|
+
style: { textAlign: "center", marginTop: 6 },
|
|
1942
|
+
onChange: (e) => {
|
|
1943
|
+
if (isMulti) {
|
|
1944
|
+
if (e.target.checked) {
|
|
1945
|
+
onChange((optionsLoad ? optionsLoad : options).map((item) => {
|
|
1946
|
+
return item;
|
|
1947
|
+
}));
|
|
1948
|
+
} else {
|
|
1949
|
+
onChange([]);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
)
|
|
1955
|
+
}
|
|
1956
|
+
) }),
|
|
1957
|
+
(columns ? columns : defaultColumns).map((col, index) => {
|
|
1958
|
+
return renderHeaderCol(col, index);
|
|
1959
|
+
})
|
|
1960
|
+
] }) }),
|
|
1961
|
+
(optionsLoad ? optionsLoad : options).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
|
|
1962
|
+
if (loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
1963
|
+
const refRow = (0, import_react13.useRef)(null);
|
|
1964
|
+
const isSelected = isMulti && value?.some((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1966
|
+
"tr",
|
|
1967
|
+
{
|
|
1968
|
+
id: `row-select-table-${indexRow}`,
|
|
1969
|
+
className: (0, import_classnames11.default)("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
1970
|
+
children: [
|
|
1971
|
+
isMulti && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1972
|
+
"td",
|
|
1973
|
+
{
|
|
1974
|
+
className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
1975
|
+
style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
|
|
1976
|
+
onClick: (e) => {
|
|
1977
|
+
if (isMulti) {
|
|
1978
|
+
const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1979
|
+
if (index > -1) {
|
|
1980
|
+
value?.splice(index, 1);
|
|
1981
|
+
onChange(value);
|
|
1982
|
+
} else {
|
|
1983
|
+
if (value) {
|
|
1984
|
+
value?.push(row);
|
|
1985
|
+
onChange(value);
|
|
1986
|
+
} else {
|
|
1987
|
+
onChange([row]);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
e.stopPropagation();
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1994
|
+
import_reactstrap8.Input,
|
|
1995
|
+
{
|
|
1996
|
+
checked: isSelected,
|
|
1997
|
+
type: "checkbox",
|
|
1998
|
+
className: "cursor-pointer",
|
|
1999
|
+
onChange: () => {
|
|
2000
|
+
},
|
|
2001
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
2002
|
+
}
|
|
2003
|
+
)
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
2006
|
+
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
2007
|
+
let valueDisplay = row[col.field];
|
|
2008
|
+
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2009
|
+
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2010
|
+
} else if (col.type === "date") {
|
|
2011
|
+
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy") : "";
|
|
2012
|
+
} else if (col.type === "datetime") {
|
|
2013
|
+
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
|
|
2014
|
+
}
|
|
2015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react13.Fragment, { children: [
|
|
2016
|
+
col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2017
|
+
"td",
|
|
2018
|
+
{
|
|
2019
|
+
id: `content-select-${indexRow}-${indexCol}`,
|
|
2020
|
+
ref: refRow,
|
|
2021
|
+
className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
2022
|
+
style: {
|
|
2023
|
+
minWidth: col.minWidth,
|
|
2024
|
+
width: col.width,
|
|
2025
|
+
maxWidth: col.maxWidth,
|
|
2026
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2027
|
+
},
|
|
2028
|
+
onClick: (e) => {
|
|
2029
|
+
if (isMulti) {
|
|
2030
|
+
const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
2031
|
+
if (index > -1) {
|
|
2032
|
+
value?.splice(index, 1);
|
|
2033
|
+
onChange(value);
|
|
2034
|
+
} else {
|
|
2035
|
+
if (value) {
|
|
2036
|
+
value?.push(row);
|
|
2037
|
+
onChange(value);
|
|
2038
|
+
} else {
|
|
2039
|
+
onChange([row]);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
} else {
|
|
2043
|
+
onChange(row);
|
|
2044
|
+
closeMenu();
|
|
2045
|
+
}
|
|
2046
|
+
e.preventDefault();
|
|
2047
|
+
e.stopPropagation();
|
|
2048
|
+
},
|
|
2049
|
+
onMouseMove: (e) => {
|
|
2050
|
+
if (indexRow !== indexFocus) {
|
|
2051
|
+
setIndexFocus(indexRow);
|
|
2052
|
+
}
|
|
2053
|
+
e.stopPropagation();
|
|
2054
|
+
},
|
|
2055
|
+
children: col.template ? col.template(row, indexRow) : valueDisplay
|
|
2056
|
+
},
|
|
2057
|
+
`col-${indexRow}-${indexCol}`
|
|
2058
|
+
),
|
|
2059
|
+
checkOverflow(refRow.current) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_reactstrap8.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-select-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
2060
|
+
] }, indexCol);
|
|
2061
|
+
})
|
|
2062
|
+
]
|
|
2063
|
+
},
|
|
2064
|
+
`row-${indexRow}`
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "r-no-data", children: t("No data available.") })
|
|
2068
|
+
] }) }),
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "r-select-footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_reactstrap8.Button, { outline: true, color: "primary", className: "r-btn-add d-flex align-items-center", onClick: handleAdd, children: [
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_becoxy_icons5.Plus, { className: "me-50", fontSize: 16 }),
|
|
2071
|
+
t("AddNew"),
|
|
2072
|
+
" (F9)"
|
|
2073
|
+
] }) })
|
|
2074
|
+
] })
|
|
2075
|
+
}
|
|
2076
|
+
) })
|
|
2077
|
+
}
|
|
2078
|
+
)
|
|
2079
|
+
]
|
|
2080
|
+
}
|
|
2081
|
+
) })
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
});
|
|
2085
|
+
var select_table_default = SelectTable;
|
|
2086
|
+
|
|
2087
|
+
// test-app/src/component/table/index.tsx
|
|
2088
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2089
|
+
var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
2090
|
+
const { t } = (0, import_react_i18next10.useTranslation)();
|
|
1548
2091
|
const {
|
|
1549
2092
|
idTable,
|
|
1550
2093
|
dataSource,
|
|
@@ -1572,36 +2115,36 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1572
2115
|
handleSelect,
|
|
1573
2116
|
isMulti
|
|
1574
2117
|
} = props;
|
|
1575
|
-
(0,
|
|
2118
|
+
(0, import_react14.useImperativeHandle)(ref, () => {
|
|
1576
2119
|
return {
|
|
1577
2120
|
refeshFocusRow: handleRefeshRow
|
|
1578
2121
|
};
|
|
1579
2122
|
});
|
|
1580
|
-
const [refreshRow, setRefreshRow] = (0,
|
|
1581
|
-
const [indexFocus, setIndexFocus] = (0,
|
|
1582
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
1583
|
-
const [headerColumns, setHeaderColumns] = (0,
|
|
1584
|
-
const [contentColumns, setContentColumns] = (0,
|
|
1585
|
-
const [levelCol, setLevelCol] = (0,
|
|
1586
|
-
const [columnFistEdit, setColumnFistEdit] = (0,
|
|
1587
|
-
const [columnLastEdit, setColumnlastEdit] = (0,
|
|
1588
|
-
const [objWidthFix, setObjWidthFix] = (0,
|
|
1589
|
-
const [openPopupTree, setOpenPopupTree] = (0,
|
|
1590
|
-
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0,
|
|
1591
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
1592
|
-
const tableElement = (0,
|
|
1593
|
-
const gridRef = (0,
|
|
2123
|
+
const [refreshRow, setRefreshRow] = (0, import_react14.useState)(false);
|
|
2124
|
+
const [indexFocus, setIndexFocus] = (0, import_react14.useState)();
|
|
2125
|
+
const [selectedRows, setSelectedRows] = (0, import_react14.useState)([]);
|
|
2126
|
+
const [headerColumns, setHeaderColumns] = (0, import_react14.useState)([[]]);
|
|
2127
|
+
const [contentColumns, setContentColumns] = (0, import_react14.useState)([]);
|
|
2128
|
+
const [levelCol, setLevelCol] = (0, import_react14.useState)(0);
|
|
2129
|
+
const [columnFistEdit, setColumnFistEdit] = (0, import_react14.useState)(0);
|
|
2130
|
+
const [columnLastEdit, setColumnlastEdit] = (0, import_react14.useState)(0);
|
|
2131
|
+
const [objWidthFix, setObjWidthFix] = (0, import_react14.useState)({});
|
|
2132
|
+
const [openPopupTree, setOpenPopupTree] = (0, import_react14.useState)(false);
|
|
2133
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0, import_react14.useState)(false);
|
|
2134
|
+
const [searchTerm, setSearchTerm] = (0, import_react14.useState)("");
|
|
2135
|
+
const tableElement = (0, import_react14.useRef)(null);
|
|
2136
|
+
const gridRef = (0, import_react14.useRef)();
|
|
1594
2137
|
let totalCount = dataSource.length;
|
|
1595
2138
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
1596
2139
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
1597
2140
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
1598
2141
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
1599
|
-
(0,
|
|
2142
|
+
(0, import_react14.useEffect)(() => {
|
|
1600
2143
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
1601
2144
|
pagingSetting.setCurrentPage(1);
|
|
1602
2145
|
}
|
|
1603
2146
|
}, [dataSource]);
|
|
1604
|
-
(0,
|
|
2147
|
+
(0, import_react14.useEffect)(() => {
|
|
1605
2148
|
let indexFirst = -1;
|
|
1606
2149
|
let indexlast = -1;
|
|
1607
2150
|
let letfWidthFix = 0;
|
|
@@ -1634,7 +2177,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1634
2177
|
setColumnFistEdit(indexFirst + 1);
|
|
1635
2178
|
setColumnlastEdit(indexlast + 1);
|
|
1636
2179
|
}, [contentColumns]);
|
|
1637
|
-
(0,
|
|
2180
|
+
(0, import_react14.useEffect)(() => {
|
|
1638
2181
|
const arrHeaderColumns = [];
|
|
1639
2182
|
const arrContentColumns = [];
|
|
1640
2183
|
let headerLevelRow = 0;
|
|
@@ -1651,7 +2194,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1651
2194
|
setHeaderColumns(arrHeaderColumns);
|
|
1652
2195
|
setContentColumns(arrContentColumns);
|
|
1653
2196
|
}, [columns]);
|
|
1654
|
-
(0,
|
|
2197
|
+
(0, import_react14.useEffect)(() => {
|
|
1655
2198
|
const arrHeaderColumns = [];
|
|
1656
2199
|
const arrContentColumns = [];
|
|
1657
2200
|
let headerLevelRow = 0;
|
|
@@ -1762,7 +2305,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1762
2305
|
}
|
|
1763
2306
|
};
|
|
1764
2307
|
const searchTemplate = () => {
|
|
1765
|
-
return /* @__PURE__ */ (0,
|
|
2308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "me-50 r-search", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1766
2309
|
react_input_default,
|
|
1767
2310
|
{
|
|
1768
2311
|
style: { width: "230px" },
|
|
@@ -1783,12 +2326,12 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1783
2326
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
1784
2327
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
1785
2328
|
case "date":
|
|
1786
|
-
return /* @__PURE__ */ (0,
|
|
1787
|
-
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2330
|
+
import_reactstrap9.Input,
|
|
1788
2331
|
{
|
|
1789
2332
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1790
2333
|
style: { textAlign: col.textAlign, height: 29 },
|
|
1791
|
-
value: row[col.field] ? (0,
|
|
2334
|
+
value: row[col.field] ? (0, import_moment2.default)(row[col.field]).format("yyyy-MM-DD") : row[col.field],
|
|
1792
2335
|
onChange: (val) => {
|
|
1793
2336
|
row[col.field] = val.target.value;
|
|
1794
2337
|
if (col.callback) {
|
|
@@ -1796,7 +2339,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1796
2339
|
}
|
|
1797
2340
|
handleDataChange(row, col, indexRow);
|
|
1798
2341
|
},
|
|
1799
|
-
className: (0,
|
|
2342
|
+
className: (0, import_classnames12.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1800
2343
|
type: "date",
|
|
1801
2344
|
max: "9999-12-31",
|
|
1802
2345
|
onKeyDown: (e) => {
|
|
@@ -1806,12 +2349,12 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1806
2349
|
}
|
|
1807
2350
|
);
|
|
1808
2351
|
case "datetime":
|
|
1809
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
-
|
|
2352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2353
|
+
import_reactstrap9.Input,
|
|
1811
2354
|
{
|
|
1812
2355
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1813
2356
|
style: { textAlign: col.textAlign, height: 29 },
|
|
1814
|
-
value: row[col.field] ? (0,
|
|
2357
|
+
value: row[col.field] ? (0, import_moment2.default)(row[col.field]).format("yyyy-MM-DD HH:MM") : row[col.field],
|
|
1815
2358
|
onChange: (val) => {
|
|
1816
2359
|
row[col.field] = val.target.value;
|
|
1817
2360
|
if (col.callback) {
|
|
@@ -1819,7 +2362,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1819
2362
|
}
|
|
1820
2363
|
handleDataChange(row, col, indexRow);
|
|
1821
2364
|
},
|
|
1822
|
-
className: (0,
|
|
2365
|
+
className: (0, import_classnames12.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1823
2366
|
type: "datetime-local",
|
|
1824
2367
|
max: "9999-12-31T23:59",
|
|
1825
2368
|
onKeyDown: (e) => {
|
|
@@ -1839,8 +2382,8 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1839
2382
|
if (!valueAsyncSelect && col.selectSettings?.defaultValue) {
|
|
1840
2383
|
valueAsyncSelect = col.selectSettings?.defaultValue(row);
|
|
1841
2384
|
}
|
|
1842
|
-
return /* @__PURE__ */ (0,
|
|
1843
|
-
/* @__PURE__ */ (0,
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_classnames12.default)("d-flex select-group", { "is-invalid": col.validate && col.validate(row[col.field], row) }), children: [
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1844
2387
|
import_async.default,
|
|
1845
2388
|
{
|
|
1846
2389
|
menuPosition: "fixed",
|
|
@@ -1859,23 +2402,23 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1859
2402
|
placeholder: t("Select"),
|
|
1860
2403
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1861
2404
|
loadOptions: col.selectSettings?.loadOptions,
|
|
1862
|
-
className: (0,
|
|
2405
|
+
className: (0, import_classnames12.default)("react-select"),
|
|
1863
2406
|
onKeyDown: (e) => {
|
|
1864
2407
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1865
2408
|
}
|
|
1866
2409
|
}
|
|
1867
2410
|
}
|
|
1868
2411
|
),
|
|
1869
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1870
2413
|
"span",
|
|
1871
2414
|
{
|
|
1872
2415
|
onClick: () => {
|
|
1873
|
-
if (col.selectSettings?.
|
|
1874
|
-
col.selectSettings?.
|
|
2416
|
+
if (col.selectSettings?.handAddNew) {
|
|
2417
|
+
col.selectSettings?.handAddNew("right");
|
|
1875
2418
|
}
|
|
1876
2419
|
},
|
|
1877
|
-
className: (0,
|
|
1878
|
-
children: /* @__PURE__ */ (0,
|
|
2420
|
+
className: (0, import_classnames12.default)("input-group-text", { "d-none": !col.selectSettings?.iconGroup }),
|
|
2421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(icon_default, { iconName: col.selectSettings?.iconGroup ?? "", size: 16 })
|
|
1879
2422
|
}
|
|
1880
2423
|
)
|
|
1881
2424
|
] });
|
|
@@ -1892,7 +2435,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1892
2435
|
} else {
|
|
1893
2436
|
valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? options?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
1894
2437
|
}
|
|
1895
|
-
return /* @__PURE__ */ (0,
|
|
2438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1896
2439
|
import_react_select3.default,
|
|
1897
2440
|
{
|
|
1898
2441
|
menuPosition: "fixed",
|
|
@@ -1911,7 +2454,56 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1911
2454
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
1912
2455
|
classNamePrefix: col.selectSettings?.widthPopup ? `select-${col.selectSettings?.widthPopup}` : "select",
|
|
1913
2456
|
placeholder: t("Select"),
|
|
1914
|
-
className: (0,
|
|
2457
|
+
className: (0, import_classnames12.default)("react-select", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2458
|
+
onKeyDown: (e) => {
|
|
2459
|
+
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
);
|
|
2464
|
+
case "selectTable":
|
|
2465
|
+
let valueSelectTable;
|
|
2466
|
+
let optionsSelectTable = [];
|
|
2467
|
+
if (col.selectSettings?.optionsField) {
|
|
2468
|
+
optionsSelectTable = row[col.selectSettings?.optionsField] ? row[col.selectSettings?.optionsField] : [];
|
|
2469
|
+
} else {
|
|
2470
|
+
optionsSelectTable = col.selectSettings?.options ? col.selectSettings?.validateOption ? col.selectSettings?.options.filter((item) => col.selectSettings?.validateOption(item, row)) : col.selectSettings?.options : [];
|
|
2471
|
+
}
|
|
2472
|
+
if (col.selectSettings?.isMulti) {
|
|
2473
|
+
valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field]?.length > 0 ? optionsSelectTable?.filter((val) => row[col.field]?.includes(val[col.selectSettings?.fieldValue ?? "value"])) : [];
|
|
2474
|
+
} else {
|
|
2475
|
+
valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelectTable?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
2476
|
+
}
|
|
2477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2478
|
+
select_table_default,
|
|
2479
|
+
{
|
|
2480
|
+
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2481
|
+
value: valueSelectTable,
|
|
2482
|
+
options: optionsSelectTable,
|
|
2483
|
+
rowData: row,
|
|
2484
|
+
onChange: (val) => {
|
|
2485
|
+
row[col.field] = col.selectSettings?.isMulti ? val?.map((item) => item[col.selectSettings?.fieldValue ?? "value"]) ?? [] : val ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
|
|
2486
|
+
if (col.callback) {
|
|
2487
|
+
col.callback(val, indexRow);
|
|
2488
|
+
}
|
|
2489
|
+
handleDataChange(row, col, indexRow);
|
|
2490
|
+
},
|
|
2491
|
+
fieldValue: col.selectSettings?.fieldValue,
|
|
2492
|
+
fieldLabel: col.selectSettings?.fieldLabel,
|
|
2493
|
+
component: tableElement,
|
|
2494
|
+
columns: col.selectSettings?.columns,
|
|
2495
|
+
isClearable: col.selectSettings?.isClearable ?? false,
|
|
2496
|
+
decimalSeparator,
|
|
2497
|
+
thousandSeparator,
|
|
2498
|
+
placeholder: t("Select"),
|
|
2499
|
+
loadOptions: col.selectSettings?.loadOptions,
|
|
2500
|
+
field: col.field,
|
|
2501
|
+
handleAdd: col.selectSettings?.handAddNew,
|
|
2502
|
+
isMulti: col.selectSettings?.isMulti,
|
|
2503
|
+
invalid: col.validate && col.validate(row[col.field], row),
|
|
2504
|
+
maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : void 0,
|
|
2505
|
+
menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
2506
|
+
textAlign: col.textAlign ?? "left",
|
|
1915
2507
|
onKeyDown: (e) => {
|
|
1916
2508
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1917
2509
|
}
|
|
@@ -1933,14 +2525,14 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1933
2525
|
}
|
|
1934
2526
|
}
|
|
1935
2527
|
};
|
|
1936
|
-
return /* @__PURE__ */ (0,
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1937
2529
|
"div",
|
|
1938
2530
|
{
|
|
1939
2531
|
onKeyDown: (e) => {
|
|
1940
2532
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1941
2533
|
}
|
|
1942
2534
|
},
|
|
1943
|
-
children: /* @__PURE__ */ (0,
|
|
2535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1944
2536
|
import_ej2_react_dropdowns.DropDownTreeComponent,
|
|
1945
2537
|
{
|
|
1946
2538
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1951,7 +2543,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1951
2543
|
parentValue: "parentId",
|
|
1952
2544
|
child: "children"
|
|
1953
2545
|
},
|
|
1954
|
-
className: (0,
|
|
2546
|
+
className: (0, import_classnames12.default)("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1955
2547
|
allowFiltering: false,
|
|
1956
2548
|
value: valueSelectTree,
|
|
1957
2549
|
popupHeight: 250,
|
|
@@ -1979,8 +2571,8 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1979
2571
|
}
|
|
1980
2572
|
);
|
|
1981
2573
|
case "checkbox":
|
|
1982
|
-
return /* @__PURE__ */ (0,
|
|
1983
|
-
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2575
|
+
import_reactstrap9.Input,
|
|
1984
2576
|
{
|
|
1985
2577
|
checked: row[col.field],
|
|
1986
2578
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2002,13 +2594,13 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2002
2594
|
);
|
|
2003
2595
|
case "numeric":
|
|
2004
2596
|
let valueCurrency = row[col.field];
|
|
2005
|
-
return /* @__PURE__ */ (0,
|
|
2006
|
-
|
|
2597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2598
|
+
import_reactstrap9.Input,
|
|
2007
2599
|
{
|
|
2008
2600
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2009
2601
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2010
2602
|
defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
2011
|
-
className: (0,
|
|
2603
|
+
className: (0, import_classnames12.default)("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2012
2604
|
onChange: (val) => {
|
|
2013
2605
|
let newVal = "";
|
|
2014
2606
|
const flag = val.target?.value.startsWith("-");
|
|
@@ -2092,8 +2684,8 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2092
2684
|
}
|
|
2093
2685
|
);
|
|
2094
2686
|
case "color":
|
|
2095
|
-
return /* @__PURE__ */ (0,
|
|
2096
|
-
|
|
2687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2688
|
+
import_reactstrap9.Input,
|
|
2097
2689
|
{
|
|
2098
2690
|
type: "color",
|
|
2099
2691
|
value: row[col.field],
|
|
@@ -2115,7 +2707,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2115
2707
|
`col-${indexRow}-${indexCol}`
|
|
2116
2708
|
) });
|
|
2117
2709
|
case "form":
|
|
2118
|
-
return /* @__PURE__ */ (0,
|
|
2710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2119
2711
|
edit_form_default,
|
|
2120
2712
|
{
|
|
2121
2713
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2137,13 +2729,13 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2137
2729
|
}
|
|
2138
2730
|
);
|
|
2139
2731
|
default:
|
|
2140
|
-
return /* @__PURE__ */ (0,
|
|
2141
|
-
|
|
2732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2733
|
+
import_reactstrap9.Input,
|
|
2142
2734
|
{
|
|
2143
2735
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2144
2736
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2145
2737
|
defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
|
|
2146
|
-
className: (0,
|
|
2738
|
+
className: (0, import_classnames12.default)("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2147
2739
|
onBlur: (val) => {
|
|
2148
2740
|
if (row[col.field] != val.target?.value) {
|
|
2149
2741
|
row[col.field] = val.target?.value;
|
|
@@ -2181,14 +2773,14 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2181
2773
|
}
|
|
2182
2774
|
};
|
|
2183
2775
|
const renderCommand = (commandItems, rowData, i) => {
|
|
2184
|
-
return /* @__PURE__ */ (0,
|
|
2185
|
-
return /* @__PURE__ */ (0,
|
|
2186
|
-
|
|
2776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2778
|
+
import_reactstrap9.Button,
|
|
2187
2779
|
{
|
|
2188
2780
|
id: `command-item-${i}`,
|
|
2189
2781
|
tabIndex: -1,
|
|
2190
2782
|
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2191
|
-
className: (0,
|
|
2783
|
+
className: (0, import_classnames12.default)("command-item", {
|
|
2192
2784
|
"btn-icon": item.tooltip === ""
|
|
2193
2785
|
}),
|
|
2194
2786
|
color: item.color ? item.color : "#000",
|
|
@@ -2200,8 +2792,8 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2200
2792
|
e.preventDefault();
|
|
2201
2793
|
},
|
|
2202
2794
|
children: [
|
|
2203
|
-
item.icon && /* @__PURE__ */ (0,
|
|
2204
|
-
/* @__PURE__ */ (0,
|
|
2795
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(icon_default, { iconName: item.icon, size: 16 }),
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2205
2797
|
]
|
|
2206
2798
|
},
|
|
2207
2799
|
`command-${index}`
|
|
@@ -2458,7 +3050,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2458
3050
|
}
|
|
2459
3051
|
}
|
|
2460
3052
|
};
|
|
2461
|
-
(0,
|
|
3053
|
+
(0, import_react14.useEffect)(() => {
|
|
2462
3054
|
setIndexFocus(-1);
|
|
2463
3055
|
if (setSelectedItem) {
|
|
2464
3056
|
if (isMulti) {
|
|
@@ -2485,7 +3077,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2485
3077
|
}
|
|
2486
3078
|
}
|
|
2487
3079
|
}, [selectedRows]);
|
|
2488
|
-
(0,
|
|
3080
|
+
(0, import_react14.useEffect)(() => {
|
|
2489
3081
|
if (!isMulti) {
|
|
2490
3082
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
2491
3083
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -2502,10 +3094,10 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2502
3094
|
}, [selectedItem]);
|
|
2503
3095
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
2504
3096
|
if (col.field === "command") {
|
|
2505
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3097
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2506
3098
|
"td",
|
|
2507
3099
|
{
|
|
2508
|
-
className: (0,
|
|
3100
|
+
className: (0, import_classnames12.default)(
|
|
2509
3101
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
2510
3102
|
{ "cell-fixed": col.fixedType },
|
|
2511
3103
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2515,15 +3107,15 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2515
3107
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2516
3108
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2517
3109
|
},
|
|
2518
|
-
children: /* @__PURE__ */ (0,
|
|
3110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-rowcell-div ", children: renderCommand(col.commandItems, row, indexRow) })
|
|
2519
3111
|
},
|
|
2520
3112
|
`col-${indexRow}-${indexCol}`
|
|
2521
3113
|
);
|
|
2522
3114
|
} else if (col.field === "#") {
|
|
2523
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3115
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2524
3116
|
"td",
|
|
2525
3117
|
{
|
|
2526
|
-
className: (0,
|
|
3118
|
+
className: (0, import_classnames12.default)(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
2527
3119
|
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
2528
3120
|
style: {
|
|
2529
3121
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
@@ -2567,15 +3159,15 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2567
3159
|
e.stopPropagation();
|
|
2568
3160
|
}
|
|
2569
3161
|
},
|
|
2570
|
-
children: /* @__PURE__ */ (0,
|
|
3162
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
2571
3163
|
},
|
|
2572
3164
|
`col-${indexRow}-${indexCol}`
|
|
2573
3165
|
);
|
|
2574
3166
|
} else if (col.field === "checkbox") {
|
|
2575
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2576
3168
|
"td",
|
|
2577
3169
|
{
|
|
2578
|
-
className: (0,
|
|
3170
|
+
className: (0, import_classnames12.default)(
|
|
2579
3171
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
2580
3172
|
{ "cell-fixed": col.fixedType },
|
|
2581
3173
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2585,7 +3177,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2585
3177
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2586
3178
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
2587
3179
|
},
|
|
2588
|
-
children: /* @__PURE__ */ (0,
|
|
3180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2589
3181
|
"div",
|
|
2590
3182
|
{
|
|
2591
3183
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -2609,8 +3201,8 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2609
3201
|
e.stopPropagation();
|
|
2610
3202
|
}
|
|
2611
3203
|
},
|
|
2612
|
-
children: /* @__PURE__ */ (0,
|
|
2613
|
-
|
|
3204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3205
|
+
import_reactstrap9.Input,
|
|
2614
3206
|
{
|
|
2615
3207
|
checked: isSelected,
|
|
2616
3208
|
type: "checkbox",
|
|
@@ -2630,16 +3222,16 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2630
3222
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
2631
3223
|
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
2632
3224
|
} else if (col.editType === "date") {
|
|
2633
|
-
value = value ? (0,
|
|
3225
|
+
value = value ? (0, import_moment2.default)(value).format("DD/MM/yyyy") : "";
|
|
2634
3226
|
} else if (col.editType === "datetime") {
|
|
2635
|
-
value = value ? (0,
|
|
3227
|
+
value = value ? (0, import_moment2.default)(value).format("DD/MM/yyyy HH:mm") : "";
|
|
2636
3228
|
}
|
|
2637
3229
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
2638
3230
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
2639
|
-
return /* @__PURE__ */ (0,
|
|
3231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2640
3232
|
"td",
|
|
2641
3233
|
{
|
|
2642
|
-
className: (0,
|
|
3234
|
+
className: (0, import_classnames12.default)(
|
|
2643
3235
|
`r-rowcell fix-${col.fixedType}`,
|
|
2644
3236
|
{ "cell-fixed": col.fixedType },
|
|
2645
3237
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2681,28 +3273,28 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2681
3273
|
e.stopPropagation();
|
|
2682
3274
|
}
|
|
2683
3275
|
},
|
|
2684
|
-
children: /* @__PURE__ */ (0,
|
|
3276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2685
3277
|
"div",
|
|
2686
3278
|
{
|
|
2687
|
-
className: (0,
|
|
3279
|
+
className: (0, import_classnames12.default)("r-rowcell-div"),
|
|
2688
3280
|
style: {
|
|
2689
3281
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width
|
|
2690
3282
|
},
|
|
2691
|
-
children: /* @__PURE__ */ (0,
|
|
3283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2692
3284
|
"div",
|
|
2693
3285
|
{
|
|
2694
3286
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
2695
|
-
className: (0,
|
|
3287
|
+
className: (0, import_classnames12.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
2696
3288
|
style: {
|
|
2697
3289
|
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
2698
3290
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
2699
3291
|
},
|
|
2700
3292
|
children: [
|
|
2701
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0,
|
|
2702
|
-
/* @__PURE__ */ (0,
|
|
2703
|
-
!(typeDis === 1 && !refreshRow) &&
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2705
|
-
|
|
3293
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { id: `content-${idTable}-${indexRow}-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id: `error-${indexRow}-${indexCol}`, className: (0, import_classnames12.default)("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_becoxy_icons6.AlertCircle, { fontSize: 15.5 }) }),
|
|
3295
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3296
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3297
|
+
import_reactstrap9.UncontrolledTooltip,
|
|
2706
3298
|
{
|
|
2707
3299
|
target: `error-${indexRow}-${indexCol}`,
|
|
2708
3300
|
className: "r-tooltip tooltip-error",
|
|
@@ -2719,14 +3311,18 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2719
3311
|
) }, indexCol);
|
|
2720
3312
|
}
|
|
2721
3313
|
};
|
|
3314
|
+
const checkOverflow = (indexRow, indexCol) => {
|
|
3315
|
+
const element = document.getElementById(`content-${idTable}-${indexRow}-${indexCol}`);
|
|
3316
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
3317
|
+
};
|
|
2722
3318
|
const renderHeaderCol = (col, indexCol, indexParent) => {
|
|
2723
3319
|
if (col.field === "checkbox") {
|
|
2724
|
-
return /* @__PURE__ */ (0,
|
|
3320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2725
3321
|
"th",
|
|
2726
3322
|
{
|
|
2727
3323
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2728
3324
|
colSpan: col.columns?.length ?? 1,
|
|
2729
|
-
className: (0,
|
|
3325
|
+
className: (0, import_classnames12.default)(
|
|
2730
3326
|
`r-headercell fix-${col.fixedType}`,
|
|
2731
3327
|
{ "cell-fixed": col.fixedType }
|
|
2732
3328
|
),
|
|
@@ -2738,17 +3334,17 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2738
3334
|
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2739
3335
|
maxWidth: col.maxWidth
|
|
2740
3336
|
},
|
|
2741
|
-
children: /* @__PURE__ */ (0,
|
|
3337
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2742
3338
|
"div",
|
|
2743
3339
|
{
|
|
2744
3340
|
style: { justifyContent: col.textAlign ?? "left" },
|
|
2745
|
-
className: (0,
|
|
2746
|
-
children: /* @__PURE__ */ (0,
|
|
2747
|
-
|
|
3341
|
+
className: (0, import_classnames12.default)("r-headercell-div"),
|
|
3342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3343
|
+
import_reactstrap9.Input,
|
|
2748
3344
|
{
|
|
2749
3345
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
2750
3346
|
type: "checkbox",
|
|
2751
|
-
className: (0,
|
|
3347
|
+
className: (0, import_classnames12.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
2752
3348
|
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
2753
3349
|
onChange: (e) => {
|
|
2754
3350
|
if (selectEnable) {
|
|
@@ -2768,15 +3364,15 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2768
3364
|
}
|
|
2769
3365
|
) }, `header-${indexCol}`);
|
|
2770
3366
|
} else if (col.field === "#") {
|
|
2771
|
-
return /* @__PURE__ */ (0,
|
|
2772
|
-
|
|
3367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3368
|
+
import_react14.Fragment,
|
|
2773
3369
|
{
|
|
2774
|
-
children: col.visible !== false && /* @__PURE__ */ (0,
|
|
3370
|
+
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2775
3371
|
"th",
|
|
2776
3372
|
{
|
|
2777
3373
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2778
3374
|
colSpan: col.columns?.length ?? 1,
|
|
2779
|
-
className: (0,
|
|
3375
|
+
className: (0, import_classnames12.default)(
|
|
2780
3376
|
`r-headercell fix-${col.fixedType}`,
|
|
2781
3377
|
{ "cell-fixed": col.fixedType }
|
|
2782
3378
|
),
|
|
@@ -2788,7 +3384,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2788
3384
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2789
3385
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
2790
3386
|
},
|
|
2791
|
-
children: /* @__PURE__ */ (0,
|
|
3387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2792
3388
|
"div",
|
|
2793
3389
|
{
|
|
2794
3390
|
title: t(col.headerText ?? ""),
|
|
@@ -2803,15 +3399,15 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2803
3399
|
`header-${indexCol}`
|
|
2804
3400
|
);
|
|
2805
3401
|
} else {
|
|
2806
|
-
return /* @__PURE__ */ (0,
|
|
2807
|
-
|
|
3402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3403
|
+
import_react14.Fragment,
|
|
2808
3404
|
{
|
|
2809
|
-
children: col.visible !== false && /* @__PURE__ */ (0,
|
|
3405
|
+
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2810
3406
|
"th",
|
|
2811
3407
|
{
|
|
2812
3408
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2813
3409
|
colSpan: col.columns?.length ?? 1,
|
|
2814
|
-
className: (0,
|
|
3410
|
+
className: (0, import_classnames12.default)(
|
|
2815
3411
|
`r-headercell fix-${col.fixedType}`,
|
|
2816
3412
|
{ "cell-fixed": col.fixedType }
|
|
2817
3413
|
),
|
|
@@ -2823,7 +3419,7 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2823
3419
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2824
3420
|
maxWidth: col.maxWidth
|
|
2825
3421
|
},
|
|
2826
|
-
children: /* @__PURE__ */ (0,
|
|
3422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2827
3423
|
"div",
|
|
2828
3424
|
{
|
|
2829
3425
|
role: "textbox",
|
|
@@ -2841,10 +3437,10 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2841
3437
|
}
|
|
2842
3438
|
};
|
|
2843
3439
|
const renderFooterCol = (col, indexCol) => {
|
|
2844
|
-
return /* @__PURE__ */ (0,
|
|
3440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2845
3441
|
"td",
|
|
2846
3442
|
{
|
|
2847
|
-
className: (0,
|
|
3443
|
+
className: (0, import_classnames12.default)(
|
|
2848
3444
|
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
2849
3445
|
{ "cell-fixed": col.fixedType }
|
|
2850
3446
|
),
|
|
@@ -2856,56 +3452,56 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2856
3452
|
maxWidth: col.maxWidth,
|
|
2857
3453
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2858
3454
|
},
|
|
2859
|
-
children: /* @__PURE__ */ (0,
|
|
3455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
2860
3456
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2861
3457
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2862
3458
|
}
|
|
2863
3459
|
) }, `summarycell-${indexCol}`);
|
|
2864
3460
|
};
|
|
2865
3461
|
const renderToolbarTop = () => {
|
|
2866
|
-
return /* @__PURE__ */ (0,
|
|
2867
|
-
/* @__PURE__ */ (0,
|
|
2868
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
3464
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
2869
3465
|
}) }),
|
|
2870
|
-
/* @__PURE__ */ (0,
|
|
2871
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
3467
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
2872
3468
|
}) }),
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
2874
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
3470
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
2875
3471
|
}) })
|
|
2876
3472
|
] }) });
|
|
2877
3473
|
};
|
|
2878
3474
|
const renderToolbarBottom = () => {
|
|
2879
|
-
return /* @__PURE__ */ (0,
|
|
2880
|
-
/* @__PURE__ */ (0,
|
|
2881
|
-
/* @__PURE__ */ (0,
|
|
2882
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0,
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
3475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "r-toolbar-left", children: [
|
|
3477
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.Button, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
3478
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
3479
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.Button, { color: "success", outline: true, onClick: () => {
|
|
2884
3480
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
2885
3481
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2888
|
-
] }) : /* @__PURE__ */ (0,
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.Button, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.Button, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
3484
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: " " }),
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.Button, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
2890
3486
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2891
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3487
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
2892
3488
|
})
|
|
2893
3489
|
] }),
|
|
2894
|
-
/* @__PURE__ */ (0,
|
|
2895
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3491
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
2896
3492
|
}) }),
|
|
2897
|
-
/* @__PURE__ */ (0,
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "r-toolbar-right", children: [
|
|
2898
3494
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2899
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3495
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
2900
3496
|
}),
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2905
|
-
/* @__PURE__ */ (0,
|
|
2906
|
-
/* @__PURE__ */ (0,
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
2908
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_becoxy_icons6.Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_classnames12.default)("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_reactstrap9.UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.DropdownToggle, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_becoxy_icons6.Info, { className: "cursor-pointer" }) }),
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.DropdownMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" })
|
|
2909
3505
|
] }) })
|
|
2910
3506
|
] }) })
|
|
2911
3507
|
] })
|
|
@@ -2934,10 +3530,10 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2934
3530
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2935
3531
|
if (flagDisplay) {
|
|
2936
3532
|
countDisplay++;
|
|
2937
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2938
3534
|
"tr",
|
|
2939
3535
|
{
|
|
2940
|
-
className: (0,
|
|
3536
|
+
className: (0, import_classnames12.default)("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
2941
3537
|
children: contentColumns.map((col, indexCol) => {
|
|
2942
3538
|
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
2943
3539
|
})
|
|
@@ -2948,29 +3544,29 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2948
3544
|
}
|
|
2949
3545
|
});
|
|
2950
3546
|
};
|
|
2951
|
-
(0,
|
|
3547
|
+
(0, import_react14.useEffect)(() => {
|
|
2952
3548
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
2953
3549
|
pagingSetting?.setCurrentPage(1);
|
|
2954
3550
|
}
|
|
2955
3551
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
2956
|
-
return /* @__PURE__ */ (0,
|
|
2957
|
-
/* @__PURE__ */ (0,
|
|
2958
|
-
/* @__PURE__ */ (0,
|
|
2959
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0,
|
|
2960
|
-
/* @__PURE__ */ (0,
|
|
2961
|
-
/* @__PURE__ */ (0,
|
|
2962
|
-
return /* @__PURE__ */ (0,
|
|
3552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react14.Fragment, { children: [
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "react-table-edit", children: [
|
|
3554
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "r-grid", ref: gridRef, children: [
|
|
3555
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: renderToolbarTop() }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {}),
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { style: { width: "100%" }, children: [
|
|
3557
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
2963
3559
|
return renderHeaderCol(col, index, indexParent);
|
|
2964
3560
|
}) }, indexParent);
|
|
2965
3561
|
}) }),
|
|
2966
|
-
/* @__PURE__ */ (0,
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
2968
3564
|
return renderFooterCol(col, index);
|
|
2969
|
-
}) }) : /* @__PURE__ */ (0,
|
|
3565
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {}) })
|
|
2970
3566
|
] }) }),
|
|
2971
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0,
|
|
3567
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: renderToolbarBottom() }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {})
|
|
2972
3568
|
] }),
|
|
2973
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */ (0,
|
|
3569
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2974
3570
|
PagingComponent,
|
|
2975
3571
|
{
|
|
2976
3572
|
onChangePage,
|
|
@@ -2980,9 +3576,9 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2980
3576
|
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
2981
3577
|
onChangePageSize
|
|
2982
3578
|
}
|
|
2983
|
-
) : /* @__PURE__ */ (0,
|
|
3579
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {})
|
|
2984
3580
|
] }),
|
|
2985
|
-
/* @__PURE__ */ (0,
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2986
3582
|
sidebar_setting_column_default,
|
|
2987
3583
|
{
|
|
2988
3584
|
handleSidebar: () => {
|
|
@@ -2998,12 +3594,12 @@ var TableEdit = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2998
3594
|
var table_default = TableEdit;
|
|
2999
3595
|
|
|
3000
3596
|
// test-app/src/component/tab-menu/index.tsx
|
|
3001
|
-
var
|
|
3002
|
-
var
|
|
3003
|
-
var
|
|
3597
|
+
var import_becoxy_icons7 = require("becoxy-icons");
|
|
3598
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
3599
|
+
var import_react15 = require("react");
|
|
3004
3600
|
var import_react_router_dom = require("react-router-dom");
|
|
3005
|
-
var
|
|
3006
|
-
var
|
|
3601
|
+
var import_reactstrap10 = require("reactstrap");
|
|
3602
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3007
3603
|
var TabsMenuComponent = ({
|
|
3008
3604
|
buttonWidth,
|
|
3009
3605
|
tabParent,
|
|
@@ -3015,14 +3611,14 @@ var TabsMenuComponent = ({
|
|
|
3015
3611
|
renderModal
|
|
3016
3612
|
}) => {
|
|
3017
3613
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
3018
|
-
const [dataMenu, setDataMenu] = (0,
|
|
3019
|
-
const [openMenu, setOpenMenu] = (0,
|
|
3020
|
-
const [url, setUrl] = (0,
|
|
3021
|
-
const [contentWidth, setContentWidth] = (0,
|
|
3022
|
-
const [componentWidth, setComponentWidth] = (0,
|
|
3023
|
-
const [scrollPosition, setScrollPosition] = (0,
|
|
3024
|
-
const [dataItem, setDataItem] = (0,
|
|
3025
|
-
const [openModal, setOpenModal] = (0,
|
|
3614
|
+
const [dataMenu, setDataMenu] = (0, import_react15.useState)([]);
|
|
3615
|
+
const [openMenu, setOpenMenu] = (0, import_react15.useState)(false);
|
|
3616
|
+
const [url, setUrl] = (0, import_react15.useState)("");
|
|
3617
|
+
const [contentWidth, setContentWidth] = (0, import_react15.useState)(0);
|
|
3618
|
+
const [componentWidth, setComponentWidth] = (0, import_react15.useState)(0);
|
|
3619
|
+
const [scrollPosition, setScrollPosition] = (0, import_react15.useState)(0);
|
|
3620
|
+
const [dataItem, setDataItem] = (0, import_react15.useState)([]);
|
|
3621
|
+
const [openModal, setOpenModal] = (0, import_react15.useState)({});
|
|
3026
3622
|
const handleWindowResize = () => {
|
|
3027
3623
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
3028
3624
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -3031,7 +3627,7 @@ var TabsMenuComponent = ({
|
|
|
3031
3627
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
3032
3628
|
}
|
|
3033
3629
|
};
|
|
3034
|
-
(0,
|
|
3630
|
+
(0, import_react15.useEffect)(() => {
|
|
3035
3631
|
setUrl(window.location.pathname);
|
|
3036
3632
|
window.addEventListener("resize", handleWindowResize);
|
|
3037
3633
|
setTimeout(() => {
|
|
@@ -3047,7 +3643,7 @@ var TabsMenuComponent = ({
|
|
|
3047
3643
|
window.removeEventListener("resize", handleWindowResize);
|
|
3048
3644
|
};
|
|
3049
3645
|
}, []);
|
|
3050
|
-
(0,
|
|
3646
|
+
(0, import_react15.useEffect)(() => {
|
|
3051
3647
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
3052
3648
|
if (item) {
|
|
3053
3649
|
if (resourceCodeParent) {
|
|
@@ -3078,23 +3674,23 @@ var TabsMenuComponent = ({
|
|
|
3078
3674
|
const handleModal = (name) => {
|
|
3079
3675
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
3080
3676
|
};
|
|
3081
|
-
return /* @__PURE__ */ (0,
|
|
3677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react15.Fragment, { children: [
|
|
3082
3678
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3084
|
-
/* @__PURE__ */ (0,
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_classnames13.default)("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3680
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3085
3681
|
"div",
|
|
3086
3682
|
{
|
|
3087
3683
|
onClick: () => handleScroll(-200),
|
|
3088
|
-
className: (0,
|
|
3089
|
-
children: /* @__PURE__ */ (0,
|
|
3684
|
+
className: (0, import_classnames13.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons7.ChevronLeft, {})
|
|
3090
3686
|
}
|
|
3091
3687
|
),
|
|
3092
|
-
/* @__PURE__ */ (0,
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3093
3689
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3094
|
-
return /* @__PURE__ */ (0,
|
|
3095
|
-
/* @__PURE__ */ (0,
|
|
3096
|
-
/* @__PURE__ */ (0,
|
|
3097
|
-
|
|
3690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_reactstrap10.UncontrolledDropdown, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.DropdownToggle, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: item.name }) }),
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.DropdownMenu, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3693
|
+
import_reactstrap10.DropdownItem,
|
|
3098
3694
|
{
|
|
3099
3695
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
3100
3696
|
onClick: () => {
|
|
@@ -3110,23 +3706,23 @@ var TabsMenuComponent = ({
|
|
|
3110
3706
|
)) })
|
|
3111
3707
|
] }, item.code);
|
|
3112
3708
|
} else {
|
|
3113
|
-
return /* @__PURE__ */ (0,
|
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3114
3710
|
import_react_router_dom.Link,
|
|
3115
3711
|
{
|
|
3116
3712
|
to: item.url,
|
|
3117
|
-
className: (0,
|
|
3713
|
+
className: (0, import_classnames13.default)("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3118
3714
|
children: item.name
|
|
3119
3715
|
},
|
|
3120
3716
|
item.code
|
|
3121
3717
|
);
|
|
3122
3718
|
}
|
|
3123
3719
|
}) }) }),
|
|
3124
|
-
/* @__PURE__ */ (0,
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3125
3721
|
"div",
|
|
3126
3722
|
{
|
|
3127
3723
|
onClick: () => handleScroll(200),
|
|
3128
|
-
className: (0,
|
|
3129
|
-
children: /* @__PURE__ */ (0,
|
|
3724
|
+
className: (0, import_classnames13.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons7.ChevronRight, {})
|
|
3130
3726
|
}
|
|
3131
3727
|
)
|
|
3132
3728
|
] })
|