@blaze-cms/react-page-builder 0.131.0-project-admin-customisations.2 → 0.131.1

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 (256) hide show
  1. package/CHANGELOG.md +5 -21
  2. package/lib/HOC/recreateOnNavigation.js +29 -0
  3. package/lib/HOC/recreateOnNavigation.js.map +1 -0
  4. package/lib/components/Button.js +1 -2
  5. package/lib/components/Button.js.map +1 -1
  6. package/lib/components/Card/CardsContainer.js +5 -5
  7. package/lib/components/Card/CardsContainer.js.map +1 -1
  8. package/lib/components/Card/CardsRender.js +6 -13
  9. package/lib/components/Card/CardsRender.js.map +1 -1
  10. package/lib/components/Card/helpers/index.js +0 -7
  11. package/lib/components/Card/helpers/index.js.map +1 -1
  12. package/lib/components/Code/Code.js +3 -7
  13. package/lib/components/Code/Code.js.map +1 -1
  14. package/lib/components/ContentGroupSection/ContentGroupSection.js +4 -1
  15. package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  16. package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -3
  17. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  18. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +2 -3
  19. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  20. package/lib/components/Layout/Layout.js +3 -2
  21. package/lib/components/Layout/Layout.js.map +1 -1
  22. package/lib/components/Layout/LayoutFactory.js +35 -0
  23. package/lib/components/Layout/LayoutFactory.js.map +1 -0
  24. package/lib/components/Layout/LayoutWithStickyTimer.js +66 -0
  25. package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -0
  26. package/lib/components/Layout/index.js +2 -2
  27. package/lib/components/Layout/index.js.map +1 -1
  28. package/lib/components/List/ListFactory.js +11 -16
  29. package/lib/components/List/ListFactory.js.map +1 -1
  30. package/lib/components/List/helpers/index.js +0 -14
  31. package/lib/components/List/helpers/index.js.map +1 -1
  32. package/lib/components/SearchContent/SearchContent.js +6 -8
  33. package/lib/components/SearchContent/SearchContent.js.map +1 -1
  34. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +11 -17
  35. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  36. package/lib/components/SearchFilter/SearchFilterContainer.js +85 -63
  37. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  38. package/lib/components/SearchFilter/helpers/build-filters-query.js +1 -3
  39. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  40. package/lib/components/SearchFilter/helpers/build-new-query.js +15 -0
  41. package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -0
  42. package/lib/components/SearchFilter/helpers/build-query.js +37 -0
  43. package/lib/components/SearchFilter/helpers/build-query.js.map +1 -0
  44. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +43 -0
  45. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
  46. package/lib/components/SearchFilter/helpers/index.js +11 -18
  47. package/lib/components/SearchFilter/helpers/index.js.map +1 -1
  48. package/lib/components/SearchFilter/index.js.map +1 -1
  49. package/lib/components/SearchFilterSort/SearchFilterSort.js +11 -31
  50. package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  51. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -19
  52. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  53. package/lib/components/SearchFilterSort/helpers/update-sort.js +5 -9
  54. package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  55. package/lib/helpers/build-inherited-filters.js +0 -2
  56. package/lib/helpers/build-inherited-filters.js.map +1 -1
  57. package/lib/helpers/build-props-query.js +2 -5
  58. package/lib/helpers/build-props-query.js.map +1 -1
  59. package/lib/helpers/build-set-filters.js +1 -5
  60. package/lib/helpers/build-set-filters.js.map +1 -1
  61. package/lib/helpers/get-query-filters.js +8 -6
  62. package/lib/helpers/get-query-filters.js.map +1 -1
  63. package/lib/helpers/get-query-props.js +2 -13
  64. package/lib/helpers/get-query-props.js.map +1 -1
  65. package/lib/helpers/get-wrapped-value-with-link.js +3 -2
  66. package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
  67. package/lib/helpers/index.js +0 -14
  68. package/lib/helpers/index.js.map +1 -1
  69. package/lib/helpers/parse-props-to-display.js +8 -13
  70. package/lib/helpers/parse-props-to-display.js.map +1 -1
  71. package/lib/utils/get-class-modifiers.js +1 -1
  72. package/lib/utils/get-class-modifiers.js.map +1 -1
  73. package/lib-es/HOC/recreateOnNavigation.js +20 -0
  74. package/lib-es/HOC/recreateOnNavigation.js.map +1 -0
  75. package/lib-es/components/Button.js +1 -2
  76. package/lib-es/components/Button.js.map +1 -1
  77. package/lib-es/components/Card/CardsContainer.js +5 -5
  78. package/lib-es/components/Card/CardsContainer.js.map +1 -1
  79. package/lib-es/components/Card/CardsRender.js +7 -14
  80. package/lib-es/components/Card/CardsRender.js.map +1 -1
  81. package/lib-es/components/Card/helpers/index.js +0 -1
  82. package/lib-es/components/Card/helpers/index.js.map +1 -1
  83. package/lib-es/components/Code/Code.js +4 -8
  84. package/lib-es/components/Code/Code.js.map +1 -1
  85. package/lib-es/components/ContentGroupSection/ContentGroupSection.js +8 -4
  86. package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  87. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -3
  88. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  89. package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -4
  90. package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  91. package/lib-es/components/Layout/Layout.js +3 -2
  92. package/lib-es/components/Layout/Layout.js.map +1 -1
  93. package/lib-es/components/Layout/LayoutFactory.js +14 -0
  94. package/lib-es/components/Layout/LayoutFactory.js.map +1 -0
  95. package/lib-es/components/Layout/LayoutWithStickyTimer.js +42 -0
  96. package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -0
  97. package/lib-es/components/Layout/index.js +2 -2
  98. package/lib-es/components/Layout/index.js.map +1 -1
  99. package/lib-es/components/List/ListFactory.js +12 -16
  100. package/lib-es/components/List/ListFactory.js.map +1 -1
  101. package/lib-es/components/List/helpers/index.js +0 -2
  102. package/lib-es/components/List/helpers/index.js.map +1 -1
  103. package/lib-es/components/SearchContent/SearchContent.js +6 -8
  104. package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
  105. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +11 -18
  106. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  107. package/lib-es/components/SearchFilter/SearchFilterContainer.js +72 -47
  108. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  109. package/lib-es/components/SearchFilter/helpers/build-filters-query.js +0 -2
  110. package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  111. package/lib-es/components/SearchFilter/helpers/build-new-query.js +6 -0
  112. package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -0
  113. package/lib-es/components/SearchFilter/helpers/build-query.js +23 -0
  114. package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -0
  115. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +26 -0
  116. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
  117. package/lib-es/components/SearchFilter/helpers/index.js +4 -5
  118. package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
  119. package/lib-es/components/SearchFilter/index.js +2 -2
  120. package/lib-es/components/SearchFilter/index.js.map +1 -1
  121. package/lib-es/components/SearchFilterSort/SearchFilterSort.js +10 -26
  122. package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  123. package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +4 -21
  124. package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  125. package/lib-es/components/SearchFilterSort/helpers/update-sort.js +4 -8
  126. package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  127. package/lib-es/helpers/build-inherited-filters.js +0 -2
  128. package/lib-es/helpers/build-inherited-filters.js.map +1 -1
  129. package/lib-es/helpers/build-props-query.js +2 -4
  130. package/lib-es/helpers/build-props-query.js.map +1 -1
  131. package/lib-es/helpers/build-set-filters.js +1 -5
  132. package/lib-es/helpers/build-set-filters.js.map +1 -1
  133. package/lib-es/helpers/get-query-filters.js +8 -6
  134. package/lib-es/helpers/get-query-filters.js.map +1 -1
  135. package/lib-es/helpers/get-query-props.js +2 -10
  136. package/lib-es/helpers/get-query-props.js.map +1 -1
  137. package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
  138. package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
  139. package/lib-es/helpers/index.js +0 -2
  140. package/lib-es/helpers/index.js.map +1 -1
  141. package/lib-es/helpers/parse-props-to-display.js +9 -12
  142. package/lib-es/helpers/parse-props-to-display.js.map +1 -1
  143. package/lib-es/utils/get-class-modifiers.js +1 -1
  144. package/lib-es/utils/get-class-modifiers.js.map +1 -1
  145. package/package.json +10 -10
  146. package/src/HOC/recreateOnNavigation.js +21 -0
  147. package/src/components/Button.js +1 -2
  148. package/src/components/Card/CardsContainer.js +3 -3
  149. package/src/components/Card/CardsRender.js +7 -27
  150. package/src/components/Card/helpers/index.js +0 -1
  151. package/src/components/Code/Code.js +3 -7
  152. package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
  153. package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -4
  154. package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -6
  155. package/src/components/Layout/Layout.js +29 -32
  156. package/src/components/Layout/LayoutFactory.js +17 -0
  157. package/src/components/Layout/LayoutWithStickyTimer.js +40 -0
  158. package/src/components/Layout/index.js +2 -2
  159. package/src/components/List/ListFactory.js +15 -25
  160. package/src/components/List/helpers/index.js +0 -2
  161. package/src/components/SearchContent/SearchContent.js +6 -8
  162. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +12 -21
  163. package/src/components/SearchFilter/SearchFilterContainer.js +69 -57
  164. package/src/components/SearchFilter/helpers/build-filters-query.js +1 -9
  165. package/src/components/SearchFilter/helpers/build-new-query.js +6 -0
  166. package/src/components/SearchFilter/helpers/build-query.js +26 -0
  167. package/src/components/SearchFilter/helpers/get-initial-filter-values.js +30 -0
  168. package/src/components/SearchFilter/helpers/index.js +7 -9
  169. package/src/components/SearchFilter/index.js +2 -2
  170. package/src/components/SearchFilterSort/SearchFilterSort.js +8 -18
  171. package/src/components/SearchFilterSort/helpers/handle-sort-update.js +5 -14
  172. package/src/components/SearchFilterSort/helpers/update-sort.js +3 -7
  173. package/src/helpers/build-inherited-filters.js +1 -3
  174. package/src/helpers/build-props-query.js +2 -4
  175. package/src/helpers/build-set-filters.js +1 -2
  176. package/src/helpers/get-query-filters.js +4 -4
  177. package/src/helpers/get-query-props.js +4 -12
  178. package/src/helpers/get-wrapped-value-with-link.js +3 -6
  179. package/src/helpers/index.js +0 -2
  180. package/src/helpers/parse-props-to-display.js +21 -25
  181. package/src/utils/get-class-modifiers.js +1 -1
  182. package/tests/helpers/mocks.js +5 -3
  183. package/tests/unit/src/HOC/recreateOnNavigation.test.js +28 -0
  184. package/tests/unit/src/components/Code/Code.test.js +0 -5
  185. package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +0 -8
  186. package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -9
  187. package/tests/unit/src/components/Layout/Layout.test.js +1 -1
  188. package/tests/unit/src/components/Layout/LayoutFactory.test.js +53 -0
  189. package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +7 -1
  190. package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
  191. package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +7 -24
  192. package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
  193. package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +1 -4
  194. package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +19 -26
  195. package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +1 -10
  196. package/tests/unit/src/helpers/build-props-query.test.js +0 -25
  197. package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
  198. package/tests/unit/src/helpers/parse-props-to-display.test.js +0 -4
  199. package/lib/components/Card/helpers/get-updated-items-to-display.js +0 -55
  200. package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
  201. package/lib/components/List/helpers/get-list-query.js +0 -43
  202. package/lib/components/List/helpers/get-list-query.js.map +0 -1
  203. package/lib/components/List/helpers/get-list-specific-search-filter.js +0 -21
  204. package/lib/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
  205. package/lib/components/List/helpers/strip-query-key.js +0 -14
  206. package/lib/components/List/helpers/strip-query-key.js.map +0 -1
  207. package/lib/components/SearchFilter/helpers/build-new-url.js +0 -17
  208. package/lib/components/SearchFilter/helpers/build-new-url.js.map +0 -1
  209. package/lib/components/SearchFilter/helpers/build-url-query.js +0 -48
  210. package/lib/components/SearchFilter/helpers/build-url-query.js.map +0 -1
  211. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -32
  212. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
  213. package/lib/components/SearchFilter/helpers/get-filter-values.js +0 -31
  214. package/lib/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
  215. package/lib/components/SearchFilter/searchFilterReducer.js +0 -45
  216. package/lib/components/SearchFilter/searchFilterReducer.js.map +0 -1
  217. package/lib/helpers/build-query-key.js +0 -16
  218. package/lib/helpers/build-query-key.js.map +0 -1
  219. package/lib/helpers/process-data-summary-value.js +0 -56
  220. package/lib/helpers/process-data-summary-value.js.map +0 -1
  221. package/lib-es/components/Card/helpers/get-updated-items-to-display.js +0 -32
  222. package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
  223. package/lib-es/components/List/helpers/get-list-query.js +0 -24
  224. package/lib-es/components/List/helpers/get-list-query.js.map +0 -1
  225. package/lib-es/components/List/helpers/get-list-specific-search-filter.js +0 -12
  226. package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
  227. package/lib-es/components/List/helpers/strip-query-key.js +0 -6
  228. package/lib-es/components/List/helpers/strip-query-key.js.map +0 -1
  229. package/lib-es/components/SearchFilter/helpers/build-new-url.js +0 -8
  230. package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +0 -1
  231. package/lib-es/components/SearchFilter/helpers/build-url-query.js +0 -30
  232. package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +0 -1
  233. package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -18
  234. package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
  235. package/lib-es/components/SearchFilter/helpers/get-filter-values.js +0 -19
  236. package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
  237. package/lib-es/components/SearchFilter/searchFilterReducer.js +0 -28
  238. package/lib-es/components/SearchFilter/searchFilterReducer.js.map +0 -1
  239. package/lib-es/helpers/build-query-key.js +0 -7
  240. package/lib-es/helpers/build-query-key.js.map +0 -1
  241. package/lib-es/helpers/process-data-summary-value.js +0 -36
  242. package/lib-es/helpers/process-data-summary-value.js.map +0 -1
  243. package/src/components/Card/helpers/get-updated-items-to-display.js +0 -32
  244. package/src/components/List/helpers/get-list-query.js +0 -28
  245. package/src/components/List/helpers/get-list-specific-search-filter.js +0 -10
  246. package/src/components/List/helpers/strip-query-key.js +0 -6
  247. package/src/components/SearchFilter/helpers/build-new-url.js +0 -8
  248. package/src/components/SearchFilter/helpers/build-url-query.js +0 -31
  249. package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -17
  250. package/src/components/SearchFilter/helpers/get-filter-values.js +0 -21
  251. package/src/components/SearchFilter/searchFilterReducer.js +0 -15
  252. package/src/helpers/build-query-key.js +0 -7
  253. package/src/helpers/process-data-summary-value.js +0 -22
  254. package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +0 -72
  255. package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +0 -18
  256. package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +0 -52
