@blaze-cms/react-page-builder 0.124.1-alpha.2 → 0.124.1-alpha.3

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.
Files changed (195) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/lib/BannerContext/index.js.map +1 -1
  3. package/lib/HOC/withInfiniteScroll.js.map +1 -1
  4. package/lib/HOC/withTitle.js.map +1 -1
  5. package/lib/PBContext/index.js.map +1 -1
  6. package/lib/application/query/index.js.map +1 -1
  7. package/lib/components/BackToTop/BackToTop.js.map +1 -1
  8. package/lib/components/Banner/AdSlotRender.js.map +1 -1
  9. package/lib/components/Banner/Banner.js.map +1 -1
  10. package/lib/components/Banner/BannerRender.js.map +1 -1
  11. package/lib/components/Banner/helpers.js.map +1 -1
  12. package/lib/components/Banner/index.js.map +1 -1
  13. package/lib/components/BlazeLink.js.map +1 -1
  14. package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
  15. package/lib/components/Button.js.map +1 -1
  16. package/lib/components/Card/Card.js.map +1 -1
  17. package/lib/components/Card/CardContainer.js.map +1 -1
  18. package/lib/components/Card/CardFactory.js.map +1 -1
  19. package/lib/components/Card/CardRender.js.map +1 -1
  20. package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
  21. package/lib/components/Card/helpers/filters-setup.js.map +1 -1
  22. package/lib/components/Card/helpers/get-dynamic-grid-classes.js.map +1 -1
  23. package/lib/components/Carousel/Carousel.js.map +1 -1
  24. package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
  25. package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
  26. package/lib/components/CarouselWrapper.js.map +1 -1
  27. package/lib/components/ClickWrapper.js.map +1 -1
  28. package/lib/components/Code/Code.js.map +1 -1
  29. package/lib/components/Code/ScriptTag.js.map +1 -1
  30. package/lib/components/Code/helpers/wrap-script-tags.js.map +1 -1
  31. package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
  32. package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
  33. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.map +1 -1
  34. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
  35. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.map +1 -1
  36. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
  37. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.map +1 -1
  38. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
  39. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.map +1 -1
  40. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
  41. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.map +1 -1
  42. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
  43. package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
  44. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  45. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  46. package/lib/components/DataSummary/helpers/get-data-summary-query.js.map +1 -1
  47. package/lib/components/DataSummary/helpers/get-link-based-on-value.js.map +1 -1
  48. package/lib/components/DataSummary/helpers/get-prop-value.js.map +1 -1
  49. package/lib/components/DataSummary/helpers/get-value-from-array.js.map +1 -1
  50. package/lib/components/DataSummary/helpers/strip-summary-props-content.js.map +1 -1
  51. package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
  52. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  53. package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
  54. package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
  55. package/lib/components/Image/Image.js.map +1 -1
  56. package/lib/components/Image/ImageDetails.js.map +1 -1
  57. package/lib/components/Image/ImageFactory.js.map +1 -1
  58. package/lib/components/Image/ImageRender.js.map +1 -1
  59. package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
  60. package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -1
  61. package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -1
  62. package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -1
  63. package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
  64. package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -1
  65. package/lib/components/Layout/Layout.js.map +1 -1
  66. package/lib/components/Layout/helpers/check-if-row-has-columns.js.map +1 -1
  67. package/lib/components/LazyImage/LazyImage.js.map +1 -1
  68. package/lib/components/LazyImage/index.js.map +1 -1
  69. package/lib/components/List/ListBuilder.js.map +1 -1
  70. package/lib/components/List/ListFactory.js.map +1 -1
  71. package/lib/components/List/ListRender.js.map +1 -1
  72. package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js.map +1 -1
  73. package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
  74. package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
  75. package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
  76. package/lib/components/List/components/Full/FullRender.js.map +1 -1
  77. package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
  78. package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js.map +1 -1
  79. package/lib/components/List/components/Header/ListHeader.js.map +1 -1
  80. package/lib/components/List/components/Pagination/Classic.js.map +1 -1
  81. package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
  82. package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
  83. package/lib/components/List/helpers/build-az-aggregations.js.map +1 -1
  84. package/lib/components/List/helpers/build-az-url.js.map +1 -1
  85. package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
  86. package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
  87. package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -1
  88. package/lib/components/Login/LoggedInMessage.js.map +1 -1
  89. package/lib/components/Login/Login.js.map +1 -1
  90. package/lib/components/Login/LoginForm.js.map +1 -1
  91. package/lib/components/Menu/Menu.js.map +1 -1
  92. package/lib/components/Menu/MenuContext.js.map +1 -1
  93. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  94. package/lib/components/Modal/Modal.js.map +1 -1
  95. package/lib/components/PasswordReset/PasswordReset.js.map +1 -1
  96. package/lib/components/PasswordReset/helpers/validatePassword.js.map +1 -1
  97. package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
  98. package/lib/components/SearchContent/SearchContent.js.map +1 -1
  99. package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
  100. package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
  101. package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
  102. package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
  103. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  104. package/lib/components/SearchFilter/SearchFilterContainer.js +9 -3
  105. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  106. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  107. package/lib/components/SearchFilter/components/Range.js +1 -2
  108. package/lib/components/SearchFilter/components/Range.js.map +1 -1
  109. package/lib/components/SearchFilter/components/Select.js.map +1 -1
  110. package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
  111. package/lib/components/SearchFilter/helpers/build-filters-query.js +24 -6
  112. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  113. package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
  114. package/lib/components/SearchFilter/helpers/calculate-min-max.js.map +1 -1
  115. package/lib/components/SearchFilter/helpers/check-if-range-updated.js.map +1 -1
  116. package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
  117. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
  118. package/lib/components/SearchFilter/helpers/get-intersected-prop.js.map +1 -1
  119. package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
  120. package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js.map +1 -1
  121. package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
  122. package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  123. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  124. package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  125. package/lib/components/SocialFollow/SFItem.js.map +1 -1
  126. package/lib/components/SocialFollow/SocialFollow.js.map +1 -1
  127. package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
  128. package/lib/components/SubMenu/SubMenu.js.map +1 -1
  129. package/lib/components/TextBlock/TextBlockRender.js.map +1 -1
  130. package/lib/components/TextBlock/index.js.map +1 -1
  131. package/lib/components/Video/Video.js.map +1 -1
  132. package/lib/components/Video/VideoModal.js.map +1 -1
  133. package/lib/components/Video/VideoRender.js.map +1 -1
  134. package/lib/components/Video/providers/Default.js.map +1 -1
  135. package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
  136. package/lib/components/Video/providers/YouTube/YouTubeProvider.js.map +1 -1
  137. package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
  138. package/lib/components/Video/providers/get-provider.js.map +1 -1
  139. package/lib/components/Wrapper.js.map +1 -1
  140. package/lib/components/index.js.map +1 -1
  141. package/lib/helpers/build-inherited-filters.js.map +1 -1
  142. package/lib/helpers/build-raw-query-base.js.map +1 -1
  143. package/lib/helpers/build-raw-query.js.map +1 -1
  144. package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
  145. package/lib/helpers/check-props-to-use.js.map +1 -1
  146. package/lib/helpers/get-entities-with-banner.js.map +1 -1
  147. package/lib/helpers/get-entity-data.js.map +1 -1
  148. package/lib/helpers/get-entity-render-props.js.map +1 -1
  149. package/lib/helpers/get-filter-props.js.map +1 -1
  150. package/lib/helpers/get-generic-props.js.map +1 -1
  151. package/lib/helpers/get-generic-render-variables.js.map +1 -1
  152. package/lib/helpers/get-image-ids.js.map +1 -1
  153. package/lib/helpers/get-parsed-prop-values.js.map +1 -1
  154. package/lib/helpers/get-prop-values.js.map +1 -1
  155. package/lib/helpers/get-query-filters.js.map +1 -1
  156. package/lib/helpers/get-query-props.js.map +1 -1
  157. package/lib/helpers/get-updated-filter-by.js.map +1 -1
  158. package/lib/helpers/inject-banner.js.map +1 -1
  159. package/lib/helpers/inject-banners-to-entities.js.map +1 -1
  160. package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
  161. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
  162. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/group-node-entities.js.map +1 -1
  163. package/lib/helpers/inject-multiple-banners/inject-multiple-banners.js.map +1 -1
  164. package/lib/helpers/is-filter-entitys-id.js.map +1 -1
  165. package/lib/helpers/parse-TextBlock.js.map +1 -1
  166. package/lib/helpers/parse-props-to-display.js.map +1 -1
  167. package/lib/helpers/render-children.js.map +1 -1
  168. package/lib/helpers/sort-response-data.js.map +1 -1
  169. package/lib/hooks/helpers/RenderComponent.js.map +1 -1
  170. package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
  171. package/lib/hooks/helpers/getComponent.js.map +1 -1
  172. package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
  173. package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
  174. package/lib/hooks/helpers/insert-banners.js.map +1 -1
  175. package/lib/hooks/helpers/update-targetings.js.map +1 -1
  176. package/lib/hooks/use-banner-insertion.js.map +1 -1
  177. package/lib/hooks/use-check-mobile-screen.js.map +1 -1
  178. package/lib/hooks/use-get-entity-schema.js.map +1 -1
  179. package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
  180. package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
  181. package/lib/hooks/use-get-images.js.map +1 -1
  182. package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
  183. package/lib/hooks/use-page-builder.js.map +1 -1
  184. package/lib/utils/get-class-modifiers.js.map +1 -1
  185. package/lib/utils/get-image-data.js.map +1 -1
  186. package/lib-es/components/SearchFilter/SearchFilterContainer.js +7 -1
  187. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  188. package/lib-es/components/SearchFilter/components/Range.js +1 -2
  189. package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
  190. package/lib-es/components/SearchFilter/helpers/build-filters-query.js +25 -6
  191. package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  192. package/package.json +2 -2
  193. package/src/components/SearchFilter/SearchFilterContainer.js +7 -1
  194. package/src/components/SearchFilter/components/Range.js +10 -13
  195. package/src/components/SearchFilter/helpers/build-filters-query.js +7 -6
