@eztrak/shared 0.13.8 → 0.15.0
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/README.md +114 -3
- package/dist/{chunk-DSP67UYZ.mjs → chunk-EIX5CUQF.mjs} +10 -1
- package/dist/chunk-EIX5CUQF.mjs.map +1 -0
- package/dist/{chunk-4SOWLOGR.mjs → chunk-KFBKDGZV.mjs} +337 -27
- package/dist/chunk-KFBKDGZV.mjs.map +1 -0
- package/dist/{chunk-UIDXC5S2.mjs → chunk-WZVYTP6G.mjs} +2 -2
- package/dist/components/index.d.mts +157 -5
- package/dist/components/index.d.ts +157 -5
- package/dist/components/index.js +342 -27
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +18 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +342 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/utils/index.d.mts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/package.json +1 -1
- package/dist/chunk-4SOWLOGR.mjs.map +0 -1
- package/dist/chunk-DSP67UYZ.mjs.map +0 -1
- /package/dist/{chunk-UIDXC5S2.mjs.map → chunk-WZVYTP6G.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/components/index.ts
|
|
31
31
|
var components_exports = {};
|
|
32
32
|
__export(components_exports, {
|
|
33
|
+
ActionMenuItem: () => ActionMenuItem,
|
|
33
34
|
CardSkeleton: () => CardSkeleton,
|
|
34
35
|
CustomCellEditor: () => CustomCellEditor,
|
|
35
36
|
CustomPagination: () => CustomPagination,
|
|
@@ -38,14 +39,20 @@ __export(components_exports, {
|
|
|
38
39
|
Loader: () => Loader,
|
|
39
40
|
Modal: () => Modal,
|
|
40
41
|
PopupCellRenderer: () => PopupCellRenderer,
|
|
42
|
+
ROW_ACTION_DEFAULT_ICON_SIZE: () => ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
43
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE: () => ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
44
|
+
ROW_ACTION_ITEM_HOVER_CLASS: () => ROW_ACTION_ITEM_HOVER_CLASS,
|
|
45
|
+
ROW_ACTION_PRESETS: () => ROW_ACTION_PRESETS,
|
|
41
46
|
ResetColumnsButton: () => ResetColumnsButton,
|
|
42
47
|
ResetFiltersButton: () => ResetFiltersButton,
|
|
48
|
+
RowActions: () => RowActions,
|
|
43
49
|
SearchInput: () => SearchInput,
|
|
44
50
|
TableErrorBoundary: () => TableErrorBoundary,
|
|
45
51
|
TableLayoutToolbarControls: () => TableLayoutToolbarControls,
|
|
46
52
|
ToolTip: () => ToolTip,
|
|
47
53
|
TooltipText: () => TooltipText,
|
|
48
|
-
dropdownStyles: () => dropdownStyles
|
|
54
|
+
dropdownStyles: () => dropdownStyles,
|
|
55
|
+
resolveActions: () => resolveActions
|
|
49
56
|
});
|
|
50
57
|
module.exports = __toCommonJS(components_exports);
|
|
51
58
|
|
|
@@ -782,6 +789,14 @@ var dropdownStyles = (_borderRadius) => ({
|
|
|
782
789
|
})
|
|
783
790
|
});
|
|
784
791
|
|
|
792
|
+
// src/utils/resetPageParam.ts
|
|
793
|
+
function resetPageParam(params, pageKey = "page", defaultPage = "1") {
|
|
794
|
+
if (params.has(pageKey)) {
|
|
795
|
+
params.set(pageKey, defaultPage);
|
|
796
|
+
}
|
|
797
|
+
return params;
|
|
798
|
+
}
|
|
799
|
+
|
|
785
800
|
// src/utils/localStorage.ts
|
|
786
801
|
function getStorage() {
|
|
787
802
|
if (typeof window === "undefined") return null;
|
|
@@ -827,6 +842,7 @@ function DropdownFilter({
|
|
|
827
842
|
isDisabled = false,
|
|
828
843
|
isLoading = false,
|
|
829
844
|
saveToLocalStorage = false,
|
|
845
|
+
pageParam = "page",
|
|
830
846
|
...otherProps
|
|
831
847
|
}) {
|
|
832
848
|
const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
|
|
@@ -839,10 +855,10 @@ function DropdownFilter({
|
|
|
839
855
|
if (stored != null && stored !== "") {
|
|
840
856
|
setSearchParams((prev) => {
|
|
841
857
|
prev.set(name, String(stored));
|
|
842
|
-
return prev;
|
|
858
|
+
return resetPageParam(prev, pageParam);
|
|
843
859
|
});
|
|
844
860
|
}
|
|
845
|
-
}, [saveToLocalStorage, name, searchParams, setSearchParams]);
|
|
861
|
+
}, [saveToLocalStorage, name, pageParam, searchParams, setSearchParams]);
|
|
846
862
|
const currentValue = searchParams.get(name);
|
|
847
863
|
const selectedOption = currentValue ? options?.find(
|
|
848
864
|
(option) => option[valueKey]?.toString() === currentValue
|
|
@@ -850,12 +866,15 @@ function DropdownFilter({
|
|
|
850
866
|
const handleChange = (selected) => {
|
|
851
867
|
const selectedValue = selected && selected[valueKey] !== "" ? String(selected[valueKey]) : null;
|
|
852
868
|
setSearchParams((prev) => {
|
|
869
|
+
if ((prev.get(name) ?? "") === (selectedValue ?? "")) {
|
|
870
|
+
return prev;
|
|
871
|
+
}
|
|
853
872
|
if (!selectedValue) {
|
|
854
873
|
prev.delete(name);
|
|
855
874
|
} else {
|
|
856
875
|
prev.set(name, selectedValue);
|
|
857
876
|
}
|
|
858
|
-
return prev;
|
|
877
|
+
return resetPageParam(prev, pageParam);
|
|
859
878
|
});
|
|
860
879
|
if (saveToLocalStorage) {
|
|
861
880
|
if (selectedValue) {
|
|
@@ -972,6 +991,7 @@ function SearchInput({
|
|
|
972
991
|
debounceDelay = 500,
|
|
973
992
|
customIcon = null,
|
|
974
993
|
defaultValue,
|
|
994
|
+
pageParam = "page",
|
|
975
995
|
...props
|
|
976
996
|
}) {
|
|
977
997
|
const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
|
|
@@ -979,17 +999,18 @@ function SearchInput({
|
|
|
979
999
|
const [inputValue, setInputValue] = (0, import_react3.useState)(queryParam);
|
|
980
1000
|
const debounceTimerRef = (0, import_react3.useRef)(null);
|
|
981
1001
|
const updateSearchParams = (searchQuery) => {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1002
|
+
const nextValue = searchQuery?.trim() ?? "";
|
|
1003
|
+
setSearchParams((prev) => {
|
|
1004
|
+
if ((prev.get(defaultParam) ?? "") === nextValue) {
|
|
985
1005
|
return prev;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
|
|
1006
|
+
}
|
|
1007
|
+
if (nextValue) {
|
|
1008
|
+
prev.set(defaultParam, nextValue);
|
|
1009
|
+
} else {
|
|
989
1010
|
prev.delete(defaultParam);
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
1011
|
+
}
|
|
1012
|
+
return resetPageParam(prev, pageParam);
|
|
1013
|
+
});
|
|
993
1014
|
};
|
|
994
1015
|
const handleSearch = (e) => {
|
|
995
1016
|
e.preventDefault();
|
|
@@ -1735,7 +1756,8 @@ function PopupCellRenderer({
|
|
|
1735
1756
|
params,
|
|
1736
1757
|
onAction,
|
|
1737
1758
|
placement = "bottom-end",
|
|
1738
|
-
tippyProps
|
|
1759
|
+
tippyProps,
|
|
1760
|
+
ariaLabel = "Row actions"
|
|
1739
1761
|
}) {
|
|
1740
1762
|
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
1741
1763
|
const show = () => setVisible(true);
|
|
@@ -1771,7 +1793,7 @@ function PopupCellRenderer({
|
|
|
1771
1793
|
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
1772
1794
|
className
|
|
1773
1795
|
),
|
|
1774
|
-
"aria-label":
|
|
1796
|
+
"aria-label": ariaLabel,
|
|
1775
1797
|
children: [
|
|
1776
1798
|
!hideTitle && title,
|
|
1777
1799
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ActionIcon, { "aria-hidden": true })
|
|
@@ -1782,10 +1804,296 @@ function PopupCellRenderer({
|
|
|
1782
1804
|
) });
|
|
1783
1805
|
}
|
|
1784
1806
|
|
|
1807
|
+
// src/components/row-actions/presets.ts
|
|
1808
|
+
var import_fa2 = require("react-icons/fa");
|
|
1809
|
+
var ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
|
|
1810
|
+
var ROW_ACTION_DEFAULT_ICON_SIZE = 16;
|
|
1811
|
+
var ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE = {
|
|
1812
|
+
zIndex: 1e4
|
|
1813
|
+
};
|
|
1814
|
+
var ROW_ACTION_PRESETS = {
|
|
1815
|
+
edit: { label: "Edit", icon: import_fa2.FaEdit },
|
|
1816
|
+
delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true },
|
|
1817
|
+
view: { label: "View", icon: import_fa2.FaEye },
|
|
1818
|
+
notes: { label: "Notes", icon: import_fa2.FaFileAlt },
|
|
1819
|
+
history: { label: "History", icon: import_fa2.FaHistory },
|
|
1820
|
+
download: { label: "Download", icon: import_fa2.FaDownload },
|
|
1821
|
+
archive: { label: "Archive", icon: import_fa2.FaArchive },
|
|
1822
|
+
resolve: { label: "Resolve", icon: import_fa2.FaCheckCircle }
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
// src/components/row-actions/ActionMenuItem.tsx
|
|
1826
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1827
|
+
function ActionMenuItem({
|
|
1828
|
+
label,
|
|
1829
|
+
icon: Icon,
|
|
1830
|
+
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
1831
|
+
iconClassName,
|
|
1832
|
+
tooltip,
|
|
1833
|
+
tooltipPlacement = "top",
|
|
1834
|
+
tooltipDelayShow,
|
|
1835
|
+
tooltipDelayHide,
|
|
1836
|
+
tooltipClassName,
|
|
1837
|
+
tooltipStyle,
|
|
1838
|
+
disabled = false,
|
|
1839
|
+
danger = false,
|
|
1840
|
+
highlight = false,
|
|
1841
|
+
showLabel = true,
|
|
1842
|
+
className,
|
|
1843
|
+
onClick
|
|
1844
|
+
}) {
|
|
1845
|
+
const tooltipText = tooltip ?? label;
|
|
1846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1847
|
+
ToolTip,
|
|
1848
|
+
{
|
|
1849
|
+
text: tooltipText,
|
|
1850
|
+
disabled: !tooltipText,
|
|
1851
|
+
placement: tooltipPlacement,
|
|
1852
|
+
delayShow: tooltipDelayShow,
|
|
1853
|
+
delayHide: tooltipDelayHide,
|
|
1854
|
+
tooltipClassName,
|
|
1855
|
+
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
1856
|
+
className: showLabel ? "block w-full" : "inline-flex",
|
|
1857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1858
|
+
"button",
|
|
1859
|
+
{
|
|
1860
|
+
type: "button",
|
|
1861
|
+
disabled,
|
|
1862
|
+
"aria-label": label,
|
|
1863
|
+
onClick: (event) => {
|
|
1864
|
+
event.stopPropagation();
|
|
1865
|
+
if (disabled) return;
|
|
1866
|
+
onClick();
|
|
1867
|
+
},
|
|
1868
|
+
className: cn(
|
|
1869
|
+
"flex items-center gap-2 text-sm transition-colors duration-150",
|
|
1870
|
+
showLabel ? "w-full rounded-xl px-3 py-2 text-left" : "justify-center rounded-md p-1",
|
|
1871
|
+
disabled ? "cursor-not-allowed opacity-50" : ROW_ACTION_ITEM_HOVER_CLASS,
|
|
1872
|
+
danger && "text-red-500",
|
|
1873
|
+
highlight && !danger && "text-primary-150",
|
|
1874
|
+
className
|
|
1875
|
+
),
|
|
1876
|
+
children: [
|
|
1877
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1878
|
+
Icon,
|
|
1879
|
+
{
|
|
1880
|
+
className: cn("shrink-0", iconClassName),
|
|
1881
|
+
"aria-hidden": true,
|
|
1882
|
+
size: iconSize
|
|
1883
|
+
}
|
|
1884
|
+
) : null,
|
|
1885
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: label }) : null
|
|
1886
|
+
]
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
}
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
// src/components/row-actions/resolveActions.ts
|
|
1894
|
+
function evalFlag(flag, data) {
|
|
1895
|
+
if (typeof flag === "function") return Boolean(flag(data));
|
|
1896
|
+
return Boolean(flag);
|
|
1897
|
+
}
|
|
1898
|
+
function mergePreset(name, overrides) {
|
|
1899
|
+
if (!name) return void 0;
|
|
1900
|
+
const base = ROW_ACTION_PRESETS[name];
|
|
1901
|
+
const extra = overrides?.[name];
|
|
1902
|
+
if (!extra) return base;
|
|
1903
|
+
return { ...base, ...extra };
|
|
1904
|
+
}
|
|
1905
|
+
function resolveActions(actions, data, hasPermission, presets) {
|
|
1906
|
+
const list = typeof actions === "function" ? actions(data) : actions;
|
|
1907
|
+
return list.flatMap((action, index) => {
|
|
1908
|
+
const type = action.type ?? "item";
|
|
1909
|
+
const preset = mergePreset(action.preset, presets);
|
|
1910
|
+
const key = action.key ?? action.preset ?? `action-${index}`;
|
|
1911
|
+
const label = action.label ?? preset?.label ?? key;
|
|
1912
|
+
if (action.permission && hasPermission && !hasPermission(action.permission)) {
|
|
1913
|
+
return [];
|
|
1914
|
+
}
|
|
1915
|
+
if (evalFlag(action.hidden, data)) {
|
|
1916
|
+
return [];
|
|
1917
|
+
}
|
|
1918
|
+
const tooltip = action.tooltip === false ? void 0 : action.tooltip ?? (type === "divider" ? void 0 : label);
|
|
1919
|
+
const resolved = {
|
|
1920
|
+
key,
|
|
1921
|
+
type,
|
|
1922
|
+
label,
|
|
1923
|
+
icon: action.icon ?? preset?.icon,
|
|
1924
|
+
iconSize: action.iconSize,
|
|
1925
|
+
content: action.content,
|
|
1926
|
+
onClick: action.onClick,
|
|
1927
|
+
disabled: evalFlag(action.disabled, data),
|
|
1928
|
+
danger: action.danger ?? preset?.danger ?? false,
|
|
1929
|
+
highlight: evalFlag(action.highlight, data),
|
|
1930
|
+
tooltip,
|
|
1931
|
+
tooltipPlacement: action.tooltipPlacement,
|
|
1932
|
+
confirm: action.confirm,
|
|
1933
|
+
closeOnClick: action.closeOnClick !== false,
|
|
1934
|
+
className: action.className
|
|
1935
|
+
};
|
|
1936
|
+
return [resolved];
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
// src/components/row-actions/RowActions.tsx
|
|
1941
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1942
|
+
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
1943
|
+
if (!action.onClick) {
|
|
1944
|
+
if (action.closeOnClick) hide?.();
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
const execute = () => action.onClick?.(data);
|
|
1948
|
+
if (action.confirm) {
|
|
1949
|
+
confirmFn?.(execute, action.confirm);
|
|
1950
|
+
} else {
|
|
1951
|
+
execute();
|
|
1952
|
+
}
|
|
1953
|
+
if (action.closeOnClick) {
|
|
1954
|
+
hide?.();
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
function RowActions({
|
|
1958
|
+
actions,
|
|
1959
|
+
data,
|
|
1960
|
+
mode = "menu",
|
|
1961
|
+
actionIcon,
|
|
1962
|
+
className,
|
|
1963
|
+
menuClassName,
|
|
1964
|
+
itemClassName,
|
|
1965
|
+
itemIconClassName,
|
|
1966
|
+
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
1967
|
+
triggerTooltip = "Actions",
|
|
1968
|
+
triggerAriaLabel = "Row actions",
|
|
1969
|
+
hasPermission,
|
|
1970
|
+
placement = "bottom-end",
|
|
1971
|
+
tippyProps,
|
|
1972
|
+
presets,
|
|
1973
|
+
confirmFn = confirmationAlert,
|
|
1974
|
+
tooltipPlacement = "top",
|
|
1975
|
+
tooltipDelayShow,
|
|
1976
|
+
tooltipDelayHide,
|
|
1977
|
+
tooltipClassName,
|
|
1978
|
+
tooltipStyle,
|
|
1979
|
+
renderItem,
|
|
1980
|
+
renderMenu,
|
|
1981
|
+
renderTrigger
|
|
1982
|
+
}) {
|
|
1983
|
+
const resolved = resolveActions(actions, data, hasPermission, presets);
|
|
1984
|
+
if (resolved.length === 0) {
|
|
1985
|
+
return null;
|
|
1986
|
+
}
|
|
1987
|
+
const mergedTooltipStyle = {
|
|
1988
|
+
...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
1989
|
+
...tooltipStyle
|
|
1990
|
+
};
|
|
1991
|
+
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
1992
|
+
if (action.type === "divider") {
|
|
1993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1994
|
+
"div",
|
|
1995
|
+
{
|
|
1996
|
+
role: "separator",
|
|
1997
|
+
className: cn("my-1 h-px bg-gray-100", action.className)
|
|
1998
|
+
},
|
|
1999
|
+
action.key
|
|
2000
|
+
);
|
|
2001
|
+
}
|
|
2002
|
+
if (action.content) {
|
|
2003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2004
|
+
}
|
|
2005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2006
|
+
ActionMenuItem,
|
|
2007
|
+
{
|
|
2008
|
+
label: action.label,
|
|
2009
|
+
icon: action.icon,
|
|
2010
|
+
iconSize: action.iconSize ?? iconSize,
|
|
2011
|
+
iconClassName: itemIconClassName,
|
|
2012
|
+
tooltip: action.tooltip,
|
|
2013
|
+
tooltipPlacement: action.tooltipPlacement ?? tooltipPlacement,
|
|
2014
|
+
tooltipDelayShow,
|
|
2015
|
+
tooltipDelayHide,
|
|
2016
|
+
tooltipClassName,
|
|
2017
|
+
tooltipStyle: mergedTooltipStyle,
|
|
2018
|
+
disabled: action.disabled,
|
|
2019
|
+
danger: action.danger,
|
|
2020
|
+
highlight: action.highlight,
|
|
2021
|
+
showLabel,
|
|
2022
|
+
className: cn(itemClassName, action.className),
|
|
2023
|
+
onClick: () => runAction(action, data, hide, confirmFn)
|
|
2024
|
+
},
|
|
2025
|
+
action.key
|
|
2026
|
+
);
|
|
2027
|
+
};
|
|
2028
|
+
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2029
|
+
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2030
|
+
if (!renderItem) return defaultItem;
|
|
2031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2032
|
+
});
|
|
2033
|
+
if (mode === "inline") {
|
|
2034
|
+
const inlineItems = renderItems(void 0, false);
|
|
2035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
2036
|
+
}
|
|
2037
|
+
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2038
|
+
const buildMenu = (hide) => {
|
|
2039
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2040
|
+
"div",
|
|
2041
|
+
{
|
|
2042
|
+
className: cn(
|
|
2043
|
+
"flex min-w-[180px] flex-col rounded-lg border border-gray-100 bg-white p-2 shadow-lg",
|
|
2044
|
+
menuClassName
|
|
2045
|
+
),
|
|
2046
|
+
children: renderItems(hide, true)
|
|
2047
|
+
}
|
|
2048
|
+
);
|
|
2049
|
+
if (!renderMenu) return defaultMenu;
|
|
2050
|
+
return renderMenu({
|
|
2051
|
+
data,
|
|
2052
|
+
actions: resolved,
|
|
2053
|
+
hide,
|
|
2054
|
+
defaultMenu
|
|
2055
|
+
});
|
|
2056
|
+
};
|
|
2057
|
+
if (renderTrigger) {
|
|
2058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: renderTrigger({
|
|
2059
|
+
data,
|
|
2060
|
+
actions: resolved,
|
|
2061
|
+
hide: () => void 0,
|
|
2062
|
+
defaultMenu: buildMenu(() => void 0)
|
|
2063
|
+
}) });
|
|
2064
|
+
}
|
|
2065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2066
|
+
ToolTip,
|
|
2067
|
+
{
|
|
2068
|
+
text: triggerTooltipText,
|
|
2069
|
+
disabled: !triggerTooltipText,
|
|
2070
|
+
placement: tooltipPlacement,
|
|
2071
|
+
delayShow: tooltipDelayShow,
|
|
2072
|
+
delayHide: tooltipDelayHide,
|
|
2073
|
+
tooltipClassName,
|
|
2074
|
+
tooltipStyle,
|
|
2075
|
+
className: "flex h-full items-center justify-center",
|
|
2076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2077
|
+
PopupCellRenderer,
|
|
2078
|
+
{
|
|
2079
|
+
params: { data },
|
|
2080
|
+
actionIcon,
|
|
2081
|
+
hideTitle: true,
|
|
2082
|
+
className,
|
|
2083
|
+
placement,
|
|
2084
|
+
tippyProps,
|
|
2085
|
+
ariaLabel: triggerAriaLabel,
|
|
2086
|
+
dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
|
|
2087
|
+
}
|
|
2088
|
+
)
|
|
2089
|
+
}
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
|
|
1785
2093
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
1786
2094
|
var import_react9 = require("react");
|
|
1787
2095
|
var import_fa6 = require("react-icons/fa6");
|
|
1788
|
-
var
|
|
2096
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1789
2097
|
var TableErrorBoundary = ({
|
|
1790
2098
|
isError,
|
|
1791
2099
|
isLoading = false,
|
|
@@ -1802,7 +2110,7 @@ var TableErrorBoundary = ({
|
|
|
1802
2110
|
return "Unable to load table data. Please try again.";
|
|
1803
2111
|
}, [error, errorMessage]);
|
|
1804
2112
|
if (isLoading && !isError) {
|
|
1805
|
-
return /* @__PURE__ */ (0,
|
|
2113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1806
2114
|
"div",
|
|
1807
2115
|
{
|
|
1808
2116
|
className: cn(
|
|
@@ -1813,12 +2121,12 @@ var TableErrorBoundary = ({
|
|
|
1813
2121
|
role: "status",
|
|
1814
2122
|
"aria-live": "polite",
|
|
1815
2123
|
"aria-busy": "true",
|
|
1816
|
-
children: /* @__PURE__ */ (0,
|
|
2124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loader, { size: "40px" })
|
|
1817
2125
|
}
|
|
1818
2126
|
);
|
|
1819
2127
|
}
|
|
1820
2128
|
if (isError) {
|
|
1821
|
-
return /* @__PURE__ */ (0,
|
|
2129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1822
2130
|
"div",
|
|
1823
2131
|
{
|
|
1824
2132
|
className: cn(
|
|
@@ -1829,7 +2137,7 @@ var TableErrorBoundary = ({
|
|
|
1829
2137
|
role: "alert",
|
|
1830
2138
|
"aria-live": "assertive",
|
|
1831
2139
|
children: [
|
|
1832
|
-
/* @__PURE__ */ (0,
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1833
2141
|
import_fa6.FaTriangleExclamation,
|
|
1834
2142
|
{
|
|
1835
2143
|
className: "text-red-500",
|
|
@@ -1837,11 +2145,11 @@ var TableErrorBoundary = ({
|
|
|
1837
2145
|
"aria-hidden": true
|
|
1838
2146
|
}
|
|
1839
2147
|
),
|
|
1840
|
-
/* @__PURE__ */ (0,
|
|
1841
|
-
/* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
2148
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
2149
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
1843
2151
|
] }),
|
|
1844
|
-
refetch && /* @__PURE__ */ (0,
|
|
2152
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1845
2153
|
"button",
|
|
1846
2154
|
{
|
|
1847
2155
|
type: "button",
|
|
@@ -1849,7 +2157,7 @@ var TableErrorBoundary = ({
|
|
|
1849
2157
|
disabled: isLoading,
|
|
1850
2158
|
className: "inline-flex items-center gap-2 rounded-lg bg-primary-150 px-4 py-2 text-sm font-medium text-white transition-colors hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
|
|
1851
2159
|
children: [
|
|
1852
|
-
/* @__PURE__ */ (0,
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
1853
2161
|
isLoading ? "Retrying..." : "Try again"
|
|
1854
2162
|
]
|
|
1855
2163
|
}
|
|
@@ -1858,10 +2166,11 @@ var TableErrorBoundary = ({
|
|
|
1858
2166
|
}
|
|
1859
2167
|
);
|
|
1860
2168
|
}
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children });
|
|
1862
2170
|
};
|
|
1863
2171
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1864
2172
|
0 && (module.exports = {
|
|
2173
|
+
ActionMenuItem,
|
|
1865
2174
|
CardSkeleton,
|
|
1866
2175
|
CustomCellEditor,
|
|
1867
2176
|
CustomPagination,
|
|
@@ -1870,13 +2179,19 @@ var TableErrorBoundary = ({
|
|
|
1870
2179
|
Loader,
|
|
1871
2180
|
Modal,
|
|
1872
2181
|
PopupCellRenderer,
|
|
2182
|
+
ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
2183
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
2184
|
+
ROW_ACTION_ITEM_HOVER_CLASS,
|
|
2185
|
+
ROW_ACTION_PRESETS,
|
|
1873
2186
|
ResetColumnsButton,
|
|
1874
2187
|
ResetFiltersButton,
|
|
2188
|
+
RowActions,
|
|
1875
2189
|
SearchInput,
|
|
1876
2190
|
TableErrorBoundary,
|
|
1877
2191
|
TableLayoutToolbarControls,
|
|
1878
2192
|
ToolTip,
|
|
1879
2193
|
TooltipText,
|
|
1880
|
-
dropdownStyles
|
|
2194
|
+
dropdownStyles,
|
|
2195
|
+
resolveActions
|
|
1881
2196
|
});
|
|
1882
2197
|
//# sourceMappingURL=index.js.map
|