@@ -1 +1 @@
1
- {"version":3,"file":"build-filters-query.js","names":["QUERY_KEYS_TO_IGNORE","builFilterObject","_ref","queryKey","value","filters","isRange","isInQuery","min","minValue","max","maxValue","push","range","_defineProperty2","gte","Number","lte","key","concat","isArray","Array","singleFilterObj","match","forEach","filterValue","buildFiltersQuery","_ref2","shouldAddFilters","query","filterBy","filterByProperty","rangeValues","queryKeys","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","_filterByPropOption$s","split","_filterByPropOption$s2","_slicedToArray2","filterByPropKey","filterByOption","indexOf","_filterByOption$split","_filterByOption$split2","filteryByValue","filterByKeyword","_default","exports"],"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 = ({\n shouldAddFilters,\n query,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys\n}) => {\n if (!shouldAddFilters) return [];\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,IAAMA,oBAAoB,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,aAAa,CAAC;AAE1E,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAyD;EAAA,IAAnDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IAAEC,SAAS,GAAAL,IAAA,CAATK,SAAS;EACtE,IAAID,OAAO,EAAE;IACX;IACA,IAAIC,SAAS,IAAKH,KAAK,CAACI,GAAG,KAAKJ,KAAK,CAACK,QAAQ,IAAIL,KAAK,CAACM,GAAG,KAAKN,KAAK,CAACO,QAAS,EAAE;MAC/EN,OAAO,CAACO,IAAI,CAAC;QACXC,KAAK,MAAAC,gBAAA,iBACFX,QAAQ,EAAG;UACVY,GAAG,EAAEC,MAAM,CAACZ,KAAK,CAACK,QAAQ,CAAC;UAC3BQ,GAAG,EAAED,MAAM,CAACZ,KAAK,C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["QUERY_KEYS_TO_IGNORE","builFilterObject","_ref","queryKey","value","filters","isRange","isInQuery","min","minValue","max","maxValue","push","range","_defineProperty2","gte","Number","lte","key","concat","isArray","Array","singleFilterObj","match","forEach","filterValue","buildFiltersQuery","_ref2","query","filterBy","filterByProperty","rangeValues","queryKeys","mustFilters","Object","keys","includes","queryValue","length","filterByPropOption","_filterByPropOption$s","split","_filterByPropOption$s2","_slicedToArray2","filterByPropKey","filterByOption","indexOf","_filterByOption$split","_filterByOption$split2","filteryByValue","filterByKeyword","_default","exports"],"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,IAAMA,oBAAoB,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,aAAa,CAAC;AAE1E,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAyD;EAAA,IAAnDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IAAEC,SAAS,GAAAL,IAAA,CAATK,SAAS;EACtE,IAAID,OAAO,EAAE;IACX;IACA,IAAIC,SAAS,IAAKH,KAAK,CAACI,GAAG,KAAKJ,KAAK,CAACK,QAAQ,IAAIL,KAAK,CAACM,GAAG,KAAKN,KAAK,CAACO,QAAS,EAAE;MAC/EN,OAAO,CAACO,IAAI,CAAC;QACXC,KAAK,MAAAC,gBAAA,iBACFX,QAAQ,EAAG;UACVY,GAAG,EAAEC,MAAM,CAACZ,KAAK,CAACK,QAAQ,CAAC;UAC3BQ,GAAG,EAAED,MAAM,CAACZ,KAAK,CAACO,QAAQ;QAC5B,CAAC;MAEL,CAAC,CAAC;IACJ;IACA;EACF;EAEA,IAAMO,GAAG,GAAGZ,OAAO,GAAGH,QAAQ,MAAAgB,MAAA,CAAMhB,QAAQ,aAAU;EAEtD,IAAMiB,OAAO,GAAGC,KAAK,CAACD,OAAO,CAAChB,KAAK,CAAC;EACpC,IAAI,CAACgB,OAAO,EAAE;IACZ,IAAME,eAAe,GAAG;MAAEC,KAAK,MAAAT,gBAAA,iBAAKI,GAAG,EAAGd,KAAK;IAAG,CAA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A,gBAAgB,CAACN,OAAO,CAAC,UAAAe,kBAAkB,EAAI;MAC7C,IAAAC,qBAAA,GAA0BD,kBAAkB,CAACE,KAAK,CAAC,GAAG,CAAC;QAAAC,sBAAA,OAAAC,eAAA,aAAAH,qBAAA;QAAhDI,eAAe,GAAAF,sBAAA;MACtBb,QAAQ,CAACL,OAAO,CAAC,UAAAqB,cAAc,EAAI;QACjC,IAAIA,cAAc,CAACC,OAAO,CAACF,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE;QACpD,IAAAG,qBAAA,GAA2BF,cAAc,CAACJ,KAAK,CAAC,GAAG,CAAC;UAAAO,sBAAA,OAAAL,eAAA,aAAAI,qBAAA;UAA3CE,cAAc,GAAAD,sBAAA;QACvB,IAAME,eAAe,MAAA/B,MAAA,CAAMyB,eAAe,aAAU;QACpD,IAAI,CAACK,cAAc,EAAE;QACrBhB,WAAW,CAACrB,IAAI,CAAC;UAAEW,KAAK,MAAAT,gBAAA,iBAAKoC,eAAe,EAAGD,cAAc;QAAG,CAAC,CAAC;MACpE,CAAC,CAAC;IACJ,CAAC,CAAC;EACN;EAEA,OAAOhB,WAAW;AACpB,CAAC;AAAC,IAAAkB,QAAA,GAEazB,iBAAiB;AAAA0B,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ require("core-js/modules/es.array.concat.js");
9
+ var buildNewQuery = function buildNewQuery(url, currentUrl, queryParams, sortValues) {
10
+ var newUrl = url ? "".concat(url, "?").concat(queryParams) : "".concat(currentUrl, "?").concat(queryParams);
11
+ return sortValues ? "".concat(newUrl, "&").concat(sortValues) : newUrl;
12
+ };
13
+ var _default = buildNewQuery;
14
+ exports["default"] = _default;
15
+ //# sourceMappingURL=build-new-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","newUrl","concat","_default","exports"],"sources":["../../../../src/components/SearchFilter/helpers/build-new-query.js"],"sourcesContent":["const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {\n const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;\n return sortValues ? `${newUrl}&${sortValues}` : newUrl;\n};\n\nexport default buildNewQuery;\n"],"mappings":";;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,GAAG,EAAEC,UAAU,EAAEC,WAAW,EAAEC,UAAU,EAAK;EAClE,IAAMC,MAAM,GAAGJ,GAAG,MAAAK,MAAA,CAAML,GAAG,OAAAK,MAAA,CAAIH,WAAW,OAAAG,MAAA,CAAQJ,UAAU,OAAAI,MAAA,CAAIH,WAAW,CAAE;EAC7E,OAAOC,UAAU,MAAAE,MAAA,CAAMD,MAAM,OAAAC,MAAA,CAAIF,UAAU,IAAKC,MAAM;AACxD,CAAC;AAAC,IAAAE,QAAA,GAEaP,aAAa;AAAAQ,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ require("core-js/modules/es.array.concat.js");
10
+ require("core-js/modules/es.array.for-each.js");
11
+ require("core-js/modules/es.object.to-string.js");
12
+ require("core-js/modules/web.dom-collections.for-each.js");
13
+ require("core-js/modules/es.array.includes.js");
14
+ require("core-js/modules/es.array.join.js");
15
+ var _constants = require("../constants");
16
+ var _parseFilterValue = _interopRequireDefault(require("./parse-filter-value"));
17
+ var buildQuery = function buildQuery(filterValues, filters) {
18
+ var newQuery = [];
19
+ var searchValue = filterValues[_constants.SEARCH_TERM] ? encodeURIComponent(filterValues[_constants.SEARCH_TERM]) : '';
20
+ if (searchValue) newQuery.push("".concat(_constants.SEARCH_TERM, "=").concat(searchValue));
21
+ filters.forEach(function (_ref) {
22
+ var propsToDisplay = _ref.propsToDisplay,
23
+ type = _ref.type;
24
+ if (type === _constants.TEXT_SEARCH) return;
25
+ propsToDisplay.forEach(function (prop) {
26
+ var value = filterValues[prop];
27
+ var parsedValue = (0, _parseFilterValue["default"])(prop, type, value);
28
+ if (parsedValue && !newQuery.includes(parsedValue)) {
29
+ newQuery.push(parsedValue);
30
+ }
31
+ });
32
+ });
33
+ return newQuery.join('&');
34
+ };
35
+ var _default = buildQuery;
36
+ exports["default"] = _default;
37
+ //# sourceMappingURL=build-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-query.js","names":["_constants","require","_parseFilterValue","_interopRequireDefault","buildQuery","filterValues","filters","newQuery","searchValue","SEARCH_TERM","encodeURIComponent","push","concat","forEach","_ref","propsToDisplay","type","TEXT_SEARCH","prop","value","parsedValue","parseFilterValue","includes","join","_default","exports"],"sources":["../../../../src/components/SearchFilter/helpers/build-query.js"],"sourcesContent":["import { SEARCH_TERM, TEXT_SEARCH } from '../constants';\nimport parseFilterValue from './parse-filter-value';\n\nconst buildQuery = (filterValues, filters) => {\n const newQuery = [];\n const searchValue = filterValues[SEARCH_TERM]\n ? encodeURIComponent(filterValues[SEARCH_TERM])\n : '';\n if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);\n\n filters.forEach(({ propsToDisplay, type }) => {\n if (type === TEXT_SEARCH) return;\n\n propsToDisplay.forEach(prop => {\n const value = filterValues[prop];\n const parsedValue = parseFilterValue(prop, type, value);\n if (parsedValue && !newQuery.includes(parsedValue)) {\n newQuery.push(parsedValue);\n }\n });\n });\n\n return newQuery.join('&');\n};\n\nexport default buildQuery;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,UAAU,GAAG,SAAbA,UAAUA,CAAIC,YAAY,EAAEC,OAAO,EAAK;EAC5C,IAAMC,QAAQ,GAAG,EAAE;EACnB,IAAMC,WAAW,GAAGH,YAAY,CAACI,sBAAW,CAAC,GACzCC,kBAAkB,CAACL,YAAY,CAACI,sBAAW,CAAC,CAAC,GAC7C,EAAE;EACN,IAAID,WAAW,EAAED,QAAQ,CAACI,IAAI,IAAAC,MAAA,CAAIH,sBAAW,OAAAG,MAAA,CAAIJ,WAAW,CAAE,CAAC;EAE/DF,OAAO,CAACO,OAAO,CAAC,UAAAC,IAAA,EAA8B;IAAA,IAA3BC,cAAc,GAAAD,IAAA,CAAdC,cAAc;MAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACrC,IAAIA,IAAI,KAAKC,sBAAW,EAAE;IAE1BF,cAAc,CAACF,OAAO,CAAC,UAAAK,IAAI,EAAI;MAC7B,IAAMC,KAAK,GAAGd,YAAY,CAACa,IAAI,CAAC;MAChC,IAAME,WAAW,GAAG,IAAAC,4BAAgB,EAACH,IAAI,EAAEF,IAAI,EAAEG,KAAK,CAAC;MACvD,IAAIC,WAAW,IAAI,CAACb,QAAQ,CAACe,QAAQ,CAACF,WAAW,CAAC,EAAE;QAClDb,QAAQ,CAACI,IAAI,CAACS,WAAW,CAAC;MAC5B;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOb,QAAQ,CAACgB,IAAI,CAAC,GAAG,CAAC;AAC3B,CAAC;AAAC,IAAAC,QAAA,GAEapB,UAAU;AAAAqB,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ require("core-js/modules/es.array.for-each.js");
11
+ require("core-js/modules/es.object.to-string.js");
12
+ require("core-js/modules/web.dom-collections.for-each.js");
13
+ require("core-js/modules/es.object.keys.js");
14
+ require("core-js/modules/es.array.find.js");
15
+ var _constants = require("../constants");
16
+ var _getFilterValueFromQuery = _interopRequireDefault(require("./get-filter-value-from-query"));
17
+ var getInitialFilterValues = function getInitialFilterValues(filterData, filters, query) {
18
+ var filterValues = {};
19
+ filterValues[_constants.SEARCH_TERM] = query[_constants.SEARCH_TERM] || '';
20
+ if (!filterData) {
21
+ filters.forEach(function (filterProps) {
22
+ var _filterProps$propsToD = (0, _slicedToArray2["default"])(filterProps.propsToDisplay, 1),
23
+ key = _filterProps$propsToD[0];
24
+ filterValues[key] = query[key] ? (0, _getFilterValueFromQuery["default"])(key, filterProps, {}, query) : null;
25
+ });
26
+ filterValues.dataNotSet = true;
27
+ return filterValues;
28
+ }
29
+ Object.keys(filterData).forEach(function (key) {
30
+ var filterProps = filters.find(function (_ref) {
31
+ var propsToDisplay = _ref.propsToDisplay;
32
+ return propsToDisplay.find(function (prop) {
33
+ return key === prop;
34
+ });
35
+ }) || {};
36
+ filterValues[key] = (0, _getFilterValueFromQuery["default"])(key, filterProps, filterData[key], query);
37
+ });
38
+ filterValues.dataNotSet = false;
39
+ return filterValues;
40
+ };
41
+ var _default = getInitialFilterValues;
42
+ exports["default"] = _default;
43
+ //# sourceMappingURL=get-initial-filter-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-initial-filter-values.js","names":["_constants","require","_getFilterValueFromQuery","_interopRequireDefault","getInitialFilterValues","filterData","filters","query","filterValues","SEARCH_TERM","forEach","filterProps","_filterProps$propsToD","_slicedToArray2","propsToDisplay","key","getFilterValueFromQuery","dataNotSet","Object","keys","find","_ref","prop","_default","exports"],"sources":["../../../../src/components/SearchFilter/helpers/get-initial-filter-values.js"],"sourcesContent":["import { SEARCH_TERM } from '../constants';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\n\nconst getInitialFilterValues = (filterData, filters, query) => {\n const filterValues = {};\n filterValues[SEARCH_TERM] = query[SEARCH_TERM] || '';\n\n if (!filterData) {\n filters.forEach(filterProps => {\n const {\n propsToDisplay: [key]\n } = filterProps;\n filterValues[key] = query[key] ? getFilterValueFromQuery(key, filterProps, {}, query) : null;\n });\n filterValues.dataNotSet = true;\n return filterValues;\n }\n\n Object.keys(filterData).forEach(key => {\n const filterProps =\n filters.find(({ propsToDisplay }) => propsToDisplay.find(prop => key === prop)) || {};\n filterValues[key] = getFilterValueFromQuery(key, filterProps, filterData[key], query);\n });\n\n filterValues.dataNotSet = false;\n\n return filterValues;\n};\n\nexport default getInitialFilterValues;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,UAAU,EAAEC,OAAO,EAAEC,KAAK,EAAK;EAC7D,IAAMC,YAAY,GAAG,CAAC,CAAC;EACvBA,YAAY,CAACC,sBAAW,CAAC,GAAGF,KAAK,CAACE,sBAAW,CAAC,IAAI,EAAE;EAEpD,IAAI,CAACJ,UAAU,EAAE;IACfC,OAAO,CAACI,OAAO,CAAC,UAAAC,WAAW,EAAI;MAC7B,IAAAC,qBAAA,OAAAC,eAAA,aAEIF,WAAW,CADbG,cAAc;QAAGC,GAAG,GAAAH,qBAAA;MAEtBJ,YAAY,CAACO,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC,GAAG,IAAAC,mCAAuB,EAACD,GAAG,EAAEJ,WAAW,EAAE,CAAC,CAAC,EAAEJ,KAAK,CAAC,GAAG,IAAI;IAC9F,CAAC,CAAC;IACFC,YAAY,CAACS,UAAU,GAAG,IAAI;IAC9B,OAAOT,YAAY;EACrB;EAEAU,MAAM,CAACC,IAAI,CAACd,UAAU,CAAC,CAACK,OAAO,CAAC,UAAAK,GAAG,EAAI;IACrC,IAAMJ,WAAW,GACfL,OAAO,CAACc,IAAI,CAAC,UAAAC,IAAA;MAAA,IAAGP,cAAc,GAAAO,IAAA,CAAdP,cAAc;MAAA,OAAOA,cAAc,CAACM,IAAI,CAAC,UAAAE,IAAI;QAAA,OAAIP,GAAG,KAAKO,IAAI;MAAA,EAAC;IAAA,EAAC,IAAI,CAAC,CAAC;IACvFd,YAAY,CAACO,GAAG,CAAC,GAAG,IAAAC,mCAAuB,EAACD,GAAG,EAAEJ,WAAW,EAAEN,UAAU,CAACU,GAAG,CAAC,EAAER,KAAK,CAAC;EACvF,CAAC,CAAC;EAEFC,YAAY,CAACS,UAAU,GAAG,KAAK;EAE/B,OAAOT,YAAY;AACrB,CAAC;AAAC,IAAAe,QAAA,GAEanB,sBAAsB;AAAAoB,OAAA,cAAAD,QAAA"}
@@ -11,22 +11,22 @@ Object.defineProperty(exports, "buildFiltersQuery", {
11
11
  return _buildFiltersQuery["default"];
12
12
  }
13
13
  });