@@ -1,14 +1,20 @@
1
1
  const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];
2
2
 
3
- const builFilterObject = (queryKey, value, filters, isRange) => {
3
+ const builFilterObject = ({
4
+ queryKey,
5
+ value,
6
+ filters,
7
+ isRange,
8
+ isInQuery
9
+ }) => {
4
10
  if (isRange) {
5
11
  // don't add to query if value matches range values
6
- if (value.min !== value.minValue && value.max !== value.maxValue) {
12
+ if (isInQuery || value.min !== value.minValue && value.max !== value.maxValue) {
7
13
  filters.push({
8
14
  range: {
9
15
  [queryKey]: {
10
- gte: Number(value.min),
11
- lte: Number(value.max)
16
+ gte: Number(value.minValue),
17
+ lte: Number(value.maxValue)
12
18
  }
13
19
  }
14
20
  });
@@ -39,14 +45,27 @@ const builFilterObject = (queryKey, value, filters, isRange) => {
39
45
  });
40
46
  };
41
47
 
42
- const buildFiltersQuery = (query, filterBy, filterByProperty, rangeValues) => {
48
+ const buildFiltersQuery = ({
49
+ query,
50
+ filterBy,
51
+ filterByProperty,
52
+ rangeValues,
53
+ queryKeys
54
+ }) => {
43
55
  const mustFilters = [];
44
56
  Object.keys(query).forEach(queryKey => {
45
57
  if (QUERY_KEYS_TO_IGNORE.includes(queryKey)) return;
46
58
  if (!queryKey || !query[queryKey]) return;
47
59
  const queryValue = query[queryKey];
48
60
  const isRange = rangeValues.includes(queryKey);
49
- builFilterObject(queryKey, queryValue, mustFilters, isRange);
61
+ const isInQuery = queryKeys.includes(queryKey);
62
+ builFilterObject({
63
+ queryKey,
64
+ value: queryValue,
65
+ filters: mustFilters,
66
+ isRange,
67
+ isInQuery
68
+ });
50
69
  });
51
70
 
52
71
  if (filterByProperty && filterByProperty.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"build-filters-query.js","names":["QUERY_KEYS_TO_IGNORE","builFilterObject","queryKey","value","filters","isRange","min","minValue","max","maxValue","push","range","gte","Number","lte","key","isArray","Array","singleFilterObj","match","forEach","filterValue","buildFiltersQuery","query","filterBy","filterByProperty","rangeValues","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","filterByPropKey","split","filterByOption","indexOf","filteryByValue","filterByKeyword"],"sources":["../../../../src/components/SearchFilter/helpers/build-filters-query.js"],"sourcesContent":["const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];\n\nconst builFilterObject = (queryKey, value, filters, isRange) => {\n if (isRange) {\n // don't add to query if value matches range values\n if (value.min !== value.minValue && value.max !== value.maxValue) {\n filters.push({\n range: {\n [queryKey]: {\n gte: Number(value.min),\n lte: Number(value.max)\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};\nconst buildFiltersQuery = (query, filterBy, filterByProperty, rangeValues) => {\n const mustFilters = [];\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 builFilterObject(queryKey, queryValue, mustFilters, isRange);\n });\n\n if (filterByProperty && filterByProperty.length) {\n filterByProperty &&\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,YAAD,EAAe,cAAf,EAA+B,aAA/B,CAA7B;;AAEA,MAAMC,gBAAgB,GAAG,CAACC,QAAD,EAAWC,KAAX,EAAkBC,OAAlB,EAA2BC,OAA3B,KAAuC;EAC9D,IAAIA,OAAJ,EAAa;IACX;IACA,IAAIF,KAAK,CAACG,GAAN,KAAcH,KAAK,CAACI,QAApB,IAAgCJ,KAAK,CAACK,GAAN,KAAcL,KAAK,CAACM,QAAxD,EAAkE;MAChEL,OAAO,CAACM,IAAR,CAAa;QACXC,KAAK,EAAE;UACL,CAACT,QAAD,GAAY;YACVU,GAAG,EAAEC,MAAM,CAACV,KAAK,CAACG,GAAP,CADD;YAEVQ,GAAG,EAAED,MAAM,CAACV,KAAK,CAACK,GAAP;UAFD;QADP;MADI,CAAb;IAQD;;IACD;EACD;;EAED,MAAMO,GAAG,GAAGV,OAAO,GAAGH,QAAH,GAAe,GAAEA,QAAS,UAA7C;EAEA,MAAMc,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcb,KAAd,CAAhB;;EACA,IAAI,CAACa,OAAL,EAAc;I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D,KAAf,CAAqB,GAArB,CAA3B;QACA,MAAMI,eAAe,GAAI,GAAEL,eAAgB,UAA3C;QACA,IAAI,CAACI,cAAL,EAAqB;QACrBX,WAAW,CAACjB,IAAZ,CAAiB;UAAES,KAAK,EAAE;YAAE,CAACoB,eAAD,GAAmBD;UAArB;QAAT,CAAjB;MACD,CAND;IAOD,CATD,CADF;EAWD;;EAED,OAAOX,WAAP;AACD,CA1BD;;AA4BA,eAAeL,iBAAf"}
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","query","filterBy","filterByProperty","rangeValues","queryKeys","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","filterByPropKey","split","filterByOption","indexOf","filteryByValue","filterByKeyword"],"sources":["../../../../src/components/SearchFilter/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};\nconst buildFiltersQuery = ({ query, filterBy, filterByProperty, rangeValues, queryKeys }) => {\n const mustFilters = [];\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 if (filterByProperty && filterByProperty.length) {\n filterByProperty &&\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,YAAD,EAAe,cAAf,EAA+B,aAA/B,CAA7B;;AAEA,MAAMC,gBAAgB,GAAG,CAAC;EAAEC,QAAF;EAAYC,KAAZ;EAAmBC,OAAnB;EAA4BC,OAA5B;EAAqCC;AAArC,CAAD,KAAsD;EAC7E,IAAID,OAAJ,EAAa;IACX;IACA,IAAIC,SAAS,IAAKH,KAAK,CAACI,GAAN,KAAcJ,KAAK,CAACK,QAApB,IAAgCL,KAAK,CAACM,GAAN,KAAcN,KAAK,CAACO,QAAtE,EAAiF;MAC/EN,OAAO,CAACO,IAAR,CAAa;QACXC,KAAK,EAAE;UACL,CAACV,QAAD,GAAY;YACVW,GAAG,EAAEC,MAAM,CAACX,KAAK,CAACK,QAAP,CADD;YAEVO,GAAG,EAAED,MAAM,CAACX,KAAK,CAACO,QAAP;UAFD;QADP;MADI,CAAb;IAQD;;IACD;EACD;;EAED,MAAMM,GAAG,GAAGX,OAAO,GAAGH,QAAH,GAAe,GAAEA,QAAS,UAA7C;EAEA,MAAMe,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcd,KAAd,CAAhB;;EACA,IAAI,CAACc,OAAL,EAAc;IACZ,MAAME,eAAe,GAAG;MAAEC,KAAK,EAAE;QAAE,CAACJ,GAAD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C,OAAf,CAAuBH,eAAvB,MAA4C,CAAC,CAAjD,EAAoD;QACpD,MAAM,GAAGI,cAAH,IAAqBF,cAAc,CAACD,KAAf,CAAqB,GAArB,CAA3B;QACA,MAAMI,eAAe,GAAI,GAAEL,eAAgB,UAA3C;QACA,IAAI,CAACI,cAAL,EAAqB;QACrBX,WAAW,CAAClB,IAAZ,CAAiB;UAAES,KAAK,EAAE;YAAE,CAACqB,eAAD,GAAmBD;UAArB;QAAT,CAAjB;MACD,CAND;IAOD,CATD,CADF;EAWD;;EAED,OAAOX,WAAP;AACD,CA3BD;;AA6BA,eAAeN,iBAAf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/react-page-builder",
3
- "version": "0.124.1-alpha.2",
3
+ "version": "0.124.1-alpha.3",
4
4
  "description": "Blaze react page builder",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -85,5 +85,5 @@
85
85
  "lib/*",
86
86
  "lib-es/*"
87
87
  ],
88
- "gitHead": "0e1d785e22450229007f0171ed1e204df7963e4f"
88
+ "gitHead": "25aa010b1846146fab034b6ce1323144ec0bf23c"
89
89
  }
@@ -86,7 +86,13 @@ const SearchFilterContainer = ({
86
86
  const { docType } = getEntityData(entity);
87
87
 
88
88
  const filtersQuery = shouldAddFilters
89
- ? buildFiltersQuery(filterValues || query, filterBy, filterByProperty, rangeValues)
89
+ ? buildFiltersQuery({
90
+ query: filterValues,
91
+ filterBy,
92
+ filterByProperty,
93
+ rangeValues,
94
+ queryKeys: Object.keys(query)
95
+ })
90
96
  : [];
91
97
 
92
98
  const rawQueryStringified = buildRawQueryStringified(
@@ -40,7 +40,6 @@ const Range = ({
40
40
  const options = getSelectOptions(getEntitySchema, propsToDisplay);
41
41
  // get range from aggregations so it updates
42
42
  const { min, max } = calculateMinMax(dataAggregations[rangeOption], rangeInterval);
43
- const shouldShowRange = rangeOption && min !== max;
44
43
  const minValue = rangeValue.minValue < min ? min : rangeValue.minValue;
45
44
  const maxValue = rangeValue.maxValue > max ? max : rangeValue.maxValue;
46
45
  const valueToUse = { ...rangeValue, min, max, minValue, maxValue };
@@ -72,18 +71,16 @@ const Range = ({
72
71
  />
73
72
  </>
74
73
  )}
75
- {shouldShowRange && (
76
- <RangeFilter
77
- key={`${rangeOption}-${minValue}-${maxValue}`}
78
- name={rangeOption}
79
- label={hasMultipleOptions ? '' : label}
80
- value={valueToUse}
81
- id={rangeOption}
82
- onChange={({ value }) => {
83
- handleChange(rangeOption, value);
84
- }}
85
- />
86
- )}
74
+ <RangeFilter
75
+ key={`${rangeOption}-${minValue}-${maxValue}`}
76
+ name={rangeOption}
77
+ label={hasMultipleOptions ? '' : label}
78
+ value={valueToUse}
79
+ id={rangeOption}
80
+ onChange={({ value }) => {
81
+ handleChange(rangeOption, value);
82
+ }}
83
+ />
87
84
  </>
88
85
  );
89
86
  };
@@ -1,14 +1,14 @@
1
1
  const QUERY_KEYS_TO_IGNORE = ['dataNotSet', 'shouldSearch', 'search_term'];
2
2
 
3
- const builFilterObject = (queryKey, value, filters, isRange) => {
3
+ const builFilterObject = ({ queryKey, value, filters, isRange, isInQuery }) => {
4
4
  if (isRange) {
5
5
  // don't add to query if value matches range values
6
- if (value.min !== value.minValue && value.max !== value.maxValue) {
6
+ if (isInQuery || (value.min !== value.minValue && value.max !== value.maxValue)) {
7
7
  filters.push({
8
8
  range: {
9
9
  [queryKey]: {
10
- gte: Number(value.min),
11
- lte: Number(value.max)
10
+ gte: Number(value.minValue),
11
+ lte: Number(value.maxValue)
12
12
  }
13
13
  }
14
14
  });
@@ -29,7 +29,7 @@ const builFilterObject = (queryKey, value, filters, isRange) => {
29
29
  filters.push({ match: { [key]: filterValue } });
30
30
  });
31
31
  };
32
- const buildFiltersQuery = (query, filterBy, filterByProperty, rangeValues) => {
32
+ const buildFiltersQuery = ({ query, filterBy, filterByProperty, rangeValues, queryKeys }) => {
33
33
  const mustFilters = [];
34
34
  Object.keys(query).forEach(queryKey => {
35
35
  if (QUERY_KEYS_TO_IGNORE.includes(queryKey)) return;
@@ -37,7 +37,8 @@ const buildFiltersQuery = (query, filterBy, filterByProperty, rangeValues) => {
37
37
  const queryValue = query[queryKey];
38
38
 
39
39
  const isRange = rangeValues.includes(queryKey);
40
- builFilterObject(queryKey, queryValue, mustFilters, isRange);
40
+ const isInQuery = queryKeys.includes(queryKey);
41
+ builFilterObject({ queryKey, value: queryValue, filters: mustFilters, isRange, isInQuery });
41
42
  });
42
43
 
43
44
  if (filterByProperty && filterByProperty.length) {