@equinor/fusion-react-filter 1.1.10 → 2.1.0-filter.2
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 +4 -4
- package/dist/FilterProvider.d.ts +7 -28
- package/dist/FilterProvider.d.ts.map +1 -1
- package/dist/FilterProvider.js +24 -31
- package/dist/FilterProvider.js.map +1 -1
- package/dist/actions.d.ts +32 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +20 -0
- package/dist/actions.js.map +1 -0
- package/dist/components/filter/FilterOptionHeader.d.ts +7 -0
- package/dist/components/filter/FilterOptionHeader.d.ts.map +1 -0
- package/dist/components/filter/FilterOptionHeader.js +69 -0
- package/dist/components/filter/FilterOptionHeader.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilter.d.ts +16 -0
- package/dist/components/filter/checkbox/CheckboxFilter.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilter.js +16 -0
- package/dist/components/filter/checkbox/CheckboxFilter.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilter.style.d.ts +5 -0
- package/dist/components/filter/checkbox/CheckboxFilter.style.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilter.style.js +19 -0
- package/dist/components/filter/checkbox/CheckboxFilter.style.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.d.ts +14 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.js +19 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.d.ts +3 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.js +40 -0
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.d.ts +3 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.js +24 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptions.d.ts +3 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptions.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptions.js +37 -0
- package/dist/components/filter/checkbox/CheckboxFilterOptions.js.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterProvider.d.ts +13 -0
- package/dist/components/filter/checkbox/CheckboxFilterProvider.d.ts.map +1 -0
- package/dist/components/filter/checkbox/CheckboxFilterProvider.js +16 -0
- package/dist/components/filter/checkbox/CheckboxFilterProvider.js.map +1 -0
- package/dist/components/filter/checkbox/context.d.ts +4 -0
- package/dist/components/filter/checkbox/context.d.ts.map +1 -0
- package/dist/components/filter/checkbox/context.js +3 -0
- package/dist/components/filter/checkbox/context.js.map +1 -0
- package/dist/components/filter/checkbox/index.d.ts +2 -0
- package/dist/components/filter/checkbox/index.d.ts.map +1 -0
- package/dist/components/filter/checkbox/index.js +2 -0
- package/dist/components/filter/checkbox/index.js.map +1 -0
- package/dist/components/filter/checkbox/types.d.ts +7 -0
- package/dist/components/filter/checkbox/types.d.ts.map +1 -0
- package/dist/components/filter/checkbox/types.js +2 -0
- package/dist/components/filter/checkbox/types.js.map +1 -0
- package/dist/components/filter/index.d.ts +5 -0
- package/dist/components/filter/index.d.ts.map +1 -0
- package/dist/components/filter/index.js +5 -0
- package/dist/components/filter/index.js.map +1 -0
- package/dist/components/filter/search/SearchFilter.d.ts +17 -0
- package/dist/components/filter/search/SearchFilter.d.ts.map +1 -0
- package/dist/components/filter/search/SearchFilter.js +47 -0
- package/dist/components/filter/search/SearchFilter.js.map +1 -0
- package/dist/components/filter/search/index.d.ts +2 -0
- package/dist/components/filter/search/index.d.ts.map +1 -0
- package/dist/components/filter/search/index.js +2 -0
- package/dist/components/filter/search/index.js.map +1 -0
- package/dist/components/filter/types.d.ts +7 -0
- package/dist/components/filter/types.d.ts.map +1 -0
- package/dist/components/filter/types.js +2 -0
- package/dist/components/filter/types.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/misc/ClearFilterButton.d.ts +10 -0
- package/dist/components/misc/ClearFilterButton.d.ts.map +1 -0
- package/dist/components/misc/ClearFilterButton.js +25 -0
- package/dist/components/misc/ClearFilterButton.js.map +1 -0
- package/dist/components/misc/FilterContainer.d.ts +12 -0
- package/dist/components/misc/FilterContainer.d.ts.map +1 -0
- package/dist/components/misc/FilterContainer.js +18 -0
- package/dist/components/misc/FilterContainer.js.map +1 -0
- package/dist/components/misc/index.d.ts +3 -0
- package/dist/components/misc/index.d.ts.map +1 -0
- package/dist/components/misc/index.js +3 -0
- package/dist/components/misc/index.js.map +1 -0
- package/dist/components/panel/FilterPanel.d.ts +19 -0
- package/dist/components/panel/FilterPanel.d.ts.map +1 -0
- package/dist/components/panel/FilterPanel.js +17 -0
- package/dist/components/panel/FilterPanel.js.map +1 -0
- package/dist/components/panel/FilterPanelBar.d.ts +3 -0
- package/dist/components/panel/FilterPanelBar.d.ts.map +1 -0
- package/dist/components/panel/FilterPanelBar.js +31 -0
- package/dist/components/panel/FilterPanelBar.js.map +1 -0
- package/dist/components/panel/FilterPanelFilters.d.ts +3 -0
- package/dist/components/panel/FilterPanelFilters.d.ts.map +1 -0
- package/dist/components/panel/FilterPanelFilters.js +13 -0
- package/dist/components/panel/FilterPanelFilters.js.map +1 -0
- package/dist/components/panel/FilterPanelProvider.d.ts +32 -0
- package/dist/components/panel/FilterPanelProvider.d.ts.map +1 -0
- package/dist/components/panel/FilterPanelProvider.js +35 -0
- package/dist/components/panel/FilterPanelProvider.js.map +1 -0
- package/dist/components/panel/FilterPanelSelector.d.ts +7 -0
- package/dist/components/panel/FilterPanelSelector.d.ts.map +1 -0
- package/dist/components/panel/FilterPanelSelector.js +17 -0
- package/dist/components/panel/FilterPanelSelector.js.map +1 -0
- package/dist/components/panel/index.d.ts +5 -0
- package/dist/components/panel/index.d.ts.map +1 -0
- package/dist/components/panel/index.js +5 -0
- package/dist/components/panel/index.js.map +1 -0
- package/dist/context.d.ts +6 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +6 -0
- package/dist/context.js.map +1 -0
- package/dist/hooks/index.d.ts +12 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +25 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useClearFilter.d.ts +9 -0
- package/dist/hooks/useClearFilter.d.ts.map +1 -0
- package/dist/hooks/useClearFilter.js +30 -0
- package/dist/hooks/useClearFilter.js.map +1 -0
- package/dist/hooks/useFilter.d.ts +7 -0
- package/dist/hooks/useFilter.d.ts.map +1 -0
- package/dist/hooks/useFilter.js +26 -0
- package/dist/hooks/useFilter.js.map +1 -0
- package/dist/hooks/useFilterData.d.ts +11 -0
- package/dist/hooks/useFilterData.d.ts.map +1 -0
- package/dist/hooks/useFilterData.js +39 -0
- package/dist/hooks/useFilterData.js.map +1 -0
- package/dist/hooks/useFilterSelection.d.ts +5 -9
- package/dist/hooks/useFilterSelection.d.ts.map +1 -1
- package/dist/hooks/useFilterSelection.js +6 -21
- package/dist/hooks/useFilterSelection.js.map +1 -1
- package/dist/index.d.ts +4 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -15
- package/dist/index.js.map +1 -1
- package/dist/options/FilterOptionProvider.d.ts +12 -0
- package/dist/options/FilterOptionProvider.d.ts.map +1 -0
- package/dist/options/FilterOptionProvider.js +55 -0
- package/dist/options/FilterOptionProvider.js.map +1 -0
- package/dist/options/actions.d.ts +8 -0
- package/dist/options/actions.d.ts.map +1 -0
- package/dist/options/actions.js +6 -0
- package/dist/options/actions.js.map +1 -0
- package/dist/options/context.d.ts +6 -0
- package/dist/options/context.d.ts.map +1 -0
- package/dist/options/context.js +7 -0
- package/dist/options/context.js.map +1 -0
- package/dist/options/create-options.d.ts +4 -0
- package/dist/options/create-options.d.ts.map +1 -0
- package/dist/options/create-options.js +24 -0
- package/dist/options/create-options.js.map +1 -0
- package/dist/options/index.d.ts +6 -0
- package/dist/options/index.d.ts.map +1 -0
- package/dist/options/index.js +6 -0
- package/dist/options/index.js.map +1 -0
- package/dist/options/reducer.d.ts +58 -0
- package/dist/options/reducer.d.ts.map +1 -0
- package/dist/options/reducer.js +4 -0
- package/dist/options/reducer.js.map +1 -0
- package/dist/options/search/filter-option-match.d.ts +7 -0
- package/dist/options/search/filter-option-match.d.ts.map +1 -0
- package/dist/options/search/filter-option-match.js +10 -0
- package/dist/options/search/filter-option-match.js.map +1 -0
- package/dist/options/search/filter-option-search.d.ts +8 -0
- package/dist/options/search/filter-option-search.d.ts.map +1 -0
- package/dist/options/search/filter-option-search.js +12 -0
- package/dist/options/search/filter-option-search.js.map +1 -0
- package/dist/options/search/index.d.ts +2 -0
- package/dist/options/search/index.d.ts.map +1 -0
- package/dist/options/search/index.js +2 -0
- package/dist/options/search/index.js.map +1 -0
- package/dist/options/search/types.d.ts +9 -0
- package/dist/options/search/types.d.ts.map +1 -0
- package/dist/options/search/types.js +2 -0
- package/dist/options/search/types.js.map +1 -0
- package/dist/options/search/useFilterOptionSearch.d.ts +12 -0
- package/dist/options/search/useFilterOptionSearch.d.ts.map +1 -0
- package/dist/options/search/useFilterOptionSearch.js +28 -0
- package/dist/options/search/useFilterOptionSearch.js.map +1 -0
- package/dist/options/types.d.ts +32 -0
- package/dist/options/types.d.ts.map +1 -0
- package/dist/options/types.js +2 -0
- package/dist/options/types.js.map +1 -0
- package/dist/reducers.d.ts +170 -0
- package/dist/reducers.d.ts.map +1 -0
- package/dist/reducers.js +23 -0
- package/dist/reducers.js.map +1 -0
- package/dist/{types/Filter.d.ts → types.d.ts} +19 -16
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +13 -9
- package/dist/FilterContext.d.ts +0 -8
- package/dist/FilterContext.d.ts.map +0 -1
- package/dist/FilterContext.js +0 -4
- package/dist/FilterContext.js.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxFilter.d.ts +0 -34
- package/dist/components/CheckBoxFilter/CheckBoxFilter.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxFilter.js +0 -76
- package/dist/components/CheckBoxFilter/CheckBoxFilter.js.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxOption.d.ts +0 -14
- package/dist/components/CheckBoxFilter/CheckBoxOption.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxOption.js +0 -10
- package/dist/components/CheckBoxFilter/CheckBoxOption.js.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxOption.style.d.ts +0 -3
- package/dist/components/CheckBoxFilter/CheckBoxOption.style.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/CheckBoxOption.style.js +0 -24
- package/dist/components/CheckBoxFilter/CheckBoxOption.style.js.map +0 -1
- package/dist/components/CheckBoxFilter/CheckboxFilter.style.d.ts +0 -3
- package/dist/components/CheckBoxFilter/CheckboxFilter.style.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/CheckboxFilter.style.js +0 -29
- package/dist/components/CheckBoxFilter/CheckboxFilter.style.js.map +0 -1
- package/dist/components/CheckBoxFilter/SelectAllOption.d.ts +0 -12
- package/dist/components/CheckBoxFilter/SelectAllOption.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/SelectAllOption.js +0 -22
- package/dist/components/CheckBoxFilter/SelectAllOption.js.map +0 -1
- package/dist/components/CheckBoxFilter/index.d.ts +0 -5
- package/dist/components/CheckBoxFilter/index.d.ts.map +0 -1
- package/dist/components/CheckBoxFilter/index.js +0 -5
- package/dist/components/CheckBoxFilter/index.js.map +0 -1
- package/dist/components/FilterSection/FilterSection.d.ts +0 -29
- package/dist/components/FilterSection/FilterSection.d.ts.map +0 -1
- package/dist/components/FilterSection/FilterSection.js +0 -64
- package/dist/components/FilterSection/FilterSection.js.map +0 -1
- package/dist/components/FilterSection/FilterSection.style.d.ts +0 -3
- package/dist/components/FilterSection/FilterSection.style.d.ts.map +0 -1
- package/dist/components/FilterSection/FilterSection.style.js +0 -56
- package/dist/components/FilterSection/FilterSection.style.js.map +0 -1
- package/dist/components/FilterSection/index.d.ts +0 -3
- package/dist/components/FilterSection/index.d.ts.map +0 -1
- package/dist/components/FilterSection/index.js +0 -3
- package/dist/components/FilterSection/index.js.map +0 -1
- package/dist/components/FilterSelectionChips/FilterSelectionChips.d.ts +0 -7
- package/dist/components/FilterSelectionChips/FilterSelectionChips.d.ts.map +0 -1
- package/dist/components/FilterSelectionChips/FilterSelectionChips.js +0 -18
- package/dist/components/FilterSelectionChips/FilterSelectionChips.js.map +0 -1
- package/dist/components/FilterSelectionChips/FilterSelectionChips.style.d.ts +0 -3
- package/dist/components/FilterSelectionChips/FilterSelectionChips.style.d.ts.map +0 -1
- package/dist/components/FilterSelectionChips/FilterSelectionChips.style.js +0 -31
- package/dist/components/FilterSelectionChips/FilterSelectionChips.style.js.map +0 -1
- package/dist/components/FilterSelectionChips/index.d.ts +0 -2
- package/dist/components/FilterSelectionChips/index.d.ts.map +0 -1
- package/dist/components/FilterSelectionChips/index.js +0 -2
- package/dist/components/FilterSelectionChips/index.js.map +0 -1
- package/dist/components/FilterSelectionChips/useChipsSelection.d.ts +0 -9
- package/dist/components/FilterSelectionChips/useChipsSelection.d.ts.map +0 -1
- package/dist/components/FilterSelectionChips/useChipsSelection.js +0 -26
- package/dist/components/FilterSelectionChips/useChipsSelection.js.map +0 -1
- package/dist/components/FilterSelector/FilterCategory.d.ts +0 -7
- package/dist/components/FilterSelector/FilterCategory.d.ts.map +0 -1
- package/dist/components/FilterSelector/FilterCategory.js +0 -24
- package/dist/components/FilterSelector/FilterCategory.js.map +0 -1
- package/dist/components/FilterSelector/FilterCategory.style.d.ts +0 -3
- package/dist/components/FilterSelector/FilterCategory.style.d.ts.map +0 -1
- package/dist/components/FilterSelector/FilterCategory.style.js +0 -12
- package/dist/components/FilterSelector/FilterCategory.style.js.map +0 -1
- package/dist/components/FilterSelector/FilterSelector.d.ts +0 -31
- package/dist/components/FilterSelector/FilterSelector.d.ts.map +0 -1
- package/dist/components/FilterSelector/FilterSelector.js +0 -51
- package/dist/components/FilterSelector/FilterSelector.js.map +0 -1
- package/dist/components/FilterSelector/FilterSelector.style.d.ts +0 -3
- package/dist/components/FilterSelector/FilterSelector.style.d.ts.map +0 -1
- package/dist/components/FilterSelector/FilterSelector.style.js +0 -44
- package/dist/components/FilterSelector/FilterSelector.style.js.map +0 -1
- package/dist/components/FilterSelector/index.d.ts +0 -4
- package/dist/components/FilterSelector/index.d.ts.map +0 -1
- package/dist/components/FilterSelector/index.js +0 -4
- package/dist/components/FilterSelector/index.js.map +0 -1
- package/dist/components/GeneralBar/GeneralBar.d.ts +0 -26
- package/dist/components/GeneralBar/GeneralBar.d.ts.map +0 -1
- package/dist/components/GeneralBar/GeneralBar.js +0 -63
- package/dist/components/GeneralBar/GeneralBar.js.map +0 -1
- package/dist/components/GeneralBar/GeneralBar.style.d.ts +0 -3
- package/dist/components/GeneralBar/GeneralBar.style.d.ts.map +0 -1
- package/dist/components/GeneralBar/GeneralBar.style.js +0 -20
- package/dist/components/GeneralBar/GeneralBar.style.js.map +0 -1
- package/dist/components/GeneralBar/index.d.ts +0 -3
- package/dist/components/GeneralBar/index.d.ts.map +0 -1
- package/dist/components/GeneralBar/index.js +0 -3
- package/dist/components/GeneralBar/index.js.map +0 -1
- package/dist/components/HorizontalBar/HorizontalBar.d.ts +0 -10
- package/dist/components/HorizontalBar/HorizontalBar.d.ts.map +0 -1
- package/dist/components/HorizontalBar/HorizontalBar.js +0 -23
- package/dist/components/HorizontalBar/HorizontalBar.js.map +0 -1
- package/dist/components/HorizontalBar/index.d.ts +0 -3
- package/dist/components/HorizontalBar/index.d.ts.map +0 -1
- package/dist/components/HorizontalBar/index.js +0 -3
- package/dist/components/HorizontalBar/index.js.map +0 -1
- package/dist/components/HorizontalFilterPanel/HorizontalFilterPanel.d.ts +0 -17
- package/dist/components/HorizontalFilterPanel/HorizontalFilterPanel.d.ts.map +0 -1
- package/dist/components/HorizontalFilterPanel/HorizontalFilterPanel.js +0 -28
- package/dist/components/HorizontalFilterPanel/HorizontalFilterPanel.js.map +0 -1
- package/dist/components/HorizontalFilterPanel/index.d.ts +0 -3
- package/dist/components/HorizontalFilterPanel/index.d.ts.map +0 -1
- package/dist/components/HorizontalFilterPanel/index.js +0 -3
- package/dist/components/HorizontalFilterPanel/index.js.map +0 -1
- package/dist/components/Icon/index.d.ts +0 -11
- package/dist/components/Icon/index.d.ts.map +0 -1
- package/dist/components/Icon/index.js +0 -16
- package/dist/components/Icon/index.js.map +0 -1
- package/dist/components/RadioFilter/RadioFilter.d.ts +0 -17
- package/dist/components/RadioFilter/RadioFilter.d.ts.map +0 -1
- package/dist/components/RadioFilter/RadioFilter.js +0 -51
- package/dist/components/RadioFilter/RadioFilter.js.map +0 -1
- package/dist/components/RadioFilter/RadioFilter.style.d.ts +0 -3
- package/dist/components/RadioFilter/RadioFilter.style.d.ts.map +0 -1
- package/dist/components/RadioFilter/RadioFilter.style.js +0 -38
- package/dist/components/RadioFilter/RadioFilter.style.js.map +0 -1
- package/dist/components/RadioFilter/index.d.ts +0 -3
- package/dist/components/RadioFilter/index.d.ts.map +0 -1
- package/dist/components/RadioFilter/index.js +0 -3
- package/dist/components/RadioFilter/index.js.map +0 -1
- package/dist/epic/StatefulObserver.d.ts +0 -8
- package/dist/epic/StatefulObserver.d.ts.map +0 -1
- package/dist/epic/StatefulObserver.js +0 -26
- package/dist/epic/StatefulObserver.js.map +0 -1
- package/dist/epic/epic.d.ts +0 -14
- package/dist/epic/epic.d.ts.map +0 -1
- package/dist/epic/epic.js +0 -2
- package/dist/epic/epic.js.map +0 -1
- package/dist/epic/hooks/useObservableSelector.d.ts +0 -14
- package/dist/epic/hooks/useObservableSelector.d.ts.map +0 -1
- package/dist/epic/hooks/useObservableSelector.js +0 -16
- package/dist/epic/hooks/useObservableSelector.js.map +0 -1
- package/dist/epic/hooks/useObservableState.d.ts +0 -13
- package/dist/epic/hooks/useObservableState.d.ts.map +0 -1
- package/dist/epic/hooks/useObservableState.js +0 -18
- package/dist/epic/hooks/useObservableState.js.map +0 -1
- package/dist/epic/hooks/useSelector.d.ts +0 -10
- package/dist/epic/hooks/useSelector.d.ts.map +0 -1
- package/dist/epic/hooks/useSelector.js +0 -14
- package/dist/epic/hooks/useSelector.js.map +0 -1
- package/dist/epic/reducer.d.ts +0 -56
- package/dist/epic/reducer.d.ts.map +0 -1
- package/dist/epic/reducer.js +0 -78
- package/dist/epic/reducer.js.map +0 -1
- package/dist/filterStore/actions.d.ts +0 -23
- package/dist/filterStore/actions.d.ts.map +0 -1
- package/dist/filterStore/actions.js +0 -18
- package/dist/filterStore/actions.js.map +0 -1
- package/dist/filterStore/epics.d.ts +0 -10
- package/dist/filterStore/epics.d.ts.map +0 -1
- package/dist/filterStore/epics.js +0 -10
- package/dist/filterStore/epics.js.map +0 -1
- package/dist/filterStore/reducers.d.ts +0 -4
- package/dist/filterStore/reducers.d.ts.map +0 -1
- package/dist/filterStore/reducers.js +0 -43
- package/dist/filterStore/reducers.js.map +0 -1
- package/dist/filterStore/store.d.ts +0 -106
- package/dist/filterStore/store.d.ts.map +0 -1
- package/dist/filterStore/store.js +0 -158
- package/dist/filterStore/store.js.map +0 -1
- package/dist/hooks/useEventListener.d.ts +0 -4
- package/dist/hooks/useEventListener.d.ts.map +0 -1
- package/dist/hooks/useEventListener.js +0 -14
- package/dist/hooks/useEventListener.js.map +0 -1
- package/dist/hooks/useFilterChangeHandler.d.ts +0 -26
- package/dist/hooks/useFilterChangeHandler.d.ts.map +0 -1
- package/dist/hooks/useFilterChangeHandler.js +0 -43
- package/dist/hooks/useFilterChangeHandler.js.map +0 -1
- package/dist/hooks/useFilterContext.d.ts +0 -4
- package/dist/hooks/useFilterContext.d.ts.map +0 -1
- package/dist/hooks/useFilterContext.js +0 -5
- package/dist/hooks/useFilterContext.js.map +0 -1
- package/dist/hooks/useFilterOptionsBuilder.d.ts +0 -27
- package/dist/hooks/useFilterOptionsBuilder.d.ts.map +0 -1
- package/dist/hooks/useFilterOptionsBuilder.js +0 -39
- package/dist/hooks/useFilterOptionsBuilder.js.map +0 -1
- package/dist/hooks/useFilterOptionsCounter.d.ts +0 -16
- package/dist/hooks/useFilterOptionsCounter.d.ts.map +0 -1
- package/dist/hooks/useFilterOptionsCounter.js +0 -32
- package/dist/hooks/useFilterOptionsCounter.js.map +0 -1
- package/dist/hooks/useFilterStore.d.ts +0 -25
- package/dist/hooks/useFilterStore.d.ts.map +0 -1
- package/dist/hooks/useFilterStore.js +0 -34
- package/dist/hooks/useFilterStore.js.map +0 -1
- package/dist/hooks/useResizablePanel.d.ts +0 -20
- package/dist/hooks/useResizablePanel.d.ts.map +0 -1
- package/dist/hooks/useResizablePanel.js +0 -71
- package/dist/hooks/useResizablePanel.js.map +0 -1
- package/dist/types/Filter.d.ts.map +0 -1
- package/dist/types/Filter.js +0 -2
- package/dist/types/Filter.js.map +0 -1
- package/dist/types/FilterContainerProps.d.ts +0 -10
- package/dist/types/FilterContainerProps.d.ts.map +0 -1
- package/dist/types/FilterContainerProps.js +0 -2
- package/dist/types/FilterContainerProps.js.map +0 -1
- package/dist/types/FilterCounters.d.ts +0 -3
- package/dist/types/FilterCounters.d.ts.map +0 -1
- package/dist/types/FilterCounters.js +0 -2
- package/dist/types/FilterCounters.js.map +0 -1
- package/dist/types/FilterOption.d.ts +0 -13
- package/dist/types/FilterOption.d.ts.map +0 -1
- package/dist/types/FilterOption.js +0 -2
- package/dist/types/FilterOption.js.map +0 -1
- package/dist/types/FilterStoreState.d.ts +0 -6
- package/dist/types/FilterStoreState.d.ts.map +0 -1
- package/dist/types/FilterStoreState.js +0 -2
- package/dist/types/FilterStoreState.js.map +0 -1
package/dist/context.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
const context = createContext({});
|
|
3
|
+
export const useFilterContext = () => useContext(context);
|
|
4
|
+
export const { Provider, Consumer } = context;
|
|
5
|
+
export default useFilterContext;
|
|
6
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,OAAO,GAAG,aAAa,CAAgB,EAAmB,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAGM,EAAE,CAAC,UAAU,CAAC,OAAO,CAAqC,CAAC;AAEjG,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;AAE9C,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { useClearFilter } from './useClearFilter';
|
|
2
|
+
export { useFilter } from './useFilter';
|
|
3
|
+
export { useFilterSelection } from './useFilterSelection';
|
|
4
|
+
export { useFilterData } from './useFilterData';
|
|
5
|
+
/** re-exports */
|
|
6
|
+
export { useFilterContext } from '../context';
|
|
7
|
+
export declare const useFunky: () => import("rxjs").Observable<{
|
|
8
|
+
key: string;
|
|
9
|
+
title: string | undefined;
|
|
10
|
+
selection: any[];
|
|
11
|
+
}[]>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,iBAAiB;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAO9C,eAAO,MAAM,QAAQ;;;;IAkBpB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { useClearFilter } from './useClearFilter';
|
|
2
|
+
export { useFilter } from './useFilter';
|
|
3
|
+
export { useFilterSelection } from './useFilterSelection';
|
|
4
|
+
export { useFilterData } from './useFilterData';
|
|
5
|
+
/** re-exports */
|
|
6
|
+
export { useFilterContext } from '../context';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import { combineLatest, of } from 'rxjs';
|
|
9
|
+
import { distinctUntilChanged, switchMap } from 'rxjs/operators';
|
|
10
|
+
import { useFilterContext } from '..';
|
|
11
|
+
export const useFunky = () => {
|
|
12
|
+
const context = useFilterContext();
|
|
13
|
+
const [gg] = useState(() => combineLatest([context.filter$, context.selection$]).pipe(distinctUntilChanged(), switchMap(([filters, selections]) => {
|
|
14
|
+
const gg = Object.values(filters)
|
|
15
|
+
.map((filter) => {
|
|
16
|
+
const { title, key } = filter;
|
|
17
|
+
const selection = selections[key] || [];
|
|
18
|
+
return { key, title, selection: [...selection] };
|
|
19
|
+
})
|
|
20
|
+
.filter((x) => !!x.title && !!x.selection);
|
|
21
|
+
return of(gg);
|
|
22
|
+
})));
|
|
23
|
+
return gg;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;A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E,CAAC;AACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Filter } from '../types';
|
|
3
|
+
export declare const selectionChanges: <TSelection = any>(filter$: Observable<Record<string, Filter>>, selection$: Observable<Record<string, TSelection>>) => Observable<Record<string, TSelection>>;
|
|
4
|
+
export declare const useClearFilter: () => {
|
|
5
|
+
clear: () => void;
|
|
6
|
+
changed$: Observable<Record<string, any>>;
|
|
7
|
+
};
|
|
8
|
+
export default useClearFilter;
|
|
9
|
+
//# sourceMappingURL=useClearFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClearFilter.d.ts","sourceRoot":"","sources":["../../src/hooks/useClearFilter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyC,UAAU,EAAE,MAAM,MAAM,CAAC;AASzE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,gBAAgB,8BAClB,WAAW,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC,+FAa5C,CAAC;AAEF,eAAO,MAAM,cAAc;;;CAkC1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { withLatestFrom, filter, combineLatest } from 'rxjs';
|
|
3
|
+
import { map, distinctUntilChanged } from 'rxjs/operators';
|
|
4
|
+
import { isActionOf } from 'typesafe-actions';
|
|
5
|
+
import { useObservableEffect } from '@equinor/fusion-react-observable';
|
|
6
|
+
import { useFilterContext } from '../context';
|
|
7
|
+
import { actions } from '../actions';
|
|
8
|
+
export const selectionChanges = (filter$, selection$) => {
|
|
9
|
+
return combineLatest([selection$, filter$]).pipe(map(([selections, filters]) => {
|
|
10
|
+
return Object.values(filters).reduce((acc, filter) => {
|
|
11
|
+
const selection = selections[filter.key];
|
|
12
|
+
const changed = filter.hasChanged && filter.hasChanged(selection, filter.initial);
|
|
13
|
+
return changed ? Object.assign(acc, { [filter.key]: selection }) : acc;
|
|
14
|
+
}, {});
|
|
15
|
+
}), distinctUntilChanged());
|
|
16
|
+
};
|
|
17
|
+
export const useClearFilter = () => {
|
|
18
|
+
const { selection$, filter$ } = useFilterContext();
|
|
19
|
+
const clear = useCallback(() => {
|
|
20
|
+
selection$.next(actions.selection.clear());
|
|
21
|
+
}, [selection$]);
|
|
22
|
+
const initial$ = useMemo(() => filter$.pipe(map((x) => Object.values(x).reduce((acc, filter) => {
|
|
23
|
+
return Object.assign(acc, { [filter.key]: filter.initial });
|
|
24
|
+
}, {}))), [filter$]);
|
|
25
|
+
const changed$ = useMemo(() => selectionChanges(filter$, selection$), [filter$, selection$]);
|
|
26
|
+
useObservableEffect(selection$, useCallback((action$) => action$.pipe(filter(isActionOf(actions.selection.clear)), withLatestFrom(initial$), map(([_, initial]) => actions.selection.set(initial))), [initial$]));
|
|
27
|
+
return { clear, changed$ };
|
|
28
|
+
};
|
|
29
|
+
export default useClearFilter;
|
|
30
|
+
//# sourceMappingURL=useClearFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClearFilter.js","sourceRoot":"","sources":["../../src/hooks/useClearFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAc,MAAM,MAAM,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,MAAM,CAAC,MAAM,gBAAgB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,EAAE;QACtC,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC,EAAE,EAAE,CAAC,CACP,CACF,EACH,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAE7F,mBAAmB,CACjB,UAAU,EACV,WAAW,CACT,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,IAAI,CACV,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAC3C,cAAc,CAAC,QAAQ,CAAC,EACxB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CACtD,EACH,CAAC,QAAQ,CAAC,CACX,CACF,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Filter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for attaching a filter to the current context
|
|
4
|
+
* Must be used within {@link FilterProvider}
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFilter: <TData, TSelection>(filter: Filter<TData, TSelection>) => (value: TSelection) => void;
|
|
7
|
+
//# sourceMappingURL=useFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilter.d.ts","sourceRoot":"","sources":["../../src/hooks/useFilter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,SAAS,mFAAmF,IAsBxG,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect } from 'react';
|
|
2
|
+
import { actions } from '../actions';
|
|
3
|
+
import { useFilterContext } from '../context';
|
|
4
|
+
/**
|
|
5
|
+
* Hook for attaching a filter to the current context
|
|
6
|
+
* Must be used within {@link FilterProvider}
|
|
7
|
+
*/
|
|
8
|
+
export const useFilter = (filter) => {
|
|
9
|
+
const context = useFilterContext();
|
|
10
|
+
const { key } = filter;
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
/** add filter to store */
|
|
13
|
+
context.filter$.next(actions.filter.add(filter));
|
|
14
|
+
/** add initial selection to filter selection */
|
|
15
|
+
if (!Object.keys(context.selection$.value).includes(key)) {
|
|
16
|
+
context.selection$.next(actions.selection.initial({ [key]: filter.initial }));
|
|
17
|
+
}
|
|
18
|
+
/** remove filter when consumer unmounts */
|
|
19
|
+
return () => context.filter$.next(actions.filter.remove(filter.key));
|
|
20
|
+
}, [context, filter, key]);
|
|
21
|
+
/** return a function which the consumer can set the selection for the provided filter */
|
|
22
|
+
return useCallback((selection) => {
|
|
23
|
+
context.selection$.next(actions.selection.set({ [key]: selection }));
|
|
24
|
+
}, [context, key]);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilter.js","sourceRoot":"","sources":["../../src/hooks/useFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAoB,MAAiC,EAAiC,EAAE;IAC/G,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IACvB,eAAe,CAAC,GAAG,EAAE;QACnB,0BAA0B;QAC1B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QAEjD,gDAAgD;QAChD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxD,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;SAC/E;QACD,2CAA2C;QAC3C,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACvE,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAE3B,0FAA0F;IAC1F,OAAO,WAAW,CAChB,CAAC,SAAqB,EAAE,EAAE;QACxB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC,EACD,CAAC,OAAO,EAAE,GAAG,CAAC,CACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Filter } from '../types';
|
|
3
|
+
declare type useFilterDataArgs = {
|
|
4
|
+
/** array of filter keys of filters that will not be included in the data filtration */
|
|
5
|
+
exclude?: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const filterSelection: (filter$: Observable<Record<string, Filter>>, exclude?: string[] | undefined) => Observable<Record<string, Filter>>;
|
|
8
|
+
export declare const filterData: <TInn extends Record<string, any>, TOut extends Record<string, any> = TInn>(source$: Observable<TInn[]>, filter$: Observable<Record<string, Filter<TInn, any>>>, selection$: Observable<Record<string, any>>) => Observable<TOut[]>;
|
|
9
|
+
export declare const useFilterData: <TData extends Record<string, any>>(args?: useFilterDataArgs | undefined) => Observable<TData[]>;
|
|
10
|
+
export default useFilterData;
|
|
11
|
+
//# sourceMappingURL=useFilterData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterData.d.ts","sourceRoot":"","sources":["../../src/hooks/useFilterData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,aAAK,iBAAiB,GAAG;IACvB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,YACjB,WAAW,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC,qCAE1C,WAAW,OAAO,MAAM,EAAE,MAAM,CAAC,CAgBnC,CAAC;AAEF,eAAO,MAAM,UAAU,+KAGT,WAAW,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,uBAc5C,CAAC;AAEF,eAAO,MAAM,aAAa,kGASzB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { combineLatest, from } from 'rxjs';
|
|
3
|
+
import { distinctUntilChanged, map, switchMap, reduce } from 'rxjs/operators';
|
|
4
|
+
import { useFilterContext } from '.';
|
|
5
|
+
export const filterSelection = (filter$, exclude) => {
|
|
6
|
+
return filter$.pipe(
|
|
7
|
+
/** create a selection of filters base on provided args */
|
|
8
|
+
map((x) => Object.entries(x)
|
|
9
|
+
.filter(([key]) => !exclude || !exclude.includes(key))
|
|
10
|
+
.reduce((acc, [key, filter]) => Object.assign(acc, { [key]: filter }), {})),
|
|
11
|
+
/** only update filters when filter function changes */
|
|
12
|
+
distinctUntilChanged((a, b) => {
|
|
13
|
+
const filterA = Object.values(a);
|
|
14
|
+
const filterB = Object.values(b);
|
|
15
|
+
if (filterA.length !== filterB.length)
|
|
16
|
+
return false;
|
|
17
|
+
return !filterA.find((x) => filterB.find((y) => x.filterFn !== y.filterFn));
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
export const filterData = (source$, filter$, selection$) => {
|
|
21
|
+
return combineLatest([selection$, source$, filter$]).pipe(switchMap(([selections, source, filters]) => {
|
|
22
|
+
/** loop threw all provided filters */
|
|
23
|
+
return from(Object.values(filters)).pipe(reduce((acc, filter) => {
|
|
24
|
+
/** extract selection for current filter */
|
|
25
|
+
const selection = selections[filter.key];
|
|
26
|
+
return selection ? filter.filterFn(acc, selection) : acc;
|
|
27
|
+
}, source));
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
export const useFilterData = (args) => {
|
|
31
|
+
const { exclude } = args || {};
|
|
32
|
+
const { source$, filter$, selection$ } = useFilterContext();
|
|
33
|
+
/** create selection of filters to apply */
|
|
34
|
+
const selectedFilter$ = useMemo(() => filterSelection(filter$, exclude), [filter$, exclude]);
|
|
35
|
+
/** create observable filtered data */
|
|
36
|
+
return useMemo(() => filterData(source$, selectedFilter$, selection$), [source$, selectedFilter$, selection$]);
|
|
37
|
+
};
|
|
38
|
+
export default useFilterData;
|
|
39
|
+
//# sourceMappingURL=useFilterData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterData.js","sourceRoot":"","sources":["../../src/hooks/useFilterData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAc,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE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
import { Observable } from '@equinor/fusion-react-observable';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param key Filter key
|
|
6
|
-
* @returns filter selection
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const currentOptionsSelection = useFilterSelection<string[]>('name');
|
|
3
|
+
* Use the filter selection from filter provider context
|
|
4
|
+
* @param filterKey {string} the key that the filter was registered on
|
|
5
|
+
* @returns {Observable<TSelection>}
|
|
10
6
|
*/
|
|
11
|
-
declare const useFilterSelection: <TSelection>(
|
|
7
|
+
export declare const useFilterSelection: <TSelection>(filterKey: string) => Observable<Set<TSelection>>;
|
|
12
8
|
export default useFilterSelection;
|
|
13
9
|
//# sourceMappingURL=useFilterSelection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilterSelection.d.ts","sourceRoot":"","sources":["../../src/hooks/useFilterSelection.
|
|
1
|
+
{"version":3,"file":"useFilterSelection.d.ts","sourceRoot":"","sources":["../../src/hooks/useFilterSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAI3E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0BAA2B,MAAM,gCAC0B,CAAC;AAE3F,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import useFilterContext from '
|
|
1
|
+
import { useSelector } from '@equinor/fusion-react-observable';
|
|
2
|
+
import { useFilterContext } from '../context';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param key Filter key
|
|
8
|
-
* @returns filter selection
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* const currentOptionsSelection = useFilterSelection<string[]>('name');
|
|
4
|
+
* Use the filter selection from filter provider context
|
|
5
|
+
* @param filterKey {string} the key that the filter was registered on
|
|
6
|
+
* @returns {Observable<TSelection>}
|
|
12
7
|
*/
|
|
13
|
-
const useFilterSelection = (
|
|
14
|
-
const { store } = useFilterContext();
|
|
15
|
-
const [filterSelection, setFilterSelection] = useState(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const subscription = store.selection$.subscribe((selection) => {
|
|
18
|
-
setFilterSelection(selection[key] || null);
|
|
19
|
-
});
|
|
20
|
-
return () => subscription.unsubscribe();
|
|
21
|
-
}, [store, key]);
|
|
22
|
-
return filterSelection;
|
|
23
|
-
};
|
|
8
|
+
export const useFilterSelection = (filterKey) => useSelector(useFilterContext().selection$, filterKey);
|
|
24
9
|
export default useFilterSelection;
|
|
25
10
|
//# sourceMappingURL=useFilterSelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilterSelection.js","sourceRoot":"","sources":["../../src/hooks/useFilterSelection.
|
|
1
|
+
{"version":3,"file":"useFilterSelection.js","sourceRoot":"","sources":["../../src/hooks/useFilterSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAa,SAAiB,EAA+B,EAAE,CAC/F,WAAW,CAAC,gBAAgB,EAAE,CAAC,UAA6C,EAAE,SAAS,CAAC,CAAC;AAE3F,eAAe,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
export { FilterProvider } from './FilterProvider';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export { default as useFilterOptionsCounter } from './hooks/useFilterOptionsCounter';
|
|
6
|
-
export { default as useFilterSelection } from './hooks/useFilterSelection';
|
|
7
|
-
export { default as useFilterContext } from './hooks/useFilterContext';
|
|
8
|
-
export { HorizontalFilterPanel as FilterPanel } from './components/HorizontalFilterPanel/HorizontalFilterPanel';
|
|
9
|
-
export { FilterSection } from './components/FilterSection';
|
|
10
|
-
export { CheckBoxFilter } from './components/CheckBoxFilter';
|
|
11
|
-
export { RadioFilter } from './components/RadioFilter/RadioFilter';
|
|
12
|
-
export { FilterSelectionChips } from './components/FilterSelectionChips/FilterSelectionChips';
|
|
13
|
-
export { GeneralBar } from './components/GeneralBar';
|
|
14
|
-
export { HorizontalBar } from './components/HorizontalBar/HorizontalBar';
|
|
1
|
+
export { FilterProvider, FilterProviderProps } from './FilterProvider';
|
|
2
|
+
export { actions as filterActions, Actions as FilterActions } from './actions';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './types';
|
|
15
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/E,cAAc,SAAS,CAAC;AAExB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
export { FilterProvider } from './FilterProvider';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export { default as useFilterOptionsBuilder } from './hooks/useFilterOptionsBuilder';
|
|
6
|
-
export { default as useFilterOptionsCounter } from './hooks/useFilterOptionsCounter';
|
|
7
|
-
export { default as useFilterSelection } from './hooks/useFilterSelection';
|
|
8
|
-
export { default as useFilterContext } from './hooks/useFilterContext';
|
|
9
|
-
// UI Components
|
|
10
|
-
export { HorizontalFilterPanel as FilterPanel } from './components/HorizontalFilterPanel/HorizontalFilterPanel';
|
|
11
|
-
export { FilterSection } from './components/FilterSection';
|
|
12
|
-
export { CheckBoxFilter } from './components/CheckBoxFilter';
|
|
13
|
-
export { RadioFilter } from './components/RadioFilter/RadioFilter';
|
|
14
|
-
export { FilterSelectionChips } from './components/FilterSelectionChips/FilterSelectionChips';
|
|
15
|
-
export { GeneralBar } from './components/GeneralBar';
|
|
16
|
-
export { HorizontalBar } from './components/HorizontalBar/HorizontalBar';
|
|
2
|
+
export { actions as filterActions } from './actions';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './types';
|
|
17
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAA4B,MAAM,WAAW,CAAC;AAE/E,cAAc,SAAS,CAAC;AAExB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Filter } from '..';
|
|
3
|
+
import { FilterOption, FilterOptionBuilder, FilterOptionSelector } from './types';
|
|
4
|
+
export declare type FilterComponentProviderProps<TData, TOption extends FilterOption, TValue> = {
|
|
5
|
+
filter: Filter<TData, Set<TValue>>;
|
|
6
|
+
optionBuilder?: FilterOptionBuilder<TData, TOption, TValue>;
|
|
7
|
+
selector?: Extract<keyof TData, string> | string | FilterOptionSelector<TData>;
|
|
8
|
+
initial?: Set<TValue>;
|
|
9
|
+
};
|
|
10
|
+
export declare const FilterOptionProvider: <TData extends Record<string, any>, TOption extends FilterOption, TValue>(props: import("react").PropsWithChildren<FilterComponentProviderProps<TData, TOption, TValue>>) => JSX.Element;
|
|
11
|
+
export default FilterOptionProvider;
|
|
12
|
+
//# sourceMappingURL=FilterOptionProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterOptionProvider.d.ts","sourceRoot":"","sources":["../../src/options/FilterOptionProvider.tsx"],"names":[],"mappings":";AAOA,OAAO,EAA+B,MAAM,EAAE,MAAM,IAAI,CAAC;AAKzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAOlF,oBAAY,4BAA4B,CAAC,KAAK,EAAE,OAAO,SAAS,YAAY,EAAE,MAAM,IAAI;IACtF,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC/E,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,+KAE9B,WAiDF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { combineLatest, of } from 'rxjs';
|
|
4
|
+
import { switchMap, map } from 'rxjs/operators';
|
|
5
|
+
import { useObservable } from '@equinor/fusion-react-observable';
|
|
6
|
+
import { useFilter, useFilterContext } from '..';
|
|
7
|
+
import { Provider } from './context';
|
|
8
|
+
import { actions } from './actions';
|
|
9
|
+
import { createOptionReducer } from './reducer';
|
|
10
|
+
import { createOptionBuilder, propertySelector } from './create-options';
|
|
11
|
+
import { useFilterData, useFilterSelection } from '../hooks';
|
|
12
|
+
const optionReducer = createOptionReducer({});
|
|
13
|
+
export const FilterOptionProvider = (props) => {
|
|
14
|
+
/** append change method if not provided */
|
|
15
|
+
const filter = useMemo(() => {
|
|
16
|
+
props.filter.hasChanged ??= (a, b) => a !== b;
|
|
17
|
+
return props.filter;
|
|
18
|
+
}, [props.filter]);
|
|
19
|
+
const setSelection = useFilter(filter);
|
|
20
|
+
const selection$ = useFilterSelection(filter.key);
|
|
21
|
+
const context = useFilterContext();
|
|
22
|
+
const options$ = useObservable(optionReducer, {});
|
|
23
|
+
/** memorize method for creating filter options */
|
|
24
|
+
const optionBuilder = useMemo(() => {
|
|
25
|
+
/** return provided builder if any */
|
|
26
|
+
if (props.optionBuilder)
|
|
27
|
+
return props.optionBuilder;
|
|
28
|
+
if (props.selector) {
|
|
29
|
+
/** create a default option builder */
|
|
30
|
+
return createOptionBuilder(
|
|
31
|
+
/** if selector is not a key of object return the selector for creating option */
|
|
32
|
+
typeof props.selector === 'string'
|
|
33
|
+
? propertySelector(props.selector)
|
|
34
|
+
: props.selector);
|
|
35
|
+
}
|
|
36
|
+
throw Error('either provide a builder for option or a selector for option creation');
|
|
37
|
+
}, [props.optionBuilder, props.selector]);
|
|
38
|
+
const data$ = useFilterData(useMemo(() => ({ exclude: [filter.key] }), [filter.key]));
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const subscription = combineLatest([context.source$, data$, selection$])
|
|
41
|
+
.pipe(switchMap(([source, data, selection]) => {
|
|
42
|
+
return of(optionBuilder(source, selection, data));
|
|
43
|
+
}), map((x) => actions.set(x)))
|
|
44
|
+
.subscribe(options$);
|
|
45
|
+
return () => subscription.unsubscribe();
|
|
46
|
+
}, [context, selection$, options$, data$, optionBuilder]);
|
|
47
|
+
const value = {
|
|
48
|
+
options$,
|
|
49
|
+
selection$,
|
|
50
|
+
setSelection,
|
|
51
|
+
};
|
|
52
|
+
return _jsx(Provider, Object.assign({ value: value }, { children: props.children }), void 0);
|
|
53
|
+
};
|
|
54
|
+
export default FilterOptionProvider;
|
|
55
|
+
//# sourceMappingURL=FilterOptionProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterOptionProvider.js","sourceRoot":"","sources":["../../src/options/FilterOptionProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAU,MAAM,IAAI,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,aAAa,GAAG,mBAAmB,CAAC,EAAkC,CAAC,CAAC;AAS9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAoF,EACvE,EAAE;IACf,2CAA2C;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,KAAK,CAAC,MAAM,CAAC,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,kBAAkB,CAAS,MAAM,CAA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CAAC,CAAC,CAAC,CAC3B;aACA,SAAS,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1D,MAAM,KAAK,GAAG;QACZ,QAAQ;QACR,UAAU;QACV,YAAY;KACb,CAAC;IACF,OAAO,KAAC,QAAQ,kBAAC,KAAK,EAAE,KAAK,gBAAG,KAAK,CAAC,QAAQ,YAAY,CAAC;AAC7D,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionType } from 'typesafe-actions';
|
|
2
|
+
import { FilterOption } from './types';
|
|
3
|
+
export declare const actions: {
|
|
4
|
+
set: import("typesafe-actions").PayloadActionCreator<"@FILTER_OPTIONS/SELECTION_SET", Record<string, FilterOption>>;
|
|
5
|
+
};
|
|
6
|
+
export declare type Actions = ActionType<typeof actions>;
|
|
7
|
+
export default actions;
|
|
8
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/options/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF,oBAAY,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAEjD,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/options/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,kBAAkB,CAAC;AAG5D,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,EAAE,YAAY,CAAC,+BAA+B,CAAC,EAAgC;CACnF,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FilterOption, FilterOptionContext } from './types';
|
|
3
|
+
export declare const Provider: import("react").Provider<any>, Consumer: import("react").Consumer<any>;
|
|
4
|
+
export declare const useFilterOptionContext: <TOption extends FilterOption = FilterOption, TValue = string>() => FilterOptionContext<TOption, TValue>;
|
|
5
|
+
export default useFilterOptionContext;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/options/context.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAI5D,eAAO,MAAQ,QAAQ,iCAAE,QAAQ,+BAAY,CAAC;AAE9C,eAAO,MAAM,sBAAsB,0GAGqE,CAAC;AAEzG,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
const context = createContext({});
|
|
4
|
+
export const { Provider, Consumer } = context;
|
|
5
|
+
export const useFilterOptionContext = () => useContext(context);
|
|
6
|
+
export default useFilterOptionContext;
|
|
7
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/options/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIlD,aAAa;AACb,MAAM,OAAO,GAAG,aAAa,CAAsB,EAAE,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAGI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAyC,CAAC;AAEzG,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FilterOption, FilterOptionBuilder, FilterOptionSelector } from './types';
|
|
2
|
+
export declare const propertySelector: <TData extends Record<string, any>>(key: Extract<keyof TData, string>) => FilterOptionSelector<TData>;
|
|
3
|
+
export declare const createOptionBuilder: <TData extends Record<string, unknown>, TOption extends FilterOption, TOptions extends Record<string, TOption> = Record<string, TOption>, TValue = string | keyof TOptions>(selector: FilterOptionSelector<TData>, isSelected?: (key: string | keyof TOptions, selection: Set<TValue>, data?: TData | undefined) => boolean) => FilterOptionBuilder<TData, TOption, TValue>;
|
|
4
|
+
//# sourceMappingURL=create-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-options.d.ts","sourceRoot":"","sources":["../../src/options/create-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElF,eAAO,MAAM,gBAAgB,uGAI5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,sTAQwD,OAAO,gDAyB5F,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const propertySelector = (key) => {
|
|
2
|
+
return (data) => ({ key: data[key], value: data[key] });
|
|
3
|
+
};
|
|
4
|
+
export const createOptionBuilder = (selector, isSelected = (key, selection) => selection.has(key)) => (source, selection, data) => {
|
|
5
|
+
const hasEntry = (value) => data && !!data.find((x) => selector(x).value === value);
|
|
6
|
+
const srcCount = (value) => source.filter((x) => selector(x).value === value).length;
|
|
7
|
+
const dataCount = (value) => (data || []).filter((x) => selector(x).value === value).length;
|
|
8
|
+
const options = source.reduce((acc, item) => {
|
|
9
|
+
const { key, value, label } = selector(item);
|
|
10
|
+
if (acc[key]) {
|
|
11
|
+
return acc;
|
|
12
|
+
}
|
|
13
|
+
const option = {
|
|
14
|
+
label: label || value,
|
|
15
|
+
excluded: !hasEntry(value),
|
|
16
|
+
selected: selection && isSelected(key, selection, item),
|
|
17
|
+
count: dataCount(value),
|
|
18
|
+
totalCount: srcCount(value),
|
|
19
|
+
};
|
|
20
|
+
return { ...acc, [key]: option };
|
|
21
|
+
}, {});
|
|
22
|
+
return options;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=create-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-options.js","sourceRoot":"","sources":["../../src/options/create-options.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAiC,EACJ,EAAE;IAC/B,OAAO,CAAC,IAAW,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAC9B,CAME,QAAqC,EACrC,aAA8F,CAC5F,GAAmB,EACnB,SAAsB,EACtB,EAAE,CAAE,SAA4C,CAAC,GAAG,CAAC,GAAG,CAAC,EACd,EAAE,CACjD,CAAC,MAAe,EAAE,SAAuB,EAAE,IAAc,EAAY,EAAE;IACrE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAC7F,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,CAAC;IAC9F,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,CAAC;IACrG,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC1C,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,GAAG,CAAC,GAAuB,CAAC,EAAE;YAChC,OAAO,GAAG,CAAC;SACZ;QACD,MAAM,MAAM,GAAG;YACb,KAAK,EAAE,KAAK,IAAI,KAAK;YACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC1B,QAAQ,EAAE,SAAS,IAAI,UAAU,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC;YACvD,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;YACvB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;SAC5B,CAAC;QACF,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC,EAAE,EAAc,CAAC,CAAC;IAEnB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FilterOptionProvider, FilterComponentProviderProps, default } from './FilterOptionProvider';
|
|
2
|
+
export { useFilterOptionSearch } from './search';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export { Consumer as FilterOptionConsumer, useFilterOptionContext } from './context';
|
|
5
|
+
export { propertySelector } from './create-options';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FilterOptionProvider, default } from './FilterOptionProvider';
|
|
2
|
+
export { useFilterOptionSearch } from './search';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export { Consumer as FilterOptionConsumer, useFilterOptionContext } from './context';
|
|
5
|
+
export { propertySelector } from './create-options';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAgC,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|