@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.
- package/CHANGELOG.md +5 -21
- package/lib/HOC/recreateOnNavigation.js +29 -0
- package/lib/HOC/recreateOnNavigation.js.map +1 -0
- package/lib/components/Button.js +1 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +5 -5
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/Card/CardsRender.js +6 -13
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/index.js +0 -7
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Code/Code.js +3 -7
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js +4 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/Layout/Layout.js +3 -2
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/LayoutFactory.js +35 -0
- package/lib/components/Layout/LayoutFactory.js.map +1 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js +66 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/Layout/index.js.map +1 -1
- package/lib/components/List/ListFactory.js +11 -16
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/index.js +0 -14
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +6 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +11 -17
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +85 -63
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +1 -3
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +15 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js +37 -0
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +43 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +11 -18
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +11 -31
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -19
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +5 -9
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +0 -2
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +2 -5
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-set-filters.js +1 -5
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-filters.js +8 -6
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +2 -13
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +3 -2
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +0 -14
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +8 -13
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib-es/HOC/recreateOnNavigation.js +20 -0
- package/lib-es/HOC/recreateOnNavigation.js.map +1 -0
- package/lib-es/components/Button.js +1 -2
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsContainer.js +5 -5
- package/lib-es/components/Card/CardsContainer.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +7 -14
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/index.js +0 -1
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Code/Code.js +4 -8
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +8 -4
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -4
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +3 -2
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/components/Layout/LayoutFactory.js +14 -0
- package/lib-es/components/Layout/LayoutFactory.js.map +1 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js +42 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib-es/components/Layout/index.js +2 -2
- package/lib-es/components/Layout/index.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +12 -16
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/index.js +0 -2
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +6 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +11 -18
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +72 -47
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +0 -2
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js +23 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +26 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +4 -5
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/index.js +2 -2
- package/lib-es/components/SearchFilter/index.js.map +1 -1
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +10 -26
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +4 -21
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +4 -8
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +0 -2
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +2 -4
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-set-filters.js +1 -5
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +8 -6
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +2 -10
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +0 -2
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +9 -12
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/utils/get-class-modifiers.js +1 -1
- package/lib-es/utils/get-class-modifiers.js.map +1 -1
- package/package.json +10 -10
- package/src/HOC/recreateOnNavigation.js +21 -0
- package/src/components/Button.js +1 -2
- package/src/components/Card/CardsContainer.js +3 -3
- package/src/components/Card/CardsRender.js +7 -27
- package/src/components/Card/helpers/index.js +0 -1
- package/src/components/Code/Code.js +3 -7
- package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
- package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -4
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -6
- package/src/components/Layout/Layout.js +29 -32
- package/src/components/Layout/LayoutFactory.js +17 -0
- package/src/components/Layout/LayoutWithStickyTimer.js +40 -0
- package/src/components/Layout/index.js +2 -2
- package/src/components/List/ListFactory.js +15 -25
- package/src/components/List/helpers/index.js +0 -2
- package/src/components/SearchContent/SearchContent.js +6 -8
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +12 -21
- package/src/components/SearchFilter/SearchFilterContainer.js +69 -57
- package/src/components/SearchFilter/helpers/build-filters-query.js +1 -9
- package/src/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/src/components/SearchFilter/helpers/build-query.js +26 -0
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +30 -0
- package/src/components/SearchFilter/helpers/index.js +7 -9
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilterSort/SearchFilterSort.js +8 -18
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +5 -14
- package/src/components/SearchFilterSort/helpers/update-sort.js +3 -7
- package/src/helpers/build-inherited-filters.js +1 -3
- package/src/helpers/build-props-query.js +2 -4
- package/src/helpers/build-set-filters.js +1 -2
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +4 -12
- package/src/helpers/get-wrapped-value-with-link.js +3 -6
- package/src/helpers/index.js +0 -2
- package/src/helpers/parse-props-to-display.js +21 -25
- package/src/utils/get-class-modifiers.js +1 -1
- package/tests/helpers/mocks.js +5 -3
- package/tests/unit/src/HOC/recreateOnNavigation.test.js +28 -0
- package/tests/unit/src/components/Code/Code.test.js +0 -5
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +0 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -9
- package/tests/unit/src/components/Layout/Layout.test.js +1 -1
- package/tests/unit/src/components/Layout/LayoutFactory.test.js +53 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +7 -1
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +7 -24
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +1 -4
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +19 -26
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +1 -10
- package/tests/unit/src/helpers/build-props-query.test.js +0 -25
- package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
- package/tests/unit/src/helpers/parse-props-to-display.test.js +0 -4
- package/lib/components/Card/helpers/get-updated-items-to-display.js +0 -55
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib/components/List/helpers/get-list-query.js +0 -43
- package/lib/components/List/helpers/get-list-query.js.map +0 -1
- package/lib/components/List/helpers/get-list-specific-search-filter.js +0 -21
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib/components/List/helpers/strip-query-key.js +0 -14
- package/lib/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +0 -17
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-url-query.js +0 -48
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -32
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-values.js +0 -31
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +0 -45
- package/lib/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib/helpers/build-query-key.js +0 -16
- package/lib/helpers/build-query-key.js.map +0 -1
- package/lib/helpers/process-data-summary-value.js +0 -56
- package/lib/helpers/process-data-summary-value.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-query.js +0 -24
- package/lib-es/components/List/helpers/get-list-query.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +0 -12
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib-es/components/List/helpers/strip-query-key.js +0 -6
- package/lib-es/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +0 -30
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -18
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +0 -19
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +0 -28
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib-es/helpers/build-query-key.js +0 -7
- package/lib-es/helpers/build-query-key.js.map +0 -1
- package/lib-es/helpers/process-data-summary-value.js +0 -36
- package/lib-es/helpers/process-data-summary-value.js.map +0 -1
- package/src/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/src/components/List/helpers/get-list-query.js +0 -28
- package/src/components/List/helpers/get-list-specific-search-filter.js +0 -10
- package/src/components/List/helpers/strip-query-key.js +0 -6
- package/src/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/src/components/SearchFilter/helpers/build-url-query.js +0 -31
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -17
- package/src/components/SearchFilter/helpers/get-filter-values.js +0 -21
- package/src/components/SearchFilter/searchFilterReducer.js +0 -15
- package/src/helpers/build-query-key.js +0 -7
- package/src/helpers/process-data-summary-value.js +0 -22
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +0 -72
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +0 -18
- 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","
|
|
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","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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AAAH,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, "
|
|
14
|
+
Object.defineProperty(exports, "buildNewQuery", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _buildNewQuery["default"];
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "buildQuery", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _buildQuery["default"];
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "buildRawQueryStringified", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
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, "
|
|
74
|
+
Object.defineProperty(exports, "getInitialFilterValues", {
|
|
81
75
|
enumerable: true,
|
|
82
76
|
get: function get() {
|
|
83
|
-
return
|
|
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
|
|
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
|
|
122
|
+
var _getInitialFilterValues = _interopRequireDefault(require("./get-initial-filter-values"));
|
|
129
123
|
var _getFilterValueFromQuery = _interopRequireDefault(require("./get-filter-value-from-query"));
|
|
130
|
-
var
|
|
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":["
|
|
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","
|
|
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
|
-
|
|
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
|
|
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
|
|
45
|
-
sortby = _parseUrl$query2
|
|
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","
|
|
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,IAA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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(
|
|
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 !==
|
|
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)
|
|
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
|
|
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","
|
|
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), {},
|
|
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)
|
|
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","
|
|
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,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AM,EAAEH,SAAS;IAAEI,IAAI,EAAEH;EAAO,EAAE;EACnE,IAAMI,WAAW,GAAG,IAAAC,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","
|
|
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,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,WA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AAA,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 && (!!
|
|
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')) {
|