@facter/ds-core 1.18.0 → 1.20.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/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1656,21 +1656,21 @@ var DataTableSearch = React10__namespace.memo(function DataTableSearch2({
|
|
|
1656
1656
|
columnInstance?.getFilterValue() ?? ""
|
|
1657
1657
|
);
|
|
1658
1658
|
const debouncedValue = useDebounce(value, debounce);
|
|
1659
|
+
const isServerSide = !!onSearch;
|
|
1659
1660
|
React10__namespace.useEffect(() => {
|
|
1660
|
-
if (
|
|
1661
|
-
columnInstance.setFilterValue(debouncedValue || void 0);
|
|
1662
|
-
}
|
|
1663
|
-
if (onSearch) {
|
|
1661
|
+
if (isServerSide) {
|
|
1664
1662
|
onSearch(debouncedValue);
|
|
1663
|
+
} else if (columnInstance) {
|
|
1664
|
+
columnInstance.setFilterValue(debouncedValue || void 0);
|
|
1665
1665
|
}
|
|
1666
|
-
}, [debouncedValue, columnInstance, onSearch]);
|
|
1666
|
+
}, [debouncedValue, columnInstance, onSearch, isServerSide]);
|
|
1667
1667
|
React10__namespace.useEffect(() => {
|
|
1668
|
-
if (!columnInstance) return;
|
|
1668
|
+
if (isServerSide || !columnInstance) return;
|
|
1669
1669
|
const filterValue = columnInstance.getFilterValue() ?? "";
|
|
1670
1670
|
if (filterValue !== value) {
|
|
1671
1671
|
setValue(filterValue);
|
|
1672
1672
|
}
|
|
1673
|
-
}, [columnInstance?.getFilterValue()]);
|
|
1673
|
+
}, [columnInstance?.getFilterValue(), isServerSide]);
|
|
1674
1674
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-[150px] lg:w-[250px]", className), children: [
|
|
1675
1675
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" }),
|
|
1676
1676
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1712,14 +1712,14 @@ var DataTableFilter = React10__namespace.memo(function DataTableFilter2({
|
|
|
1712
1712
|
const filterValue = column?.getFilterValue() ?? [];
|
|
1713
1713
|
const [localValue, setLocalValue] = React10__namespace.useState("all");
|
|
1714
1714
|
const currentValue = column ? filterValue.length > 0 ? filterValue[0] : "all" : localValue;
|
|
1715
|
+
const isServerSide = !!onServerValueChange;
|
|
1715
1716
|
const handleValueChange = React10__namespace.useCallback(
|
|
1716
1717
|
(value) => {
|
|
1717
1718
|
const resolvedValue = value === "all" ? void 0 : value;
|
|
1718
|
-
if (
|
|
1719
|
-
column.setFilterValue(resolvedValue ? [resolvedValue] : void 0);
|
|
1720
|
-
}
|
|
1721
|
-
if (onServerValueChange) {
|
|
1719
|
+
if (isServerSide) {
|
|
1722
1720
|
onServerValueChange(resolvedValue);
|
|
1721
|
+
} else if (column) {
|
|
1722
|
+
column.setFilterValue(resolvedValue ? [resolvedValue] : void 0);
|
|
1723
1723
|
}
|
|
1724
1724
|
setLocalValue(value);
|
|
1725
1725
|
},
|
|
@@ -1735,7 +1735,10 @@ var DataTableFilter = React10__namespace.memo(function DataTableFilter2({
|
|
|
1735
1735
|
className,
|
|
1736
1736
|
children: [
|
|
1737
1737
|
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "all", children: "Todos" }),
|
|
1738
|
-
options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children:
|
|
1738
|
+
options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
1739
|
+
option.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground", children: option.icon }),
|
|
1740
|
+
option.label
|
|
1741
|
+
] }) }, option.value))
|
|
1739
1742
|
]
|
|
1740
1743
|
}
|
|
1741
1744
|
);
|