@bluemarble/bm-components 1.12.2 → 1.13.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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -205,7 +205,10 @@ type FilterProps = {
|
|
|
205
205
|
value: unknown;
|
|
206
206
|
compareType: FilterCompareType;
|
|
207
207
|
};
|
|
208
|
-
|
|
208
|
+
interface IUseFilterProps {
|
|
209
|
+
defaultFilters?: FilterProps[];
|
|
210
|
+
}
|
|
211
|
+
declare function useFilter(props?: IUseFilterProps): {
|
|
209
212
|
filters: FilterProps[];
|
|
210
213
|
filterBy: (newFilter: FilterProps) => void;
|
|
211
214
|
removeFilter: (prop: string, isId?: boolean) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -205,7 +205,10 @@ type FilterProps = {
|
|
|
205
205
|
value: unknown;
|
|
206
206
|
compareType: FilterCompareType;
|
|
207
207
|
};
|
|
208
|
-
|
|
208
|
+
interface IUseFilterProps {
|
|
209
|
+
defaultFilters?: FilterProps[];
|
|
210
|
+
}
|
|
211
|
+
declare function useFilter(props?: IUseFilterProps): {
|
|
209
212
|
filters: FilterProps[];
|
|
210
213
|
filterBy: (newFilter: FilterProps) => void;
|
|
211
214
|
removeFilter: (prop: string, isId?: boolean) => void;
|
package/dist/index.js
CHANGED
|
@@ -4694,8 +4694,10 @@ function getObjectValue(obj) {
|
|
|
4694
4694
|
}
|
|
4695
4695
|
|
|
4696
4696
|
// src/hooks/useFilter.ts
|
|
4697
|
-
function useFilter() {
|
|
4698
|
-
const [selectedFilters, setSelectedFilters] = _react.useState.call(void 0,
|
|
4697
|
+
function useFilter(props) {
|
|
4698
|
+
const [selectedFilters, setSelectedFilters] = _react.useState.call(void 0,
|
|
4699
|
+
props.defaultFilters || []
|
|
4700
|
+
);
|
|
4699
4701
|
const filterBy = _react.useCallback.call(void 0, (newFilter) => {
|
|
4700
4702
|
const propToCompare = (newFilter == null ? void 0 : newFilter.id) ? "id" : "prop";
|
|
4701
4703
|
function removeRepeatedFilters(filter) {
|