@bluemarble/bm-components 1.13.3 → 1.14.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.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4695,9 +4695,10 @@ function getObjectValue(obj) {
|
|
|
4695
4695
|
|
|
4696
4696
|
// src/hooks/useFilter.ts
|
|
4697
4697
|
function useFilter(props = { defaultFilters: [] }) {
|
|
4698
|
-
const [selectedFilters, setSelectedFilters] = useState6(
|
|
4699
|
-
|
|
4700
|
-
|
|
4698
|
+
const [selectedFilters, setSelectedFilters] = useState6(() => {
|
|
4699
|
+
const { defaultFilters } = props;
|
|
4700
|
+
return defaultFilters || [];
|
|
4701
|
+
});
|
|
4701
4702
|
const filterBy = useCallback4((newFilter) => {
|
|
4702
4703
|
const propToCompare = (newFilter == null ? void 0 : newFilter.id) ? "id" : "prop";
|
|
4703
4704
|
function removeRepeatedFilters(filter) {
|
|
@@ -4799,9 +4800,15 @@ function useGrid({
|
|
|
4799
4800
|
},
|
|
4800
4801
|
[]
|
|
4801
4802
|
);
|
|
4802
|
-
const
|
|
4803
|
+
const clearSort = useCallback5(() => {
|
|
4804
|
+
setSortedBy([]);
|
|
4805
|
+
}, []);
|
|
4806
|
+
const appendSort = useCallback5((prop, direction) => {
|
|
4803
4807
|
setSortedBy((prev) => [...prev, { prop, direction }]);
|
|
4804
4808
|
}, []);
|
|
4809
|
+
const setSort = useCallback5((prop, direction) => {
|
|
4810
|
+
setSortedBy([{ prop, direction }]);
|
|
4811
|
+
}, []);
|
|
4805
4812
|
const onSortBy = useCallback5(
|
|
4806
4813
|
(prop) => {
|
|
4807
4814
|
if (!prop)
|
|
@@ -4889,18 +4896,20 @@ function useGrid({
|
|
|
4889
4896
|
}, [externalDefaultData]);
|
|
4890
4897
|
return {
|
|
4891
4898
|
data: displayData,
|
|
4892
|
-
set,
|
|
4893
|
-
onSortBy,
|
|
4894
4899
|
sortedBy,
|
|
4895
4900
|
defaultData,
|
|
4896
4901
|
columns,
|
|
4897
4902
|
currentPage,
|
|
4898
4903
|
totalNumberOfPages: totalNumberOfPages < 0 ? 0 : totalNumberOfPages,
|
|
4899
|
-
onPageChange,
|
|
4900
|
-
setRowsPerPage: onChangeRowsPerPage,
|
|
4901
4904
|
rowsPerPageOptions,
|
|
4902
4905
|
rowsPerPage,
|
|
4903
|
-
|
|
4906
|
+
set,
|
|
4907
|
+
onSortBy,
|
|
4908
|
+
onPageChange,
|
|
4909
|
+
setRowsPerPage: onChangeRowsPerPage,
|
|
4910
|
+
appendSort,
|
|
4911
|
+
setSort,
|
|
4912
|
+
clearSort
|
|
4904
4913
|
};
|
|
4905
4914
|
}
|
|
4906
4915
|
function searchKeysForValue(row, compare) {
|