@blaze-cms/react-page-builder 0.146.0-alpha.0 → 0.146.0-alpha.13
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/CHANGELOG.md +86 -0
- package/lib/components/BackToTop/BackToTop.js +8 -13
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Card/Card.js +19 -12
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +8 -4
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/Card/CardsFactory.js +37 -7
- package/lib/components/Card/CardsFactory.js.map +1 -1
- package/lib/components/Card/CardsRender.js +8 -4
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/index.js +6 -6
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Carousel/CarouselImage/CarouselImage.js +3 -1
- package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
- package/lib/components/Carousel/CarouselImage/constants.js +9 -0
- package/lib/components/Carousel/CarouselImage/constants.js.map +1 -0
- package/lib/components/CarouselWrapper/DefaultCarousel.js +2 -0
- package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js +1 -2
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/NavButton.js +6 -3
- package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
- package/lib/components/Image/Image.js +1 -0
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/Lightbox/Lightbox.js +2 -2
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/ItemList/ItemListNew/ItemListNew.js +1 -2
- package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js +2 -2
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/MenuItem/MenuEntitiesItem.js +203 -0
- package/lib/components/MenuItem/MenuEntitiesItem.js.map +1 -0
- package/lib/components/MenuItem/MenuItem.js +25 -71
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js +104 -0
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -0
- package/lib/components/MenuItem/helpers/index.js +15 -0
- package/lib/components/MenuItem/helpers/index.js.map +1 -0
- package/lib/components/MenuItem/helpers/inject-helper-into-template.js +17 -0
- package/lib/components/MenuItem/helpers/inject-helper-into-template.js.map +1 -0
- package/lib/components/Modal/Modal.js +2 -2
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/ModalAdapter/ModalAdapter.js +21 -0
- package/lib/components/ModalAdapter/ModalAdapter.js.map +1 -0
- package/lib/components/ModalAdapter/index.js +11 -0
- package/lib/components/ModalAdapter/index.js.map +1 -0
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js +1 -1
- package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js +3 -3
- package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +26 -7
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +23 -28
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +1 -0
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-list-name-query.js +31 -0
- package/lib/components/SearchFilter/helpers/build-list-name-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/decode-encode.js.map +1 -1
- package/lib/components/SearchFilter/helpers/index.js +7 -0
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/Video/VideoModal.js +2 -2
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/components/Video/providers/Vimeo/VimeoProvider.js +0 -1
- package/lib/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
- package/lib/helpers/build-filters-query.js +1 -2
- package/lib/helpers/build-filters-query.js.map +1 -1
- package/lib/{components/Card/helpers → helpers}/filter-query-setup.js +10 -7
- package/lib/helpers/filter-query-setup.js.map +1 -0
- package/lib/{components/Card/helpers → helpers}/filters-setup.js +8 -5
- package/lib/helpers/filters-setup.js.map +1 -0
- package/lib/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib/helpers/get-updated-sort-properties.js.map +1 -0
- package/lib/helpers/index.js +42 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/should-return.js.map +1 -0
- package/lib/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
- package/lib/helpers/should-skip-single-query.js.map +1 -0
- package/lib/hooks/index.js +14 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-filter-aggregation-values.js +54 -0
- package/lib/hooks/use-filter-aggregation-values.js.map +1 -0
- package/lib/hooks/use-portal.js +30 -0
- package/lib/hooks/use-portal.js.map +1 -0
- package/lib-es/components/BackToTop/BackToTop.js +11 -17
- package/lib-es/components/BackToTop/BackToTop.js.map +1 -1
- package/lib-es/components/Card/Card.js +19 -12
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/Card/CardsContainer.js +9 -5
- package/lib-es/components/Card/CardsContainer.js.map +1 -1
- package/lib-es/components/Card/CardsFactory.js +40 -9
- package/lib-es/components/Card/CardsFactory.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +9 -5
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/index.js +6 -6
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Carousel/CarouselImage/CarouselImage.js +3 -1
- package/lib-es/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
- package/lib-es/components/Carousel/CarouselImage/constants.js +2 -0
- package/lib-es/components/Carousel/CarouselImage/constants.js.map +1 -0
- package/lib-es/components/CarouselWrapper/DefaultCarousel.js +2 -0
- package/lib-es/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupTabs.js +1 -2
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
- package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib-es/components/Image/GlobalLightbox/NavButton.js +6 -3
- package/lib-es/components/Image/GlobalLightbox/NavButton.js.map +1 -1
- package/lib-es/components/Image/Image.js +1 -0
- package/lib-es/components/Image/Image.js.map +1 -1
- package/lib-es/components/Image/Lightbox/Lightbox.js +1 -1
- package/lib-es/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js +1 -2
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js.map +1 -1
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib-es/components/List/components/Full/FullRender.js +2 -2
- package/lib-es/components/List/components/Full/FullRender.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +1 -1
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/MenuItem/MenuEntitiesItem.js +177 -0
- package/lib-es/components/MenuItem/MenuEntitiesItem.js.map +1 -0
- package/lib-es/components/MenuItem/MenuItem.js +28 -60
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItemRender.js +84 -0
- package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -0
- package/lib-es/components/MenuItem/helpers/index.js +3 -0
- package/lib-es/components/MenuItem/helpers/index.js.map +1 -0
- package/lib-es/components/MenuItem/helpers/inject-helper-into-template.js +8 -0
- package/lib-es/components/MenuItem/helpers/inject-helper-into-template.js.map +1 -0
- package/lib-es/components/Modal/Modal.js +1 -1
- package/lib-es/components/Modal/Modal.js.map +1 -1
- package/lib-es/components/ModalAdapter/ModalAdapter.js +13 -0
- package/lib-es/components/ModalAdapter/ModalAdapter.js.map +1 -0
- package/lib-es/components/ModalAdapter/index.js +3 -0
- package/lib-es/components/ModalAdapter/index.js.map +1 -0
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/MobileFormToolbar.js +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/ResetDesktopForm.js +3 -3
- package/lib-es/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +19 -7
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +23 -20
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +1 -0
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-list-name-query.js +15 -0
- package/lib-es/components/SearchFilter/helpers/build-list-name-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/decode-encode.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/index.js +2 -1
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/Video/VideoModal.js +1 -1
- package/lib-es/components/Video/VideoModal.js.map +1 -1
- package/lib-es/components/Video/providers/Vimeo/VimeoProvider.js +0 -1
- package/lib-es/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
- package/lib-es/helpers/build-filters-query.js +1 -2
- package/lib-es/helpers/build-filters-query.js.map +1 -1
- package/lib-es/{components/Card/helpers → helpers}/filter-query-setup.js +5 -3
- package/lib-es/helpers/filter-query-setup.js.map +1 -0
- package/lib-es/{components/Card/helpers → helpers}/filters-setup.js +4 -2
- package/lib-es/helpers/filters-setup.js.map +1 -0
- package/lib-es/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib-es/helpers/get-updated-sort-properties.js.map +1 -0
- package/lib-es/helpers/index.js +6 -0
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/should-return.js.map +1 -0
- package/lib-es/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
- package/lib-es/helpers/should-skip-single-query.js.map +1 -0
- package/lib-es/hooks/index.js +2 -0
- package/lib-es/hooks/index.js.map +1 -1
- package/lib-es/hooks/use-filter-aggregation-values.js +31 -0
- package/lib-es/hooks/use-filter-aggregation-values.js.map +1 -0
- package/lib-es/hooks/use-portal.js +14 -0
- package/lib-es/hooks/use-portal.js.map +1 -0
- package/package.json +5 -5
- package/src/components/BackToTop/BackToTop.js +6 -11
- package/src/components/Card/Card.js +29 -19
- package/src/components/Card/CardsContainer.js +7 -3
- package/src/components/Card/CardsFactory.js +34 -6
- package/src/components/Card/CardsRender.js +6 -2
- package/src/components/Card/helpers/index.js +6 -6
- package/src/components/Carousel/CarouselImage/CarouselImage.js +3 -1
- package/src/components/Carousel/CarouselImage/constants.js +1 -0
- package/src/components/CarouselWrapper/DefaultCarousel.js +2 -0
- package/src/components/ContentGroup/ContentGroupTabs.js +1 -3
- package/src/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
- package/src/components/Image/GlobalLightbox/NavButton.js +5 -3
- package/src/components/Image/Image.js +1 -0
- package/src/components/Image/Lightbox/Lightbox.js +1 -1
- package/src/components/ItemList/ItemListNew/ItemListNew.js +1 -4
- package/src/components/List/ListRender.js +0 -1
- package/src/components/List/components/Cards/CardsRender.js +2 -0
- package/src/components/List/components/Full/FullRender.js +2 -1
- package/src/components/Menu/Menu.js +1 -1
- package/src/components/MenuItem/MenuEntitiesItem.js +202 -0
- package/src/components/MenuItem/MenuItem.js +15 -65
- package/src/components/MenuItem/MenuItemRender.js +92 -0
- package/src/components/MenuItem/helpers/index.js +3 -0
- package/src/components/MenuItem/helpers/inject-helper-into-template.js +11 -0
- package/src/components/Modal/Modal.js +1 -1
- package/src/components/ModalAdapter/ModalAdapter.js +12 -0
- package/src/components/ModalAdapter/index.js +3 -0
- package/src/components/SearchFilter/SearchFilter/FiltersList.js +3 -0
- package/src/components/SearchFilter/SearchFilter/MobileFormToolbar.js +1 -1
- package/src/components/SearchFilter/SearchFilter/ResetDesktopForm.js +3 -2
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +26 -10
- package/src/components/SearchFilter/SearchFilterContainer.js +21 -22
- package/src/components/SearchFilter/components/Checkbox.js +3 -1
- package/src/components/SearchFilter/components/Select.js +2 -0
- package/src/components/SearchFilter/components/TextSearch.js +1 -0
- package/src/components/SearchFilter/helpers/build-list-name-query.js +18 -0
- package/src/components/SearchFilter/helpers/decode-encode.js +0 -1
- package/src/components/SearchFilter/helpers/index.js +2 -0
- package/src/components/Video/VideoModal.js +1 -1
- package/src/components/Video/providers/Vimeo/VimeoProvider.js +0 -1
- package/src/helpers/build-filters-query.js +1 -3
- package/src/{components/Card/helpers → helpers}/filter-query-setup.js +5 -3
- package/src/{components/Card/helpers → helpers}/filters-setup.js +5 -2
- package/src/helpers/index.js +6 -0
- package/src/{components/Card/helpers → helpers}/should-skip-single-query.js +1 -1
- package/src/hooks/index.js +2 -0
- package/src/hooks/use-filter-aggregation-values.js +37 -0
- package/src/hooks/use-portal.js +18 -0
- package/tests/unit/src/components/BackToTop/BackToTop.test.js +9 -5
- package/tests/unit/src/components/BackToTop/__snapshots__/BackToTop.test.js.snap +1 -1
- package/tests/unit/src/components/Card/Card.test.js +16 -1
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +83 -0
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +1 -1
- package/tests/unit/src/components/Carousel/CarouselImage/__snapshots__/CarouselImage.test.js.snap +1 -1
- package/tests/unit/src/components/Carousel/__snapshots__/Carousel.test.js.snap +1 -1
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +4 -4
- package/tests/unit/src/components/Image/Lightbox/Lightbox.test.js +4 -0
- package/tests/unit/src/components/Image/Lightbox/__snapshots__/Lightbox.test.js.snap +3 -38
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListNew.test.js.snap +0 -2
- package/tests/unit/src/components/MenuItem/MenuEntitiesItem.test.js +23 -0
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +30 -11
- package/tests/unit/src/components/MenuItem/MenuItemRender.test.js +55 -0
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuEntitiesItem.test.js.snap +3 -0
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +5 -56
- package/tests/unit/src/components/MenuItem/helpers/inject-helper-into-template.test.js +44 -0
- package/tests/unit/src/components/MenuItem/mocks.js +71 -0
- package/tests/unit/src/components/Modal/Modal.test.js +4 -0
- package/tests/unit/src/components/Modal/__snapshots__/Modal.test.js.snap +7 -42
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/MobileFormToolbar.test.js.snap +1 -1
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/ResetDesktopForm.test.js.snap +1 -1
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +19 -17
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +7 -1
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +1 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/TextSearch.test.js.snap +1 -0
- package/tests/unit/src/components/SearchFilterSort/__snapshots__/SearchFilterSort.test.js.snap +1 -0
- package/tests/unit/src/components/Video/providers/Vimeo/__snapshots__/Vimeo.test.js.snap +0 -1
- package/lib/components/Card/helpers/filter-query-setup.js.map +0 -1
- package/lib/components/Card/helpers/filters-setup.js.map +0 -1
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib/components/Card/helpers/get-updated-sort-properties.js.map +0 -1
- package/lib/components/Card/helpers/should-return.js.map +0 -1
- package/lib/components/Card/helpers/should-skip-single-query.js.map +0 -1
- package/lib-es/components/Card/helpers/filter-query-setup.js.map +0 -1
- package/lib-es/components/Card/helpers/filters-setup.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-sort-properties.js.map +0 -1
- package/lib-es/components/Card/helpers/should-return.js.map +0 -1
- package/lib-es/components/Card/helpers/should-skip-single-query.js.map +0 -1
- /package/lib/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
- /package/lib/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
- /package/lib/{components/Card/helpers → helpers}/should-return.js +0 -0
- /package/lib-es/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
- /package/lib-es/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
- /package/lib-es/{components/Card/helpers → helpers}/should-return.js +0 -0
- /package/src/{components/Card/helpers → helpers}/get-updated-items-to-display.js +0 -0
- /package/src/{components/Card/helpers → helpers}/get-updated-sort-properties.js +0 -0
- /package/src/{components/Card/helpers → helpers}/should-return.js +0 -0
|
@@ -7,25 +7,12 @@ import { parseUrl } from 'query-string';
|
|
|
7
7
|
import SearchFilter from './SearchFilter';
|
|
8
8
|
import { withTitle } from '../../HOC';
|
|
9
9
|
import { getSearchPublishedContent, generateSingleItemQuery } from '../../application/query';
|
|
10
|
-
import { buildNewUrl, getFilterValues, getFilterRangesAndCheckboxesValues, getUpdatedFilterBy } from './helpers';
|
|
10
|
+
import { buildNewUrl, getFilterValues, getFilterRangesAndCheckboxesValues, getUpdatedFilterBy, buildListNameQuery } from './helpers';
|
|
11
11
|
import { getEntityData, getInheritedFilters, getQueryProps, buildRawQueryStringified, buildFiltersQuery } from '../../helpers';
|
|
12
12
|
import { RAW_RESULTS } from './constants';
|
|
13
13
|
import { SCROLL_OFFSET } from '../../constants';
|
|
14
14
|
import searchFilterReducer from './searchFilterReducer';
|
|
15
15
|
import { useGetEntitySchemasAsObj } from '../../hooks';
|
|
16
|
-
const getFiltersUrlQuery = (query, listName) => {
|
|
17
|
-
if (!listName) return query;
|
|
18
|
-
const updatedQuery = {};
|
|
19
|
-
const listKey = `pb[${listName}]`;
|
|
20
|
-
Object.keys(query).forEach(queryKey => {
|
|
21
|
-
const isListKey = queryKey.indexOf(`${listName}`) !== -1;
|
|
22
|
-
if (!isListKey) return;
|
|
23
|
-
const decodedQueryValue = Array.isArray(query[queryKey]) ? query[queryKey].map(value => decodeURIComponent(value)) : decodeURIComponent(query[queryKey]);
|
|
24
|
-
const strippedKey = queryKey.substring(listKey.length + 1, queryKey.length - 1);
|
|
25
|
-
if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;
|
|
26
|
-
});
|
|
27
|
-
return updatedQuery;
|
|
28
|
-
};
|
|
29
16
|
const SearchFilterContainer = ({
|
|
30
17
|
entity,
|
|
31
18
|
url,
|
|
@@ -38,7 +25,8 @@ const SearchFilterContainer = ({
|
|
|
38
25
|
filterByProperty,
|
|
39
26
|
shouldAddFilters,
|
|
40
27
|
listComponentName,
|
|
41
|
-
parent
|
|
28
|
+
parent,
|
|
29
|
+
mobileRefineButtonText
|
|
42
30
|
}) => {
|
|
43
31
|
const {
|
|
44
32
|
isPreview
|
|
@@ -56,14 +44,26 @@ const SearchFilterContainer = ({
|
|
|
56
44
|
url: currentUrl,
|
|
57
45
|
query
|
|
58
46
|
} = parseUrl(urlPath);
|
|
59
|
-
const updatedQuery =
|
|
47
|
+
const updatedQuery = buildListNameQuery(query, listComponentName);
|
|
60
48
|
const {
|
|
61
49
|
itemId: parentId,
|
|
62
50
|
itemEntity: parentEntity
|
|
63
51
|
} = parent;
|
|
64
52
|
useEffect(() => {
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
const {
|
|
54
|
+
query: newQuery
|
|
55
|
+
} = parseUrl(asPath);
|
|
56
|
+
const updatedNewQuery = buildListNameQuery(newQuery, listComponentName);
|
|
57
|
+
const newValues = getFilterValues({}, filters, updatedNewQuery);
|
|
58
|
+
if (newValues) dispatch({
|
|
59
|
+
newValues,
|
|
60
|
+
shouldSearch: false,
|
|
61
|
+
type: 'update'
|
|
62
|
+
});
|
|
63
|
+
setUrlPath(asPath);
|
|
64
|
+
},
|
|
65
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
+
[asPath]);
|
|
67
67
|
const {
|
|
68
68
|
data: mainSchemas = {},
|
|
69
69
|
loading: schemasLoading
|
|
@@ -189,10 +189,12 @@ const SearchFilterContainer = ({
|
|
|
189
189
|
displaySearchFilter: displaySearchFilter,
|
|
190
190
|
setDisplaySearchFilter: setDisplaySearchFilter,
|
|
191
191
|
groupAfterMobile: groupAfterMobile,
|
|
192
|
-
groupAfterDesktop: groupAfterDesktop
|
|
192
|
+
groupAfterDesktop: groupAfterDesktop,
|
|
193
|
+
mobileRefineButtonText: mobileRefineButtonText
|
|
193
194
|
});
|
|
194
195
|
};
|
|
195
196
|
SearchFilterContainer.propTypes = {
|
|
197
|
+
mobileRefineButtonText: PropTypes.string,
|
|
196
198
|
entity: PropTypes.string,
|
|
197
199
|
url: PropTypes.string,
|
|
198
200
|
filters: PropTypes.array,
|
|
@@ -217,7 +219,8 @@ SearchFilterContainer.defaultProps = {
|
|
|
217
219
|
filterByProperty: [],
|
|
218
220
|
shouldAddFilters: false,
|
|
219
221
|
listComponentName: '',
|
|
220
|
-
parent: {}
|
|
222
|
+
parent: {},
|
|
223
|
+
mobileRefineButtonText: ''
|
|
221
224
|
};
|
|
222
225
|
export default withTitle(SearchFilterContainer);
|
|
223
226
|
//# sourceMappingURL=SearchFilterContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useEffect","useRef","useReducer","useContext","MainContext","useRouter","useQuery","PropTypes","parseUrl","SearchFilter","withTitle","getSearchPublishedContent","generateSingleItemQuery","buildNewUrl","getFilterValues","getFilterRangesAndCheckboxesValues","getUpdatedFilterBy","getEntityData","getInheritedFilters","getQueryProps","buildRawQueryStringified","buildFiltersQuery","RAW_RESULTS","SCROLL_OFFSET","searchFilterReducer","useGetEntitySchemasAsObj","getFiltersUrlQuery","query","listName","updatedQuery","listKey","Object","keys","forEach","queryKey","isListKey","indexOf","decodedQueryValue","Array","isArray","map","value","decodeURIComponent","strippedKey","substring","length","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","listComponentName","parent","isPreview","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","filterValues","dispatch","currentUrl","itemId","parentId","itemEntity","parentEntity","data","mainSchemas","loading","schemasLoading","parentSchema","filterEntitySchema","actions","getAction","get","getPublished","inheritedFilters","queryProps","entityData","parentData","parentQueryLoading","variables","id","skip","updatedFilterBy","updatedFilterByProperty","action","checkboxSelectValues","rangeValues","docType","filtersQuery","queryKeys","rawQueryStringified","error","limit","message","searchPublishedContent","rawResults","aggregations","filterData","newValues","shouldSearch","type","handleSearch","newQuery","hashBit","split","parsedHashBit","scrollToFirstList","baseQuery","push","shallow","scroll","then","Date","now","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","hasUrl","propTypes","string","array","isRequired","bool","number","object","defaultProps"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useEffect, useRef, useReducer, useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent, generateSingleItemQuery } from '../../application/query';\nimport {\n buildNewUrl,\n getFilterValues,\n getFilterRangesAndCheckboxesValues,\n getUpdatedFilterBy\n} from './helpers';\nimport {\n getEntityData,\n getInheritedFilters,\n getQueryProps,\n buildRawQueryStringified,\n buildFiltersQuery\n} from '../../helpers';\nimport { RAW_RESULTS } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\nimport searchFilterReducer from './searchFilterReducer';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\n\nconst getFiltersUrlQuery = (query, listName) => {\n if (!listName) return query;\n const updatedQuery = {};\n const listKey = `pb[${listName}]`;\n Object.keys(query).forEach(queryKey => {\n const isListKey = queryKey.indexOf(`${listName}`) !== -1;\n if (!isListKey) return;\n const decodedQueryValue = Array.isArray(query[queryKey])\n ? query[queryKey].map(value => decodeURIComponent(value))\n : decodeURIComponent(query[queryKey]);\n const strippedKey = queryKey.substring(listKey.length + 1, queryKey.length - 1);\n if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;\n });\n\n return updatedQuery;\n};\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters,\n listComponentName,\n parent\n}) => {\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const [filterValues, dispatch] = useReducer(searchFilterReducer, null);\n const { url: currentUrl, query } = parseUrl(urlPath);\n const updatedQuery = getFiltersUrlQuery(query, listComponentName);\n const { itemId: parentId, itemEntity: parentEntity } = parent;\n\n useEffect(\n () => {\n if (asPath) setUrlPath(asPath);\n },\n [asPath]\n );\n const { data: mainSchemas = {}, loading: schemasLoading } = useGetEntitySchemasAsObj([\n parentEntity,\n entity\n ]);\n const { [parentEntity]: parentSchema = {}, [entity]: filterEntitySchema = {} } = mainSchemas;\n const { actions = {} } = parentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, parentSchema, filterEntitySchema);\n const { data: { entityData: parentData } = {}, loading: parentQueryLoading } = useQuery(\n generateSingleItemQuery(getAction, queryProps),\n {\n variables: { id: parentId },\n skip: schemasLoading || !inheritedFilters.length\n }\n );\n const { updatedFilterBy, updatedFilterByProperty } = getUpdatedFilterBy(\n filterBy,\n filterByProperty,\n parentData\n );\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const [checkboxSelectValues, rangeValues] = getFilterRangesAndCheckboxesValues(filters);\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = buildFiltersQuery({\n shouldAddFilters,\n query: filterValues,\n filterBy: updatedFilterBy,\n filterByProperty: updatedFilterByProperty,\n rangeValues,\n queryKeys: Object.keys(updatedQuery)\n });\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error, loading } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified || parentQueryLoading\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (!filterValues && !loading && !parentQueryLoading && (filterData || !rawQueryStringified)) {\n const newValues = getFilterValues(filterData, filters, updatedQuery);\n dispatch({ newValues, shouldSearch: false, type: 'update' });\n return null;\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n const hashBit = asPath.split('#')[1] || '';\n const parsedHashBit = hashBit ? `#${hashBit}` : '';\n scrollToFirstList();\n if (!newQuery) {\n const baseQuery = `${currentUrl}${parsedHashBit}`;\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !url, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const newUrl = buildNewUrl(url, currentUrl, newQuery, hashBit);\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !url, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !url && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n\n if (!filterValues) return null;\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n query={updatedQuery}\n listComponentName={listComponentName}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={!!url}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool,\n listComponentName: PropTypes.string,\n parent: PropTypes.object\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false,\n listComponentName: '',\n parent: {}\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU,QAAQ,OAAO;AAClF,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,yBAAyB,EAAEC,uBAAuB,QAAQ,yBAAyB;AAC5F,SACEC,WAAW,EACXC,eAAe,EACfC,kCAAkC,EAClCC,kBAAkB,QACb,WAAW;AAClB,SACEC,aAAa,EACbC,mBAAmB,EACnBC,aAAa,EACbC,wBAAwB,EACxBC,iBAAiB,QACZ,eAAe;AACtB,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,SAASC,wBAAwB,QAAQ,aAAa;AAEtD,MAAMC,kBAAkB,GAAGA,CAACC,KAAK,EAAEC,QAAQ,KAAK;EAC9C,IAAI,CAACA,QAAQ,EAAE,OAAOD,KAAK;EAC3B,MAAME,YAAY,GAAG,CAAC,CAAC;EACvB,MAAMC,OAAO,GAAI,MAAKF,QAAS,GAAE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B,EAAEA,mBAAoB;IACzCC,sBAAsB,EAAEA,sBAAuB;IAC/Cd,gBAAgB,EAAEA,gBAAiB;IACnCC,iBAAiB,EAAEA;EAAkB,CACtC,CAAC;AAEN,CAAC;AAEDP,qBAAqB,CAAC8F,SAAS,GAAG;EAChC7F,MAAM,EAAExC,SAAS,CAACsI,MAAM;EACxB7F,GAAG,EAAEzC,SAAS,CAACsI,MAAM;EACrB5F,OAAO,EAAE1C,SAAS,CAACuI,KAAK;EACxB5F,IAAI,EAAE3C,SAAS,CAACsI,MAAM,CAACE,UAAU;EACjC5F,uBAAuB,EAAE5C,SAAS,CAACyI,IAAI;EACvC5F,gBAAgB,EAAE7C,SAAS,CAAC0I,MAAM;EAClC5F,iBAAiB,EAAE9C,SAAS,CAAC0I,MAAM;EACnC3F,QAAQ,EAAE/C,SAAS,CAACuI,KAAK;EACzBvF,gBAAgB,EAAEhD,SAAS,CAACuI,KAAK;EACjCtF,gBAAgB,EAAEjD,SAAS,CAACyI,IAAI;EAChCvF,iBAAiB,EAAElD,SAAS,CAACsI,MAAM;EACnCnF,MAAM,EAAEnD,SAAS,CAAC2I;AACpB,CAAC;AAEDpG,qBAAqB,CAACqG,YAAY,GAAG;EACnCnG,GAAG,EAAE,IAAI;EACTC,OAAO,EAAE,EAAE;EACXF,MAAM,EAAE,EAAE;EACVI,uBAAuB,EAAE,IAAI;EAC7BC,gBAAgB,EAAE,CAAC;EACnBC,iBAAiB,EAAE,CAAC;EACpBC,QAAQ,EAAE,EAAE;EACZC,gBAAgB,EAAE,EAAE;EACpBC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,EAAE;EACrBC,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAehD,SAAS,CAACoC,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useEffect","useRef","useReducer","useContext","MainContext","useRouter","useQuery","PropTypes","parseUrl","SearchFilter","withTitle","getSearchPublishedContent","generateSingleItemQuery","buildNewUrl","getFilterValues","getFilterRangesAndCheckboxesValues","getUpdatedFilterBy","buildListNameQuery","getEntityData","getInheritedFilters","getQueryProps","buildRawQueryStringified","buildFiltersQuery","RAW_RESULTS","SCROLL_OFFSET","searchFilterReducer","useGetEntitySchemasAsObj","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","listComponentName","parent","mobileRefineButtonText","isPreview","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","filterValues","dispatch","currentUrl","query","updatedQuery","itemId","parentId","itemEntity","parentEntity","newQuery","updatedNewQuery","newValues","shouldSearch","type","data","mainSchemas","loading","schemasLoading","parentSchema","filterEntitySchema","actions","getAction","get","getPublished","inheritedFilters","queryProps","entityData","parentData","parentQueryLoading","variables","id","skip","length","updatedFilterBy","updatedFilterByProperty","action","checkboxSelectValues","rangeValues","docType","filtersQuery","queryKeys","Object","keys","rawQueryStringified","error","limit","message","searchPublishedContent","rawResults","aggregations","filterData","handleSearch","hashBit","split","parsedHashBit","scrollToFirstList","baseQuery","push","shallow","scroll","then","Date","now","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","hasUrl","propTypes","string","array","isRequired","bool","number","object","defaultProps"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useEffect, useRef, useReducer, useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent, generateSingleItemQuery } from '../../application/query';\nimport {\n buildNewUrl,\n getFilterValues,\n getFilterRangesAndCheckboxesValues,\n getUpdatedFilterBy,\n buildListNameQuery\n} from './helpers';\nimport {\n getEntityData,\n getInheritedFilters,\n getQueryProps,\n buildRawQueryStringified,\n buildFiltersQuery\n} from '../../helpers';\nimport { RAW_RESULTS } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\nimport searchFilterReducer from './searchFilterReducer';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters,\n listComponentName,\n parent,\n mobileRefineButtonText\n}) => {\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const [filterValues, dispatch] = useReducer(searchFilterReducer, null);\n const { url: currentUrl, query } = parseUrl(urlPath);\n const updatedQuery = buildListNameQuery(query, listComponentName);\n const { itemId: parentId, itemEntity: parentEntity } = parent;\n\n useEffect(\n () => {\n const { query: newQuery } = parseUrl(asPath);\n const updatedNewQuery = buildListNameQuery(newQuery, listComponentName);\n const newValues = getFilterValues({}, filters, updatedNewQuery);\n if (newValues)\n dispatch({\n newValues,\n shouldSearch: false,\n type: 'update'\n });\n setUrlPath(asPath);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [asPath]\n );\n\n const { data: mainSchemas = {}, loading: schemasLoading } = useGetEntitySchemasAsObj([\n parentEntity,\n entity\n ]);\n const { [parentEntity]: parentSchema = {}, [entity]: filterEntitySchema = {} } = mainSchemas;\n const { actions = {} } = parentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, parentSchema, filterEntitySchema);\n const { data: { entityData: parentData } = {}, loading: parentQueryLoading } = useQuery(\n generateSingleItemQuery(getAction, queryProps),\n {\n variables: { id: parentId },\n skip: schemasLoading || !inheritedFilters.length\n }\n );\n const { updatedFilterBy, updatedFilterByProperty } = getUpdatedFilterBy(\n filterBy,\n filterByProperty,\n parentData\n );\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const [checkboxSelectValues, rangeValues] = getFilterRangesAndCheckboxesValues(filters);\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = buildFiltersQuery({\n shouldAddFilters,\n query: filterValues,\n filterBy: updatedFilterBy,\n filterByProperty: updatedFilterByProperty,\n rangeValues,\n queryKeys: Object.keys(updatedQuery)\n });\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error, loading } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified || parentQueryLoading\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (!filterValues && !loading && !parentQueryLoading && (filterData || !rawQueryStringified)) {\n const newValues = getFilterValues(filterData, filters, updatedQuery);\n dispatch({ newValues, shouldSearch: false, type: 'update' });\n return null;\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n const hashBit = asPath.split('#')[1] || '';\n const parsedHashBit = hashBit ? `#${hashBit}` : '';\n scrollToFirstList();\n if (!newQuery) {\n const baseQuery = `${currentUrl}${parsedHashBit}`;\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !url, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const newUrl = buildNewUrl(url, currentUrl, newQuery, hashBit);\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !url, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !url && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n\n if (!filterValues) return null;\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n query={updatedQuery}\n listComponentName={listComponentName}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={!!url}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n mobileRefineButtonText={mobileRefineButtonText}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n mobileRefineButtonText: PropTypes.string,\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool,\n listComponentName: PropTypes.string,\n parent: PropTypes.object\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false,\n listComponentName: '',\n parent: {},\n mobileRefineButtonText: ''\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU,QAAQ,OAAO;AAClF,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;A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BC,MAAM,EAAE,CAAC,CAAC;EACVC,sBAAsB,EAAE;AAC1B,CAAC;AAED,eAAe9B,SAAS,CAACiB,qBAAqB,CAAC"}
|
|
@@ -75,7 +75,7 @@ const Checkbox = ({
|
|
|
75
75
|
role: "button",
|
|
76
76
|
className: "see-more",
|
|
77
77
|
onClick: handleCheckboxOptions,
|
|
78
|
-
"aria-label": shouldDisplayMore ? `See ${MORE} options` : `See ${LESS} options`
|
|
78
|
+
"aria-label": shouldDisplayMore ? `See ${MORE} ${label} options` : `See ${LESS} ${label} options`
|
|
79
79
|
}, shouldDisplayMore ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(FaChevronDown, {
|
|
80
80
|
className: "inline-icon"
|
|
81
81
|
})), ` See ${MORE}`) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(FaChevronUp, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","elementTitle","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n elementTitle,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n return (\n <>\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div\n role=\"button\"\n className=\"see-more\"\n onClick={handleCheckboxOptions}\n aria-label={shouldDisplayMore ? `See ${MORE} options` : `See ${LESS} options
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","elementTitle","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n elementTitle,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n return (\n <>\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div\n role=\"button\"\n className=\"see-more\"\n onClick={handleCheckboxOptions}\n aria-label={\n shouldDisplayMore ? `See ${MORE} ${label} options` : `See ${LESS} ${label} options`\n }>\n {shouldDisplayMore ? (\n <>\n <i>\n <FaChevronDown className=\"inline-icon\" />\n </i>\n {` See ${MORE}`}\n </>\n ) : (\n <>\n <i>\n <FaChevronUp className=\"inline-icon\" />\n </i>\n {` See ${LESS}`}\n </>\n )}\n </div>\n )}\n </>\n );\n};\n\nCheckbox.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n displayFilterCount: PropTypes.bool\n};\n\nCheckbox.defaultProps = {\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayFilterCount: false\n};\n\nexport default withTitle(Checkbox);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,aAAa,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AS,CAAC6D,IAAI;EAC5B7C,KAAK,EAAEhB,SAAS,CAAC2D,MAAM;EACvB1C,YAAY,EAAEjB,SAAS,CAAC2D,MAAM;EAC9BxC,kBAAkB,EAAEnB,SAAS,CAAC6D;AAChC,CAAC;AAEDlD,QAAQ,CAACmD,YAAY,GAAG;EACtB5C,YAAY,EAAE,KAAK;EACnBF,KAAK,EAAE,EAAE;EACTC,YAAY,EAAE,EAAE;EAChBE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAed,SAAS,CAACM,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["React","PropTypes","Select","DEFAULT_OPTION","SelectFilter","data","label","prop","updateFilterValues","filterValues","shouldSearch","displayLabelAsPlaceholder","displayFilterCount","elementTitle","filterValue","disabledOptions","buckets","options","map","key","doc_count","count","push","optionLabel","filter","Boolean","sort","labelText","labelToUse","defaultTextValue","createElement","Fragment","className","value","id","name","onChange","valueToUse","disabled","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Select.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { DEFAULT_OPTION } from '../constants';\n\nconst SelectFilter = ({\n data,\n label,\n prop,\n updateFilterValues,\n filterValues,\n shouldSearch,\n displayLabelAsPlaceholder,\n displayFilterCount,\n elementTitle\n}) => {\n const filterValue = filterValues[prop] || '';\n const disabledOptions = [];\n const { buckets = [] } = data[prop] || {};\n const options = buckets\n .map(({ key, doc_count: count }) => {\n if (!count) disabledOptions.push(key);\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel];\n })\n .filter(Boolean)\n .sort();\n\n const labelText = label || prop;\n let labelToUse = labelText;\n let defaultTextValue = DEFAULT_OPTION;\n if (displayLabelAsPlaceholder) {\n defaultTextValue = labelToUse;\n labelToUse = null;\n }\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <Select\n label={labelToUse}\n value={filterValue}\n id={prop}\n name={`filter-${prop}`}\n data-testid={`filter-${prop}`}\n options={options}\n defaultTextValue={defaultTextValue}\n onChange={({ value }) => {\n let valueToUse = value;\n if (value === defaultTextValue) valueToUse = '';\n updateFilterValues({ [prop]: valueToUse }, shouldSearch);\n }}\n disabled={disabledOptions}\n />\n </>\n );\n};\n\nSelectFilter.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n\n displayLabelAsPlaceholder: PropTypes.bool,\n displayFilterCount: PropTypes.bool\n};\n\nSelectFilter.defaultProps = {\n filterValues: {},\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayLabelAsPlaceholder: false,\n displayFilterCount: false\n};\n\nexport default SelectFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,cAAc,QAAQ,cAAc;AAE7C,MAAMC,YAAY,GAAGA,CAAC;EACpBC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJC,kBAAkB;EAClBC,YAAY;EACZC,YAAY;EACZC,yBAAyB;EACzBC,kBAAkB;EAClBC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGL,YAAY,CAACF,IAAI,CAAC,IAAI,EAAE;EAC5C,MAAMQ,eAAe,GAAG,EAAE;EAC1B,MAAM;IAAEC,OAAO,GAAG;EAAG,CAAC,GAAGX,IAAI,CAACE,IAAI,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.js","names":["React","PropTypes","Select","DEFAULT_OPTION","SelectFilter","data","label","prop","updateFilterValues","filterValues","shouldSearch","displayLabelAsPlaceholder","displayFilterCount","elementTitle","filterValue","disabledOptions","buckets","options","map","key","doc_count","count","push","optionLabel","filter","Boolean","sort","labelText","labelToUse","defaultTextValue","createElement","Fragment","className","value","id","name","onChange","valueToUse","disabled","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Select.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { DEFAULT_OPTION } from '../constants';\n\nconst SelectFilter = ({\n data,\n label,\n prop,\n updateFilterValues,\n filterValues,\n shouldSearch,\n displayLabelAsPlaceholder,\n displayFilterCount,\n elementTitle\n}) => {\n const filterValue = filterValues[prop] || '';\n const disabledOptions = [];\n const { buckets = [] } = data[prop] || {};\n\n const options = buckets\n .map(({ key, doc_count: count }) => {\n if (!count) disabledOptions.push(key);\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel];\n })\n .filter(Boolean)\n .sort();\n\n const labelText = label || prop;\n let labelToUse = labelText;\n let defaultTextValue = DEFAULT_OPTION;\n if (displayLabelAsPlaceholder) {\n defaultTextValue = labelToUse;\n labelToUse = null;\n }\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <Select\n label={labelToUse}\n value={filterValue}\n id={prop}\n name={`filter-${prop}`}\n data-testid={`filter-${prop}`}\n options={options}\n defaultTextValue={defaultTextValue}\n onChange={({ value }) => {\n let valueToUse = value;\n if (value === defaultTextValue) valueToUse = '';\n\n updateFilterValues({ [prop]: valueToUse }, shouldSearch);\n }}\n disabled={disabledOptions}\n />\n </>\n );\n};\n\nSelectFilter.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n\n displayLabelAsPlaceholder: PropTypes.bool,\n displayFilterCount: PropTypes.bool\n};\n\nSelectFilter.defaultProps = {\n filterValues: {},\n shouldSearch: false,\n label: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,EAAE;EAChBF,yBAAyB,EAAE,KAAK;EAChCC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeR,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","SEARCH_TERM","TextSearch","label","searchValue","updateFilterValues","elementTitle","createElement","Fragment","className","id","value","placeholder","onChange","eValue","type","onClick","e","preventDefault","propTypes","string","isRequired","func","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/TextSearch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport { MdSearch } from 'react-icons/md';\nimport { SEARCH_TERM } from '../constants';\n\nconst TextSearch = ({ label, searchValue, updateFilterValues, elementTitle }) => (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <div className=\"search\">\n <div className=\"search__wrapper\">\n <div className=\"form-field form-field--input form-field--search\">\n <Input\n id={SEARCH_TERM}\n value={searchValue}\n placeholder={label || 'Search'}\n onChange={({ value: eValue }) => {\n updateFilterValues({ [SEARCH_TERM]: eValue }, false);\n }}\n />\n </div>\n <button\n type=\"button\"\n className=\"icon-button icon-button--search\"\n onClick={e => {\n e.preventDefault();\n updateFilterValues({ [SEARCH_TERM]: searchValue }, true);\n }}>\n <i>\n <MdSearch />\n </i>\n </button>\n </div>\n </div>\n </>\n);\n\nTextSearch.propTypes = {\n searchValue: PropTypes.string.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n elementTitle: PropTypes.string,\n label: PropTypes.string\n};\n\nTextSearch.defaultProps = {\n elementTitle: '',\n label: ''\n};\n\nexport default TextSearch;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC,kBAAkB;EAAEC;AAAa,CAAC,kBAC1ET,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAAW,QAAA,QACGF,YAAY,iBAAIT,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAA0B,GAAEH,YAAkB,CAAC,eAC/ET,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAQ,gBACrBZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiB,gBAC9BZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiD,gBAC9DZ,KAAA,CAAAU,aAAA,CAACR,KAAK;EACJW,EAAE,EAAET,WAAY;EAChBU,KAAK,EAAEP,WAAY;EACnBQ,WAAW,EAAET,KAAK,IAAI,QAAS;EAC/BU,QAAQ,EAAEA,CAAC;IAAEF,KAAK,EAAEG;EAAO,CAAC,KAAK;IAC/BT,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGa;IAAO,CAAC,EAAE,KAAK,CAAC;EACtD;AAAE,CACH,CACE,CAAC,eACNjB,KAAA,CAAAU,aAAA;EACEQ,IAAI,EAAC,QAAQ;EACbN,SAAS,EAAC,iCAAiC;
|
|
1
|
+
{"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","SEARCH_TERM","TextSearch","label","searchValue","updateFilterValues","elementTitle","createElement","Fragment","className","id","value","placeholder","onChange","eValue","type","onClick","e","preventDefault","propTypes","string","isRequired","func","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/TextSearch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport { MdSearch } from 'react-icons/md';\nimport { SEARCH_TERM } from '../constants';\n\nconst TextSearch = ({ label, searchValue, updateFilterValues, elementTitle }) => (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <div className=\"search\">\n <div className=\"search__wrapper\">\n <div className=\"form-field form-field--input form-field--search\">\n <Input\n id={SEARCH_TERM}\n value={searchValue}\n placeholder={label || 'Search'}\n onChange={({ value: eValue }) => {\n updateFilterValues({ [SEARCH_TERM]: eValue }, false);\n }}\n />\n </div>\n <button\n type=\"button\"\n className=\"icon-button icon-button--search\"\n aria-label=\"Search\"\n onClick={e => {\n e.preventDefault();\n updateFilterValues({ [SEARCH_TERM]: searchValue }, true);\n }}>\n <i>\n <MdSearch />\n </i>\n </button>\n </div>\n </div>\n </>\n);\n\nTextSearch.propTypes = {\n searchValue: PropTypes.string.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n elementTitle: PropTypes.string,\n label: PropTypes.string\n};\n\nTextSearch.defaultProps = {\n elementTitle: '',\n label: ''\n};\n\nexport default TextSearch;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC,kBAAkB;EAAEC;AAAa,CAAC,kBAC1ET,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAAW,QAAA,QACGF,YAAY,iBAAIT,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAA0B,GAAEH,YAAkB,CAAC,eAC/ET,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAQ,gBACrBZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiB,gBAC9BZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiD,gBAC9DZ,KAAA,CAAAU,aAAA,CAACR,KAAK;EACJW,EAAE,EAAET,WAAY;EAChBU,KAAK,EAAEP,WAAY;EACnBQ,WAAW,EAAET,KAAK,IAAI,QAAS;EAC/BU,QAAQ,EAAEA,CAAC;IAAEF,KAAK,EAAEG;EAAO,CAAC,KAAK;IAC/BT,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGa;IAAO,CAAC,EAAE,KAAK,CAAC;EACtD;AAAE,CACH,CACE,CAAC,eACNjB,KAAA,CAAAU,aAAA;EACEQ,IAAI,EAAC,QAAQ;EACbN,SAAS,EAAC,iCAAiC;EAC3C,cAAW,QAAQ;EACnBO,OAAO,EAAEC,CAAC,IAAI;IACZA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClBb,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGG;IAAY,CAAC,EAAE,IAAI,CAAC;EAC1D;AAAE,gBACFP,KAAA,CAAAU,aAAA,yBACEV,KAAA,CAAAU,aAAA,CAACP,QAAQ,MAAE,CACV,CACG,CACL,CACF,CACL,CACH;AAEDE,UAAU,CAACiB,SAAS,GAAG;EACrBf,WAAW,EAAEN,SAAS,CAACsB,MAAM,CAACC,UAAU;EACxChB,kBAAkB,EAAEP,SAAS,CAACwB,IAAI,CAACD,UAAU;EAC7Cf,YAAY,EAAER,SAAS,CAACsB,MAAM;EAC9BjB,KAAK,EAAEL,SAAS,CAACsB;AACnB,CAAC;AAEDlB,UAAU,CAACqB,YAAY,GAAG;EACxBjB,YAAY,EAAE,EAAE;EAChBH,KAAK,EAAE;AACT,CAAC;AAED,eAAeD,UAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const buildListNameQuery = (query, listName) => {
|
|
2
|
+
if (!listName) return query;
|
|
3
|
+
const updatedQuery = {};
|
|
4
|
+
const listKey = `pb[${listName}]`;
|
|
5
|
+
Object.keys(query).forEach(queryKey => {
|
|
6
|
+
const isListKey = queryKey.indexOf(`${listName}`) !== -1;
|
|
7
|
+
if (!isListKey) return;
|
|
8
|
+
const decodedQueryValue = Array.isArray(query[queryKey]) ? query[queryKey].map(value => decodeURIComponent(value)) : decodeURIComponent(query[queryKey]);
|
|
9
|
+
const strippedKey = queryKey.substring(listKey.length + 1, queryKey.length - 1);
|
|
10
|
+
if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;
|
|
11
|
+
});
|
|
12
|
+
return updatedQuery;
|
|
13
|
+
};
|
|
14
|
+
export default buildListNameQuery;
|
|
15
|
+
//# sourceMappingURL=build-list-name-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-list-name-query.js","names":["buildListNameQuery","query","listName","updatedQuery","listKey","Object","keys","forEach","queryKey","isListKey","indexOf","decodedQueryValue","Array","isArray","map","value","decodeURIComponent","strippedKey","substring","length"],"sources":["../../../../src/components/SearchFilter/helpers/build-list-name-query.js"],"sourcesContent":["const buildListNameQuery = (query, listName) => {\n if (!listName) return query;\n const updatedQuery = {};\n const listKey = `pb[${listName}]`;\n Object.keys(query).forEach(queryKey => {\n const isListKey = queryKey.indexOf(`${listName}`) !== -1;\n if (!isListKey) return;\n const decodedQueryValue = Array.isArray(query[queryKey])\n ? query[queryKey].map(value => decodeURIComponent(value))\n : decodeURIComponent(query[queryKey]);\n const strippedKey = queryKey.substring(listKey.length + 1, queryKey.length - 1);\n if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;\n });\n\n return updatedQuery;\n};\n\nexport default buildListNameQuery;\n"],"mappings":"AAAA,MAAMA,kBAAkB,GAAGA,CAACC,KAAK,EAAEC,QAAQ,KAAK;EAC9C,IAAI,CAACA,QAAQ,EAAE,OAAOD,KAAK;EAC3B,MAAME,YAAY,GAAG,CAAC,CAAC;EACvB,MAAMC,OAAO,GAAI,MAAKF,QAAS,GAAE;EACjCG,MAAM,CAACC,IAAI,CAACL,KAAK,CAAC,CAACM,OAAO,CAACC,QAAQ,IAAI;IACrC,MAAMC,SAAS,GAAGD,QAAQ,CAACE,OAAO,CAAE,GAAER,QAAS,EAAC,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,CAACO,SAAS,EAAE;IAChB,MAAME,iBAAiB,GAAGC,KAAK,CAACC,OAAO,CAACZ,KAAK,CAACO,QAAQ,CAAC,CAAC,GACpDP,KAAK,CAACO,QAAQ,CAAC,CAACM,GAAG,CAACC,KAAK,IAAIC,kBAAkB,CAACD,KAAK,CAAC,CAAC,GACvDC,kBAAkB,CAACf,KAAK,CAACO,QAAQ,CAAC,CAAC;IACvC,MAAMS,WAAW,GAAGT,QAAQ,CAACU,SAAS,CAACd,OAAO,CAACe,MAAM,GAAG,CAAC,EAAEX,QAAQ,CAACW,MAAM,GAAG,CAAC,CAAC;IAC/E,IAAIV,SAAS,EAAEN,YAAY,CAACc,WAAW,CAAC,GAAGN,iBAAiB;EAC9D,CAAC,CAAC;EAEF,OAAOR,YAAY;AACrB,CAAC;AAED,eAAeH,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-encode.js","names":["decodeValue","value","decodeURIComponent","encodeValue","encodeURIComponent"],"sources":["../../../../src/components/SearchFilter/helpers/decode-encode.js"],"sourcesContent":["const decodeValue = value => decodeURIComponent(value);\
|
|
1
|
+
{"version":3,"file":"decode-encode.js","names":["decodeValue","value","decodeURIComponent","encodeValue","encodeURIComponent"],"sources":["../../../../src/components/SearchFilter/helpers/decode-encode.js"],"sourcesContent":["const decodeValue = value => decodeURIComponent(value);\nconst encodeValue = value => encodeURIComponent(value);\n\nexport { decodeValue, encodeValue };\n"],"mappings":"AAAA,MAAMA,WAAW,GAAGC,KAAK,IAAIC,kBAAkB,CAACD,KAAK,CAAC;AACtD,MAAME,WAAW,GAAGF,KAAK,IAAIG,kBAAkB,CAACH,KAAK,CAAC;AAEtD,SAASD,WAAW,EAAEG,WAAW"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import buildListNameQuery from './build-list-name-query';
|
|
1
2
|
import buildNewUrl from './build-new-url';
|
|
2
3
|
import { decodeValue, encodeValue } from './decode-encode';
|
|
3
4
|
import checkIfRangeUpdated from './check-if-range-updated';
|
|
@@ -14,5 +15,5 @@ import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
|
14
15
|
import getFilterRangesAndCheckboxesValues from './get-filter-ranges-and-checkboxes-values';
|
|
15
16
|
import getUpdatedFilterBy from './get-updated-filter-by';
|
|
16
17
|
import buildUrlQuery from './build-url-query';
|
|
17
|
-
export { buildNewUrl, decodeValue, encodeValue, checkIfRangeUpdated, getResponsiveFilterClassnames, getDisplayValue, calculateStep, calculateMinMax, getIntersectedProp, getRangeValue, getSelectOptions, isDeviceDesktop, getFilterValues, getFilterValueFromQuery, getFilterRangesAndCheckboxesValues, getUpdatedFilterBy, buildUrlQuery };
|
|
18
|
+
export { buildListNameQuery, buildNewUrl, decodeValue, encodeValue, checkIfRangeUpdated, getResponsiveFilterClassnames, getDisplayValue, calculateStep, calculateMinMax, getIntersectedProp, getRangeValue, getSelectOptions, isDeviceDesktop, getFilterValues, getFilterValueFromQuery, getFilterRangesAndCheckboxesValues, getUpdatedFilterBy, buildUrlQuery };
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buildNewUrl","decodeValue","encodeValue","checkIfRangeUpdated","getResponsiveFilterClassnames","getDisplayValue","calculateStep","calculateMinMax","getIntersectedProp","getRangeValue","getSelectOptions","isDeviceDesktop","getFilterValues","getFilterValueFromQuery","getFilterRangesAndCheckboxesValues","getUpdatedFilterBy","buildUrlQuery"],"sources":["../../../../src/components/SearchFilter/helpers/index.js"],"sourcesContent":["import buildNewUrl from './build-new-url';\nimport { decodeValue, encodeValue } from './decode-encode';\nimport checkIfRangeUpdated from './check-if-range-updated';\nimport getResponsiveFilterClassnames from './get-responsive-filter-classnames';\nimport getDisplayValue from './get-display-value';\nimport calculateStep from './calculate-step';\nimport calculateMinMax from './calculate-min-max';\nimport getIntersectedProp from './get-intersected-prop';\nimport getRangeValue from './get-range-value';\nimport getSelectOptions from './get-select-options';\nimport isDeviceDesktop from './is-device-desktop';\nimport getFilterValues from './get-filter-values';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\nimport getFilterRangesAndCheckboxesValues from './get-filter-ranges-and-checkboxes-values';\nimport getUpdatedFilterBy from './get-updated-filter-by';\nimport buildUrlQuery from './build-url-query';\n\nexport {\n buildNewUrl,\n decodeValue,\n encodeValue,\n checkIfRangeUpdated,\n getResponsiveFilterClassnames,\n getDisplayValue,\n calculateStep,\n calculateMinMax,\n getIntersectedProp,\n getRangeValue,\n getSelectOptions,\n isDeviceDesktop,\n getFilterValues,\n getFilterValueFromQuery,\n getFilterRangesAndCheckboxesValues,\n getUpdatedFilterBy,\n buildUrlQuery\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,6BAA6B,MAAM,oCAAoC;AAC9E,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,OAAOC,kCAAkC,MAAM,2CAA2C;AAC1F,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildListNameQuery","buildNewUrl","decodeValue","encodeValue","checkIfRangeUpdated","getResponsiveFilterClassnames","getDisplayValue","calculateStep","calculateMinMax","getIntersectedProp","getRangeValue","getSelectOptions","isDeviceDesktop","getFilterValues","getFilterValueFromQuery","getFilterRangesAndCheckboxesValues","getUpdatedFilterBy","buildUrlQuery"],"sources":["../../../../src/components/SearchFilter/helpers/index.js"],"sourcesContent":["import buildListNameQuery from './build-list-name-query';\nimport buildNewUrl from './build-new-url';\nimport { decodeValue, encodeValue } from './decode-encode';\nimport checkIfRangeUpdated from './check-if-range-updated';\nimport getResponsiveFilterClassnames from './get-responsive-filter-classnames';\nimport getDisplayValue from './get-display-value';\nimport calculateStep from './calculate-step';\nimport calculateMinMax from './calculate-min-max';\nimport getIntersectedProp from './get-intersected-prop';\nimport getRangeValue from './get-range-value';\nimport getSelectOptions from './get-select-options';\nimport isDeviceDesktop from './is-device-desktop';\nimport getFilterValues from './get-filter-values';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\nimport getFilterRangesAndCheckboxesValues from './get-filter-ranges-and-checkboxes-values';\nimport getUpdatedFilterBy from './get-updated-filter-by';\nimport buildUrlQuery from './build-url-query';\n\nexport {\n buildListNameQuery,\n buildNewUrl,\n decodeValue,\n encodeValue,\n checkIfRangeUpdated,\n getResponsiveFilterClassnames,\n getDisplayValue,\n calculateStep,\n calculateMinMax,\n getIntersectedProp,\n getRangeValue,\n getSelectOptions,\n isDeviceDesktop,\n getFilterValues,\n getFilterValueFromQuery,\n getFilterRangesAndCheckboxesValues,\n getUpdatedFilterBy,\n buildUrlQuery\n};\n"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,6BAA6B,MAAM,oCAAoC;AAC9E,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,OAAOC,kCAAkC,MAAM,2CAA2C;AAC1F,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,SACEjB,kBAAkB,EAClBC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,6BAA6B,EAC7BC,eAAe,EACfC,aAAa,EACbC,eAAe,EACfC,kBAAkB,EAClBC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,uBAAuB,EACvBC,kCAAkC,EAClCC,kBAAkB,EAClBC,aAAa"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import Modal from '
|
|
4
|
+
import Modal from '../ModalAdapter';
|
|
5
5
|
import VideoRender from './VideoRender';
|
|
6
6
|
const VideoModal = _ref => {
|
|
7
7
|
let props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoModal.js","names":["React","useState","Modal","VideoRender","VideoModal","_ref","props","_extends","_objectDestructuringEmpty","displayModal","setDisplayModal","createElement","Fragment","role","onClick","placeholderOnly","autoplay","className","isFullScreen","showFooter","isSimple","onClose"],"sources":["../../../src/components/Video/VideoModal.js"],"sourcesContent":["import React, { useState } from 'react';\nimport Modal from '
|
|
1
|
+
{"version":3,"file":"VideoModal.js","names":["React","useState","Modal","VideoRender","VideoModal","_ref","props","_extends","_objectDestructuringEmpty","displayModal","setDisplayModal","createElement","Fragment","role","onClick","placeholderOnly","autoplay","className","isFullScreen","showFooter","isSimple","onClose"],"sources":["../../../src/components/Video/VideoModal.js"],"sourcesContent":["import React, { useState } from 'react';\nimport Modal from '../ModalAdapter';\nimport VideoRender from './VideoRender';\n\nconst VideoModal = ({ ...props }) => {\n const [displayModal, setDisplayModal] = useState(false);\n\n return (\n <>\n <div\n role=\"button\"\n aria-label=\"Open video\"\n onClick={() => {\n setDisplayModal(!displayModal);\n }}>\n <VideoRender placeholderOnly autoplay={false} {...props} />\n </div>\n {displayModal && (\n <Modal\n className=\"modal--video\"\n isFullScreen\n showFooter={false}\n isSimple\n onClose={() => setDisplayModal(!displayModal)}>\n <VideoRender {...props} placeholderOnly={false} autoplay />\n </Modal>\n )}\n </>\n );\n};\n\nexport default VideoModal;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,KAAK,MAAM,iBAAiB;AACnC,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,UAAU,GAAGC,IAAA,IAAkB;EAAA,IAAZC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAAH,IAAA,GAAAA,IAAA;EAC5B,MAAM,CAACI,YAAY,EAAEC,eAAe,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEvD,oBACED,KAAA,CAAAW,aAAA,CAAAX,KAAA,CAAAY,QAAA,qBACEZ,KAAA,CAAAW,aAAA;IACEE,IAAI,EAAC,QAAQ;IACb,cAAW,YAAY;IACvBC,OAAO,EAAEA,CAAA,KAAM;MACbJ,eAAe,CAAC,CAACD,YAAY,CAAC;IAChC;EAAE,gBACFT,KAAA,CAAAW,aAAA,CAACR,WAAW,EAAAI,QAAA;IAACQ,eAAe;IAACC,QAAQ,EAAE;EAAM,GAAKV,KAAK,CAAG,CACvD,CAAC,EACLG,YAAY,iBACXT,KAAA,CAAAW,aAAA,CAACT,KAAK;IACJe,SAAS,EAAC,cAAc;IACxBC,YAAY;IACZC,UAAU,EAAE,KAAM;IAClBC,QAAQ;IACRC,OAAO,EAAEA,CAAA,KAAMX,eAAe,CAAC,CAACD,YAAY;EAAE,gBAC9CT,KAAA,CAAAW,aAAA,CAACR,WAAW,EAAAI,QAAA,KAAKD,KAAK;IAAES,eAAe,EAAE,KAAM;IAACC,QAAQ;EAAA,EAAE,CACrD,CAET,CAAC;AAEP,CAAC;AAED,eAAeZ,UAAU"}
|
|
@@ -50,7 +50,6 @@ const VimeoProvider = ({
|
|
|
50
50
|
role: "button",
|
|
51
51
|
className: VIDEO_WRAPPER_CLASS_NAME,
|
|
52
52
|
style: videoStyle,
|
|
53
|
-
"aria-label": "Open video",
|
|
54
53
|
onClick: () => !shouldRenderVideo && setShouldRenderVideo(true)
|
|
55
54
|
}, shouldRenderVideo && !videoError && wrappedCode, videoError && videoError.message);
|
|
56
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VimeoProvider.js","names":["React","useEffect","useState","useRef","PropTypes","parseHTML","addExtraParamsToUrl","wrapScriptTags","VIDEO_WRAPPER_CLASS_NAME","VimeoProvider","url","autoplay","loop","imageData","inputEl","videoData","setVideoData","videoError","setVideoError","shouldRenderVideo","setShouldRenderVideo","fetchVideoData","videoUrl","res","fetch","data","json","err","currentHeight","current","clientHeight","urlWithParams","height","thumbnail_url_with_play_button","thumbnailUrl","html","imageUrl","backgroundUrl","videoStyle","backgroundImage","maxheight","parsedCode","wrappedCode","createElement","ref","role","className","style","onClick","message","propTypes","string","isRequired","bool","object","defaultProps"],"sources":["../../../../../src/components/Video/providers/Vimeo/VimeoProvider.js"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport { addExtraParamsToUrl } from './helpers';\nimport { wrapScriptTags } from '../../../Code/helpers';\nimport { VIDEO_WRAPPER_CLASS_NAME } from '../../../../constants';\n\nconst VimeoProvider = ({ url, autoplay, loop, imageData }) => {\n const inputEl = useRef(null);\n const [videoData, setVideoData] = useState(null);\n const [videoError, setVideoError] = useState(null);\n const [shouldRenderVideo, setShouldRenderVideo] = useState(!!autoplay);\n\n useEffect(\n () => {\n async function fetchVideoData(videoUrl) {\n try {\n const res = await fetch(videoUrl);\n const data = await res.json();\n setVideoData(data);\n } catch (err) {\n setVideoError(err);\n }\n }\n if (url) {\n const currentHeight = inputEl.current.clientHeight;\n const urlWithParams = addExtraParamsToUrl(url, {\n autoplay: true,\n loop,\n height: currentHeight\n });\n fetchVideoData(urlWithParams);\n }\n },\n [autoplay, loop, url]\n );\n\n const { thumbnail_url_with_play_button: thumbnailUrl, html = '' } = videoData || {};\n const imageUrl = imageData && imageData.url;\n const backgroundUrl = imageUrl || thumbnailUrl;\n const videoStyle = {};\n if (!shouldRenderVideo && backgroundUrl)\n videoStyle.backgroundImage = `url(${!shouldRenderVideo ? backgroundUrl : ''})`;\n if (inputEl && inputEl.current) videoStyle.maxheight = inputEl.current.clientHeight;\n const parsedCode = parseHTML(html);\n const wrappedCode = wrapScriptTags(parsedCode);\n\n return (\n <div\n ref={inputEl}\n role=\"button\"\n className={VIDEO_WRAPPER_CLASS_NAME}\n style={videoStyle}\n
|
|
1
|
+
{"version":3,"file":"VimeoProvider.js","names":["React","useEffect","useState","useRef","PropTypes","parseHTML","addExtraParamsToUrl","wrapScriptTags","VIDEO_WRAPPER_CLASS_NAME","VimeoProvider","url","autoplay","loop","imageData","inputEl","videoData","setVideoData","videoError","setVideoError","shouldRenderVideo","setShouldRenderVideo","fetchVideoData","videoUrl","res","fetch","data","json","err","currentHeight","current","clientHeight","urlWithParams","height","thumbnail_url_with_play_button","thumbnailUrl","html","imageUrl","backgroundUrl","videoStyle","backgroundImage","maxheight","parsedCode","wrappedCode","createElement","ref","role","className","style","onClick","message","propTypes","string","isRequired","bool","object","defaultProps"],"sources":["../../../../../src/components/Video/providers/Vimeo/VimeoProvider.js"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport { addExtraParamsToUrl } from './helpers';\nimport { wrapScriptTags } from '../../../Code/helpers';\nimport { VIDEO_WRAPPER_CLASS_NAME } from '../../../../constants';\n\nconst VimeoProvider = ({ url, autoplay, loop, imageData }) => {\n const inputEl = useRef(null);\n const [videoData, setVideoData] = useState(null);\n const [videoError, setVideoError] = useState(null);\n const [shouldRenderVideo, setShouldRenderVideo] = useState(!!autoplay);\n\n useEffect(\n () => {\n async function fetchVideoData(videoUrl) {\n try {\n const res = await fetch(videoUrl);\n const data = await res.json();\n setVideoData(data);\n } catch (err) {\n setVideoError(err);\n }\n }\n if (url) {\n const currentHeight = inputEl.current.clientHeight;\n const urlWithParams = addExtraParamsToUrl(url, {\n autoplay: true,\n loop,\n height: currentHeight\n });\n fetchVideoData(urlWithParams);\n }\n },\n [autoplay, loop, url]\n );\n\n const { thumbnail_url_with_play_button: thumbnailUrl, html = '' } = videoData || {};\n const imageUrl = imageData && imageData.url;\n const backgroundUrl = imageUrl || thumbnailUrl;\n const videoStyle = {};\n if (!shouldRenderVideo && backgroundUrl)\n videoStyle.backgroundImage = `url(${!shouldRenderVideo ? backgroundUrl : ''})`;\n if (inputEl && inputEl.current) videoStyle.maxheight = inputEl.current.clientHeight;\n const parsedCode = parseHTML(html);\n const wrappedCode = wrapScriptTags(parsedCode);\n\n return (\n <div\n ref={inputEl}\n role=\"button\"\n className={VIDEO_WRAPPER_CLASS_NAME}\n style={videoStyle}\n onClick={() => !shouldRenderVideo && setShouldRenderVideo(true)}>\n {shouldRenderVideo && !videoError && wrappedCode}\n {videoError && videoError.message}\n </div>\n );\n};\n\nVimeoProvider.propTypes = {\n url: PropTypes.string.isRequired,\n autoplay: PropTypes.bool,\n loop: PropTypes.bool,\n imageData: PropTypes.object\n};\n\nVimeoProvider.defaultProps = {\n autoplay: false,\n loop: false,\n imageData: null\n};\n\nexport default VimeoProvider;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,wBAAwB,QAAQ,uBAAuB;AA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AIF,YAAY;EAC9C,MAAMI,UAAU,GAAG,CAAC,CAAC;EACrB,IAAI,CAACnB,iBAAiB,IAAIkB,aAAa,EACrCC,UAAU,CAACC,eAAe,GAAI,OAAM,CAACpB,iBAAiB,GAAGkB,aAAa,GAAG,EAAG,GAAE;EAChF,IAAIvB,OAAO,IAAIA,OAAO,CAACe,OAAO,EAAES,UAAU,CAACE,SAAS,GAAG1B,OAAO,CAACe,OAAO,CAACC,YAAY;EACnF,MAAMW,UAAU,GAAGpC,SAAS,CAAC8B,IAAI,CAAC;EAClC,MAAMO,WAAW,GAAGnC,cAAc,CAACkC,UAAU,CAAC;EAE9C,oBACEzC,KAAA,CAAA2C,aAAA;IACEC,GAAG,EAAE9B,OAAQ;IACb+B,IAAI,EAAC,QAAQ;IACbC,SAAS,EAAEtC,wBAAyB;IACpCuC,KAAK,EAAET,UAAW;IAClBU,OAAO,EAAEA,CAAA,KAAM,CAAC7B,iBAAiB,IAAIC,oBAAoB,CAAC,IAAI;EAAE,GAC/DD,iBAAiB,IAAI,CAACF,UAAU,IAAIyB,WAAW,EAC/CzB,UAAU,IAAIA,UAAU,CAACgC,OACvB,CAAC;AAEV,CAAC;AAEDxC,aAAa,CAACyC,SAAS,GAAG;EACxBxC,GAAG,EAAEN,SAAS,CAAC+C,MAAM,CAACC,UAAU;EAChCzC,QAAQ,EAAEP,SAAS,CAACiD,IAAI;EACxBzC,IAAI,EAAER,SAAS,CAACiD,IAAI;EACpBxC,SAAS,EAAET,SAAS,CAACkD;AACvB,CAAC;AAED7C,aAAa,CAAC8C,YAAY,GAAG;EAC3B5C,QAAQ,EAAE,KAAK;EACfC,IAAI,EAAE,KAAK;EACXC,SAAS,EAAE;AACb,CAAC;AAED,eAAeJ,aAAa"}
|
|
@@ -47,9 +47,8 @@ const buildFiltersQuery = ({
|
|
|
47
47
|
queryKeys,
|
|
48
48
|
query
|
|
49
49
|
}) => {
|
|
50
|
-
if (!shouldAddFilters) return [];
|
|
51
50
|
const mustFilters = [];
|
|
52
|
-
if (query) {
|
|
51
|
+
if (shouldAddFilters && query) {
|
|
53
52
|
Object.keys(query).forEach(queryKey => {
|
|
54
53
|
if (QUERY_KEYS_TO_IGNORE.includes(queryKey)) return;
|
|
55
54
|
if (!queryKey || !query[queryKey]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-filters-query.js","names":["QUERY_KEYS_TO_IGNORE","builFilterObject","queryKey","value","filters","isRange","isInQuery","min","minValue","max","maxValue","push","range","gte","Number","lte","key","isArray","Array","singleFilterObj","match","forEach","filterValue","buildFiltersQuery","shouldAddFilters","filterBy","filterByProperty","rangeValues","queryKeys","query","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","filterByPropKey","split","filterByOption","indexOf","filteryByValue","filterByKeyword"],"sources":["../../src/helpers/build-filters-query.js"],"sourcesContent":["const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];\n\nconst builFilterObject = ({ queryKey, value, filters, isRange, isInQuery }) => {\n if (isRange) {\n // don't add to query if value matches range values\n if (isInQuery || (value.min !== value.minValue && value.max !== value.maxValue)) {\n filters.push({\n range: {\n [queryKey]: {\n gte: Number(value.minValue),\n lte: Number(value.maxValue)\n }\n }\n });\n }\n return;\n }\n\n const key = isRange ? queryKey : `${queryKey}.keyword`;\n\n const isArray = Array.isArray(value);\n if (!isArray) {\n const singleFilterObj = { match: { [key]: value } };\n filters.push(singleFilterObj);\n return;\n }\n\n value.forEach(filterValue => {\n filters.push({ match: { [key]: filterValue } });\n });\n};\n\nconst buildFiltersQuery = ({\n shouldAddFilters,\n
|
|
1
|
+
{"version":3,"file":"build-filters-query.js","names":["QUERY_KEYS_TO_IGNORE","builFilterObject","queryKey","value","filters","isRange","isInQuery","min","minValue","max","maxValue","push","range","gte","Number","lte","key","isArray","Array","singleFilterObj","match","forEach","filterValue","buildFiltersQuery","shouldAddFilters","filterBy","filterByProperty","rangeValues","queryKeys","query","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","filterByPropKey","split","filterByOption","indexOf","filteryByValue","filterByKeyword"],"sources":["../../src/helpers/build-filters-query.js"],"sourcesContent":["const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];\n\nconst builFilterObject = ({ queryKey, value, filters, isRange, isInQuery }) => {\n if (isRange) {\n // don't add to query if value matches range values\n if (isInQuery || (value.min !== value.minValue && value.max !== value.maxValue)) {\n filters.push({\n range: {\n [queryKey]: {\n gte: Number(value.minValue),\n lte: Number(value.maxValue)\n }\n }\n });\n }\n return;\n }\n\n const key = isRange ? queryKey : `${queryKey}.keyword`;\n\n const isArray = Array.isArray(value);\n if (!isArray) {\n const singleFilterObj = { match: { [key]: value } };\n filters.push(singleFilterObj);\n return;\n }\n\n value.forEach(filterValue => {\n filters.push({ match: { [key]: filterValue } });\n });\n};\n\nconst buildFiltersQuery = ({\n shouldAddFilters,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys,\n query\n}) => {\n const mustFilters = [];\n if (shouldAddFilters && query) {\n Object.keys(query).forEach(queryKey => {\n if (QUERY_KEYS_TO_IGNORE.includes(queryKey)) return;\n if (!queryKey || !query[queryKey]) return;\n const queryValue = query[queryKey];\n\n const isRange = rangeValues.includes(queryKey);\n const isInQuery = queryKeys.includes(queryKey);\n builFilterObject({ queryKey, value: queryValue, filters: mustFilters, isRange, isInQuery });\n });\n }\n\n if (filterByProperty && filterByProperty.length) {\n filterByProperty.forEach(filterByPropOption => {\n const [filterByPropKey] = filterByPropOption.split('/');\n filterBy.forEach(filterByOption => {\n if (filterByOption.indexOf(filterByPropKey) === -1) return;\n const [, filteryByValue] = filterByOption.split('/');\n const filterByKeyword = `${filterByPropKey}.keyword`;\n if (!filteryByValue) return;\n mustFilters.push({ match: { [filterByKeyword]: filteryByValue } });\n });\n });\n }\n\n return mustFilters;\n};\n\nexport default buildFiltersQuery;\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAG,CAAC,YAAY,EAAE,cAAc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/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { getStringTypeProps } from '@blaze-cms/utils/src/helpers';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import getGenericRenderVariables from './get-generic-render-variables';
|
|
6
|
+
import buildRawQueryBase from './build-raw-query-base';
|
|
7
|
+
import buildSetFilters from './build-set-filters';
|
|
8
|
+
import { DEFAULT_LIMIT } from '../constants';
|
|
7
9
|
const filterQuerySetup = ({
|
|
8
10
|
getEntitySchemas,
|
|
9
11
|
entity,
|
|
@@ -15,7 +17,7 @@ const filterQuerySetup = ({
|
|
|
15
17
|
itemsToDisplay,
|
|
16
18
|
entitySameAsCurrentItemEntity,
|
|
17
19
|
entitySchema,
|
|
18
|
-
useRandomSort
|
|
20
|
+
useRandomSort = false
|
|
19
21
|
}) => {
|
|
20
22
|
const stringProps = getStringTypeProps(entity, filterEntityRelations, getEntitySchemas);
|
|
21
23
|
const filterValues = updatedFilterBy && updatedFilterBy.length ? buildSetFilters(_objectSpread(_objectSpread({}, variableProps), {}, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-query-setup.js","names":["getStringTypeProps","getGenericRenderVariables","buildRawQueryBase","buildSetFilters","DEFAULT_LIMIT","filterQuerySetup","getEntitySchemas","entity","updatedFilterBy","variableProps","docType","filterOperator","filterEntityRelations","itemsToDisplay","entitySameAsCurrentItemEntity","entitySchema","useRandomSort","stringProps","filterValues","length","_objectSpread","filterBy","rawQuery","bool","relations","addListFiltersToQuery","limit","settingsLimit","requestLimit","Number","variables","filterProps"],"sources":["../../src/helpers/filter-query-setup.js"],"sourcesContent":["import { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport getGenericRenderVariables from './get-generic-render-variables';\nimport buildRawQueryBase from './build-raw-query-base';\nimport buildSetFilters from './build-set-filters';\nimport { DEFAULT_LIMIT } from '../constants';\n\nconst filterQuerySetup = ({\n getEntitySchemas,\n entity,\n updatedFilterBy,\n variableProps,\n docType,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay,\n entitySameAsCurrentItemEntity,\n entitySchema,\n useRandomSort = false\n}) => {\n const stringProps = getStringTypeProps(entity, filterEntityRelations, getEntitySchemas);\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...variableProps, filterBy: updatedFilterBy })\n : buildSetFilters(variableProps);\n\n const rawQuery = {\n bool: buildRawQueryBase({\n docType,\n filterValues,\n filterOperator,\n relations: filterEntityRelations,\n stringProps,\n itemsToDisplay,\n addListFiltersToQuery: true,\n entity,\n entitySchema\n })\n };\n\n // increase limit to get extra item in case results contain current parent\n const { limit: settingsLimit } = variableProps;\n const limit = settingsLimit || DEFAULT_LIMIT; // all falsey should use default\n const requestLimit = entitySameAsCurrentItemEntity ? Number(limit) + 1 : limit;\n const variables = getGenericRenderVariables({\n relations: filterEntityRelations,\n filterProps: { ...variableProps, limit: requestLimit },\n stringProps,\n rawQuery,\n useRandomSort\n });\n\n return { variables, limit };\n};\n\nexport default filterQuerySetup;\n"],"mappings":";;;AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AACjE,OAAOC,yBAAyB,MAAM,gCAAgC;AACtE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,SAASC,aAA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|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import buildQueryFields from './build-query-fields';
|
|
2
|
+
import getInheritedFilters from './get-inherited-filters';
|
|
3
|
+
import getQueryProps from './get-query-props';
|
|
4
|
+
import { getSearchPublishedContent } from '../application/query';
|
|
3
5
|
const filtersSetup = ({
|
|
4
6
|
entityFields,
|
|
5
7
|
entityTypes,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters-setup.js","names":["buildQueryFields","getInheritedFilters","getQueryProps","getSearchPublishedContent","filtersSetup","entityFields","entityTypes","filterBy","filterByProperty","entities","currentSchema","filterEntitySchema","isPreview","itemEntityUpdated","isFull","fields","action","inheritedFilters","entitySameAsCurrentItemEntity","includes","relations","filterEntityRelations","queryProps","actions","getAction","get","getPublished"],"sources":["../../src/helpers/filters-setup.js"],"sourcesContent":["import buildQueryFields from './build-query-fields';\nimport getInheritedFilters from './get-inherited-filters';\nimport getQueryProps from './get-query-props';\nimport { getSearchPublishedContent } from '../application/query';\n\nconst filtersSetup = ({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities,\n currentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated,\n isFull\n}) => {\n const fields = buildQueryFields(entityFields, entityTypes, isFull);\n const action = getSearchPublishedContent(fields);\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n\n const entitySameAsCurrentItemEntity = entities.includes(itemEntityUpdated);\n const { relations: filterEntityRelations = [] } = filterEntitySchema;\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n return {\n getAction,\n queryProps,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n };\n};\n\nexport default filtersSetup;\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,yBAAyB,QAAQ,sBAAsB;AAEhE,MAAMC,YAAY,GAAGA,CAAC;EACpBC,YAAY;EACZC,WAAW;EACXC,QAAQ;EACRC,gBAAgB;EAChBC,QAAQ;EACRC,aAAa;EACbC,kBAAkB;EAClBC,SAAS;EACTC,iBAAiB;EACjBC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGf,gBAAgB,CAACK,YAAY,EAAEC,WAAW,EAAEQ,MAAM,CAAC;EAClE,MAAME,MAAM,GAAGb,yBAAyB,CAACY,MAAM,CAAC;EAChD,MAAME,gBAAgB,GAAGhB,mBAAmB,CAACM,QAAQ,EAAEC,gBAAgB,CAAC;EAExE,MAAMU,6BAA6B,GAAGT,QAAQ,CAACU,QAAQ,CAACN,iBAAiB,CAAC;EAC1E,MAAM;IAAEO,SAAS,EAAEC,qBAAqB,GAAG;EAAG,CAAC,GAAGV,kBAAkB;EACpE,MAAMW,UAAU,GAAGpB,aAAa,CAACe,gBAAgB,EAAEP,aAAa,EAAEC,kBAAkB,CAAC;EACrF,MAAM;IAAEY,OAAO,GAAG,CAAC;EAAE,CAAC,GAAGb,aAAa,IAAI,CAAC,CAAC;EAC5C,MAAMc,SAAS,GAAGZ,SAAS,GAAGW,OAAO,CAACE,GAAG,GAAGF,OAAO,CAACG,YAAY;EAEhE,OAAO;IACLF,SAAS;IACTF,UAAU;IACVL,gBAAgB;IAChBP,aAAa;IACbC,kBAAkB;IAClBO,6BAA6B;IAC7BF,MAAM;IACNK;EACF,CAAC;AACH,CAAC;AAED,eAAejB,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","parentSchema","parentEntityData","itemsToDisplay","inheritedFilters","idProp","find","filter","indexOf","properties","entityKey","split","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","Array","isArray","forEach","value","push","displayItems"],"sources":["../../src/helpers/get-updated-items-to-display.js"],"sourcesContent":["const getUpdatedItemsToDisplay = ({\n parentSchema,\n parentEntityData,\n itemsToDisplay = [],\n inheritedFilters = []\n}) => {\n const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);\n\n if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;\n const { properties } = parentSchema;\n const [, entityKey] = idProp.split('/');\n if (!properties || !entityKey) return itemsToDisplay;\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === entityKey\n );\n const parentValues = parentEntityData[queryValue];\n if (!parentValues) return itemsToDisplay;\n const updatedItemsToDisplay = [...itemsToDisplay];\n if (Array.isArray(parentValues)) {\n parentValues.forEach(value => {\n updatedItemsToDisplay.push({ displayItems: [value] });\n });\n } else {\n updatedItemsToDisplay.push({ displayItems: [parentValues] });\n }\n return updatedItemsToDisplay;\n};\n\nexport default getUpdatedItemsToDisplay;\n"],"mappings":"AAAA,MAAMA,wBAAwB,GAAGA,CAAC;EAChCC,YAAY;EACZC,gBAAgB;EAChBC,cAAc,GAAG,EAAE;EACnBC,gBAAgB,GAAG;AACrB,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGD,gBAAgB,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;EAE3E,IAAI,CAACH,MAAM,IAAI,CAACJ,YAAY,IAAI,CAACC,gBAAgB,EAAE,OAAOC,cAAc;EACxE,MAAM;IAAEM;EAAW,CAAC,GAAGR,YAAY;EACnC,MAAM,GAAGS,SAAS,CAAC,GAAGL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;EACvC,IAAI,CAACF,UAAU,IAAI,CAACC,SAAS,EAAE,OAAOP,cAAc;EACpD,MAAMS,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACL,UAAU,CAAC,CAACH,IAAI,CAC7CS,OAAO,IACLN,UAAU,CAACM,OAAO,CAAC,IACnBN,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,IAC5BP,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,CAACC,gBAAgB,KAAKP,SACtD,CAAC;EACD,MAAMQ,YAAY,GAAGhB,gBAAgB,CAACU,UAAU,CAAC;EACjD,IAAI,CAACM,YAAY,EAAE,OAAOf,cAAc;EACxC,MAAMgB,qBAAqB,GAAG,CAAC,GAAGhB,cAAc,CAAC;EACjD,IAAIiB,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACI,OAAO,CAACC,KAAK,IAAI;MAC5BJ,qBAAqB,CAACK,IAAI,CAAC;QAAEC,YAAY,EAAE,CAACF,KAAK;MAAE,CAAC,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,MAAM;IACLJ,qBAAqB,CAACK,IAAI,CAAC;MAAEC,YAAY,EAAE,CAACP,YAAY;IAAE,CAAC,CAAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAED,eAAenB,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-updated-sort-properties.js","names":["getUpdatedSortProperties","sort","sortby","sortProperties","updatedSortProperties","length","unshift","propsToDisplay","sortbyFilters","map","filter","Boolean","flat"],"sources":["../../src/helpers/get-updated-sort-properties.js"],"sourcesContent":["const getUpdatedSortProperties = (sort, sortby, sortProperties = []) => {\n const updatedSortProperties = [...sortProperties];\n if (!updatedSortProperties.length && sort) {\n updatedSortProperties.unshift({ sort, propsToDisplay: sortby });\n }\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay }) => propsToDisplay)\n .filter(Boolean)\n .flat();\n return [updatedSortProperties, sortbyFilters];\n};\n\nexport default getUpdatedSortProperties;\n"],"mappings":"AAAA,MAAMA,wBAAwB,GAAGA,CAACC,IAAI,EAAEC,MAAM,EAAEC,cAAc,GAAG,EAAE,KAAK;EACtE,MAAMC,qBAAqB,GAAG,CAAC,GAAGD,cAAc,CAAC;EACjD,IAAI,CAACC,qBAAqB,CAACC,MAAM,IAAIJ,IAAI,EAAE;IACzCG,qBAAqB,CAACE,OAAO,CAAC;MAAEL,IAAI;MAAEM,cAAc,EAAEL;IAAO,CAAC,CAAC;EACjE;EAEA,MAAMM,aAAa,GAAGJ,qBAAqB,CACxCK,GAAG,CAAC,CAAC;IAAEF;EAAe,CAAC,KAAKA,cAAc,CAAC,CAC3CG,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO,CAACR,qBAAqB,EAAEI,aAAa,CAAC;AAC/C,CAAC;AAED,eAAeR,wBAAwB"}
|
package/lib-es/helpers/index.js
CHANGED
|
@@ -53,6 +53,12 @@ export { default as appendImages } from './append-images';
|
|
|
53
53
|
export { default as parseTextBlock } from './parse-TextBlock';
|
|
54
54
|
export { default as processDataSummaryValue } from './process-data-summary-value';
|
|
55
55
|
export { default as buildQueryKey } from './build-query-key';
|
|
56
|
+
export { default as filterQuerySetup } from './filter-query-setup';
|
|
57
|
+
export { default as filtersSetup } from './filters-setup';
|
|
58
|
+
export { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';
|
|
59
|
+
export { default as getUpdatedSortProperties } from './get-updated-sort-properties';
|
|
60
|
+
export { default as shouldReturn } from './should-return';
|
|
61
|
+
export { default as shouldSkipSingleQuery } from './should-skip-single-query';
|
|
56
62
|
export { default as buildRawQueryStringified } from './build-raw-query-stringified';
|
|
57
63
|
export { default as buildFiltersQuery } from './build-filters-query';
|
|
58
64
|
//# sourceMappingURL=index.js.map
|