@blaze-cms/react-page-builder 0.124.0-alpha.9 → 0.124.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +325 -0
- package/README.md +8 -0
- package/lib/BannerContext/index.js.map +1 -1
- package/lib/HOC/withInfiniteScroll.js.map +1 -1
- package/lib/HOC/withTitle.js.map +1 -1
- package/lib/PBContext/index.js.map +1 -1
- package/lib/application/query/index.js +8 -2
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Banner/helpers.js.map +1 -1
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/components/Button.js +18 -5
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContainer.js +3 -7
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/CardFactory.js +6 -3
- package/lib/components/Card/CardFactory.js.map +1 -1
- package/lib/components/Card/CardRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/Card/helpers/filters-setup.js.map +1 -1
- package/lib/components/Card/helpers/get-dynamic-grid-classes.js.map +1 -1
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
- package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib/components/CarouselWrapper.js +2 -2
- package/lib/components/CarouselWrapper.js.map +1 -1
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/Code/ScriptTag.js.map +1 -1
- package/lib/components/Code/helpers/wrap-script-tags.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-data-summary-query.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-based-on-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-prop-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-value-from-array.js.map +1 -1
- package/lib/components/DataSummary/helpers/strip-summary-props-content.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/ImageDetails.js.map +1 -1
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/Image/ImageRender.js +5 -1
- package/lib/components/Image/ImageRender.js.map +1 -1
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/ItemList/ItemListButton/ItemListButton.js +161 -0
- package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib/components/ItemList/ItemListButton/index.js +16 -0
- package/lib/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +83 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/index.js +16 -0
- package/lib/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js +87 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/index.js +16 -0
- package/lib/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib/components/ItemList/constants.js +19 -0
- package/lib/components/ItemList/constants.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js +17 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js +23 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js +28 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib/components/ItemList/helpers/index.js +50 -0
- package/lib/components/ItemList/helpers/index.js.map +1 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js +22 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js +51 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib/components/ItemList/hooks/index.js +18 -0
- package/lib/components/ItemList/hooks/index.js.map +1 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js +45 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/helpers/check-if-row-has-columns.js.map +1 -1
- package/lib/components/LazyImage/LazyImage.js +5 -1
- package/lib/components/LazyImage/LazyImage.js.map +1 -1
- package/lib/components/LazyImage/index.js.map +1 -1
- package/lib/components/List/ListBuilder.js +12 -6
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +34 -7
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/Classic.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib/components/List/helpers/build-az-aggregations.js.map +1 -1
- package/lib/components/List/helpers/build-az-url.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
- package/lib/components/List/helpers/has-required-item-list-details.js +29 -0
- package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib/components/List/helpers/index.js +8 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/Login/LoggedInMessage.js.map +1 -1
- package/lib/components/Login/Login.js.map +1 -1
- package/lib/components/Login/LoginForm.js.map +1 -1
- package/lib/components/Menu/Menu.js +41 -28
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +20 -0
- package/lib/components/Menu/MenuContext.js.map +1 -0
- package/lib/components/MenuItem/MenuItem.js +26 -7
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/PasswordReset/PasswordReset.js.map +1 -1
- package/lib/components/PasswordReset/helpers/validatePassword.js.map +1 -1
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +183 -0
- package/lib/components/SearchContent/SearchContent.js.map +1 -0
- package/lib/components/SearchContent/SearchContentItems.js +51 -0
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib/components/SearchContent/SearchContentResults.js +45 -0
- package/lib/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js +42 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib/components/SearchContent/index.js +2 -301
- package/lib/components/SearchContent/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +18 -67
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +97 -22
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +19 -9
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +23 -6
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +27 -11
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +110 -0
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js +15 -8
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib/components/SearchFilter/helpers/calculate-min-max.js.map +1 -1
- package/lib/components/SearchFilter/helpers/check-if-range-updated.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +16 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-intersected-prop.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-range-value.js +4 -2
- package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
- package/lib/components/SearchFilter/helpers/index.js +8 -0
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/helpers/parse-filter-value.js +3 -7
- package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/components/SocialFollow/SFItem.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollow.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
- package/lib/components/SubMenu/SubMenu.js.map +1 -1
- package/lib/components/TextBlock/TextBlockRender.js.map +1 -1
- package/lib/components/TextBlock/index.js.map +1 -1
- package/lib/components/Video/Video.js.map +1 -1
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/components/Video/VideoRender.js.map +1 -1
- package/lib/components/Video/providers/Default.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YouTubeProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/Wrapper.js.map +1 -1
- package/lib/components/index.js +16 -1
- package/lib/components/index.js.map +1 -1
- package/lib/constants/index.js +3 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-raw-query-base.js.map +1 -1
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
- package/lib/helpers/check-props-to-use.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-entity-data.js.map +1 -1
- package/lib/helpers/get-entity-render-props.js.map +1 -1
- package/lib/helpers/get-filter-props.js.map +1 -1
- package/lib/helpers/get-generic-props.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib/helpers/get-image-ids.js.map +1 -1
- package/lib/helpers/get-parsed-prop-values.js.map +1 -1
- package/lib/helpers/get-prop-values.js.map +1 -1
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-updated-filter-by.js.map +1 -1
- package/lib/helpers/inject-banner.js.map +1 -1
- package/lib/helpers/inject-banners-to-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/group-node-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/inject-multiple-banners.js.map +1 -1
- package/lib/helpers/is-filter-entitys-id.js.map +1 -1
- package/lib/helpers/parse-TextBlock.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/render-children.js.map +1 -1
- package/lib/helpers/sort-response-data.js.map +1 -1
- package/lib/hooks/helpers/RenderComponent.js.map +1 -1
- package/lib/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/getComponent.js.map +1 -1
- package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/hooks/helpers/insert-banners.js.map +1 -1
- package/lib/hooks/helpers/update-targetings.js.map +1 -1
- package/lib/hooks/use-banner-insertion.js.map +1 -1
- package/lib/hooks/use-check-mobile-screen.js.map +1 -1
- package/lib/hooks/use-get-entity-schema.js.map +1 -1
- package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
- package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib/hooks/use-get-images.js.map +1 -1
- package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
- package/lib/hooks/use-page-builder.js.map +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib/utils/get-image-data.js.map +1 -1
- package/lib-es/application/query/index.js +45 -1
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/Button.js +18 -6
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardContainer.js +3 -7
- package/lib-es/components/Card/CardContainer.js.map +1 -1
- package/lib-es/components/Card/CardFactory.js +7 -4
- package/lib-es/components/Card/CardFactory.js.map +1 -1
- package/lib-es/components/CarouselWrapper.js +2 -2
- package/lib-es/components/CarouselWrapper.js.map +1 -1
- package/lib-es/components/Image/ImageRender.js +4 -1
- package/lib-es/components/Image/ImageRender.js.map +1 -1
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js +111 -0
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib-es/components/ItemList/ItemListButton/index.js +3 -0
- package/lib-es/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js +60 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js +3 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js +64 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/index.js +3 -0
- package/lib-es/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib-es/components/ItemList/constants.js +6 -0
- package/lib-es/components/ItemList/constants.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js +7 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js +13 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib-es/components/ItemList/helpers/index.js +6 -0
- package/lib-es/components/ItemList/helpers/index.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js +10 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib-es/components/ItemList/hooks/index.js +2 -0
- package/lib-es/components/ItemList/hooks/index.js.map +1 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js +26 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib-es/components/LazyImage/LazyImage.js +4 -1
- package/lib-es/components/LazyImage/LazyImage.js.map +1 -1
- package/lib-es/components/List/ListBuilder.js +12 -6
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +33 -9
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/has-required-item-list-details.js +20 -0
- package/lib-es/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +54 -46
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +6 -0
- package/lib-es/components/Menu/MenuContext.js.map +1 -0
- package/lib-es/components/MenuItem/MenuItem.js +24 -9
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +129 -0
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentItems.js +33 -0
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentResults.js +31 -0
- package/lib-es/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js +30 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib-es/components/SearchContent/index.js +1 -205
- package/lib-es/components/SearchContent/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +12 -44
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +77 -15
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +18 -9
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Range.js +19 -6
- package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +23 -8
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +73 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js +15 -9
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +14 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/get-range-value.js +2 -2
- package/lib-es/components/SearchFilter/helpers/get-range-value.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/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib-es/components/index.js +10 -1
- package/lib-es/components/index.js.map +1 -1
- package/lib-es/constants/index.js +2 -1
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib-es/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/package.json +5 -4
- package/src/application/query/index.js +51 -1
- package/src/components/Button.js +27 -5
- package/src/components/Card/CardContainer.js +2 -6
- package/src/components/Card/CardFactory.js +5 -3
- package/src/components/CarouselWrapper.js +2 -2
- package/src/components/Image/ImageRender.js +3 -0
- package/src/components/ItemList/ItemListButton/ItemListButton.js +94 -0
- package/src/components/ItemList/ItemListButton/index.js +3 -0
- package/src/components/ItemList/ItemListCounter/ItemListCounter.js +52 -0
- package/src/components/ItemList/ItemListCounter/index.js +3 -0
- package/src/components/ItemList/ItemListNew/ItemListNew.js +51 -0
- package/src/components/ItemList/ItemListNew/index.js +3 -0
- package/src/components/ItemList/constants.js +5 -0
- package/src/components/ItemList/helpers/get-item-list-data.js +6 -0
- package/src/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/src/components/ItemList/helpers/get-item-list-ids.js +10 -0
- package/src/components/ItemList/helpers/index.js +5 -0
- package/src/components/ItemList/helpers/set-item-list-id.js +9 -0
- package/src/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/src/components/ItemList/hooks/index.js +1 -0
- package/src/components/ItemList/hooks/use-item-list-id.js +27 -0
- package/src/components/LazyImage/LazyImage.js +11 -1
- package/src/components/List/ListBuilder.js +10 -5
- package/src/components/List/ListFactory.js +48 -12
- package/src/components/List/helpers/has-required-item-list-details.js +14 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/components/Menu/Menu.js +61 -54
- package/src/components/Menu/MenuContext.js +5 -0
- package/src/components/MenuItem/MenuItem.js +39 -14
- package/src/components/SearchContent/SearchContent.js +136 -0
- package/src/components/SearchContent/SearchContentItems.js +28 -0
- package/src/components/SearchContent/SearchContentResults.js +27 -0
- package/src/components/SearchContent/SearchContentToggleIcon.js +27 -0
- package/src/components/SearchContent/index.js +1 -217
- package/src/components/SearchFilter/SearchFilter/FiltersList.js +30 -37
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +12 -26
- package/src/components/SearchFilter/SearchFilterContainer.js +72 -16
- package/src/components/SearchFilter/components/Checkbox.js +23 -8
- package/src/components/SearchFilter/components/Range.js +11 -5
- package/src/components/SearchFilter/components/Select.js +18 -11
- package/src/components/SearchFilter/components/TextSearch.js +1 -3
- package/src/components/SearchFilter/helpers/build-filters-query.js +60 -0
- package/src/components/SearchFilter/helpers/build-query.js +3 -1
- package/src/components/SearchFilter/helpers/build-raw-query-stringified.js +17 -11
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +15 -1
- package/src/components/SearchFilter/helpers/get-range-value.js +2 -2
- package/src/components/SearchFilter/helpers/index.js +3 -1
- package/src/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/src/components/index.js +10 -1
- package/src/constants/index.js +2 -0
- package/src/helpers/build-raw-query.js +1 -0
- package/src/hooks/helpers/append-gtm-classname.js +3 -0
- package/tests/unit/src/components/Button.test.js +55 -1
- package/tests/unit/src/components/ItemList/ItemListButton.test.js +175 -0
- package/tests/unit/src/components/ItemList/ItemListCounter.test.js +65 -0
- package/tests/unit/src/components/ItemList/ItemListNew.test.js +164 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListButton.test.js.snap +107 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListCounter.test.js.snap +31 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListNew.test.js.snap +27 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-data.test.js +28 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-id.test.js +20 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-ids.test.js +19 -0
- package/tests/unit/src/components/ItemList/helpers/set-item-list-id.test.js +13 -0
- package/tests/unit/src/components/ItemList/helpers/set-param-and-redirect.test.js +30 -0
- package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +32 -0
- package/tests/unit/src/components/List/helpers/has-required-item-list-details.test.js +30 -0
- package/tests/unit/src/components/Menu/Menu.test.js +9 -3
- package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +12 -11
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +1 -1
- package/tests/unit/src/components/MenuItem/SubMenu.test.js +5 -1
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +54 -10
- package/tests/unit/src/components/SearchContent/SearchContent.test.js +29 -0
- package/tests/unit/src/components/SearchContent/__snapshots__/SearchContent.test.js.snap +9 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +3 -6
- package/tests/unit/src/components/SearchFilter/components/Range.test.js +24 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Checkbox.test.js.snap +2 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Range.test.js.snap +3 -3
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +4 -0
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +31 -11
- package/tests/unit/src/components/SearchFilter/helpers/parse-filter-value.test.js +1 -1
- package/tests/unit/src/components/__snapshots__/index.test.js.snap +12 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useRef } from 'react';
|
|
1
|
+
import React, { useState, useRef, useReducer, useEffect } from 'react';
|
|
2
2
|
import { useRouter } from 'next/router';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -6,11 +6,31 @@ import { parseUrl, stringify } from 'query-string';
|
|
|
6
6
|
import SearchFilter from './SearchFilter';
|
|
7
7
|
import { withTitle } from '../../HOC';
|
|
8
8
|
import { getSearchPublishedContent } from '../../application/query';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
buildNewQuery,
|
|
11
|
+
buildRawQueryStringified,
|
|
12
|
+
getInitialFilterValues,
|
|
13
|
+
buildFiltersQuery
|
|
14
|
+
} from './helpers';
|
|
10
15
|
import { getEntityData } from '../../helpers';
|
|
11
16
|
import { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';
|
|
12
17
|
import { SCROLL_OFFSET } from '../../constants';
|
|
13
18
|
|
|
19
|
+
const reducer = (state, action) => {
|
|
20
|
+
const { newValues, type, shouldSearch = true } = action;
|
|
21
|
+
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'update':
|
|
24
|
+
return { ...state, ...newValues, shouldSearch };
|
|
25
|
+
case 'resetSearch':
|
|
26
|
+
return { ...state, shouldSearch: false };
|
|
27
|
+
case 'reset':
|
|
28
|
+
return { ...newValues, shouldSearch: false };
|
|
29
|
+
default:
|
|
30
|
+
throw new Error();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
14
34
|
const SearchFilterContainer = ({
|
|
15
35
|
entity,
|
|
16
36
|
url,
|
|
@@ -18,25 +38,40 @@ const SearchFilterContainer = ({
|
|
|
18
38
|
name,
|
|
19
39
|
isCollapsedOnResponsive,
|
|
20
40
|
groupAfterMobile,
|
|
21
|
-
groupAfterDesktop
|
|
41
|
+
groupAfterDesktop,
|
|
42
|
+
filterBy,
|
|
43
|
+
filterByProperty,
|
|
44
|
+
shouldAddFilters
|
|
22
45
|
}) => {
|
|
23
46
|
const router = useRouter();
|
|
47
|
+
const { asPath } = router;
|
|
24
48
|
const searchFilterRef = useRef(null);
|
|
25
49
|
const [key, setKey] = useState(`filter-${name}`);
|
|
26
50
|
const [displaySearchFilter, setDisplaySearchFilter] = useState(false);
|
|
27
|
-
const
|
|
51
|
+
const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update
|
|
28
52
|
const {
|
|
29
53
|
url: currentUrl,
|
|
30
54
|
query: { sort, sortby },
|
|
31
55
|
query
|
|
32
|
-
} = parseUrl(
|
|
56
|
+
} = parseUrl(urlPath);
|
|
57
|
+
const [filterValues, dispatch] = useReducer(
|
|
58
|
+
reducer,
|
|
59
|
+
getInitialFilterValues(null, filters, query)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
useEffect(
|
|
63
|
+
() => {
|
|
64
|
+
if (asPath) setUrlPath(asPath);
|
|
65
|
+
},
|
|
66
|
+
[asPath]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const hasUrl = !!url;
|
|
70
|
+
|
|
33
71
|
const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';
|
|
34
72
|
const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;
|
|
35
73
|
|
|
36
74
|
const action = getSearchPublishedContent(RAW_RESULTS);
|
|
37
|
-
|
|
38
|
-
let rawQueryStringified = '';
|
|
39
|
-
|
|
40
75
|
const checkboxSelectValues = [];
|
|
41
76
|
const rangeValues = [];
|
|
42
77
|
|
|
@@ -50,33 +85,46 @@ const SearchFilterContainer = ({
|
|
|
50
85
|
|
|
51
86
|
const { docType } = getEntityData(entity);
|
|
52
87
|
|
|
53
|
-
|
|
88
|
+
const filtersQuery = shouldAddFilters
|
|
89
|
+
? buildFiltersQuery(filterValues || query, filterBy, filterByProperty, rangeValues)
|
|
90
|
+
: [];
|
|
91
|
+
|
|
92
|
+
const rawQueryStringified = buildRawQueryStringified(
|
|
93
|
+
checkboxSelectValues,
|
|
94
|
+
rangeValues,
|
|
95
|
+
docType,
|
|
96
|
+
filtersQuery
|
|
97
|
+
);
|
|
54
98
|
|
|
55
|
-
const { data, error
|
|
99
|
+
const { data, error } = useQuery(action, {
|
|
56
100
|
variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results
|
|
57
101
|
skip: !rawQueryStringified
|
|
58
102
|
});
|
|
59
103
|
|
|
60
|
-
if (loading) return null;
|
|
61
104
|
if (error) return error.message;
|
|
62
105
|
if (!filters.length) return null;
|
|
63
106
|
|
|
64
|
-
const { searchPublishedContent: { rawResults: { aggregations: filterData
|
|
107
|
+
const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =
|
|
65
108
|
data || {};
|
|
66
109
|
|
|
67
|
-
|
|
110
|
+
if (filterValues.dataNotSet && filterData) {
|
|
111
|
+
const initialFilterValues = getInitialFilterValues(filterData, filters, query);
|
|
112
|
+
dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });
|
|
113
|
+
}
|
|
68
114
|
|
|
69
115
|
const handleSearch = newQuery => {
|
|
70
116
|
setDisplaySearchFilter(false);
|
|
71
117
|
|
|
72
118
|
if (!newQuery) {
|
|
73
119
|
scrollToFirstList();
|
|
120
|
+
setUrlPath(baseQuery);
|
|
74
121
|
return router.push('/Resolver', baseQuery, { shallow: !hasUrl, scroll: false }).then(() => {
|
|
75
122
|
setKey(`filter-${name}:${Date.now()}`); // remove after range component update
|
|
76
123
|
});
|
|
77
124
|
}
|
|
78
125
|
const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues);
|
|
79
126
|
scrollToFirstList();
|
|
127
|
+
setUrlPath(newUrl);
|
|
80
128
|
return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });
|
|
81
129
|
};
|
|
82
130
|
|
|
@@ -93,17 +141,19 @@ const SearchFilterContainer = ({
|
|
|
93
141
|
window.scrollTo(0, 0);
|
|
94
142
|
}
|
|
95
143
|
};
|
|
144
|
+
if (!filterValues) return '';
|
|
96
145
|
|
|
97
146
|
return (
|
|
98
147
|
<SearchFilter
|
|
99
148
|
key={key}
|
|
149
|
+
setAppliedFilters={dispatch}
|
|
100
150
|
searchFilterRef={searchFilterRef}
|
|
101
151
|
data={filterData}
|
|
102
152
|
filters={filters}
|
|
103
153
|
hasUrl={hasUrl}
|
|
104
154
|
entity={entity}
|
|
105
155
|
handleSearch={handleSearch}
|
|
106
|
-
|
|
156
|
+
filterValues={filterValues}
|
|
107
157
|
name={name}
|
|
108
158
|
isCollapsedOnResponsive={isCollapsedOnResponsive}
|
|
109
159
|
displaySearchFilter={displaySearchFilter}
|
|
@@ -121,7 +171,10 @@ SearchFilterContainer.propTypes = {
|
|
|
121
171
|
name: PropTypes.string.isRequired,
|
|
122
172
|
isCollapsedOnResponsive: PropTypes.bool,
|
|
123
173
|
groupAfterMobile: PropTypes.number,
|
|
124
|
-
groupAfterDesktop: PropTypes.number
|
|
174
|
+
groupAfterDesktop: PropTypes.number,
|
|
175
|
+
filterBy: PropTypes.array,
|
|
176
|
+
filterByProperty: PropTypes.array,
|
|
177
|
+
shouldAddFilters: PropTypes.bool
|
|
125
178
|
};
|
|
126
179
|
|
|
127
180
|
SearchFilterContainer.defaultProps = {
|
|
@@ -130,7 +183,10 @@ SearchFilterContainer.defaultProps = {
|
|
|
130
183
|
entity: '',
|
|
131
184
|
isCollapsedOnResponsive: true,
|
|
132
185
|
groupAfterMobile: 0,
|
|
133
|
-
groupAfterDesktop: 0
|
|
186
|
+
groupAfterDesktop: 0,
|
|
187
|
+
filterBy: [],
|
|
188
|
+
filterByProperty: [],
|
|
189
|
+
shouldAddFilters: false
|
|
134
190
|
};
|
|
135
191
|
|
|
136
192
|
export default withTitle(SearchFilterContainer);
|
|
@@ -7,8 +7,17 @@ import { withTitle } from '../../../HOC';
|
|
|
7
7
|
import { decodeValue } from '../helpers';
|
|
8
8
|
import { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';
|
|
9
9
|
|
|
10
|
-
const Checkbox = ({
|
|
10
|
+
const Checkbox = ({
|
|
11
|
+
data,
|
|
12
|
+
prop,
|
|
13
|
+
updateFilterValues,
|
|
14
|
+
filterValues,
|
|
15
|
+
label,
|
|
16
|
+
shouldSearch,
|
|
17
|
+
displayFilterCount
|
|
18
|
+
}) => {
|
|
11
19
|
const [checkboxLimit, setCheckboxLimit] = useState(null);
|
|
20
|
+
if (!data[prop]) return null;
|
|
12
21
|
|
|
13
22
|
const handleCheckboxOptions = () => {
|
|
14
23
|
if (checkboxLimit[prop] === LIMIT_MIN) {
|
|
@@ -35,7 +44,10 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldS
|
|
|
35
44
|
const multiple = [];
|
|
36
45
|
|
|
37
46
|
const sortedValues = data[prop].buckets
|
|
38
|
-
.map(({ key }) =>
|
|
47
|
+
.map(({ key, doc_count: count }) => {
|
|
48
|
+
const optionLabel = displayFilterCount ? `${key} (${count})` : key;
|
|
49
|
+
return [key, optionLabel, !count];
|
|
50
|
+
})
|
|
39
51
|
.filter(Boolean)
|
|
40
52
|
.sort();
|
|
41
53
|
|
|
@@ -43,11 +55,12 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldS
|
|
|
43
55
|
(value, i) =>
|
|
44
56
|
i < checkboxLimit[prop] &&
|
|
45
57
|
multiple.push({
|
|
46
|
-
label: upperFirst(value),
|
|
47
|
-
value,
|
|
58
|
+
label: upperFirst(value[1]),
|
|
59
|
+
value: value[0],
|
|
48
60
|
name: prop,
|
|
49
|
-
checked: checkboxQueryParams.includes(value),
|
|
50
|
-
id: value
|
|
61
|
+
checked: checkboxQueryParams.includes(value[0]),
|
|
62
|
+
id: value[0],
|
|
63
|
+
disabled: value[2]
|
|
51
64
|
})
|
|
52
65
|
);
|
|
53
66
|
|
|
@@ -95,12 +108,14 @@ Checkbox.propTypes = {
|
|
|
95
108
|
filterValues: PropTypes.object.isRequired,
|
|
96
109
|
updateFilterValues: PropTypes.func.isRequired,
|
|
97
110
|
shouldSearch: PropTypes.bool,
|
|
98
|
-
label: PropTypes.string
|
|
111
|
+
label: PropTypes.string,
|
|
112
|
+
displayFilterCount: PropTypes.bool
|
|
99
113
|
};
|
|
100
114
|
|
|
101
115
|
Checkbox.defaultProps = {
|
|
102
116
|
shouldSearch: false,
|
|
103
|
-
label: ''
|
|
117
|
+
label: '',
|
|
118
|
+
displayFilterCount: false
|
|
104
119
|
};
|
|
105
120
|
|
|
106
121
|
export default withTitle(Checkbox);
|
|
@@ -7,7 +7,7 @@ import Select from '@blaze-react/select';
|
|
|
7
7
|
import { parseUrl } from 'query-string';
|
|
8
8
|
import { useGetSingleEntitySchema } from '../../../hooks';
|
|
9
9
|
import { withTitle } from '../../../HOC';
|
|
10
|
-
import { getSelectOptions, getIntersectedProp, getRangeValue } from '../helpers';
|
|
10
|
+
import { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';
|
|
11
11
|
import { decodeValue } from '../helpers/decode-encode';
|
|
12
12
|
|
|
13
13
|
const Range = ({
|
|
@@ -15,6 +15,7 @@ const Range = ({
|
|
|
15
15
|
label,
|
|
16
16
|
entity,
|
|
17
17
|
propsToDisplay,
|
|
18
|
+
dataAggregations,
|
|
18
19
|
updateFilterValues,
|
|
19
20
|
filterValues,
|
|
20
21
|
shouldSearch
|
|
@@ -37,8 +38,12 @@ const Range = ({
|
|
|
37
38
|
if (loading || !rangeOption || !rangeValue) return '';
|
|
38
39
|
|
|
39
40
|
const options = getSelectOptions(getEntitySchema, propsToDisplay);
|
|
40
|
-
|
|
41
|
+
// get range from aggregations so it updates
|
|
42
|
+
const { min, max } = calculateMinMax(dataAggregations[rangeOption], rangeInterval);
|
|
41
43
|
const shouldShowRange = rangeOption && min !== max;
|
|
44
|
+
const minValue = rangeValue.minValue < min ? min : rangeValue.minValue;
|
|
45
|
+
const maxValue = rangeValue.maxValue > max ? max : rangeValue.maxValue;
|
|
46
|
+
const valueToUse = { ...rangeValue, min, max, minValue, maxValue };
|
|
42
47
|
|
|
43
48
|
const handleChange = debounce((option, value) => {
|
|
44
49
|
updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } }, shouldSearch);
|
|
@@ -69,10 +74,10 @@ const Range = ({
|
|
|
69
74
|
)}
|
|
70
75
|
{shouldShowRange && (
|
|
71
76
|
<RangeFilter
|
|
72
|
-
key={rangeOption}
|
|
77
|
+
key={`${rangeOption}-${minValue}-${maxValue}`}
|
|
73
78
|
name={rangeOption}
|
|
74
79
|
label={hasMultipleOptions ? '' : label}
|
|
75
|
-
value={
|
|
80
|
+
value={valueToUse}
|
|
76
81
|
id={rangeOption}
|
|
77
82
|
onChange={({ value }) => {
|
|
78
83
|
handleChange(rangeOption, value);
|
|
@@ -90,7 +95,8 @@ Range.propTypes = {
|
|
|
90
95
|
updateFilterValues: PropTypes.func.isRequired,
|
|
91
96
|
shouldSearch: PropTypes.bool,
|
|
92
97
|
rangeInterval: PropTypes.number,
|
|
93
|
-
label: PropTypes.string
|
|
98
|
+
label: PropTypes.string,
|
|
99
|
+
dataAggregations: PropTypes.object.isRequired
|
|
94
100
|
};
|
|
95
101
|
|
|
96
102
|
Range.defaultProps = {
|
|
@@ -11,17 +11,21 @@ const SelectFilter = ({
|
|
|
11
11
|
updateFilterValues,
|
|
12
12
|
filterValues,
|
|
13
13
|
shouldSearch,
|
|
14
|
-
displayLabelAsPlaceholder
|
|
14
|
+
displayLabelAsPlaceholder,
|
|
15
|
+
displayFilterCount
|
|
15
16
|
}) => {
|
|
16
17
|
const filterValue = filterValues[prop] || '';
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const disabledOptions = [];
|
|
19
|
+
const { buckets = [] } = data[prop] || {};
|
|
20
|
+
const options = buckets
|
|
21
|
+
.map(({ key, doc_count: count }) => {
|
|
22
|
+
if (!count) disabledOptions.push(key);
|
|
23
|
+
const optionLabel = displayFilterCount ? `${key} (${count})` : key;
|
|
24
|
+
return [key, optionLabel];
|
|
25
|
+
})
|
|
20
26
|
.filter(Boolean)
|
|
21
27
|
.sort();
|
|
22
28
|
|
|
23
|
-
const optionsJoined = options;
|
|
24
|
-
|
|
25
29
|
const labelText = label || prop;
|
|
26
30
|
let labelToUse = labelText;
|
|
27
31
|
let defaultTextValue = DEFAULT_OPTION;
|
|
@@ -36,14 +40,14 @@ const SelectFilter = ({
|
|
|
36
40
|
value={filterValue}
|
|
37
41
|
id={prop}
|
|
38
42
|
data-testid={`filter-${prop}`}
|
|
39
|
-
options={
|
|
43
|
+
options={options}
|
|
40
44
|
defaultTextValue={defaultTextValue}
|
|
41
45
|
onChange={({ value }) => {
|
|
42
46
|
let valueToUse = value;
|
|
43
47
|
if (value === defaultTextValue) valueToUse = '';
|
|
44
|
-
|
|
45
48
|
updateFilterValues({ [prop]: valueToUse }, shouldSearch);
|
|
46
49
|
}}
|
|
50
|
+
disabled={disabledOptions}
|
|
47
51
|
/>
|
|
48
52
|
);
|
|
49
53
|
};
|
|
@@ -51,17 +55,20 @@ const SelectFilter = ({
|
|
|
51
55
|
SelectFilter.propTypes = {
|
|
52
56
|
data: PropTypes.object.isRequired,
|
|
53
57
|
prop: PropTypes.string.isRequired,
|
|
54
|
-
filterValues: PropTypes.object
|
|
58
|
+
filterValues: PropTypes.object,
|
|
55
59
|
updateFilterValues: PropTypes.func.isRequired,
|
|
56
60
|
shouldSearch: PropTypes.bool,
|
|
57
61
|
label: PropTypes.string,
|
|
58
|
-
displayLabelAsPlaceholder: PropTypes.bool
|
|
62
|
+
displayLabelAsPlaceholder: PropTypes.bool,
|
|
63
|
+
displayFilterCount: PropTypes.bool
|
|
59
64
|
};
|
|
60
65
|
|
|
61
66
|
SelectFilter.defaultProps = {
|
|
67
|
+
filterValues: {},
|
|
62
68
|
shouldSearch: false,
|
|
63
69
|
label: '',
|
|
64
|
-
displayLabelAsPlaceholder: false
|
|
70
|
+
displayLabelAsPlaceholder: false,
|
|
71
|
+
displayFilterCount: false
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
export default withTitle(SelectFilter);
|
|
@@ -5,7 +5,7 @@ import { MdSearch } from 'react-icons/md';
|
|
|
5
5
|
import { withTitle } from '../../../HOC';
|
|
6
6
|
import { SEARCH_TERM } from '../constants';
|
|
7
7
|
|
|
8
|
-
const TextSearch = ({ label, searchValue, updateFilterValues
|
|
8
|
+
const TextSearch = ({ label, searchValue, updateFilterValues }) => (
|
|
9
9
|
<div className="search">
|
|
10
10
|
<div className="search__wrapper">
|
|
11
11
|
<div className="form-field form-field--input form-field--search">
|
|
@@ -34,10 +34,8 @@ const TextSearch = ({ label, searchValue, updateFilterValues, handleSubmit, filt
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
TextSearch.propTypes = {
|
|
37
|
-
filterValues: PropTypes.object.isRequired,
|
|
38
37
|
searchValue: PropTypes.string.isRequired,
|
|
39
38
|
updateFilterValues: PropTypes.func.isRequired,
|
|
40
|
-
handleSubmit: PropTypes.func.isRequired,
|
|
41
39
|
label: PropTypes.string
|
|
42
40
|
};
|
|
43
41
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];
|
|
2
|
+
|
|
3
|
+
const builFilterObject = (queryKey, value, filters, isRange) => {
|
|
4
|
+
if (isRange) {
|
|
5
|
+
// don't add to query if value matches range values
|
|
6
|
+
if (value.min !== value.minValue && value.max !== value.maxValue) {
|
|
7
|
+
filters.push({
|
|
8
|
+
range: {
|
|
9
|
+
[queryKey]: {
|
|
10
|
+
gte: Number(value.min),
|
|
11
|
+
lte: Number(value.max)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const key = isRange ? queryKey : `${queryKey}.keyword`;
|
|
20
|
+
|
|
21
|
+
const isArray = Array.isArray(value);
|
|
22
|
+
if (!isArray) {
|
|
23
|
+
const singleFilterObj = { match: { [key]: value } };
|
|
24
|
+
filters.push(singleFilterObj);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
value.forEach(filterValue => {
|
|
29
|
+
filters.push({ match: { [key]: filterValue } });
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const buildFiltersQuery = (query, filterBy, filterByProperty, rangeValues) => {
|
|
33
|
+
const mustFilters = [];
|
|
34
|
+
Object.keys(query).forEach(queryKey => {
|
|
35
|
+
if (QUERY_KEYS_TO_IGNORE.includes(queryKey)) return;
|
|
36
|
+
if (!queryKey || !query[queryKey]) return;
|
|
37
|
+
const queryValue = query[queryKey];
|
|
38
|
+
|
|
39
|
+
const isRange = rangeValues.includes(queryKey);
|
|
40
|
+
builFilterObject(queryKey, queryValue, mustFilters, isRange);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (filterByProperty && filterByProperty.length) {
|
|
44
|
+
filterByProperty &&
|
|
45
|
+
filterByProperty.forEach(filterByPropOption => {
|
|
46
|
+
const [filterByPropKey] = filterByPropOption.split('/');
|
|
47
|
+
filterBy.forEach(filterByOption => {
|
|
48
|
+
if (filterByOption.indexOf(filterByPropKey) === -1) return;
|
|
49
|
+
const [, filteryByValue] = filterByOption.split('/');
|
|
50
|
+
const filterByKeyword = `${filterByPropKey}.keyword`;
|
|
51
|
+
if (!filteryByValue) return;
|
|
52
|
+
mustFilters.push({ match: { [filterByKeyword]: filteryByValue } });
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return mustFilters;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default buildFiltersQuery;
|
|
@@ -3,7 +3,9 @@ import parseFilterValue from './parse-filter-value';
|
|
|
3
3
|
|
|
4
4
|
const buildQuery = (filterValues, filters) => {
|
|
5
5
|
const newQuery = [];
|
|
6
|
-
const searchValue = filterValues[SEARCH_TERM]
|
|
6
|
+
const searchValue = filterValues[SEARCH_TERM]
|
|
7
|
+
? encodeURIComponent(filterValues[SEARCH_TERM])
|
|
8
|
+
: '';
|
|
7
9
|
if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);
|
|
8
10
|
|
|
9
11
|
filters.forEach(({ propsToDisplay, type }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KEYWORD, SIZE } from '../constants';
|
|
2
2
|
|
|
3
|
-
const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity) => {
|
|
3
|
+
const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity, mustFilters = []) => {
|
|
4
4
|
if (!checkboxSelectValues.length && !rangeValues.length) return '';
|
|
5
5
|
|
|
6
6
|
const aggs = {};
|
|
@@ -22,22 +22,28 @@ const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity) =>
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
const boolFilter = {
|
|
26
|
+
should: [
|
|
27
|
+
{
|
|
28
|
+
match: {
|
|
29
|
+
docType: entity
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
minimum_should_match: 1
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (mustFilters.length) {
|
|
37
|
+
boolFilter.must = mustFilters;
|
|
38
|
+
}
|
|
39
|
+
|
|
25
40
|
return JSON.stringify({
|
|
26
41
|
aggs,
|
|
27
42
|
size: 0,
|
|
28
43
|
query: {
|
|
29
44
|
bool: {
|
|
30
45
|
filter: {
|
|
31
|
-
bool:
|
|
32
|
-
should: [
|
|
33
|
-
{
|
|
34
|
-
match: {
|
|
35
|
-
docType: entity
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
minimum_should_match: 1
|
|
40
|
-
}
|
|
46
|
+
bool: boolFilter
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
}
|
|
@@ -3,12 +3,26 @@ import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
|
3
3
|
|
|
4
4
|
const getInitialFilterValues = (filterData, filters, query) => {
|
|
5
5
|
const filterValues = {};
|
|
6
|
+
filterValues[SEARCH_TERM] = query[SEARCH_TERM] || '';
|
|
7
|
+
|
|
8
|
+
if (!filterData) {
|
|
9
|
+
filters.forEach(filterProps => {
|
|
10
|
+
const {
|
|
11
|
+
propsToDisplay: [key]
|
|
12
|
+
} = filterProps;
|
|
13
|
+
filterValues[key] = query[key] ? getFilterValueFromQuery(key, filterProps, {}, query) : null;
|
|
14
|
+
});
|
|
15
|
+
filterValues.dataNotSet = true;
|
|
16
|
+
return filterValues;
|
|
17
|
+
}
|
|
18
|
+
|
|
6
19
|
Object.keys(filterData).forEach(key => {
|
|
7
20
|
const filterProps =
|
|
8
21
|
filters.find(({ propsToDisplay }) => propsToDisplay.find(prop => key === prop)) || {};
|
|
9
22
|
filterValues[key] = getFilterValueFromQuery(key, filterProps, filterData[key], query);
|
|
10
23
|
});
|
|
11
|
-
|
|
24
|
+
|
|
25
|
+
filterValues.dataNotSet = false;
|
|
12
26
|
|
|
13
27
|
return filterValues;
|
|
14
28
|
};
|
|
@@ -11,8 +11,8 @@ const getRangeValue = (rawQueryProp, rangeInterval, _min, _max) => {
|
|
|
11
11
|
const updatedMaxValue = Number(queryParamMax);
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
|
-
min,
|
|
15
|
-
max,
|
|
14
|
+
min: Number.isNaN(min) ? updatedMinValue : min,
|
|
15
|
+
max: Number.isNaN(max) ? updatedMaxValue : max,
|
|
16
16
|
step: rangeInterval,
|
|
17
17
|
maxValue: updatedMaxValue,
|
|
18
18
|
minValue: updatedMinValue
|
|
@@ -13,6 +13,7 @@ import isDeviceDesktop from './is-device-desktop';
|
|
|
13
13
|
import getInitialFilterValues from './get-initial-filter-values';
|
|
14
14
|
import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
15
15
|
import buildQuery from './build-query';
|
|
16
|
+
import buildFiltersQuery from './build-filters-query';
|
|
16
17
|
|
|
17
18
|
export {
|
|
18
19
|
buildQuery,
|
|
@@ -30,5 +31,6 @@ export {
|
|
|
30
31
|
getSelectOptions,
|
|
31
32
|
isDeviceDesktop,
|
|
32
33
|
getInitialFilterValues,
|
|
33
|
-
getFilterValueFromQuery
|
|
34
|
+
getFilterValueFromQuery,
|
|
35
|
+
buildFiltersQuery
|
|
34
36
|
};
|
|
@@ -8,10 +8,10 @@ const parseFilterValue = (key, type, value) => {
|
|
|
8
8
|
if (value.minValue === value.min && value.maxValue === value.max) return null;
|
|
9
9
|
return `${key}=${value.minValue}-${value.maxValue}`;
|
|
10
10
|
case CHECKBOX:
|
|
11
|
-
if (typeof value === 'string') return `${key}=${value}`;
|
|
12
|
-
return value.map(val => `${key}=${val}`).join('&');
|
|
11
|
+
if (typeof value === 'string') return `${key}=${encodeURIComponent(value)}`;
|
|
12
|
+
return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&');
|
|
13
13
|
case SELECT: {
|
|
14
|
-
const parsedValue = value
|
|
14
|
+
const parsedValue = encodeURIComponent(value);
|
|
15
15
|
return `${key}=${parsedValue}`;
|
|
16
16
|
}
|
|
17
17
|
|
package/src/components/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
video: dynamic(() => import(/* webpackChunkName: "blazePbVideo" */ './Video')),
|
|
19
19
|
wrapper: dynamic(() => import(/* webpackChunkName: "blazePbWrapper" */ './Wrapper')),
|
|
20
20
|
searchcontent: dynamic(() =>
|
|
21
|
-
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchContent')
|
|
21
|
+
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchContent/SearchContent')
|
|
22
22
|
),
|
|
23
23
|
searchfilter: dynamic(() =>
|
|
24
24
|
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchFilter')
|
|
@@ -42,5 +42,14 @@ export default {
|
|
|
42
42
|
import(/* webpackChunkName: "blazePbPasswordResetRequest" */ './PasswordResetRequest')
|
|
43
43
|
),
|
|
44
44
|
breadcrumb: dynamic(() => import(/* webpackChunkName: "blazePbBreadcrumb" */ './Breadcrumb')),
|
|
45
|
+
itemlistbutton: dynamic(() =>
|
|
46
|
+
import(/* webpackChunkName: "blazePbItemListButton" */ './ItemList/ItemListButton')
|
|
47
|
+
),
|
|
48
|
+
itemlistcounter: dynamic(() =>
|
|
49
|
+
import(/* webpackChunkName: "blazePbItemListCounter" */ './ItemList/ItemListCounter')
|
|
50
|
+
),
|
|
51
|
+
itemlistnew: dynamic(() =>
|
|
52
|
+
import(/* webpackChunkName: "blazePbItemListNew" */ './ItemList/ItemListNew')
|
|
53
|
+
),
|
|
45
54
|
backtotop: dynamic(() => import(/* webpackChunkName: "blazePbBackToTop" */ './BackToTop'))
|
|
46
55
|
};
|
package/src/constants/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const RANGE = 'range';
|
|
|
17
17
|
const CHECKBOX = 'checkbox';
|
|
18
18
|
const ELEMENT = 'element';
|
|
19
19
|
const MENU_ITEM = 'menuitem';
|
|
20
|
+
const SUB_MENU = 'submenu';
|
|
20
21
|
const SELECT = 'select';
|
|
21
22
|
const ON_CLICK = 'onClick';
|
|
22
23
|
const KEYWORD = 'keyword';
|
|
@@ -303,6 +304,7 @@ export {
|
|
|
303
304
|
MOBILE_WIDTH,
|
|
304
305
|
HIDDEN,
|
|
305
306
|
MENU_ITEM,
|
|
307
|
+
SUB_MENU,
|
|
306
308
|
LOGIN_FORM,
|
|
307
309
|
PASSWORD_REGEX,
|
|
308
310
|
PASSWORD_VALIDATION_MESSAGE,
|