14
- Object.defineProperty(exports, "buildNewUrl", {
14
+ Object.defineProperty(exports, "buildNewQuery", {
15
15
  enumerable: true,
16
16
  get: function get() {
17
- return _buildNewUrl["default"];
17
+ return _buildNewQuery["default"];
18
18
  }
19
19
  });
20
- Object.defineProperty(exports, "buildRawQueryStringified", {
20
+ Object.defineProperty(exports, "buildQuery", {
21
21
  enumerable: true,
22
22
  get: function get() {
23
- return _buildRawQueryStringified["default"];
23
+ return _buildQuery["default"];
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "buildUrlQuery", {
26
+ Object.defineProperty(exports, "buildRawQueryStringified", {
27
27
  enumerable: true,
28
28
  get: function get() {
29
- return _buildUrlQuery["default"];
29
+ return _buildRawQueryStringified["default"];
30
30
  }
31
31
  });
32
32
  Object.defineProperty(exports, "calculateMinMax", {
@@ -65,22 +65,16 @@ Object.defineProperty(exports, "getDisplayValue", {
65
65
  return _getDisplayValue["default"];
66
66
  }
67
67
  });
68
- Object.defineProperty(exports, "getFilterRangesAndCheckboxesValues", {
69
- enumerable: true,
70
- get: function get() {
71
- return _getFilterRangesAndCheckboxesValues["default"];
72
- }
73
- });
74
68
  Object.defineProperty(exports, "getFilterValueFromQuery", {
75
69
  enumerable: true,
76
70
  get: function get() {
77
71
  return _getFilterValueFromQuery["default"];
78
72
  }
79
73
  });
80
- Object.defineProperty(exports, "getFilterValues", {
74
+ Object.defineProperty(exports, "getInitialFilterValues", {
81
75
  enumerable: true,
82
76
  get: function get() {
83
- return _getFilterValues["default"];
77
+ return _getInitialFilterValues["default"];
84
78
  }
85
79
  });
86
80
  Object.defineProperty(exports, "getIntersectedProp", {
@@ -113,7 +107,7 @@ Object.defineProperty(exports, "isDeviceDesktop", {
113
107
  return _isDeviceDesktop["default"];
114
108
  }
115
109
  });
116
- var _buildNewUrl = _interopRequireDefault(require("./build-new-url"));
110
+ var _buildNewQuery = _interopRequireDefault(require("./build-new-query"));
117
111
  var _buildRawQueryStringified = _interopRequireDefault(require("./build-raw-query-stringified"));
118
112
  var _decodeEncode = require("./decode-encode");
119
113
  var _checkIfRangeUpdated = _interopRequireDefault(require("./check-if-range-updated"));
@@ -125,9 +119,8 @@ var _getIntersectedProp = _interopRequireDefault(require("./get-intersected-prop
125
119
  var _getRangeValue = _interopRequireDefault(require("./get-range-value"));
126
120
  var _getSelectOptions = _interopRequireDefault(require("./get-select-options"));
127
121
  var _isDeviceDesktop = _interopRequireDefault(require("./is-device-desktop"));
128
- var _getFilterValues = _interopRequireDefault(require("./get-filter-values"));
122
+ var _getInitialFilterValues = _interopRequireDefault(require("./get-initial-filter-values"));
129
123
  var _getFilterValueFromQuery = _interopRequireDefault(require("./get-filter-value-from-query"));
130
- var _buildUrlQuery = _interopRequireDefault(require("./build-url-query"));
124
+ var _buildQuery = _interopRequireDefault(require("./build-query"));
131
125
  var _buildFiltersQuery = _interopRequireDefault(require("./build-filters-query"));
132
- var _getFilterRangesAndCheckboxesValues = _interopRequireDefault(require("./get-filter-ranges-and-checkboxes-values"));
133
126
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_buildNewUrl","_interopRequireDefault","require","_buildRawQueryStringified","_decodeEncode","_checkIfRangeUpdated","_getResponsiveFilterClassnames","_getDisplayValue","_calculateStep","_calculateMinMax","_getIntersectedProp","_getRangeValue","_getSelectOptions","_isDeviceDesktop","_getFilterValues","_getFilterValueFromQuery","_buildUrlQuery","_buildFiltersQuery","_getFilterRangesAndCheckboxesValues"],"sources":["../../../../src/components/SearchFilter/helpers/index.js"],"sourcesContent":["import buildNewUrl from './build-new-url';\nimport buildRawQueryStringified from './build-raw-query-stringified';\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 buildUrlQuery from './build-url-query';\nimport buildFiltersQuery from './build-filters-query';\nimport getFilterRangesAndCheckboxesValues from './get-filter-ranges-and-checkboxes-values';\n\nexport {\n buildUrlQuery,\n buildNewUrl,\n buildRawQueryStringified,\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 buildFiltersQuery,\n getFilterRangesAndCheckboxesValues\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,8BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,gBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,wBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,cAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,kBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,mCAAA,GAAAjB,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_buildNewQuery","_interopRequireDefault","require","_buildRawQueryStringified","_decodeEncode","_checkIfRangeUpdated","_getResponsiveFilterClassnames","_getDisplayValue","_calculateStep","_calculateMinMax","_getIntersectedProp","_getRangeValue","_getSelectOptions","_isDeviceDesktop","_getInitialFilterValues","_getFilterValueFromQuery","_buildQuery","_buildFiltersQuery"],"sources":["../../../../src/components/SearchFilter/helpers/index.js"],"sourcesContent":["import buildNewQuery from './build-new-query';\nimport buildRawQueryStringified from './build-raw-query-stringified';\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 getInitialFilterValues from './get-initial-filter-values';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\nimport buildQuery from './build-query';\nimport buildFiltersQuery from './build-filters-query';\n\nexport {\n buildQuery,\n buildNewQuery,\n buildRawQueryStringified,\n decodeValue,\n encodeValue,\n checkIfRangeUpdated,\n getResponsiveFilterClassnames,\n getDisplayValue,\n calculateStep,\n calculateMinMax,\n getIntersectedProp,\n getRangeValue,\n getSelectOptions,\n isDeviceDesktop,\n getInitialFilterValues,\n getFilterValueFromQuery,\n buildFiltersQuery\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,8BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,uBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,wBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,kBAAA,GAAAhB,sBAAA,CAAAC,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_SearchFilterContainer","_interopRequireDefault","require","_default","SearchFilter","exports"],"sources":["../../../src/components/SearchFilter/index.js"],"sourcesContent":["import SearchFilter from './SearchFilterContainer';\n\nexport default SearchFilter;\n"],"mappings":";;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmD,IAAAC,QAAA,GAEpCC,iCAAY;AAAAC,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_SearchFilterContainer","_interopRequireDefault","require","_default","SearchFilterContainer","exports"],"sources":["../../../src/components/SearchFilter/index.js"],"sourcesContent":["import SearchFilterContainer from './SearchFilterContainer';\n\nexport default SearchFilterContainer;\n"],"mappings":";;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,IAAAC,QAAA,GAE7CC,iCAAqB;AAAAC,OAAA,cAAAF,QAAA"}
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ require("core-js/modules/es.array.sort.js");
10
10
  require("core-js/modules/es.array.concat.js");
11
11
  require("core-js/modules/es.array.map.js");
12
- require("core-js/modules/es.array.sort.js");
13
12
  var _react = _interopRequireDefault(require("react"));
14
13
  var _select = _interopRequireDefault(require("@blaze-react/select"));
15
14
  var _router = require("next/router");
@@ -18,31 +17,20 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
18
17
  var _constants = require("./constants");
19
18
  var _helpers = require("./helpers");
20
19
  var _HOC = require("../../HOC");
21
- var getSortFromQuery = function getSortFromQuery(listComponentName) {
22
- var listNameKey = listComponentName ? "pb[".concat(listComponentName, "]") : '';
23
- var sortKey = "".concat(listNameKey).concat(listNameKey ? '[sort]' : 'sort');
24
- var sortByKey = "".concat(listNameKey).concat(listNameKey ? '[sortby]' : 'sortby');
25
- return [sortKey, sortByKey];
26
- };
27
20
  var SearchFilterSort = function SearchFilterSort(_ref) {
28
- var filters = _ref.filters,
21
+ var router = _ref.router,
22
+ filters = _ref.filters,
29
23
  elementLabel = _ref.elementLabel,
30
24
  selectLabel = _ref.selectLabel,
31
- id = _ref.id,
32
- listComponentName = _ref.listComponentName;
33
- var router = (0, _router.useRouter)();
25
+ id = _ref.id;
34
26
  var asPath = router.asPath;
35
- var _getSortFromQuery = getSortFromQuery(listComponentName),
36
- _getSortFromQuery2 = (0, _slicedToArray2["default"])(_getSortFromQuery, 2),
37
- sortKey = _getSortFromQuery2[0],
38
- sortByKey = _getSortFromQuery2[1];
39
27
  var _parseUrl = (0, _queryString.parseUrl)(asPath),
40
28
  url = _parseUrl.url,
41
29
  query = _parseUrl.query,
42
30
  _parseUrl$query = _parseUrl.query,
43
31
  _parseUrl$query2 = _parseUrl$query === void 0 ? {} : _parseUrl$query,
44
- sort = _parseUrl$query2[sortKey],
45
- sortby = _parseUrl$query2[sortByKey];
32
+ sort = _parseUrl$query2.sort,
33
+ sortby = _parseUrl$query2.sortby;
46
34
  var selectedValue = "".concat(sortby, ":").concat(sort) || '';
47
35
  var defaultTextValue = selectLabel || _constants.DEFAULT_SORT;
48
36
  var options = filters.map(function (_ref2) {
@@ -53,14 +41,7 @@ var SearchFilterSort = function SearchFilterSort(_ref) {
53
41
  });
54
42
  var setSortValue = function setSortValue(_ref3) {
55
43
  var value = _ref3.value;
56
- return (0, _helpers.handleSortUpdate)({
57
- router: router,
58
- value: value,
59
- query: query,
60
- url: url,
61
- selectLabel: selectLabel,
62
- listComponentName: listComponentName
63
- });
44
+ return (0, _helpers.handleSortUpdate)(router, value, query, url, selectLabel);
64
45
  };
65
46
  return /*#__PURE__*/_react["default"].createElement("div", {
66
47
  className: "sort-by"
@@ -74,19 +55,18 @@ var SearchFilterSort = function SearchFilterSort(_ref) {
74
55
  }));
75
56
  };
76
57
  SearchFilterSort.propTypes = {
58
+ router: _propTypes["default"].object.isRequired,
77
59
  filters: _propTypes["default"].array,
78
60
  elementLabel: _propTypes["default"].string,
79
61
  selectLabel: _propTypes["default"].string,
80
- id: _propTypes["default"].string,
81
- listComponentName: _propTypes["default"].string
62
+ id: _propTypes["default"].string
82
63
  };
83
64
  SearchFilterSort.defaultProps = {
84
65
  filters: [],
85
66
  elementLabel: '',
86
67
  selectLabel: '',
87
- id: '',
88
- listComponentName: ''
68
+ id: ''
89
69
  };
90
- var _default = (0, _HOC.withTitle)(SearchFilterSort);
70
+ var _default = (0, _router.withRouter)((0, _HOC.withTitle)(SearchFilterSort));
91
71
  exports["default"] = _default;
92
72
  //# sourceMappingURL=SearchFilterSort.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchFilterSort.js","names":["_react","_interopRequireDefault","require","_select","_router","_queryString","_propTypes","_constants","_helpers","_HOC","getSortFromQuery","listComponentName","listNameKey","concat","sortKey","sortByKey","SearchFilterSort","_ref","filters","elementLabel","selectLabel","id","router","useRouter","asPath","_getSortFromQuery","_getSortFromQuery2","_slicedToArray2","_parseUrl","parseUrl","url","query","_parseUrl$query","_parseUrl$query2","sort","sortby","selectedValue","defaultTextValue","DEFAULT_SORT","options","map","_ref2","optionLabel","label","propsToDisplay","sortValue","setSortValue","_ref3","value","handleSortUpdate","createElement","className","onChange","propTypes","PropTypes","array","string","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/SearchFilterSort/SearchFilterSort.js"],"sourcesContent":["import React from 'react';\nimport Select from '@blaze-react/select';\nimport { useRouter } from 'next/router';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { DEFAULT_SORT } from './constants';\nimport { handleSortUpdate } from './helpers';\nimport { withTitle } from '../../HOC';\n\nconst getSortFromQuery = listComponentName => {\n const listNameKey = listComponentName ? `pb[${listComponentName}]` : '';\n const sortKey = `${listNameKey}${listNameKey ? '[sort]' : 'sort'}`;\n const sortByKey = `${listNameKey}${listNameKey ? '[sortby]' : 'sortby'}`;\n return [sortKey, sortByKey];\n};\nconst SearchFilterSort = ({ filters, elementLabel, selectLabel, id, listComponentName }) => {\n const router = useRouter();\n const { asPath } = router;\n const [sortKey, sortByKey] = getSortFromQuery(listComponentName);\n const { url, query, query: { [sortKey]: sort, [sortByKey]: sortby } = {} } = parseUrl(asPath);\n const selectedValue = `${sortby}:${sort}` || '';\n const defaultTextValue = selectLabel || DEFAULT_SORT;\n const options = filters.map(({ label: optionLabel, propsToDisplay, sort: sortValue }) => [\n `${propsToDisplay[0]}:${sortValue}`,\n optionLabel\n ]);\n\n const setSortValue = ({ value }) =>\n handleSortUpdate({ router, value, query, url, selectLabel, listComponentName });\n\n return (\n <div className=\"sort-by\">\n <Select\n label={elementLabel}\n defaultTextValue={defaultTextValue}\n value={selectedValue}\n id={id}\n options={options}\n onChange={setSortValue}\n />\n </div>\n );\n};\n\nSearchFilterSort.propTypes = {\n filters: PropTypes.array,\n elementLabel: PropTypes.string,\n selectLabel: PropTypes.string,\n id: PropTypes.string,\n listComponentName: PropTypes.string\n};\n\nSearchFilterSort.defaultProps = {\n filters: [],\n elementLabel: '',\n selectLabel: '',\n id: '',\n listComponentName: ''\n};\n\nexport default withTitle(SearchFilterSort);\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAEA,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,iBAAiB,EAAI;EAC5C,IAAMC,W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AACE,MAAM;EACpB7C,iBAAiB,EAAE2C,qBAAS,CAACE;AAC/B,CAAC;AAEDxC,gBAAgB,CAACyC,YAAY,GAAG;EAC9BvC,OAAO,EAAE,EAAE;EACXC,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,EAAE;EACfC,EAAE,EAAE,EAAE;EACNV,iBAAiB,EAAE;AACrB,CAAC;AAAC,IAAA+C,QAAA,GAEa,IAAAC,cAAS,EAAC3C,gBAAgB,CAAC;AAAA4C,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"SearchFilterSort.js","names":["_react","_interopRequireDefault","require","_select","_router","_queryString","_propTypes","_constants","_helpers","_HOC","SearchFilterSort","_ref","router","filters","elementLabel","selectLabel","id","asPath","_parseUrl","parseUrl","url","query","_parseUrl$query","_parseUrl$query2","sort","sortby","selectedValue","concat","defaultTextValue","DEFAULT_SORT","options","map","_ref2","optionLabel","label","propsToDisplay","sortValue","setSortValue","_ref3","value","handleSortUpdate","createElement","className","onChange","propTypes","PropTypes","object","isRequired","array","string","defaultProps","_default","withRouter","withTitle","exports"],"sources":["../../../src/components/SearchFilterSort/SearchFilterSort.js"],"sourcesContent":["import React from 'react';\nimport Select from '@blaze-react/select';\nimport { withRouter } from 'next/router';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { DEFAULT_SORT } from './constants';\nimport { handleSortUpdate } from './helpers';\nimport { withTitle } from '../../HOC';\n\nconst SearchFilterSort = ({ router, filters, elementLabel, selectLabel, id }) => {\n const { asPath } = router;\n const { url, query, query: { sort, sortby } = {} } = parseUrl(asPath);\n const selectedValue = `${sortby}:${sort}` || '';\n const defaultTextValue = selectLabel || DEFAULT_SORT;\n const options = filters.map(({ label: optionLabel, propsToDisplay, sort: sortValue }) => [\n `${propsToDisplay[0]}:${sortValue}`,\n optionLabel\n ]);\n\n const setSortValue = ({ value }) => handleSortUpdate(router, value, query, url, selectLabel);\n\n return (\n <div className=\"sort-by\">\n <Select\n label={elementLabel}\n defaultTextValue={defaultTextValue}\n value={selectedValue}\n id={id}\n options={options}\n onChange={setSortValue}\n />\n </div>\n );\n};\n\nSearchFilterSort.propTypes = {\n router: PropTypes.object.isRequired,\n filters: PropTypes.array,\n elementLabel: PropTypes.string,\n selectLabel: PropTypes.string,\n id: PropTypes.string\n};\n\nSearchFilterSort.defaultProps = {\n filters: [],\n elementLabel: '',\n selectLabel: '',\n id: ''\n};\n\nexport default withRouter(withTitle(SearchFilterSort));\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAEA,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAA2D;EAAA,IAArDC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAEC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IAAEC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAEC,EAAE,GAAAL,IAAA,CAAFK,EAAE;EACxE,IAAQC,MAAM,GAAKL,MAAM,CAAjBK,MAAM;EACd,IAAAC,SAAA,GAAqD,IAAAC,qBAAQ,EAACF,MAAM,CAAC;IAA7DG,GAAG,GAAAF,SAAA,CAAHE,GAAG;IAAEC,KAAK,GAAAH,SAAA,CAALG,KAAK;IAAAC,eAAA,GAAAJ,SAAA,CAAEG,KAAK;IAAAE,gBAAA,GAAAD,eAAA,cAAqB,CAAC,CAAC,GAAAA,eAAA;IAAnBE,IAAI,GAAAD,gBAAA,CAAJC,IAAI;IAAEC,MAAM,GAAAF,gB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AChB,CAAC;AAEDvC,gBAAgB,CAACwC,YAAY,GAAG;EAC9BrC,OAAO,EAAE,EAAE;EACXC,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,EAAE;EACfC,EAAE,EAAE;AACN,CAAC;AAAC,IAAAmC,QAAA,GAEa,IAAAC,kBAAU,EAAC,IAAAC,cAAS,EAAC3C,gBAAgB,CAAC,CAAC;AAAA4C,OAAA,cAAAH,QAAA"}
@@ -6,44 +6,30 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
- require("core-js/modules/es.array.concat.js");
10
9
  require("core-js/modules/es.array.for-each.js");
11
10
  require("core-js/modules/es.object.to-string.js");
12
11
  require("core-js/modules/web.dom-collections.for-each.js");
13
12
  require("core-js/modules/es.object.keys.js");
14
13
  require("core-js/modules/es.array.index-of.js");
14
+ require("core-js/modules/es.array.concat.js");
15
15
  var _queryString = require("query-string");
16
16
  var _constants = require("../constants");
17
17
  var _updateSort = _interopRequireDefault(require("./update-sort"));
18
- var handleSortUpdate = function handleSortUpdate(_ref) {
19
- var router = _ref.router,
20
- value = _ref.value,
21
- query = _ref.query,
22
- url = _ref.url,
23
- selectLabel = _ref.selectLabel,
24
- listComponentName = _ref.listComponentName;
18
+ var handleSortUpdate = function handleSortUpdate(router, value, query, url, selectLabel) {
25
19
  var queryWithoutSort = {};
26
20
  var routerOptions = {
27
21
  shallow: true,
28
22
  scroll: false
29
23
  };
30
- var asPath = router.asPath;
31
- var hashBit = asPath.split('#')[1];
32
- var parsedHash = hashBit ? "#".concat(hashBit) : '';
33
- var listNameKey = listComponentName ? "pb[".concat(listComponentName, "]") : '';
34
- var sortString = listNameKey ? "[".concat(_constants.SORT, "]") : _constants.SORT;
35
- var sortByString = listNameKey ? "[".concat(_constants.SORTBY, "]") : _constants.SORTBY;
36
- var sortKey = "".concat(listNameKey).concat(sortString);
37
- var sortByKey = "".concat(listNameKey).concat(sortByString);
38
24
  Object.keys(query).forEach(function (key) {
39
25
  if (key.indexOf(_constants.PAGINATION_QUERY) !== -1) return;
40
- if (key !== sortByKey && key !== sortKey) queryWithoutSort[key] = query[key];
26
+ if (key !== _constants.SORTBY && key !== _constants.SORT) queryWithoutSort[key] = query[key];
41
27
  });
42
28
  if (value === _constants.DEFAULT_SORT || value === selectLabel) {
43
29
  var stringifiedQuery = (0, _queryString.stringify)(queryWithoutSort);
44
- return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery).concat(parsedHash), routerOptions) : router.push("/Resolver", "".concat(url).concat(parsedHash), routerOptions);
30
+ return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery), routerOptions) : router.push("/Resolver", url, routerOptions);
45
31
  }
46
- var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url, parsedHash, listComponentName);
32
+ var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url);
47
33
  return router.push('/Resolver', updatedSortUrl, routerOptions);
48
34
  };
49
35
  var _default = handleSortUpdate;
@@ -1 +1 @@
1
- {"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","_ref","router","value","query","url","selectLabel","listComponentName","queryWithoutSort","routerOptions","shallow","scroll","asPath","hashBit","split","parsedHash","concat","listNameKey","sortString","SORT","sortByString","SORTBY","sortKey","sortByKey","Object","keys","forEach","key","indexOf","PAGINATION_QUERY","DEFAULT_SORT","stringifiedQuery","stringify","push","updatedSortUrl","updateSort","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = ({ router, value, query, url, selectLabel, listComponentName }) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n const { asPath } = router;\n const hashBit = asPath.split('#')[1];\n const parsedHash = hashBit ? `#${hashBit}` : '';\n const listNameKey = listComponentName ? `pb[${listComponentName}]` : '';\n const sortString = listNameKey ? `[${SORT}]` : SORT;\n const sortByString = listNameKey ? `[${SORTBY}]` : SORTBY;\n const sortKey = `${listNameKey}${sortString}`;\n const sortByKey = `${listNameKey}${sortByString}`;\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== sortByKey && key !== sortKey) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions)\n : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);\n }\n\n const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash, listComponentName);\n return router.push('/Resolver', updatedSortUrl, routerOptions);\n};\n\nexport default handleSortUpdate;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAMI,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAsE;EAAA,IAAhEC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;IAAEC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IAAEC,iBAAiB,GAAAN,IAAA,CAAjBM,iBAAiB;EACnF,IAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,IAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EACtD,IAAQC,MAAM,GAAKV,MAAM,CAAjBU,MAAM;EACd,IAAMC,OAAO,GAAGD,MAAM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G,IAAAC,sBAAU,EAAChC,KAAK,EAAEK,gBAAgB,EAAEH,GAAG,EAAEU,UAAU,EAAER,iBAAiB,CAAC;EAC9F,OAAOL,MAAM,CAAC+B,IAAI,CAAC,WAAW,EAAEC,cAAc,EAAEzB,aAAa,CAAC;AAChE,CAAC;AAAC,IAAA2B,QAAA,GAEapC,gBAAgB;AAAAqC,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","Object","keys","forEach","key","indexOf","PAGINATION_QUERY","SORTBY","SORT","DEFAULT_SORT","stringifiedQuery","stringify","push","concat","updatedSortUrl","updateSort","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = (router, value, query, url, selectLabel) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}`, routerOptions)\n : router.push(`/Resolver`, url, routerOptions);\n }\n const updatedSortUrl = updateSort(value, queryWithoutSort, url);\n return router.push('/Resolver', updatedSortUrl, routerOptions);\n};\n\nexport default handleSortUpdate;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAMI,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,GAAG,EAAEC,WAAW,EAAK;EACnE,IAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,IAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EACtDC,MAAM,CAACC,IAAI,CAACR,KAAK,CAAC,CAACS,OAAO,CAAC,UAAAC,GAAG,EAAI;IAChC,IAAIA,GAAG,CAACC,OAAO,CAACC,2BAAgB,CAAC,KAAK,CAAC,CAAC,EAAE;IAC1C,IAAIF,GAAG,KAAKG,iBAAM,IAAIH,GAAG,KAAKI,eAAI,EAAEX,gBAAgB,CAACO,GAAG,CAAC,GAAGV,KAAK,CAACU,GAAG,CAAC;EACxE,CAAC,CAAC;EACF,IAAIX,KAAK,KAAKgB,uBAAY,IAAIhB,KAAK,KAAKG,WAAW,EAAE;IACnD,IAAMc,gBAAgB,GAAG,IAAAC,sBAAS,EAACd,gBAAgB,CAAC;IAEpD,OAAOa,gBAAgB,GACnBlB,MAAM,CAACoB,IAAI,iBAAAC,MAAA,CAAiBlB,GAAG,OAAAkB,MAAA,CAAIH,gBAAgB,GAAIZ,aAAa,CAAC,GACrEN,MAAM,CAACoB,IAAI,cAAcjB,GAAG,EAAEG,aAAa,CAAC;EAClD;EACA,IAAMgB,cAAc,GAAG,IAAAC,sBAAU,EAACtB,KAAK,EAAEI,gBAAgB,EAAEF,GAAG,CAAC;EAC/D,OAAOH,MAAM,CAACoB,IAAI,CAAC,WAAW,EAAEE,cAAc,EAAEhB,aAAa,CAAC;AAChE,CAAC;AAAC,IAAAkB,QAAA,GAEazB,gBAAgB;AAAA0B,OAAA,cAAAD,QAAA"}
@@ -19,23 +19,19 @@ require("core-js/modules/es.array.concat.js");
19
19
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
20
20
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
21
21
  var _queryString = require("query-string");
22
- var _helpers = require("../../../helpers");
23
- var _constants = require("../constants");
24
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
23
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
24
  var updateSort = function updateSort(value, query, url) {
27
- var _objectSpread2;
28
- var hashBit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
29
- var listComponentName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
30
- var sortKey = (0, _helpers.buildQueryKey)(_constants.SORT, listComponentName);
31
- var sortByKey = (0, _helpers.buildQueryKey)(_constants.SORTBY, listComponentName);
32
25
  var _value$split = value.split(':'),
33
26
  _value$split2 = (0, _slicedToArray2["default"])(_value$split, 2),
34
27
  newSortBy = _value$split2[0],
35
28
  newSort = _value$split2[1];
36
- var updatedQuery = _objectSpread(_objectSpread({}, query), {}, (_objectSpread2 = {}, (0, _defineProperty2["default"])(_objectSpread2, sortByKey, newSortBy), (0, _defineProperty2["default"])(_objectSpread2, sortKey, newSort), _objectSpread2));
29
+ var updatedQuery = _objectSpread(_objectSpread({}, query), {}, {
30
+ sortby: newSortBy,
31
+ sort: newSort
32
+ });
37
33
  var parsedQuery = (0, _queryString.stringify)(updatedQuery);
38
- return "".concat(url, "?").concat(parsedQuery).concat(hashBit);
34
+ return "".concat(url, "?").concat(parsedQuery);
39
35
  };
40
36
  var _default = updateSort;
41
37
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"update-sort.js","names":["_queryString","require","_helpers","_constants","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","_objectSpread2","hashBit","undefined","listComponentName","sortKey","buildQueryKey","SORT","sortByKey","SORTBY","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","parsedQuery","stringify","concat","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { buildQueryKey } from '../../../helpers';\nimport { SORT, SORTBY } from '../constants';\n\nconst updateSort = (value, query, url, hashBit = '', listComponentName = '') => {\n const sortKey = buildQueryKey(SORT, listComponentName);\n const sortByKey = buildQueryKey(SORTBY, listComponentName);\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, [sortByKey]: newSortBy, [sortKey]: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}${hashBit}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA4C,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAA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H,YAAA;IAAtCI,SAAS,GAAAF,aAAA;IAAEG,OAAO,GAAAH,aAAA;EACzB,IAAMI,YAAY,GAAA/B,aAAA,CAAAA,aAAA,KAAQc,KAAK,QAAAE,cAAA,WAAAR,gBAAA,aAAAQ,cAAA,EAAGO,SAAS,EAAGM,SAAS,OAAArB,gBAAA,aAAAQ,cAAA,EAAGI,OAAO,EAAGU,OAAO,GAAAd,cAAA,EAAE;EAC7E,IAAMgB,WAAW,GAAG,IAAAC,sBAAS,EAACF,YAAY,CAAC;EAC3C,UAAAG,MAAA,CAAUnB,GAAG,OAAAmB,MAAA,CAAIF,WAAW,EAAAE,MAAA,CAAGjB,OAAO;AACxC,CAAC;AAAC,IAAAkB,QAAA,GAEavB,UAAU;AAAAwB,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"update-sort.js","names":["_queryString","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","sortby","sort","parsedQuery","stringify","concat","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\n\nconst updateSort = (value, query, url) => {\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, sortby: newSortBy, sort: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAyC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ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,sBAAS,EAACJ,YAAY,CAAC;EAC3C,UAAAK,MAAA,CAAUZ,GAAG,OAAAY,MAAA,CAAIF,WAAW;AAC9B,CAAC;AAAC,IAAAG,QAAA,GAEahB,UAAU;AAAAiB,OAAA,cAAAD,QAAA"}
@@ -19,7 +19,6 @@ require("core-js/modules/es.array.is-array.js");
19
19
  var _lodash = _interopRequireDefault(require("lodash.flatten"));
20
20
  var _isFilterEntitysId = _interopRequireDefault(require("./is-filter-entitys-id"));
21
21
  var _getFilterProps2 = _interopRequireDefault(require("./get-filter-props"));
22
- var _constants = require("../constants");
23
22
  var getRelationData = function getRelationData(entityData, relationName, currentRelationNames) {
24
23
  if (!entityData) return null;
25
24
  if (currentRelationNames && currentRelationNames.length) {
@@ -58,7 +57,6 @@ var buildInheritedFilters = function buildInheritedFilters(entityData, inherited
58
57
  relationEntityName = _getFilterProps.relationEntityName,
59
58
  relationForeignKeys = _getFilterProps.relationForeignKeys,
60
59
  shouldIgnoreFilter = _getFilterProps.shouldIgnoreFilter;
61
- if (filterName === _constants.ID) return;
62
60
  var relationData = getRelationData(entityData, relationName, relationForeignKeys);
63
61
  if (currentEntityId === entityName && (0, _isFilterEntitysId["default"])(filterName, currentEntityId) || shouldIgnoreFilter) {
64
62
  relationFilters.push("".concat(filterName, "/").concat(itemId));
@@ -1 +1 @@
1
- {"version":3,"file":"build-inherited-filters.js","names":["_lodash","_interopRequireDefault","require","_isFilterEntitysId","_getFilterProps2","_constants","getRelationData","entityData","relationName","currentRelationNames","length","arrayOfRelations","map","name","filter","Boolean","flatten","checkIfArrayHasData","isDataArray","relationData","setFiltersNoRelation","arrayHasData","filters","filterValues","reduce","acc","relationValue","_typeof2","push","concat","apply","_toConsumableArray2","buildInheritedFilters","inheritedFilters","currentSchema","filterEntitySchema","itemId","relationFilters","currentEntityId","identifier","forEach","_getFilterProps","getFilterProps","filterName","entityName","relationProp","relationEntityName","relationForeignKeys","shouldIgnoreFilter","ID","isFilterEntitysId","Array","isArray","filtersNoRelation","_default","exports"],"sources":["../../src/helpers/build-inherited-filters.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport isFilterEntitysId from './is-filter-entitys-id';\nimport getFilterProps from './get-filter-props';\nimport { ID } from '../constants';\n\nconst getRelationData = (entityData, relationName, currentRelationNames) => {\n if (!entityData) return null;\n if (currentRelationNames && currentRelationNames.length) {\n const arrayOfRelations = currentRelationNames.map(name => entityData[name]).filter(Boolean);\n return arrayOfRelations.length ? flatten(arrayOfRelations) : null;\n }\n return entityData[relationName];\n};\n\nconst checkIfArrayHasData = (isDataArray, relationData) => isDataArray && !!relationData.length;\n\nconst setFiltersNoRelation = (isDataArray, arrayHasData, relationData, relationName) => {\n const filters = [];\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue && typeof relationValue !== 'object')\n acc.push(`${relationName}/${relationValue}`);\n return acc;\n }, []);\n filters.push(...filterValues);\n } else if (!isDataArray && typeof relationData !== 'object') {\n filters.push(`${relationName}/${relationData}`);\n }\n\n return filters;\n};\nconst buildInheritedFilters = (\n entityData,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n itemId\n) => {\n const relationFilters = [];\n const { identifier: currentEntityId } = currentSchema;\n\n inheritedFilters.forEach(filter => {\n const {\n filterName,\n entityName,\n relationName,\n relationProp,\n relationEntityName,\n relationForeignKeys,\n shouldIgnoreFilter\n } = getFilterProps(filter, currentSchema, filterEntitySchema);\n\n if (filterName === ID) return;\n\n const relationData = getRelationData(entityData, relationName, relationForeignKeys);\n if (\n (currentEntityId === entityName && isFilterEntitysId(filterName, currentEntityId)) ||\n shouldIgnoreFilter\n ) {\n relationFilters.push(`${filterName}/${itemId}`);\n }\n\n if (!relationData) return;\n\n const isDataArray = Array.isArray(relationData);\n const arrayHasData = checkIfArrayHasData(isDataArray, relationData);\n\n if (!relationEntityName) {\n const filtersNoRelation = setFiltersNoRelation(\n isDataArray,\n arrayHasData,\n relationData,\n relationName\n );\n relationFilters.push(...filtersNoRelation);\n }\n\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue[relationProp]) acc.push(`${filterName}/${relationValue[relationProp]}`);\n return acc;\n }, []);\n relationFilters.push(...filterValues);\n } else if (!isDataArray && relationData[relationProp]) {\n relationFilters.push(`${filterName}/${relationData[relationProp]}`);\n }\n });\n\n return relationFilters;\n};\n\nexport default buildInheritedFilters;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAMI,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,UAAU,EAAEC,YAAY,EAAEC,oBAAoB,EAAK;EAC1E,IAAI,CAACF,UAAU,EAAE,OAAO,IAAI;EAC5B,IAAIE,oBAAoB,IAAIA,oBAAoB,CAACC,MAAM,EAAE;IACvD,IAAMC,gBAAgB,GAAGF,oBAAoB,CAACG,GAAG,CAAC,UAAAC,IAAI;MAAA,OAAIN,UAAU,CAACM,IAAI,CAAC;IAAA,EAAC,CAACC,MAAM,CAACC,OAAO,CAAC;IAC3F,OAAOJ,gBAAgB,CAACD,MAAM,GAAG,IAAAM,kBAAO,EAACL,gBAAgB,CAAC,GAAG,IAAI;EACnE;EACA,OAAOJ,UAAU,CAACC,YAAY,CAAC;AACjC,CAAC;AAED,IAAMS,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,WAAW,EAAEC,YAAY;EAAA,OAAKD,WAAW,IAAI,CAAC,CAACC,YAAY,CAACT,MAAM;AAAA;AAE/F,IAAMU,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIF,WAAW,EAAEG,YAAY,EAAEF,YAAY,EAAEX,YAAY,EAAK;EACtF,IAAMc,OAAO,GAAG,EAAE;EAClB,IAAID,YAAY,EAAE;IAChB,I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U,OAAAd,MAAA,CAAIV,YAAY,CAAC0B,YAAY,CAAC,CAAE,CAAC;IACrE;EACF,CAAC,CAAC;EAEF,OAAOR,eAAe;AACxB,CAAC;AAAC,IAAAiB,QAAA,GAEatB,qBAAqB;AAAAuB,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"build-inherited-filters.js","names":["_lodash","_interopRequireDefault","require","_isFilterEntitysId","_getFilterProps2","getRelationData","entityData","relationName","currentRelationNames","length","arrayOfRelations","map","name","filter","Boolean","flatten","checkIfArrayHasData","isDataArray","relationData","setFiltersNoRelation","arrayHasData","filters","filterValues","reduce","acc","relationValue","_typeof2","push","concat","apply","_toConsumableArray2","buildInheritedFilters","inheritedFilters","currentSchema","filterEntitySchema","itemId","relationFilters","currentEntityId","identifier","forEach","_getFilterProps","getFilterProps","filterName","entityName","relationProp","relationEntityName","relationForeignKeys","shouldIgnoreFilter","isFilterEntitysId","Array","isArray","filtersNoRelation","_default","exports"],"sources":["../../src/helpers/build-inherited-filters.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport isFilterEntitysId from './is-filter-entitys-id';\nimport getFilterProps from './get-filter-props';\n\nconst getRelationData = (entityData, relationName, currentRelationNames) => {\n if (!entityData) return null;\n if (currentRelationNames && currentRelationNames.length) {\n const arrayOfRelations = currentRelationNames.map(name => entityData[name]).filter(Boolean);\n return arrayOfRelations.length ? flatten(arrayOfRelations) : null;\n }\n return entityData[relationName];\n};\n\nconst checkIfArrayHasData = (isDataArray, relationData) => isDataArray && !!relationData.length;\n\nconst setFiltersNoRelation = (isDataArray, arrayHasData, relationData, relationName) => {\n const filters = [];\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue && typeof relationValue !== 'object')\n acc.push(`${relationName}/${relationValue}`);\n return acc;\n }, []);\n filters.push(...filterValues);\n } else if (!isDataArray && typeof relationData !== 'object') {\n filters.push(`${relationName}/${relationData}`);\n }\n\n return filters;\n};\nconst buildInheritedFilters = (\n entityData,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n itemId\n) => {\n const relationFilters = [];\n const { identifier: currentEntityId } = currentSchema;\n\n inheritedFilters.forEach(filter => {\n const {\n filterName,\n entityName,\n relationName,\n relationProp,\n relationEntityName,\n relationForeignKeys,\n shouldIgnoreFilter\n } = getFilterProps(filter, currentSchema, filterEntitySchema);\n\n const relationData = getRelationData(entityData, relationName, relationForeignKeys);\n\n if (\n (currentEntityId === entityName && isFilterEntitysId(filterName, currentEntityId)) ||\n shouldIgnoreFilter\n ) {\n relationFilters.push(`${filterName}/${itemId}`);\n }\n\n if (!relationData) return;\n\n const isDataArray = Array.isArray(relationData);\n const arrayHasData = checkIfArrayHasData(isDataArray, relationData);\n\n if (!relationEntityName) {\n const filtersNoRelation = setFiltersNoRelation(\n isDataArray,\n arrayHasData,\n relationData,\n relationName\n );\n relationFilters.push(...filtersNoRelation);\n }\n\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue[relationProp]) acc.push(`${filterName}/${relationValue[relationProp]}`);\n return acc;\n }, []);\n relationFilters.push(...filterValues);\n } else if (!isDataArray && relationData[relationProp]) {\n relationFilters.push(`${filterName}/${relationData[relationProp]}`);\n }\n });\n\n return relationFilters;\n};\n\nexport default buildInheritedFilters;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,UAAU,EAAEC,YAAY,EAAEC,oBAAoB,EAAK;EAC1E,IAAI,CAACF,UAAU,EAAE,OAAO,IAAI;EAC5B,IAAIE,oBAAoB,IAAIA,oBAAoB,CAACC,MAAM,EAAE;IACvD,IAAMC,gBAAgB,GAAGF,oBAAoB,CAACG,GAAG,CAAC,UAAAC,IAAI;MAAA,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,YAAY,GAAGJ,YAAY,CAACK,MAAM,CAAC,UAACC,GAAG,EAAEC,aAAa,EAAK;QAC/D,IAAIA,aAAa,CAACmB,YAAY,CAAC,EAAEpB,GAAG,CAACG,IAAI,IAAAC,MAAA,CAAIc,UAAU,OAAAd,MAAA,CAAIH,aAAa,CAACmB,YAAY,CAAC,CAAE,CAAC;QACzF,OAAOpB,GAAG;MACZ,CAAC,EAAE,EAAE,CAAC;MACNY,eAAe,CAACT,IAAI,CAAAE,KAAA,CAApBO,eAAe,MAAAN,mBAAA,aAASR,YAAY,EAAC;IACvC,CAAC,MAAM,IAAI,CAACL,WAAW,IAAIC,YAAY,CAAC0B,YAAY,CAAC,EAAE;MACrDR,eAAe,CAACT,IAAI,IAAAC,MAAA,CAAIc,UAAU,OAAAd,MAAA,CAAIV,YAAY,CAAC0B,YAAY,CAAC,CAAE,CAAC;IACrE;EACF,CAAC,CAAC;EAEF,OAAOR,eAAe;AACxB,CAAC;AAAC,IAAAgB,QAAA,GAEarB,qBAAqB;AAAAsB,OAAA,cAAAD,QAAA"}
@@ -66,15 +66,12 @@ var buildComplexProps = function buildComplexProps(shouldAddCategoryProps, props
66
66
  var _ref$relations = _ref.relations,
67
67
  relations = _ref$relations === void 0 ? [] : _ref$relations,
68
68
  _ref$dynamicPropertie = _ref.dynamicProperties,
69
- dynamicProperties = _ref$dynamicPropertie === void 0 ? {} : _ref$dynamicPropertie,
70
- _ref$properties = _ref.properties,
71
- properties = _ref$properties === void 0 ? {} : _ref$properties;
69
+ dynamicProperties = _ref$dynamicPropertie === void 0 ? {} : _ref$dynamicPropertie;
72
70
  return Object.keys(props).map(function (base) {
73
71
  var nestedProps = props[base];
74
72
  var hasLink = !!linkProps.find(function (linkProp) {
75
73
  return linkProp.includes(base);
76
74
  });
77
- var matchingProperty = !!properties[base];
78
75
  var matchingRelation = relations.find(function (_ref2) {
79
76
  var localField = _ref2.localField;
80
77
  return localField === base;
@@ -83,7 +80,7 @@ var buildComplexProps = function buildComplexProps(shouldAddCategoryProps, props
83
80
  return dynamicKey === base;
84
81
  });
85
82
  if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');
86
- if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
83
+ if (hasLink && (!!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
87
84
  var jointNestedProps = nestedProps.join(',');
88
85
  if (base === 'category' && shouldAddCategoryProps) return "".concat(base, "{").concat(jointNestedProps, ", ").concat(categoryProps, "}");
89
86
  if (base.includes('published')) {