react-table-edit 0.5.5 → 0.5.7
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 +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +758 -189
- package/dist/index.mjs +759 -182
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// test-app/src/component/table/index.tsx
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { Button as
|
|
4
|
-
import
|
|
5
|
-
import { useTranslation as
|
|
2
|
+
import { Fragment as Fragment15, forwardRef as forwardRef3, useEffect as useEffect8, useImperativeHandle, useRef as useRef3, useState as useState7 } from "react";
|
|
3
|
+
import { Button as Button4, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, Input as Input7, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
|
|
4
|
+
import classnames7 from "classnames";
|
|
5
|
+
import { useTranslation as useTranslation10 } from "react-i18next";
|
|
6
6
|
import Select3 from "react-select";
|
|
7
7
|
import AsyncSelect from "react-select/async";
|
|
8
8
|
import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
|
|
@@ -293,7 +293,7 @@ var IconCustom = (props) => {
|
|
|
293
293
|
var icon_default = IconCustom;
|
|
294
294
|
|
|
295
295
|
// test-app/src/component/table/index.tsx
|
|
296
|
-
import
|
|
296
|
+
import moment2 from "moment";
|
|
297
297
|
|
|
298
298
|
// test-app/src/component/edit-form/index.tsx
|
|
299
299
|
import { forwardRef, useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
@@ -1470,7 +1470,8 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
1470
1470
|
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
1471
1471
|
},
|
|
1472
1472
|
children: index
|
|
1473
|
-
}
|
|
1473
|
+
},
|
|
1474
|
+
`page-${index}`
|
|
1474
1475
|
)
|
|
1475
1476
|
);
|
|
1476
1477
|
}
|
|
@@ -1526,10 +1527,533 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
1526
1527
|
] }) });
|
|
1527
1528
|
};
|
|
1528
1529
|
|
|
1529
|
-
// test-app/src/component/table/index.tsx
|
|
1530
|
+
// test-app/src/component/select-table/index.tsx
|
|
1531
|
+
import { forwardRef as forwardRef2, Fragment as Fragment13, useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
|
|
1532
|
+
import {
|
|
1533
|
+
DropdownItem as DropdownItem2,
|
|
1534
|
+
DropdownMenu as DropdownMenu2,
|
|
1535
|
+
DropdownToggle as DropdownToggle2,
|
|
1536
|
+
Dropdown as Dropdown2,
|
|
1537
|
+
Button as Button3,
|
|
1538
|
+
UncontrolledTooltip,
|
|
1539
|
+
Input as Input6
|
|
1540
|
+
} from "reactstrap";
|
|
1541
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
1542
|
+
import classnames6 from "classnames";
|
|
1543
|
+
import moment from "moment";
|
|
1544
|
+
import { Plus as Plus2 } from "becoxy-icons";
|
|
1530
1545
|
import { Fragment as Fragment14, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1531
|
-
var
|
|
1546
|
+
var defaultMaxHeight = 300;
|
|
1547
|
+
var SelectTable = forwardRef2((props, ref) => {
|
|
1548
|
+
const {
|
|
1549
|
+
id,
|
|
1550
|
+
menuWidth,
|
|
1551
|
+
invalid,
|
|
1552
|
+
onKeyDown,
|
|
1553
|
+
placeholder,
|
|
1554
|
+
textAlign,
|
|
1555
|
+
options,
|
|
1556
|
+
columns,
|
|
1557
|
+
decimalSeparator,
|
|
1558
|
+
thousandSeparator,
|
|
1559
|
+
onChange,
|
|
1560
|
+
value,
|
|
1561
|
+
fieldValue,
|
|
1562
|
+
fieldLabel,
|
|
1563
|
+
loadOptions,
|
|
1564
|
+
maxHeight,
|
|
1565
|
+
handleAdd,
|
|
1566
|
+
isClearable,
|
|
1567
|
+
component,
|
|
1568
|
+
isMulti
|
|
1569
|
+
} = props;
|
|
1570
|
+
const selectTableRef = useRef2();
|
|
1571
|
+
const selectMenuTableRef = useRef2();
|
|
1572
|
+
const inputRef = useRef2();
|
|
1573
|
+
const [dropdownOpen, setDropdownOpen] = useState6(false);
|
|
1574
|
+
const [indexFocus, setIndexFocus] = useState6(-1);
|
|
1575
|
+
const [isFocus, setIsFocus] = useState6(false);
|
|
1576
|
+
const [searchTerm, setSearchTerm] = useState6("");
|
|
1577
|
+
const [optionsLoad, setOptionsLoad] = useState6();
|
|
1532
1578
|
const { t } = useTranslation9();
|
|
1579
|
+
const defaultColumns = [
|
|
1580
|
+
{
|
|
1581
|
+
field: "key",
|
|
1582
|
+
headerText: "Code",
|
|
1583
|
+
width: 100,
|
|
1584
|
+
maxWidth: 120,
|
|
1585
|
+
minWidth: 80
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
headerText: "Name",
|
|
1589
|
+
field: "label",
|
|
1590
|
+
width: 150,
|
|
1591
|
+
maxWidth: 200,
|
|
1592
|
+
minWidth: 250
|
|
1593
|
+
}
|
|
1594
|
+
];
|
|
1595
|
+
const closeMenu = () => {
|
|
1596
|
+
setDropdownOpen(false);
|
|
1597
|
+
};
|
|
1598
|
+
useEffect7(() => {
|
|
1599
|
+
if (dropdownOpen) {
|
|
1600
|
+
if (value) {
|
|
1601
|
+
if (selectMenuTableRef) {
|
|
1602
|
+
const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
|
|
1603
|
+
if (elementFocus) {
|
|
1604
|
+
const rect = elementFocus.getBoundingClientRect();
|
|
1605
|
+
const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
|
|
1606
|
+
if (rect.top < parentRect.top || rect.bottom > parentRect.bottom) {
|
|
1607
|
+
selectMenuTableRef.current.scrollTo({
|
|
1608
|
+
top: elementFocus.offsetTop,
|
|
1609
|
+
behavior: "smooth"
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
}, [dropdownOpen]);
|
|
1617
|
+
let timeOutBlur;
|
|
1618
|
+
useEffect7(() => {
|
|
1619
|
+
if (inputRef) {
|
|
1620
|
+
inputRef.current.addEventListener("blur", function() {
|
|
1621
|
+
timeOutBlur = setTimeout(() => {
|
|
1622
|
+
if (document.activeElement?.className !== "select-input" && !selectTableRef.current?.contains(document.activeElement)) {
|
|
1623
|
+
setDropdownOpen(false);
|
|
1624
|
+
setIsFocus(false);
|
|
1625
|
+
}
|
|
1626
|
+
}, 100);
|
|
1627
|
+
});
|
|
1628
|
+
inputRef.current.addEventListener("focus", function() {
|
|
1629
|
+
if (!isFocus) {
|
|
1630
|
+
setIsFocus(true);
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
}, [inputRef]);
|
|
1635
|
+
useEffect7(() => {
|
|
1636
|
+
if (searchTerm && !dropdownOpen) {
|
|
1637
|
+
setDropdownOpen(true);
|
|
1638
|
+
setIndexFocus(0);
|
|
1639
|
+
}
|
|
1640
|
+
}, [searchTerm]);
|
|
1641
|
+
const handleOpenClose = () => {
|
|
1642
|
+
setSearchTerm("");
|
|
1643
|
+
if (dropdownOpen) {
|
|
1644
|
+
closeMenu();
|
|
1645
|
+
} else {
|
|
1646
|
+
setDropdownOpen(true);
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
|
|
1650
|
+
const handleOnKeyDown = (e) => {
|
|
1651
|
+
let key = "";
|
|
1652
|
+
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
|
|
1653
|
+
key = onKeyDown(e);
|
|
1654
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1655
|
+
closeMenu();
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
let flag = false;
|
|
1659
|
+
if (!key) {
|
|
1660
|
+
if (e.code === "F9") {
|
|
1661
|
+
handleAdd();
|
|
1662
|
+
flag = true;
|
|
1663
|
+
} else if (e.code === "Escape" || e.code === "Space") {
|
|
1664
|
+
if (dropdownOpen) {
|
|
1665
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
1666
|
+
}
|
|
1667
|
+
if (!searchTerm) {
|
|
1668
|
+
handleOpenClose();
|
|
1669
|
+
flag = true;
|
|
1670
|
+
}
|
|
1671
|
+
} else if (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter") {
|
|
1672
|
+
if (dropdownOpen) {
|
|
1673
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
1674
|
+
handleOpenClose();
|
|
1675
|
+
flag = true;
|
|
1676
|
+
}
|
|
1677
|
+
} else if (e.code === "ArrowDown") {
|
|
1678
|
+
if (dropdownOpen) {
|
|
1679
|
+
let newIndex = 0;
|
|
1680
|
+
if (indexFocus >= 0) {
|
|
1681
|
+
newIndex = indexFocus + 1;
|
|
1682
|
+
} else if (value) {
|
|
1683
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) + 1;
|
|
1684
|
+
}
|
|
1685
|
+
if (newIndex < (optionsLoad ? optionsLoad : options).length) {
|
|
1686
|
+
setIndexFocus(newIndex);
|
|
1687
|
+
checkIfElementIsOutOfScroll(0);
|
|
1688
|
+
} else {
|
|
1689
|
+
setIndexFocus(0);
|
|
1690
|
+
checkIfElementIsOutOfScroll(1);
|
|
1691
|
+
}
|
|
1692
|
+
flag = true;
|
|
1693
|
+
} else {
|
|
1694
|
+
handleOpenClose();
|
|
1695
|
+
flag = true;
|
|
1696
|
+
}
|
|
1697
|
+
} else if (e.code === "ArrowUp") {
|
|
1698
|
+
if (dropdownOpen) {
|
|
1699
|
+
let newIndex = 0;
|
|
1700
|
+
if (indexFocus >= 0) {
|
|
1701
|
+
newIndex = indexFocus - 1;
|
|
1702
|
+
} else if (value) {
|
|
1703
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) - 1;
|
|
1704
|
+
}
|
|
1705
|
+
if (newIndex >= 0) {
|
|
1706
|
+
setIndexFocus(newIndex);
|
|
1707
|
+
checkIfElementIsOutOfScroll(2);
|
|
1708
|
+
} else {
|
|
1709
|
+
setIndexFocus((optionsLoad ? optionsLoad : options).length - 1);
|
|
1710
|
+
checkIfElementIsOutOfScroll(3);
|
|
1711
|
+
}
|
|
1712
|
+
flag = true;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
if (flag) {
|
|
1717
|
+
e.stopPropagation();
|
|
1718
|
+
e.preventDefault();
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
const checkIfElementIsOutOfScroll = (flag) => {
|
|
1722
|
+
if (selectMenuTableRef) {
|
|
1723
|
+
const elementFocus = document.getElementById(`row-select-table-${indexFocus}`);
|
|
1724
|
+
if (elementFocus) {
|
|
1725
|
+
const rect = elementFocus.getBoundingClientRect();
|
|
1726
|
+
const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
|
|
1727
|
+
if (flag === 1) {
|
|
1728
|
+
scrollToElement(selectMenuTableRef.current, 0);
|
|
1729
|
+
} else if (flag === 3) {
|
|
1730
|
+
scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
|
|
1731
|
+
} else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
|
|
1732
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
|
|
1733
|
+
} else if (flag === 2 && rect.top < parentRect.top + 50) {
|
|
1734
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
let timeOutElement;
|
|
1740
|
+
const scrollToElement = (elemment, top) => {
|
|
1741
|
+
clearTimeout(timeOutElement);
|
|
1742
|
+
timeOutElement = setTimeout(() => {
|
|
1743
|
+
elemment.scrollTo({
|
|
1744
|
+
top
|
|
1745
|
+
});
|
|
1746
|
+
}, 100);
|
|
1747
|
+
};
|
|
1748
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
1749
|
+
return /* @__PURE__ */ jsx13(
|
|
1750
|
+
Fragment13,
|
|
1751
|
+
{
|
|
1752
|
+
children: col.visible !== false && /* @__PURE__ */ jsx13(
|
|
1753
|
+
"th",
|
|
1754
|
+
{
|
|
1755
|
+
className: classnames6(
|
|
1756
|
+
`r-select-headercell fix-${col.fixedType}`,
|
|
1757
|
+
{ "cell-fixed": col.fixedType }
|
|
1758
|
+
),
|
|
1759
|
+
style: {
|
|
1760
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
1761
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1762
|
+
top: `${0 * 35}px`,
|
|
1763
|
+
maxWidth: col.maxWidth
|
|
1764
|
+
},
|
|
1765
|
+
children: /* @__PURE__ */ jsx13(
|
|
1766
|
+
"div",
|
|
1767
|
+
{
|
|
1768
|
+
role: "textbox",
|
|
1769
|
+
title: t(col.headerText ?? ""),
|
|
1770
|
+
style: {
|
|
1771
|
+
height: `${1 * 35}px`,
|
|
1772
|
+
justifyContent: col.textAlign ?? "left"
|
|
1773
|
+
},
|
|
1774
|
+
className: "r-select-headercell-div",
|
|
1775
|
+
children: t(col.headerText ?? "")
|
|
1776
|
+
}
|
|
1777
|
+
)
|
|
1778
|
+
}
|
|
1779
|
+
)
|
|
1780
|
+
},
|
|
1781
|
+
`header-select-${indexCol}`
|
|
1782
|
+
);
|
|
1783
|
+
};
|
|
1784
|
+
const checkSearch = (keyword, data, columnsSearch) => {
|
|
1785
|
+
if (!keyword || columnsSearch.length === 0) {
|
|
1786
|
+
return true;
|
|
1787
|
+
}
|
|
1788
|
+
for (let index = 0; index < columnsSearch.length; index++) {
|
|
1789
|
+
const key = columnsSearch[index].field.trim();
|
|
1790
|
+
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
1791
|
+
return true;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
return false;
|
|
1795
|
+
};
|
|
1796
|
+
const callbackLoadOption = (rs) => {
|
|
1797
|
+
setOptionsLoad(rs);
|
|
1798
|
+
};
|
|
1799
|
+
useEffect7(() => {
|
|
1800
|
+
if (!searchTerm) {
|
|
1801
|
+
setOptionsLoad(void 0);
|
|
1802
|
+
}
|
|
1803
|
+
}, [searchTerm]);
|
|
1804
|
+
const checkOverflow = (element) => {
|
|
1805
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
1806
|
+
};
|
|
1807
|
+
return /* @__PURE__ */ jsx13(
|
|
1808
|
+
"div",
|
|
1809
|
+
{
|
|
1810
|
+
className: "react-select-table",
|
|
1811
|
+
ref,
|
|
1812
|
+
id,
|
|
1813
|
+
children: /* @__PURE__ */ jsx13("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs12(
|
|
1814
|
+
Dropdown2,
|
|
1815
|
+
{
|
|
1816
|
+
isOpen: dropdownOpen,
|
|
1817
|
+
toggle: () => {
|
|
1818
|
+
},
|
|
1819
|
+
children: [
|
|
1820
|
+
/* @__PURE__ */ jsxs12(
|
|
1821
|
+
DropdownToggle2,
|
|
1822
|
+
{
|
|
1823
|
+
onClick: () => {
|
|
1824
|
+
inputRef?.current.focus();
|
|
1825
|
+
clearTimeout(timeOutBlur);
|
|
1826
|
+
handleOpenClose();
|
|
1827
|
+
},
|
|
1828
|
+
tabIndex: 0,
|
|
1829
|
+
tag: "div",
|
|
1830
|
+
className: classnames6("select-table-control", { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
1831
|
+
children: [
|
|
1832
|
+
/* @__PURE__ */ jsxs12("div", { className: "select-table-container", children: [
|
|
1833
|
+
isMulti ? /* @__PURE__ */ jsx13(Fragment14, { children: /* @__PURE__ */ jsx13("div", { className: classnames6("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
|
|
1834
|
+
return /* @__PURE__ */ jsxs12("span", { children: [
|
|
1835
|
+
index === 0 ? "" : ", ",
|
|
1836
|
+
ele[fieldLabel ?? "label"]
|
|
1837
|
+
] }, index);
|
|
1838
|
+
}) }) }) : /* @__PURE__ */ jsx13(Fragment14, { children: /* @__PURE__ */ jsxs12("div", { className: classnames6("select-value", { "d-none": searchTerm }), children: [
|
|
1839
|
+
value ? value[fieldLabel ?? "label"] : "",
|
|
1840
|
+
" "
|
|
1841
|
+
] }) }),
|
|
1842
|
+
/* @__PURE__ */ jsx13("div", { className: classnames6("select-placeholder", { "d-none": (isMulti ? value?.length > 0 : value) || searchTerm }), children: placeholder }),
|
|
1843
|
+
/* @__PURE__ */ jsx13("div", { className: "input-container", children: /* @__PURE__ */ jsx13(
|
|
1844
|
+
"input",
|
|
1845
|
+
{
|
|
1846
|
+
style: { textAlign: textAlign ?? "left" },
|
|
1847
|
+
ref: inputRef,
|
|
1848
|
+
className: classnames6("select-input"),
|
|
1849
|
+
value: searchTerm,
|
|
1850
|
+
onChange: (val) => {
|
|
1851
|
+
if (loadOptions && val.target.value) {
|
|
1852
|
+
loadOptions(val.target.value, callbackLoadOption);
|
|
1853
|
+
}
|
|
1854
|
+
setSearchTerm(val.target.value);
|
|
1855
|
+
},
|
|
1856
|
+
onKeyDown: (e) => handleOnKeyDown(e)
|
|
1857
|
+
}
|
|
1858
|
+
) })
|
|
1859
|
+
] }),
|
|
1860
|
+
/* @__PURE__ */ jsx13(
|
|
1861
|
+
"div",
|
|
1862
|
+
{
|
|
1863
|
+
className: classnames6("select-table-indicator cursor-pointer", { "d-none": !isClearable || !value }),
|
|
1864
|
+
onClick: (e) => {
|
|
1865
|
+
onChange(isMulti ? [] : void 0);
|
|
1866
|
+
e.stopPropagation();
|
|
1867
|
+
},
|
|
1868
|
+
children: /* @__PURE__ */ jsx13("svg", { height: "20", width: "20", style: { color: "#c4c4c4" }, viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx13("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" }) })
|
|
1869
|
+
}
|
|
1870
|
+
),
|
|
1871
|
+
/* @__PURE__ */ jsx13("div", { className: "select-table-indicator", children: /* @__PURE__ */ jsx13("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__ */ jsx13("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" }) }) })
|
|
1872
|
+
]
|
|
1873
|
+
}
|
|
1874
|
+
),
|
|
1875
|
+
/* @__PURE__ */ jsx13(
|
|
1876
|
+
DropdownMenu2,
|
|
1877
|
+
{
|
|
1878
|
+
container: component,
|
|
1879
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
1880
|
+
style: {
|
|
1881
|
+
width: menuWidth ? menuWidth : "min-content",
|
|
1882
|
+
position: "fixed",
|
|
1883
|
+
zIndex: 9999
|
|
1884
|
+
},
|
|
1885
|
+
children: /* @__PURE__ */ jsx13(DropdownItem2, { className: classnames6("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: /* @__PURE__ */ jsx13(
|
|
1886
|
+
"div",
|
|
1887
|
+
{
|
|
1888
|
+
onMouseDown: (e) => {
|
|
1889
|
+
inputRef?.current.focus();
|
|
1890
|
+
clearTimeout(timeOutBlur);
|
|
1891
|
+
e.preventDefault();
|
|
1892
|
+
},
|
|
1893
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "r-select-grid", children: [
|
|
1894
|
+
/* @__PURE__ */ jsx13("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsxs12("table", { style: { width: "100%" }, children: [
|
|
1895
|
+
/* @__PURE__ */ jsx13("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs12("tr", { className: "r-select-row", role: "row", children: [
|
|
1896
|
+
isMulti && /* @__PURE__ */ jsx13("th", { className: classnames6(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ jsx13(
|
|
1897
|
+
"div",
|
|
1898
|
+
{
|
|
1899
|
+
style: { justifyContent: "center" },
|
|
1900
|
+
className: classnames6("r-select-headercell-div"),
|
|
1901
|
+
children: /* @__PURE__ */ jsx13(
|
|
1902
|
+
Input6,
|
|
1903
|
+
{
|
|
1904
|
+
checked: (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length,
|
|
1905
|
+
type: "checkbox",
|
|
1906
|
+
className: classnames6("cursor-pointer", { "d-none": !isMulti }),
|
|
1907
|
+
style: { textAlign: "center", marginTop: 6 },
|
|
1908
|
+
onChange: (e) => {
|
|
1909
|
+
if (isMulti) {
|
|
1910
|
+
if (e.target.checked) {
|
|
1911
|
+
onChange((optionsLoad ? optionsLoad : options).map((item) => {
|
|
1912
|
+
return item;
|
|
1913
|
+
}));
|
|
1914
|
+
} else {
|
|
1915
|
+
onChange([]);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
)
|
|
1921
|
+
}
|
|
1922
|
+
) }),
|
|
1923
|
+
(columns ? columns : defaultColumns).map((col, index) => {
|
|
1924
|
+
return renderHeaderCol(col, index);
|
|
1925
|
+
})
|
|
1926
|
+
] }) }),
|
|
1927
|
+
(optionsLoad ? optionsLoad : options).length > 0 ? /* @__PURE__ */ jsx13(Fragment14, { children: /* @__PURE__ */ jsx13("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
|
|
1928
|
+
if (loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
1929
|
+
const refRow = useRef2(null);
|
|
1930
|
+
const isSelected = isMulti && value?.some((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1931
|
+
return /* @__PURE__ */ jsxs12(
|
|
1932
|
+
"tr",
|
|
1933
|
+
{
|
|
1934
|
+
id: `row-select-table-${indexRow}`,
|
|
1935
|
+
className: classnames6("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
1936
|
+
children: [
|
|
1937
|
+
isMulti && /* @__PURE__ */ jsx13(
|
|
1938
|
+
"td",
|
|
1939
|
+
{
|
|
1940
|
+
className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
1941
|
+
style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
|
|
1942
|
+
onClick: (e) => {
|
|
1943
|
+
if (isMulti) {
|
|
1944
|
+
const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1945
|
+
if (index > -1) {
|
|
1946
|
+
value?.splice(index, 1);
|
|
1947
|
+
onChange(value);
|
|
1948
|
+
} else {
|
|
1949
|
+
if (value) {
|
|
1950
|
+
value?.push(row);
|
|
1951
|
+
onChange(value);
|
|
1952
|
+
} else {
|
|
1953
|
+
onChange([row]);
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
e.stopPropagation();
|
|
1957
|
+
}
|
|
1958
|
+
},
|
|
1959
|
+
children: /* @__PURE__ */ jsx13(
|
|
1960
|
+
Input6,
|
|
1961
|
+
{
|
|
1962
|
+
checked: isSelected,
|
|
1963
|
+
type: "checkbox",
|
|
1964
|
+
className: "cursor-pointer",
|
|
1965
|
+
onChange: () => {
|
|
1966
|
+
},
|
|
1967
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
1968
|
+
}
|
|
1969
|
+
)
|
|
1970
|
+
}
|
|
1971
|
+
),
|
|
1972
|
+
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
1973
|
+
let valueDisplay = row[col.field];
|
|
1974
|
+
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
1975
|
+
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
1976
|
+
} else if (col.type === "date") {
|
|
1977
|
+
valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy") : "";
|
|
1978
|
+
} else if (col.type === "datetime") {
|
|
1979
|
+
valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
|
|
1980
|
+
}
|
|
1981
|
+
return /* @__PURE__ */ jsxs12(Fragment13, { children: [
|
|
1982
|
+
col.visible !== false && /* @__PURE__ */ jsx13(
|
|
1983
|
+
"td",
|
|
1984
|
+
{
|
|
1985
|
+
id: `content-select-${indexRow}-${indexCol}`,
|
|
1986
|
+
ref: refRow,
|
|
1987
|
+
className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
1988
|
+
style: {
|
|
1989
|
+
minWidth: col.minWidth,
|
|
1990
|
+
width: col.width,
|
|
1991
|
+
maxWidth: col.maxWidth,
|
|
1992
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
1993
|
+
},
|
|
1994
|
+
onClick: (e) => {
|
|
1995
|
+
if (isMulti) {
|
|
1996
|
+
const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1997
|
+
if (index > -1) {
|
|
1998
|
+
value?.splice(index, 1);
|
|
1999
|
+
onChange(value);
|
|
2000
|
+
} else {
|
|
2001
|
+
if (value) {
|
|
2002
|
+
value?.push(row);
|
|
2003
|
+
onChange(value);
|
|
2004
|
+
} else {
|
|
2005
|
+
onChange([row]);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
} else {
|
|
2009
|
+
onChange(row);
|
|
2010
|
+
closeMenu();
|
|
2011
|
+
}
|
|
2012
|
+
e.preventDefault();
|
|
2013
|
+
e.stopPropagation();
|
|
2014
|
+
},
|
|
2015
|
+
onMouseMove: (e) => {
|
|
2016
|
+
if (indexRow !== indexFocus) {
|
|
2017
|
+
setIndexFocus(indexRow);
|
|
2018
|
+
}
|
|
2019
|
+
e.stopPropagation();
|
|
2020
|
+
},
|
|
2021
|
+
children: col.template ? col.template(row, indexRow) : valueDisplay
|
|
2022
|
+
},
|
|
2023
|
+
`col-${indexRow}-${indexCol}`
|
|
2024
|
+
),
|
|
2025
|
+
checkOverflow(refRow.current) && /* @__PURE__ */ jsx13(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-select-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
2026
|
+
] }, indexCol);
|
|
2027
|
+
})
|
|
2028
|
+
]
|
|
2029
|
+
},
|
|
2030
|
+
`row-${indexRow}`
|
|
2031
|
+
);
|
|
2032
|
+
}
|
|
2033
|
+
}) }) }) : /* @__PURE__ */ jsx13("div", { className: "r-no-data", children: t("No data available.") })
|
|
2034
|
+
] }) }),
|
|
2035
|
+
/* @__PURE__ */ jsx13("div", { className: "r-select-footer", children: /* @__PURE__ */ jsxs12(Button3, { outline: true, color: "primary", className: "r-btn-add d-flex align-items-center", onClick: handleAdd, children: [
|
|
2036
|
+
/* @__PURE__ */ jsx13(Plus2, { className: "me-50", fontSize: 16 }),
|
|
2037
|
+
t("AddNew"),
|
|
2038
|
+
" (F9)"
|
|
2039
|
+
] }) })
|
|
2040
|
+
] })
|
|
2041
|
+
}
|
|
2042
|
+
) })
|
|
2043
|
+
}
|
|
2044
|
+
)
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
) })
|
|
2048
|
+
}
|
|
2049
|
+
);
|
|
2050
|
+
});
|
|
2051
|
+
var select_table_default = SelectTable;
|
|
2052
|
+
|
|
2053
|
+
// test-app/src/component/table/index.tsx
|
|
2054
|
+
import { Fragment as Fragment16, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2055
|
+
var TableEdit = forwardRef3((props, ref) => {
|
|
2056
|
+
const { t } = useTranslation10();
|
|
1533
2057
|
const {
|
|
1534
2058
|
idTable,
|
|
1535
2059
|
dataSource,
|
|
@@ -1562,31 +2086,31 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1562
2086
|
refeshFocusRow: handleRefeshRow
|
|
1563
2087
|
};
|
|
1564
2088
|
});
|
|
1565
|
-
const [refreshRow, setRefreshRow] =
|
|
1566
|
-
const [indexFocus, setIndexFocus] =
|
|
1567
|
-
const [selectedRows, setSelectedRows] =
|
|
1568
|
-
const [headerColumns, setHeaderColumns] =
|
|
1569
|
-
const [contentColumns, setContentColumns] =
|
|
1570
|
-
const [levelCol, setLevelCol] =
|
|
1571
|
-
const [columnFistEdit, setColumnFistEdit] =
|
|
1572
|
-
const [columnLastEdit, setColumnlastEdit] =
|
|
1573
|
-
const [objWidthFix, setObjWidthFix] =
|
|
1574
|
-
const [openPopupTree, setOpenPopupTree] =
|
|
1575
|
-
const [openPopupSetupColumn, setOpenPopupSetupColumn] =
|
|
1576
|
-
const [searchTerm, setSearchTerm] =
|
|
1577
|
-
const tableElement =
|
|
1578
|
-
const gridRef =
|
|
2089
|
+
const [refreshRow, setRefreshRow] = useState7(false);
|
|
2090
|
+
const [indexFocus, setIndexFocus] = useState7();
|
|
2091
|
+
const [selectedRows, setSelectedRows] = useState7([]);
|
|
2092
|
+
const [headerColumns, setHeaderColumns] = useState7([[]]);
|
|
2093
|
+
const [contentColumns, setContentColumns] = useState7([]);
|
|
2094
|
+
const [levelCol, setLevelCol] = useState7(0);
|
|
2095
|
+
const [columnFistEdit, setColumnFistEdit] = useState7(0);
|
|
2096
|
+
const [columnLastEdit, setColumnlastEdit] = useState7(0);
|
|
2097
|
+
const [objWidthFix, setObjWidthFix] = useState7({});
|
|
2098
|
+
const [openPopupTree, setOpenPopupTree] = useState7(false);
|
|
2099
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState7(false);
|
|
2100
|
+
const [searchTerm, setSearchTerm] = useState7("");
|
|
2101
|
+
const tableElement = useRef3(null);
|
|
2102
|
+
const gridRef = useRef3();
|
|
1579
2103
|
let totalCount = dataSource.length;
|
|
1580
2104
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
1581
2105
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
1582
2106
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
1583
2107
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
1584
|
-
|
|
2108
|
+
useEffect8(() => {
|
|
1585
2109
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
1586
2110
|
pagingSetting.setCurrentPage(1);
|
|
1587
2111
|
}
|
|
1588
2112
|
}, [dataSource]);
|
|
1589
|
-
|
|
2113
|
+
useEffect8(() => {
|
|
1590
2114
|
let indexFirst = -1;
|
|
1591
2115
|
let indexlast = -1;
|
|
1592
2116
|
let letfWidthFix = 0;
|
|
@@ -1619,7 +2143,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1619
2143
|
setColumnFistEdit(indexFirst + 1);
|
|
1620
2144
|
setColumnlastEdit(indexlast + 1);
|
|
1621
2145
|
}, [contentColumns]);
|
|
1622
|
-
|
|
2146
|
+
useEffect8(() => {
|
|
1623
2147
|
const arrHeaderColumns = [];
|
|
1624
2148
|
const arrContentColumns = [];
|
|
1625
2149
|
let headerLevelRow = 0;
|
|
@@ -1636,7 +2160,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1636
2160
|
setHeaderColumns(arrHeaderColumns);
|
|
1637
2161
|
setContentColumns(arrContentColumns);
|
|
1638
2162
|
}, [columns]);
|
|
1639
|
-
|
|
2163
|
+
useEffect8(() => {
|
|
1640
2164
|
const arrHeaderColumns = [];
|
|
1641
2165
|
const arrContentColumns = [];
|
|
1642
2166
|
let headerLevelRow = 0;
|
|
@@ -1747,7 +2271,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1747
2271
|
}
|
|
1748
2272
|
};
|
|
1749
2273
|
const searchTemplate = () => {
|
|
1750
|
-
return /* @__PURE__ */
|
|
2274
|
+
return /* @__PURE__ */ jsx14(Fragment15, { children: /* @__PURE__ */ jsx14("div", { className: "me-50 r-search", children: /* @__PURE__ */ jsx14(
|
|
1751
2275
|
react_input_default,
|
|
1752
2276
|
{
|
|
1753
2277
|
style: { width: "230px" },
|
|
@@ -1768,12 +2292,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1768
2292
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
1769
2293
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
1770
2294
|
case "date":
|
|
1771
|
-
return /* @__PURE__ */
|
|
1772
|
-
|
|
2295
|
+
return /* @__PURE__ */ jsx14(
|
|
2296
|
+
Input7,
|
|
1773
2297
|
{
|
|
1774
2298
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1775
2299
|
style: { textAlign: col.textAlign, height: 29 },
|
|
1776
|
-
value: row[col.field] ?
|
|
2300
|
+
value: row[col.field] ? moment2(row[col.field]).format("yyyy-MM-DD") : row[col.field],
|
|
1777
2301
|
onChange: (val) => {
|
|
1778
2302
|
row[col.field] = val.target.value;
|
|
1779
2303
|
if (col.callback) {
|
|
@@ -1781,7 +2305,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1781
2305
|
}
|
|
1782
2306
|
handleDataChange(row, col, indexRow);
|
|
1783
2307
|
},
|
|
1784
|
-
className:
|
|
2308
|
+
className: classnames7("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1785
2309
|
type: "date",
|
|
1786
2310
|
max: "9999-12-31",
|
|
1787
2311
|
onKeyDown: (e) => {
|
|
@@ -1791,12 +2315,12 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1791
2315
|
}
|
|
1792
2316
|
);
|
|
1793
2317
|
case "datetime":
|
|
1794
|
-
return /* @__PURE__ */
|
|
1795
|
-
|
|
2318
|
+
return /* @__PURE__ */ jsx14(
|
|
2319
|
+
Input7,
|
|
1796
2320
|
{
|
|
1797
2321
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1798
2322
|
style: { textAlign: col.textAlign, height: 29 },
|
|
1799
|
-
value: row[col.field] ?
|
|
2323
|
+
value: row[col.field] ? moment2(row[col.field]).format("yyyy-MM-DD HH:MM") : row[col.field],
|
|
1800
2324
|
onChange: (val) => {
|
|
1801
2325
|
row[col.field] = val.target.value;
|
|
1802
2326
|
if (col.callback) {
|
|
@@ -1804,7 +2328,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1804
2328
|
}
|
|
1805
2329
|
handleDataChange(row, col, indexRow);
|
|
1806
2330
|
},
|
|
1807
|
-
className:
|
|
2331
|
+
className: classnames7("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1808
2332
|
type: "datetime-local",
|
|
1809
2333
|
max: "9999-12-31T23:59",
|
|
1810
2334
|
onKeyDown: (e) => {
|
|
@@ -1824,8 +2348,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1824
2348
|
if (!valueAsyncSelect && col.selectSettings?.defaultValue) {
|
|
1825
2349
|
valueAsyncSelect = col.selectSettings?.defaultValue(row);
|
|
1826
2350
|
}
|
|
1827
|
-
return /* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ jsxs13("div", { className: classnames7("d-flex select-group", { "is-invalid": col.validate && col.validate(row[col.field], row) }), children: [
|
|
2352
|
+
/* @__PURE__ */ jsx14(
|
|
1829
2353
|
AsyncSelect,
|
|
1830
2354
|
{
|
|
1831
2355
|
menuPosition: "fixed",
|
|
@@ -1844,23 +2368,23 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1844
2368
|
placeholder: t("Select"),
|
|
1845
2369
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1846
2370
|
loadOptions: col.selectSettings?.loadOptions,
|
|
1847
|
-
className:
|
|
2371
|
+
className: classnames7("react-select"),
|
|
1848
2372
|
onKeyDown: (e) => {
|
|
1849
2373
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1850
2374
|
}
|
|
1851
2375
|
}
|
|
1852
2376
|
}
|
|
1853
2377
|
),
|
|
1854
|
-
/* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsx14(
|
|
1855
2379
|
"span",
|
|
1856
2380
|
{
|
|
1857
2381
|
onClick: () => {
|
|
1858
|
-
if (col.selectSettings?.
|
|
1859
|
-
col.selectSettings?.
|
|
2382
|
+
if (col.selectSettings?.handAddNew) {
|
|
2383
|
+
col.selectSettings?.handAddNew("right");
|
|
1860
2384
|
}
|
|
1861
2385
|
},
|
|
1862
|
-
className:
|
|
1863
|
-
children: /* @__PURE__ */
|
|
2386
|
+
className: classnames7("input-group-text", { "d-none": !col.selectSettings?.iconGroup }),
|
|
2387
|
+
children: /* @__PURE__ */ jsx14(icon_default, { iconName: col.selectSettings?.iconGroup ?? "", size: 16 })
|
|
1864
2388
|
}
|
|
1865
2389
|
)
|
|
1866
2390
|
] });
|
|
@@ -1877,7 +2401,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1877
2401
|
} else {
|
|
1878
2402
|
valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? options?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
1879
2403
|
}
|
|
1880
|
-
return /* @__PURE__ */
|
|
2404
|
+
return /* @__PURE__ */ jsx14(
|
|
1881
2405
|
Select3,
|
|
1882
2406
|
{
|
|
1883
2407
|
menuPosition: "fixed",
|
|
@@ -1896,7 +2420,56 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1896
2420
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
1897
2421
|
classNamePrefix: col.selectSettings?.widthPopup ? `select-${col.selectSettings?.widthPopup}` : "select",
|
|
1898
2422
|
placeholder: t("Select"),
|
|
1899
|
-
className:
|
|
2423
|
+
className: classnames7("react-select", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2424
|
+
onKeyDown: (e) => {
|
|
2425
|
+
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
);
|
|
2430
|
+
case "selectTable":
|
|
2431
|
+
let valueSelectTable;
|
|
2432
|
+
let optionsSelectTable = [];
|
|
2433
|
+
if (col.selectSettings?.optionsField) {
|
|
2434
|
+
optionsSelectTable = row[col.selectSettings?.optionsField] ? row[col.selectSettings?.optionsField] : [];
|
|
2435
|
+
} else {
|
|
2436
|
+
optionsSelectTable = col.selectSettings?.options ? col.selectSettings?.validateOption ? col.selectSettings?.options.filter((item) => col.selectSettings?.validateOption(item, row)) : col.selectSettings?.options : [];
|
|
2437
|
+
}
|
|
2438
|
+
if (col.selectSettings?.isMulti) {
|
|
2439
|
+
valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field]?.length > 0 ? optionsSelectTable?.filter((val) => row[col.field]?.includes(val[col.selectSettings?.fieldValue ?? "value"])) : [];
|
|
2440
|
+
} else {
|
|
2441
|
+
valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelectTable?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
2442
|
+
}
|
|
2443
|
+
return /* @__PURE__ */ jsx14(
|
|
2444
|
+
select_table_default,
|
|
2445
|
+
{
|
|
2446
|
+
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2447
|
+
value: valueSelectTable,
|
|
2448
|
+
options: optionsSelectTable,
|
|
2449
|
+
rowData: row,
|
|
2450
|
+
onChange: (val) => {
|
|
2451
|
+
row[col.field] = col.selectSettings?.isMulti ? val?.map((item) => item[col.selectSettings?.fieldValue ?? "value"]) ?? [] : val ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
|
|
2452
|
+
if (col.callback) {
|
|
2453
|
+
col.callback(val, indexRow);
|
|
2454
|
+
}
|
|
2455
|
+
handleDataChange(row, col, indexRow);
|
|
2456
|
+
},
|
|
2457
|
+
fieldValue: col.selectSettings?.fieldValue,
|
|
2458
|
+
fieldLabel: col.selectSettings?.fieldLabel,
|
|
2459
|
+
component: tableElement,
|
|
2460
|
+
columns: col.selectSettings?.columns,
|
|
2461
|
+
isClearable: col.selectSettings?.isClearable ?? false,
|
|
2462
|
+
decimalSeparator,
|
|
2463
|
+
thousandSeparator,
|
|
2464
|
+
placeholder: t("Select"),
|
|
2465
|
+
loadOptions: col.selectSettings?.loadOptions,
|
|
2466
|
+
field: col.field,
|
|
2467
|
+
handleAdd: col.selectSettings?.handAddNew,
|
|
2468
|
+
isMulti: col.selectSettings?.isMulti,
|
|
2469
|
+
invalid: col.validate && col.validate(row[col.field], row),
|
|
2470
|
+
maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : void 0,
|
|
2471
|
+
menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
2472
|
+
textAlign: col.textAlign ?? "left",
|
|
1900
2473
|
onKeyDown: (e) => {
|
|
1901
2474
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1902
2475
|
}
|
|
@@ -1918,14 +2491,14 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1918
2491
|
}
|
|
1919
2492
|
}
|
|
1920
2493
|
};
|
|
1921
|
-
return /* @__PURE__ */
|
|
2494
|
+
return /* @__PURE__ */ jsx14(
|
|
1922
2495
|
"div",
|
|
1923
2496
|
{
|
|
1924
2497
|
onKeyDown: (e) => {
|
|
1925
2498
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
1926
2499
|
}
|
|
1927
2500
|
},
|
|
1928
|
-
children: /* @__PURE__ */
|
|
2501
|
+
children: /* @__PURE__ */ jsx14(
|
|
1929
2502
|
DropDownTreeComponent,
|
|
1930
2503
|
{
|
|
1931
2504
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1936,7 +2509,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1936
2509
|
parentValue: "parentId",
|
|
1937
2510
|
child: "children"
|
|
1938
2511
|
},
|
|
1939
|
-
className:
|
|
2512
|
+
className: classnames7("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1940
2513
|
allowFiltering: false,
|
|
1941
2514
|
value: valueSelectTree,
|
|
1942
2515
|
popupHeight: 250,
|
|
@@ -1964,8 +2537,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1964
2537
|
}
|
|
1965
2538
|
);
|
|
1966
2539
|
case "checkbox":
|
|
1967
|
-
return /* @__PURE__ */
|
|
1968
|
-
|
|
2540
|
+
return /* @__PURE__ */ jsx14(
|
|
2541
|
+
Input7,
|
|
1969
2542
|
{
|
|
1970
2543
|
checked: row[col.field],
|
|
1971
2544
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -1987,13 +2560,13 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1987
2560
|
);
|
|
1988
2561
|
case "numeric":
|
|
1989
2562
|
let valueCurrency = row[col.field];
|
|
1990
|
-
return /* @__PURE__ */
|
|
1991
|
-
|
|
2563
|
+
return /* @__PURE__ */ jsx14(
|
|
2564
|
+
Input7,
|
|
1992
2565
|
{
|
|
1993
2566
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
1994
2567
|
style: { textAlign: col.textAlign, height: 29 },
|
|
1995
2568
|
defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
1996
|
-
className:
|
|
2569
|
+
className: classnames7("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
1997
2570
|
onChange: (val) => {
|
|
1998
2571
|
let newVal = "";
|
|
1999
2572
|
const flag = val.target?.value.startsWith("-");
|
|
@@ -2077,8 +2650,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2077
2650
|
}
|
|
2078
2651
|
);
|
|
2079
2652
|
case "color":
|
|
2080
|
-
return /* @__PURE__ */
|
|
2081
|
-
|
|
2653
|
+
return /* @__PURE__ */ jsx14("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx14(
|
|
2654
|
+
Input7,
|
|
2082
2655
|
{
|
|
2083
2656
|
type: "color",
|
|
2084
2657
|
value: row[col.field],
|
|
@@ -2100,7 +2673,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2100
2673
|
`col-${indexRow}-${indexCol}`
|
|
2101
2674
|
) });
|
|
2102
2675
|
case "form":
|
|
2103
|
-
return /* @__PURE__ */
|
|
2676
|
+
return /* @__PURE__ */ jsx14(
|
|
2104
2677
|
edit_form_default,
|
|
2105
2678
|
{
|
|
2106
2679
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2122,13 +2695,13 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2122
2695
|
}
|
|
2123
2696
|
);
|
|
2124
2697
|
default:
|
|
2125
|
-
return /* @__PURE__ */
|
|
2126
|
-
|
|
2698
|
+
return /* @__PURE__ */ jsx14(
|
|
2699
|
+
Input7,
|
|
2127
2700
|
{
|
|
2128
2701
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2129
2702
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2130
2703
|
defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
|
|
2131
|
-
className:
|
|
2704
|
+
className: classnames7("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2132
2705
|
onBlur: (val) => {
|
|
2133
2706
|
if (row[col.field] != val.target?.value) {
|
|
2134
2707
|
row[col.field] = val.target?.value;
|
|
@@ -2166,14 +2739,14 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2166
2739
|
}
|
|
2167
2740
|
};
|
|
2168
2741
|
const renderCommand = (commandItems, rowData, i) => {
|
|
2169
|
-
return /* @__PURE__ */
|
|
2170
|
-
return /* @__PURE__ */
|
|
2171
|
-
|
|
2742
|
+
return /* @__PURE__ */ jsx14(Fragment15, { children: /* @__PURE__ */ jsx14("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2743
|
+
return /* @__PURE__ */ jsxs13(
|
|
2744
|
+
Button4,
|
|
2172
2745
|
{
|
|
2173
2746
|
id: `command-item-${i}`,
|
|
2174
2747
|
tabIndex: -1,
|
|
2175
2748
|
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2176
|
-
className:
|
|
2749
|
+
className: classnames7("command-item", {
|
|
2177
2750
|
"btn-icon": item.tooltip === ""
|
|
2178
2751
|
}),
|
|
2179
2752
|
color: item.color ? item.color : "#000",
|
|
@@ -2185,8 +2758,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2185
2758
|
e.preventDefault();
|
|
2186
2759
|
},
|
|
2187
2760
|
children: [
|
|
2188
|
-
item.icon && /* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
2761
|
+
item.icon && /* @__PURE__ */ jsx14(icon_default, { iconName: item.icon, size: 16 }),
|
|
2762
|
+
/* @__PURE__ */ jsx14(UncontrolledTooltip2, { className: "r-tooltip", target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2190
2763
|
]
|
|
2191
2764
|
},
|
|
2192
2765
|
`command-${index}`
|
|
@@ -2443,7 +3016,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2443
3016
|
}
|
|
2444
3017
|
}
|
|
2445
3018
|
};
|
|
2446
|
-
|
|
3019
|
+
useEffect8(() => {
|
|
2447
3020
|
setIndexFocus(-1);
|
|
2448
3021
|
if (setSelectedItem) {
|
|
2449
3022
|
if (isMulti) {
|
|
@@ -2470,7 +3043,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2470
3043
|
}
|
|
2471
3044
|
}
|
|
2472
3045
|
}, [selectedRows]);
|
|
2473
|
-
|
|
3046
|
+
useEffect8(() => {
|
|
2474
3047
|
if (!isMulti) {
|
|
2475
3048
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
2476
3049
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -2487,10 +3060,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2487
3060
|
}, [selectedItem]);
|
|
2488
3061
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
2489
3062
|
if (col.field === "command") {
|
|
2490
|
-
return col.visible !== false && /* @__PURE__ */
|
|
3063
|
+
return col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2491
3064
|
"td",
|
|
2492
3065
|
{
|
|
2493
|
-
className:
|
|
3066
|
+
className: classnames7(
|
|
2494
3067
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
2495
3068
|
{ "cell-fixed": col.fixedType },
|
|
2496
3069
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2500,15 +3073,15 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2500
3073
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2501
3074
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2502
3075
|
},
|
|
2503
|
-
children: /* @__PURE__ */
|
|
3076
|
+
children: /* @__PURE__ */ jsx14("div", { className: "r-rowcell-div ", children: renderCommand(col.commandItems, row, indexRow) })
|
|
2504
3077
|
},
|
|
2505
3078
|
`col-${indexRow}-${indexCol}`
|
|
2506
3079
|
);
|
|
2507
3080
|
} else if (col.field === "#") {
|
|
2508
|
-
return col.visible !== false && /* @__PURE__ */
|
|
3081
|
+
return col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2509
3082
|
"td",
|
|
2510
3083
|
{
|
|
2511
|
-
className:
|
|
3084
|
+
className: classnames7(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
2512
3085
|
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
2513
3086
|
style: {
|
|
2514
3087
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
@@ -2552,15 +3125,15 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2552
3125
|
e.stopPropagation();
|
|
2553
3126
|
}
|
|
2554
3127
|
},
|
|
2555
|
-
children: /* @__PURE__ */
|
|
3128
|
+
children: /* @__PURE__ */ jsx14("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
2556
3129
|
},
|
|
2557
3130
|
`col-${indexRow}-${indexCol}`
|
|
2558
3131
|
);
|
|
2559
3132
|
} else if (col.field === "checkbox") {
|
|
2560
|
-
return /* @__PURE__ */
|
|
3133
|
+
return /* @__PURE__ */ jsx14(
|
|
2561
3134
|
"td",
|
|
2562
3135
|
{
|
|
2563
|
-
className:
|
|
3136
|
+
className: classnames7(
|
|
2564
3137
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
2565
3138
|
{ "cell-fixed": col.fixedType },
|
|
2566
3139
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2570,7 +3143,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2570
3143
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2571
3144
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
2572
3145
|
},
|
|
2573
|
-
children: /* @__PURE__ */
|
|
3146
|
+
children: /* @__PURE__ */ jsx14(
|
|
2574
3147
|
"div",
|
|
2575
3148
|
{
|
|
2576
3149
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -2594,8 +3167,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2594
3167
|
e.stopPropagation();
|
|
2595
3168
|
}
|
|
2596
3169
|
},
|
|
2597
|
-
children: /* @__PURE__ */
|
|
2598
|
-
|
|
3170
|
+
children: /* @__PURE__ */ jsx14(
|
|
3171
|
+
Input7,
|
|
2599
3172
|
{
|
|
2600
3173
|
checked: isSelected,
|
|
2601
3174
|
type: "checkbox",
|
|
@@ -2615,16 +3188,16 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2615
3188
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
2616
3189
|
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
2617
3190
|
} else if (col.editType === "date") {
|
|
2618
|
-
value = value ?
|
|
3191
|
+
value = value ? moment2(value).format("DD/MM/yyyy") : "";
|
|
2619
3192
|
} else if (col.editType === "datetime") {
|
|
2620
|
-
value = value ?
|
|
3193
|
+
value = value ? moment2(value).format("DD/MM/yyyy HH:mm") : "";
|
|
2621
3194
|
}
|
|
2622
3195
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
2623
3196
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
2624
|
-
return /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ jsx14(Fragment15, { children: col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2625
3198
|
"td",
|
|
2626
3199
|
{
|
|
2627
|
-
className:
|
|
3200
|
+
className: classnames7(
|
|
2628
3201
|
`r-rowcell fix-${col.fixedType}`,
|
|
2629
3202
|
{ "cell-fixed": col.fixedType },
|
|
2630
3203
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -2666,28 +3239,28 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2666
3239
|
e.stopPropagation();
|
|
2667
3240
|
}
|
|
2668
3241
|
},
|
|
2669
|
-
children: /* @__PURE__ */
|
|
3242
|
+
children: /* @__PURE__ */ jsx14(
|
|
2670
3243
|
"div",
|
|
2671
3244
|
{
|
|
2672
|
-
className:
|
|
3245
|
+
className: classnames7("r-rowcell-div"),
|
|
2673
3246
|
style: {
|
|
2674
3247
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width
|
|
2675
3248
|
},
|
|
2676
|
-
children: /* @__PURE__ */
|
|
3249
|
+
children: /* @__PURE__ */ jsxs13(
|
|
2677
3250
|
"div",
|
|
2678
3251
|
{
|
|
2679
3252
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
2680
|
-
className:
|
|
3253
|
+
className: classnames7("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
2681
3254
|
style: {
|
|
2682
3255
|
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
2683
3256
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
2684
3257
|
},
|
|
2685
3258
|
children: [
|
|
2686
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
-
!(typeDis === 1 && !refreshRow) &&
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
|
|
3259
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx14("div", { id: `content-${idTable}-${indexRow}-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3260
|
+
/* @__PURE__ */ jsx14("span", { id: `error-${indexRow}-${indexCol}`, className: classnames7("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx14(AlertCircle, { fontSize: 15.5 }) }),
|
|
3261
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx14(UncontrolledTooltip2, { className: "r-tooltip", autohide: false, target: `content-${idTable}-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3262
|
+
/* @__PURE__ */ jsx14(
|
|
3263
|
+
UncontrolledTooltip2,
|
|
2691
3264
|
{
|
|
2692
3265
|
target: `error-${indexRow}-${indexCol}`,
|
|
2693
3266
|
className: "r-tooltip tooltip-error",
|
|
@@ -2704,14 +3277,18 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2704
3277
|
) }, indexCol);
|
|
2705
3278
|
}
|
|
2706
3279
|
};
|
|
3280
|
+
const checkOverflow = (indexRow, indexCol) => {
|
|
3281
|
+
const element = document.getElementById(`content-${idTable}-${indexRow}-${indexCol}`);
|
|
3282
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
3283
|
+
};
|
|
2707
3284
|
const renderHeaderCol = (col, indexCol, indexParent) => {
|
|
2708
3285
|
if (col.field === "checkbox") {
|
|
2709
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsx14(Fragment15, { children: col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2710
3287
|
"th",
|
|
2711
3288
|
{
|
|
2712
3289
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2713
3290
|
colSpan: col.columns?.length ?? 1,
|
|
2714
|
-
className:
|
|
3291
|
+
className: classnames7(
|
|
2715
3292
|
`r-headercell fix-${col.fixedType}`,
|
|
2716
3293
|
{ "cell-fixed": col.fixedType }
|
|
2717
3294
|
),
|
|
@@ -2723,17 +3300,17 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2723
3300
|
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2724
3301
|
maxWidth: col.maxWidth
|
|
2725
3302
|
},
|
|
2726
|
-
children: /* @__PURE__ */
|
|
3303
|
+
children: /* @__PURE__ */ jsx14(
|
|
2727
3304
|
"div",
|
|
2728
3305
|
{
|
|
2729
3306
|
style: { justifyContent: col.textAlign ?? "left" },
|
|
2730
|
-
className:
|
|
2731
|
-
children: /* @__PURE__ */
|
|
2732
|
-
|
|
3307
|
+
className: classnames7("r-headercell-div"),
|
|
3308
|
+
children: /* @__PURE__ */ jsx14(
|
|
3309
|
+
Input7,
|
|
2733
3310
|
{
|
|
2734
3311
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
2735
3312
|
type: "checkbox",
|
|
2736
|
-
className:
|
|
3313
|
+
className: classnames7("cursor-pointer", { "d-none": !isMulti }),
|
|
2737
3314
|
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
2738
3315
|
onChange: (e) => {
|
|
2739
3316
|
if (selectEnable) {
|
|
@@ -2753,15 +3330,15 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2753
3330
|
}
|
|
2754
3331
|
) }, `header-${indexCol}`);
|
|
2755
3332
|
} else if (col.field === "#") {
|
|
2756
|
-
return /* @__PURE__ */
|
|
2757
|
-
|
|
3333
|
+
return /* @__PURE__ */ jsx14(
|
|
3334
|
+
Fragment15,
|
|
2758
3335
|
{
|
|
2759
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
3336
|
+
children: col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2760
3337
|
"th",
|
|
2761
3338
|
{
|
|
2762
3339
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2763
3340
|
colSpan: col.columns?.length ?? 1,
|
|
2764
|
-
className:
|
|
3341
|
+
className: classnames7(
|
|
2765
3342
|
`r-headercell fix-${col.fixedType}`,
|
|
2766
3343
|
{ "cell-fixed": col.fixedType }
|
|
2767
3344
|
),
|
|
@@ -2773,7 +3350,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2773
3350
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2774
3351
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
2775
3352
|
},
|
|
2776
|
-
children: /* @__PURE__ */
|
|
3353
|
+
children: /* @__PURE__ */ jsx14(
|
|
2777
3354
|
"div",
|
|
2778
3355
|
{
|
|
2779
3356
|
title: t(col.headerText ?? ""),
|
|
@@ -2788,15 +3365,15 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2788
3365
|
`header-${indexCol}`
|
|
2789
3366
|
);
|
|
2790
3367
|
} else {
|
|
2791
|
-
return /* @__PURE__ */
|
|
2792
|
-
|
|
3368
|
+
return /* @__PURE__ */ jsx14(
|
|
3369
|
+
Fragment15,
|
|
2793
3370
|
{
|
|
2794
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
3371
|
+
children: col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2795
3372
|
"th",
|
|
2796
3373
|
{
|
|
2797
3374
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2798
3375
|
colSpan: col.columns?.length ?? 1,
|
|
2799
|
-
className:
|
|
3376
|
+
className: classnames7(
|
|
2800
3377
|
`r-headercell fix-${col.fixedType}`,
|
|
2801
3378
|
{ "cell-fixed": col.fixedType }
|
|
2802
3379
|
),
|
|
@@ -2808,7 +3385,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2808
3385
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2809
3386
|
maxWidth: col.maxWidth
|
|
2810
3387
|
},
|
|
2811
|
-
children: /* @__PURE__ */
|
|
3388
|
+
children: /* @__PURE__ */ jsx14(
|
|
2812
3389
|
"div",
|
|
2813
3390
|
{
|
|
2814
3391
|
role: "textbox",
|
|
@@ -2826,10 +3403,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2826
3403
|
}
|
|
2827
3404
|
};
|
|
2828
3405
|
const renderFooterCol = (col, indexCol) => {
|
|
2829
|
-
return /* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ jsx14(Fragment15, { children: col.visible !== false && /* @__PURE__ */ jsx14(
|
|
2830
3407
|
"td",
|
|
2831
3408
|
{
|
|
2832
|
-
className:
|
|
3409
|
+
className: classnames7(
|
|
2833
3410
|
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
2834
3411
|
{ "cell-fixed": col.fixedType }
|
|
2835
3412
|
),
|
|
@@ -2841,56 +3418,56 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2841
3418
|
maxWidth: col.maxWidth,
|
|
2842
3419
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2843
3420
|
},
|
|
2844
|
-
children: /* @__PURE__ */
|
|
3421
|
+
children: /* @__PURE__ */ jsx14("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
2845
3422
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2846
3423
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2847
3424
|
}
|
|
2848
3425
|
) }, `summarycell-${indexCol}`);
|
|
2849
3426
|
};
|
|
2850
3427
|
const renderToolbarTop = () => {
|
|
2851
|
-
return /* @__PURE__ */
|
|
2852
|
-
/* @__PURE__ */
|
|
2853
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
3428
|
+
return /* @__PURE__ */ jsx14("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs13("div", { className: "r-toolbar-items", children: [
|
|
3429
|
+
/* @__PURE__ */ jsx14("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
3430
|
+
return item.align === "left" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
2854
3431
|
}) }),
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
3432
|
+
/* @__PURE__ */ jsx14("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
3433
|
+
return item.align === "center" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
2857
3434
|
}) }),
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
3435
|
+
/* @__PURE__ */ jsx14("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
3436
|
+
return item.align === "right" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
2860
3437
|
}) })
|
|
2861
3438
|
] }) });
|
|
2862
3439
|
};
|
|
2863
3440
|
const renderToolbarBottom = () => {
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ jsx14("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__ */ jsxs13("div", { className: "r-toolbar-items", children: [
|
|
3442
|
+
/* @__PURE__ */ jsxs13("div", { className: "r-toolbar-left", children: [
|
|
3443
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Button4, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
3444
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs13(Fragment16, { children: [
|
|
3445
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Button4, { color: "success", outline: true, onClick: () => {
|
|
2869
3446
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
2870
3447
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
/* @__PURE__ */
|
|
2873
|
-
] }) : /* @__PURE__ */
|
|
2874
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Button4, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
3449
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Button4, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
3450
|
+
] }) : /* @__PURE__ */ jsx14(Fragment16, { children: " " }),
|
|
3451
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Button4, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
2875
3452
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2876
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
3453
|
+
return item.align === "left" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
2877
3454
|
})
|
|
2878
3455
|
] }),
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
3456
|
+
/* @__PURE__ */ jsx14("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3457
|
+
return item.align === "center" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
2881
3458
|
}) }),
|
|
2882
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsxs13("div", { className: "r-toolbar-right", children: [
|
|
2883
3460
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
2884
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
3461
|
+
return item.align === "right" ? /* @__PURE__ */ jsx14("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
2885
3462
|
}),
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
3463
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ jsx14(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
3464
|
+
/* @__PURE__ */ jsx14("div", { className: classnames7("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs13(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
3465
|
+
/* @__PURE__ */ jsx14(DropdownToggle3, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx14(Info2, { className: "cursor-pointer" }) }),
|
|
3466
|
+
/* @__PURE__ */ jsx14(DropdownMenu3, { children: /* @__PURE__ */ jsxs13("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
3467
|
+
/* @__PURE__ */ jsx14("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" }),
|
|
3468
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
3469
|
+
/* @__PURE__ */ jsx14("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" }),
|
|
3470
|
+
/* @__PURE__ */ jsx14("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" })
|
|
2894
3471
|
] }) })
|
|
2895
3472
|
] }) })
|
|
2896
3473
|
] })
|
|
@@ -2919,10 +3496,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2919
3496
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2920
3497
|
if (flagDisplay) {
|
|
2921
3498
|
countDisplay++;
|
|
2922
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsx14(
|
|
2923
3500
|
"tr",
|
|
2924
3501
|
{
|
|
2925
|
-
className:
|
|
3502
|
+
className: classnames7("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
2926
3503
|
children: contentColumns.map((col, indexCol) => {
|
|
2927
3504
|
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
2928
3505
|
})
|
|
@@ -2933,29 +3510,29 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2933
3510
|
}
|
|
2934
3511
|
});
|
|
2935
3512
|
};
|
|
2936
|
-
|
|
3513
|
+
useEffect8(() => {
|
|
2937
3514
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
2938
3515
|
pagingSetting?.setCurrentPage(1);
|
|
2939
3516
|
}
|
|
2940
3517
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
2941
|
-
return /* @__PURE__ */
|
|
2942
|
-
/* @__PURE__ */
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsxs13(Fragment15, { children: [
|
|
3519
|
+
/* @__PURE__ */ jsxs13("div", { className: "react-table-edit", children: [
|
|
3520
|
+
/* @__PURE__ */ jsxs13("div", { className: "r-grid", ref: gridRef, children: [
|
|
3521
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx14(Fragment16, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx14(Fragment16, {}),
|
|
3522
|
+
/* @__PURE__ */ jsx14("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs13("table", { style: { width: "100%" }, children: [
|
|
3523
|
+
/* @__PURE__ */ jsx14("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
3524
|
+
return /* @__PURE__ */ jsx14("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
2948
3525
|
return renderHeaderCol(col, index, indexParent);
|
|
2949
3526
|
}) }, indexParent);
|
|
2950
3527
|
}) }),
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx14("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
3529
|
+
/* @__PURE__ */ jsx14("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx14("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
2953
3530
|
return renderFooterCol(col, index);
|
|
2954
|
-
}) }) : /* @__PURE__ */
|
|
3531
|
+
}) }) : /* @__PURE__ */ jsx14(Fragment16, {}) })
|
|
2955
3532
|
] }) }),
|
|
2956
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */
|
|
3533
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx14(Fragment16, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx14(Fragment16, {})
|
|
2957
3534
|
] }),
|
|
2958
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */
|
|
3535
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx14(
|
|
2959
3536
|
PagingComponent,
|
|
2960
3537
|
{
|
|
2961
3538
|
onChangePage,
|
|
@@ -2965,9 +3542,9 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2965
3542
|
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
2966
3543
|
onChangePageSize
|
|
2967
3544
|
}
|
|
2968
|
-
) : /* @__PURE__ */
|
|
3545
|
+
) : /* @__PURE__ */ jsx14(Fragment16, {})
|
|
2969
3546
|
] }),
|
|
2970
|
-
/* @__PURE__ */
|
|
3547
|
+
/* @__PURE__ */ jsx14(
|
|
2971
3548
|
sidebar_setting_column_default,
|
|
2972
3549
|
{
|
|
2973
3550
|
handleSidebar: () => {
|
|
@@ -2985,10 +3562,10 @@ var table_default = TableEdit;
|
|
|
2985
3562
|
// test-app/src/component/tab-menu/index.tsx
|
|
2986
3563
|
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight3 } from "becoxy-icons";
|
|
2987
3564
|
import classNames6 from "classnames";
|
|
2988
|
-
import { Fragment as
|
|
3565
|
+
import { Fragment as Fragment17, useEffect as useEffect9, useState as useState8 } from "react";
|
|
2989
3566
|
import { Link, useNavigate } from "react-router-dom";
|
|
2990
|
-
import { DropdownItem as
|
|
2991
|
-
import { jsx as
|
|
3567
|
+
import { DropdownItem as DropdownItem3, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
3568
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2992
3569
|
var TabsMenuComponent = ({
|
|
2993
3570
|
buttonWidth,
|
|
2994
3571
|
tabParent,
|
|
@@ -3000,14 +3577,14 @@ var TabsMenuComponent = ({
|
|
|
3000
3577
|
renderModal
|
|
3001
3578
|
}) => {
|
|
3002
3579
|
const navigate = useNavigate();
|
|
3003
|
-
const [dataMenu, setDataMenu] =
|
|
3004
|
-
const [openMenu, setOpenMenu] =
|
|
3005
|
-
const [url, setUrl] =
|
|
3006
|
-
const [contentWidth, setContentWidth] =
|
|
3007
|
-
const [componentWidth, setComponentWidth] =
|
|
3008
|
-
const [scrollPosition, setScrollPosition] =
|
|
3009
|
-
const [dataItem, setDataItem] =
|
|
3010
|
-
const [openModal, setOpenModal] =
|
|
3580
|
+
const [dataMenu, setDataMenu] = useState8([]);
|
|
3581
|
+
const [openMenu, setOpenMenu] = useState8(false);
|
|
3582
|
+
const [url, setUrl] = useState8("");
|
|
3583
|
+
const [contentWidth, setContentWidth] = useState8(0);
|
|
3584
|
+
const [componentWidth, setComponentWidth] = useState8(0);
|
|
3585
|
+
const [scrollPosition, setScrollPosition] = useState8(0);
|
|
3586
|
+
const [dataItem, setDataItem] = useState8([]);
|
|
3587
|
+
const [openModal, setOpenModal] = useState8({});
|
|
3011
3588
|
const handleWindowResize = () => {
|
|
3012
3589
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
3013
3590
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -3016,7 +3593,7 @@ var TabsMenuComponent = ({
|
|
|
3016
3593
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
3017
3594
|
}
|
|
3018
3595
|
};
|
|
3019
|
-
|
|
3596
|
+
useEffect9(() => {
|
|
3020
3597
|
setUrl(window.location.pathname);
|
|
3021
3598
|
window.addEventListener("resize", handleWindowResize);
|
|
3022
3599
|
setTimeout(() => {
|
|
@@ -3032,7 +3609,7 @@ var TabsMenuComponent = ({
|
|
|
3032
3609
|
window.removeEventListener("resize", handleWindowResize);
|
|
3033
3610
|
};
|
|
3034
3611
|
}, []);
|
|
3035
|
-
|
|
3612
|
+
useEffect9(() => {
|
|
3036
3613
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
3037
3614
|
if (item) {
|
|
3038
3615
|
if (resourceCodeParent) {
|
|
@@ -3063,23 +3640,23 @@ var TabsMenuComponent = ({
|
|
|
3063
3640
|
const handleModal = (name) => {
|
|
3064
3641
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
3065
3642
|
};
|
|
3066
|
-
return /* @__PURE__ */
|
|
3643
|
+
return /* @__PURE__ */ jsxs14(Fragment17, { children: [
|
|
3067
3644
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ jsxs14("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3646
|
+
/* @__PURE__ */ jsx15(
|
|
3070
3647
|
"div",
|
|
3071
3648
|
{
|
|
3072
3649
|
onClick: () => handleScroll(-200),
|
|
3073
3650
|
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3074
|
-
children: /* @__PURE__ */
|
|
3651
|
+
children: /* @__PURE__ */ jsx15(ChevronLeft3, {})
|
|
3075
3652
|
}
|
|
3076
3653
|
),
|
|
3077
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx15("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx15("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3078
3655
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3079
|
-
return /* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3082
|
-
|
|
3656
|
+
return /* @__PURE__ */ jsxs14(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3657
|
+
/* @__PURE__ */ jsx15(DropdownToggle4, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx15("div", { children: item.name }) }),
|
|
3658
|
+
/* @__PURE__ */ jsx15(DropdownMenu4, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx15(
|
|
3659
|
+
DropdownItem3,
|
|
3083
3660
|
{
|
|
3084
3661
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
3085
3662
|
onClick: () => {
|
|
@@ -3095,7 +3672,7 @@ var TabsMenuComponent = ({
|
|
|
3095
3672
|
)) })
|
|
3096
3673
|
] }, item.code);
|
|
3097
3674
|
} else {
|
|
3098
|
-
return /* @__PURE__ */
|
|
3675
|
+
return /* @__PURE__ */ jsx15(
|
|
3099
3676
|
Link,
|
|
3100
3677
|
{
|
|
3101
3678
|
to: item.url,
|
|
@@ -3106,12 +3683,12 @@ var TabsMenuComponent = ({
|
|
|
3106
3683
|
);
|
|
3107
3684
|
}
|
|
3108
3685
|
}) }) }),
|
|
3109
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ jsx15(
|
|
3110
3687
|
"div",
|
|
3111
3688
|
{
|
|
3112
3689
|
onClick: () => handleScroll(200),
|
|
3113
3690
|
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3114
|
-
children: /* @__PURE__ */
|
|
3691
|
+
children: /* @__PURE__ */ jsx15(ChevronRight3, {})
|
|
3115
3692
|
}
|
|
3116
3693
|
)
|
|
3117
3694
|
] })
|