@trackunit/filters-filter-bar 0.0.365 → 0.0.368
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/index.cjs.js +19 -17
- package/index.esm.js +19 -17
- package/package.json +1 -1
- package/src/lib/utils/createInitialState.d.ts +28 -8
package/index.cjs.js
CHANGED
|
@@ -504,9 +504,9 @@ const StarredFilters = ({ filterBarDefinition, filterBarConfig, disableCollapse,
|
|
|
504
504
|
const [expanded, setExpanded] = react.useState(false);
|
|
505
505
|
const [t] = useTranslation();
|
|
506
506
|
const dimensions = reactComponents.useResize();
|
|
507
|
-
return dimensions.width > 768 || disableCollapse ? (jsxRuntime.jsx(FilterSelection, { className: cvaFilterWithoutCollapse({ disableCollapse }), filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters })) : (jsxRuntime.jsx(reactComponents.Collapse, { className: cvaCollapse({ disableCollapse }), id: "storybook_collapsible", initialExpanded: expanded, label: t("filtersBar.filtersHeading") + (filterBarConfig.filtersHaveBeenApplied
|
|
507
|
+
return dimensions.width > 768 || disableCollapse ? (jsxRuntime.jsx(FilterSelection, { className: cvaFilterWithoutCollapse({ disableCollapse }), filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters })) : (jsxRuntime.jsx(reactComponents.Collapse, { className: cvaCollapse({ disableCollapse }), id: "storybook_collapsible", initialExpanded: expanded, label: t("filtersBar.filtersHeading") + (filterBarConfig.filtersHaveBeenApplied ? " *" : ""), onToggle: () => setExpanded(prev => !prev), children: jsxRuntime.jsx(FilterSelection, { className: "flex", filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters }) }));
|
|
508
508
|
};
|
|
509
|
-
const FilterSelection = ({ filterBarDefinition, filterBarConfig, hiddenFilters = [], className,
|
|
509
|
+
const FilterSelection = ({ filterBarDefinition, filterBarConfig, hiddenFilters = [], className, }) => {
|
|
510
510
|
const hideInFilterBar = react.useMemo(() => {
|
|
511
511
|
return sharedUtils.objectValues(filterBarDefinition)
|
|
512
512
|
.map(filter => {
|
|
@@ -565,8 +565,10 @@ const DynamicFilterList = ({ rowCount, keyMapper, labelMapper, prefixMapper, onC
|
|
|
565
565
|
const [t] = useTranslation();
|
|
566
566
|
const parentRef = react.useRef(null);
|
|
567
567
|
const updatedRowCount = react.useMemo(() => (showRequestMoreUseSearch ? rowCount + 1 : rowCount), [rowCount, showRequestMoreUseSearch]);
|
|
568
|
-
return (jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, ref: parentRef, children: jsxRuntime.jsx(reactComponents.VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "
|
|
569
|
-
return (jsxRuntime.jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxRuntime.jsxs("div", { className: "p-3 pt-2", children: [jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsxRuntime.jsx("br", {}), jsxRuntime.jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsxRuntime.jsx(reactFilterComponents.RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () =>
|
|
568
|
+
return (jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, ref: parentRef, children: jsxRuntime.jsx(reactComponents.VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "space", children: index => {
|
|
569
|
+
return (jsxRuntime.jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxRuntime.jsxs("div", { className: "p-3 pt-2", children: [jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsxRuntime.jsx("br", {}), jsxRuntime.jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsxRuntime.jsx(reactFilterComponents.RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => {
|
|
570
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(index);
|
|
571
|
+
}, prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
|
|
570
572
|
} }) }));
|
|
571
573
|
};
|
|
572
574
|
|
|
@@ -613,7 +615,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
613
615
|
var _a, _b, _c, _d, _e;
|
|
614
616
|
const [undefinedCount, setUndefinedCount] = react.useState(null);
|
|
615
617
|
const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
|
|
616
|
-
const
|
|
618
|
+
const handleSetValue = (value) => {
|
|
617
619
|
logEvent("Filters Applied - V2", {
|
|
618
620
|
type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
|
|
619
621
|
value: value.key,
|
|
@@ -675,14 +677,14 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
675
677
|
}, count: index => { var _a; return (_a = res[index]) === null || _a === void 0 ? void 0 : _a.count; }, keyMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.key) || ""; }, labelMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.label) || ""; }, onChange: index => {
|
|
676
678
|
const result = res[index];
|
|
677
679
|
if (result) {
|
|
678
|
-
|
|
680
|
+
handleSetValue(result);
|
|
679
681
|
}
|
|
680
682
|
}, prefixMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.prefix) || ""; }, rowCount: undefinedCount ? res.length - 1 : res.length, showRequestMoreUseSearch: showRequestMoreUseSearch, showTooltip: showTooltip, type: "CheckBox" })) }), showUndefinedOptionWithCountAtBottom && undefinedCount ? (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: filterDefinition.type === "valueName"
|
|
681
683
|
? filterBarActions.objectArrayIncludesValue(filterDefinition.filterKey, ((_c = results[undefinedCount.index]) === null || _c === void 0 ? void 0 : _c.key) || "")
|
|
682
684
|
: filterBarActions.arrayIncludesValue(filterDefinition.filterKey, ((_d = results[undefinedCount.index]) === null || _d === void 0 ? void 0 : _d.key) || ""), className: "border-t-2", dataTestId: "dynamic-filter-check-box-undefined", itemCount: undefinedCount.count, label: (_e = results[undefinedCount.index]) === null || _e === void 0 ? void 0 : _e.label, name: "dynamic-filter-check-box-undefined", onChange: () => {
|
|
683
685
|
const result = results[undefinedCount.index];
|
|
684
686
|
if (result) {
|
|
685
|
-
|
|
687
|
+
handleSetValue(result);
|
|
686
688
|
}
|
|
687
689
|
} }, "dynamic-filter-check-box-undefined")) : null] }));
|
|
688
690
|
};
|
|
@@ -816,15 +818,15 @@ const capitalize = (s) => {
|
|
|
816
818
|
* @returns {string[] | ValueName[] | null | { min: undefined, max: undefined } | { from: undefined, to: undefined }} - The initial value corresponding to the given filter type.
|
|
817
819
|
*/
|
|
818
820
|
const getInitialValueFromType = (type) => {
|
|
821
|
+
if (type === "string") {
|
|
822
|
+
return '';
|
|
823
|
+
}
|
|
819
824
|
if (type === "stringArray") {
|
|
820
825
|
return [];
|
|
821
826
|
}
|
|
822
827
|
if (type === "valueName") {
|
|
823
828
|
return [];
|
|
824
829
|
}
|
|
825
|
-
if (type === "boolean") {
|
|
826
|
-
return null;
|
|
827
|
-
}
|
|
828
830
|
if (type === "minMax") {
|
|
829
831
|
return { min: undefined, max: undefined };
|
|
830
832
|
}
|
|
@@ -1011,14 +1013,14 @@ const useFilterBar = ({ name, onValuesChange, filterBarDefinition, initialState,
|
|
|
1011
1013
|
//To do this for a changing default value as in customers and sites we would need to recreate the initialFilterBarConfig every time the default value changes.
|
|
1012
1014
|
//This mean that filterbars that have this functionality wouldn't be able to save the state of the filterbar.
|
|
1013
1015
|
//Another option would be to create a new filterbar for each customer or site. This also has its drawbacks. Would raise it with the frontend community.
|
|
1014
|
-
const hasNonVisibleDefaultValues = sharedUtils.objectValues(filterBarDefinition).some(
|
|
1016
|
+
const hasNonVisibleDefaultValues = sharedUtils.objectValues(filterBarDefinition).some(value => {
|
|
1015
1017
|
var _a;
|
|
1016
|
-
return
|
|
1017
|
-
!
|
|
1018
|
-
|
|
1019
|
-
!
|
|
1020
|
-
((_a =
|
|
1021
|
-
|
|
1018
|
+
return value.showInStarredMenu &&
|
|
1019
|
+
!value.showInStarredMenu() &&
|
|
1020
|
+
value.showInFilterBar &&
|
|
1021
|
+
!value.showInFilterBar() &&
|
|
1022
|
+
((_a = value.defaultValue) === null || _a === void 0 ? void 0 : _a.toString) &&
|
|
1023
|
+
value.defaultValue.toString().length > 0;
|
|
1022
1024
|
});
|
|
1023
1025
|
if (initialFilterBarConfig === undefined || hasNonVisibleDefaultValues) {
|
|
1024
1026
|
initialFilterBarConfig = createInitialState(name, sharedUtils.objectValues(filterBarDefinition), initialState || {}, setValue);
|
package/index.esm.js
CHANGED
|
@@ -496,9 +496,9 @@ const StarredFilters = ({ filterBarDefinition, filterBarConfig, disableCollapse,
|
|
|
496
496
|
const [expanded, setExpanded] = useState(false);
|
|
497
497
|
const [t] = useTranslation();
|
|
498
498
|
const dimensions = useResize();
|
|
499
|
-
return dimensions.width > 768 || disableCollapse ? (jsx(FilterSelection, { className: cvaFilterWithoutCollapse({ disableCollapse }), filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters })) : (jsx(Collapse, { className: cvaCollapse({ disableCollapse }), id: "storybook_collapsible", initialExpanded: expanded, label: t("filtersBar.filtersHeading") + (filterBarConfig.filtersHaveBeenApplied
|
|
499
|
+
return dimensions.width > 768 || disableCollapse ? (jsx(FilterSelection, { className: cvaFilterWithoutCollapse({ disableCollapse }), filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters })) : (jsx(Collapse, { className: cvaCollapse({ disableCollapse }), id: "storybook_collapsible", initialExpanded: expanded, label: t("filtersBar.filtersHeading") + (filterBarConfig.filtersHaveBeenApplied ? " *" : ""), onToggle: () => setExpanded(prev => !prev), children: jsx(FilterSelection, { className: "flex", filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters }) }));
|
|
500
500
|
};
|
|
501
|
-
const FilterSelection = ({ filterBarDefinition, filterBarConfig, hiddenFilters = [], className,
|
|
501
|
+
const FilterSelection = ({ filterBarDefinition, filterBarConfig, hiddenFilters = [], className, }) => {
|
|
502
502
|
const hideInFilterBar = useMemo(() => {
|
|
503
503
|
return objectValues(filterBarDefinition)
|
|
504
504
|
.map(filter => {
|
|
@@ -557,8 +557,10 @@ const DynamicFilterList = ({ rowCount, keyMapper, labelMapper, prefixMapper, onC
|
|
|
557
557
|
const [t] = useTranslation();
|
|
558
558
|
const parentRef = useRef(null);
|
|
559
559
|
const updatedRowCount = useMemo(() => (showRequestMoreUseSearch ? rowCount + 1 : rowCount), [rowCount, showRequestMoreUseSearch]);
|
|
560
|
-
return (jsx(FilterBody, { limitSize: true, ref: parentRef, children: jsx(VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "
|
|
561
|
-
return (jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxs("div", { className: "p-3 pt-2", children: [jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsx("br", {}), jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsx(RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsx(CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () =>
|
|
560
|
+
return (jsx(FilterBody, { limitSize: true, ref: parentRef, children: jsx(VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "space", children: index => {
|
|
561
|
+
return (jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxs("div", { className: "p-3 pt-2", children: [jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsx("br", {}), jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsx(RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsx(CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => {
|
|
562
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(index);
|
|
563
|
+
}, prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
|
|
562
564
|
} }) }));
|
|
563
565
|
};
|
|
564
566
|
|
|
@@ -605,7 +607,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
605
607
|
var _a, _b, _c, _d, _e;
|
|
606
608
|
const [undefinedCount, setUndefinedCount] = useState(null);
|
|
607
609
|
const { logEvent } = useAnalytics(FilterEvents);
|
|
608
|
-
const
|
|
610
|
+
const handleSetValue = (value) => {
|
|
609
611
|
logEvent("Filters Applied - V2", {
|
|
610
612
|
type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
|
|
611
613
|
value: value.key,
|
|
@@ -667,14 +669,14 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
667
669
|
}, count: index => { var _a; return (_a = res[index]) === null || _a === void 0 ? void 0 : _a.count; }, keyMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.key) || ""; }, labelMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.label) || ""; }, onChange: index => {
|
|
668
670
|
const result = res[index];
|
|
669
671
|
if (result) {
|
|
670
|
-
|
|
672
|
+
handleSetValue(result);
|
|
671
673
|
}
|
|
672
674
|
}, prefixMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.prefix) || ""; }, rowCount: undefinedCount ? res.length - 1 : res.length, showRequestMoreUseSearch: showRequestMoreUseSearch, showTooltip: showTooltip, type: "CheckBox" })) }), showUndefinedOptionWithCountAtBottom && undefinedCount ? (jsx(CheckBoxFilterItem, { checked: filterDefinition.type === "valueName"
|
|
673
675
|
? filterBarActions.objectArrayIncludesValue(filterDefinition.filterKey, ((_c = results[undefinedCount.index]) === null || _c === void 0 ? void 0 : _c.key) || "")
|
|
674
676
|
: filterBarActions.arrayIncludesValue(filterDefinition.filterKey, ((_d = results[undefinedCount.index]) === null || _d === void 0 ? void 0 : _d.key) || ""), className: "border-t-2", dataTestId: "dynamic-filter-check-box-undefined", itemCount: undefinedCount.count, label: (_e = results[undefinedCount.index]) === null || _e === void 0 ? void 0 : _e.label, name: "dynamic-filter-check-box-undefined", onChange: () => {
|
|
675
677
|
const result = results[undefinedCount.index];
|
|
676
678
|
if (result) {
|
|
677
|
-
|
|
679
|
+
handleSetValue(result);
|
|
678
680
|
}
|
|
679
681
|
} }, "dynamic-filter-check-box-undefined")) : null] }));
|
|
680
682
|
};
|
|
@@ -808,15 +810,15 @@ const capitalize = (s) => {
|
|
|
808
810
|
* @returns {string[] | ValueName[] | null | { min: undefined, max: undefined } | { from: undefined, to: undefined }} - The initial value corresponding to the given filter type.
|
|
809
811
|
*/
|
|
810
812
|
const getInitialValueFromType = (type) => {
|
|
813
|
+
if (type === "string") {
|
|
814
|
+
return '';
|
|
815
|
+
}
|
|
811
816
|
if (type === "stringArray") {
|
|
812
817
|
return [];
|
|
813
818
|
}
|
|
814
819
|
if (type === "valueName") {
|
|
815
820
|
return [];
|
|
816
821
|
}
|
|
817
|
-
if (type === "boolean") {
|
|
818
|
-
return null;
|
|
819
|
-
}
|
|
820
822
|
if (type === "minMax") {
|
|
821
823
|
return { min: undefined, max: undefined };
|
|
822
824
|
}
|
|
@@ -1003,14 +1005,14 @@ const useFilterBar = ({ name, onValuesChange, filterBarDefinition, initialState,
|
|
|
1003
1005
|
//To do this for a changing default value as in customers and sites we would need to recreate the initialFilterBarConfig every time the default value changes.
|
|
1004
1006
|
//This mean that filterbars that have this functionality wouldn't be able to save the state of the filterbar.
|
|
1005
1007
|
//Another option would be to create a new filterbar for each customer or site. This also has its drawbacks. Would raise it with the frontend community.
|
|
1006
|
-
const hasNonVisibleDefaultValues = objectValues(filterBarDefinition).some(
|
|
1008
|
+
const hasNonVisibleDefaultValues = objectValues(filterBarDefinition).some(value => {
|
|
1007
1009
|
var _a;
|
|
1008
|
-
return
|
|
1009
|
-
!
|
|
1010
|
-
|
|
1011
|
-
!
|
|
1012
|
-
((_a =
|
|
1013
|
-
|
|
1010
|
+
return value.showInStarredMenu &&
|
|
1011
|
+
!value.showInStarredMenu() &&
|
|
1012
|
+
value.showInFilterBar &&
|
|
1013
|
+
!value.showInFilterBar() &&
|
|
1014
|
+
((_a = value.defaultValue) === null || _a === void 0 ? void 0 : _a.toString) &&
|
|
1015
|
+
value.defaultValue.toString().length > 0;
|
|
1014
1016
|
});
|
|
1015
1017
|
if (initialFilterBarConfig === undefined || hasNonVisibleDefaultValues) {
|
|
1016
1018
|
initialFilterBarConfig = createInitialState(name, objectValues(filterBarDefinition), initialState || {}, setValue);
|
package/package.json
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
|
-
import { FilterBarConfig, FilterBarDefinition, FilterBarInferredValue, FilterDefinition,
|
|
1
|
+
import { FilterBarConfig, FilterBarDefinition, FilterBarInferredValue, FilterDefinition, InitialState, ValueName } from "../types/FilterTypes";
|
|
2
|
+
type InitialTypes = {
|
|
3
|
+
Arg: "string";
|
|
4
|
+
Init: '';
|
|
5
|
+
} | {
|
|
6
|
+
Arg: "stringArray";
|
|
7
|
+
Init: string[];
|
|
8
|
+
} | {
|
|
9
|
+
Arg: "valueName";
|
|
10
|
+
Init: ValueName[];
|
|
11
|
+
} | {
|
|
12
|
+
Arg: "minMax";
|
|
13
|
+
Init: {
|
|
14
|
+
min: undefined;
|
|
15
|
+
max: undefined;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
Arg: "dateRange";
|
|
19
|
+
Init: {
|
|
20
|
+
from: undefined;
|
|
21
|
+
to: undefined;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
Arg: unknown;
|
|
25
|
+
Init: null;
|
|
26
|
+
};
|
|
2
27
|
/**
|
|
3
28
|
* A helper function that returns a default value based on the filter type.
|
|
4
29
|
*
|
|
5
30
|
* @param {FilterTypes} type - The filter type for which to retrieve the initial value.
|
|
6
31
|
* @returns {string[] | ValueName[] | null | { min: undefined, max: undefined } | { from: undefined, to: undefined }} - The initial value corresponding to the given filter type.
|
|
7
32
|
*/
|
|
8
|
-
export declare const getInitialValueFromType: (type:
|
|
9
|
-
min: undefined;
|
|
10
|
-
max: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
from: undefined;
|
|
13
|
-
to: undefined;
|
|
14
|
-
};
|
|
33
|
+
export declare const getInitialValueFromType: <InitialType extends InitialTypes>(type: InitialType['Arg']) => InitialType['Init'];
|
|
15
34
|
/**
|
|
16
35
|
* Creates an initial state object for a filter bar configuration based on the provided parameters.
|
|
17
36
|
*
|
|
@@ -19,3 +38,4 @@ export declare const getInitialValueFromType: (type: FilterTypes) => string[] |
|
|
|
19
38
|
* @returns {FilterBarConfig<TFilterBarDefinition>} - Returns an initial filter bar configuration object.
|
|
20
39
|
*/
|
|
21
40
|
export declare const createInitialState: <TFilterBarDefinition extends FilterBarDefinition>(name: string, mainFilters: FilterDefinition[], initialState: InitialState<TFilterBarDefinition>, setValue: (key: string, callback: (prev: FilterBarInferredValue<TFilterBarDefinition, never> | undefined) => FilterBarInferredValue<TFilterBarDefinition, never> | undefined) => void) => FilterBarConfig<TFilterBarDefinition>;
|
|
41
|
+
export {};
|