@blaze-cms/react-page-builder 0.114.0-alpha.0 → 0.114.0-alpha.4
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 +76 -0
- package/README.md +5 -8
- package/lib/components/Card/CardRender.js +61 -17
- package/lib/components/Card/CardRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/List/ListBuilder.js +11 -6
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +20 -7
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/get-sort-props.js +46 -0
- package/lib/components/List/helpers/get-sort-props.js.map +1 -0
- package/lib/components/List/helpers/index.js +8 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +11 -5
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +7 -2
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +5 -2
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +7 -3
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +5 -2
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-query.js +6 -5
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-range-value.js +6 -4
- package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
- package/lib/components/SearchFilter/helpers/is-device-desktop.js +1 -1
- package/lib/components/SearchFilter/helpers/is-device-desktop.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js +32 -22
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib-es/components/Card/CardRender.js +32 -5
- package/lib-es/components/Card/CardRender.js.map +1 -1
- package/lib-es/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/List/ListBuilder.js +11 -6
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +20 -8
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js +26 -0
- package/lib-es/components/List/helpers/get-sort-props.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js +11 -5
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +7 -2
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +5 -2
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Range.js +7 -3
- package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +5 -2
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +5 -4
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/get-range-value.js +1 -1
- package/lib-es/components/SearchFilter/helpers/get-range-value.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/is-device-desktop.js +1 -1
- package/lib-es/components/SearchFilter/helpers/is-device-desktop.js.map +1 -1
- package/lib-es/helpers/get-generic-render-variables.js +22 -15
- package/lib-es/helpers/get-generic-render-variables.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Card/CardRender.js +24 -6
- package/src/components/Card/helpers/filter-query-setup.js +1 -0
- package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -6
- package/src/components/List/ListBuilder.js +11 -6
- package/src/components/List/ListFactory.js +18 -8
- package/src/components/List/helpers/get-sort-props.js +17 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/components/SearchFilter/SearchFilter/FiltersList.js +15 -2
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +7 -2
- package/src/components/SearchFilter/components/Checkbox.js +4 -2
- package/src/components/SearchFilter/components/Range.js +7 -3
- package/src/components/SearchFilter/components/Select.js +4 -2
- package/src/components/SearchFilter/helpers/build-query.js +5 -4
- package/src/components/SearchFilter/helpers/get-range-value.js +3 -1
- package/src/components/SearchFilter/helpers/is-device-desktop.js +2 -1
- package/src/helpers/get-generic-render-variables.js +22 -12
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +24 -0
- package/tests/unit/src/components/List/helpers/get-sort-props.test.js +58 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Range.test.js.snap +2 -2
- package/tests/unit/src/helpers/build-raw-query.test.js +2 -1
- package/tests/unit/src/helpers/get-generic-render-variables.test.js +5 -11
- package/lib/helpers/check-sort-by.js +0 -16
- package/lib/helpers/check-sort-by.js.map +0 -1
- package/lib-es/helpers/check-sort-by.js +0 -4
- package/lib-es/helpers/check-sort-by.js.map +0 -1
- package/src/helpers/check-sort-by.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SearchFilter/helpers/get-range-value.js"],"names":["calculateMinMax","getRangeValue","rawQueryProp","rangeInterval","_min","_max","min","max","queryParamMin","queryParamMax","split","updatedMinValue","Number","updatedMaxValue","step","maxValue","minValue"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,qBAA5B;;AAEA,MAAMC,aAAa,GAAG,CAACC,YAAD,EAAeC,aAAf,EAA8BC,IAA9B,EAAoCC,IAApC,KAA6C;AACjE,QAAM;AAAEC,IAAAA,GAAF;AAAOC,IAAAA;AAAP,MAAeP,eAAe,CAAC;AAAEM,IAAAA,GAAG,EAAEF,IAAP;AAAaG,IAAAA,GAAG,EAAEF;AAAlB,GAAD,EAA2BF,aAA3B,CAApC;;AAEA,MAAID,YAAJ,EAAkB;AAChB,UAAM,CAACM,aAAD,EAAgBC,aAAhB,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/SearchFilter/helpers/get-range-value.js"],"names":["calculateMinMax","getRangeValue","rawQueryProp","rangeInterval","_min","_max","min","max","queryParamMin","queryParamMax","Array","isArray","split","updatedMinValue","Number","updatedMaxValue","step","maxValue","minValue"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,qBAA5B;;AAEA,MAAMC,aAAa,GAAG,CAACC,YAAD,EAAeC,aAAf,EAA8BC,IAA9B,EAAoCC,IAApC,KAA6C;AACjE,QAAM;AAAEC,IAAAA,GAAF;AAAOC,IAAAA;AAAP,MAAeP,eAAe,CAAC;AAAEM,IAAAA,GAAG,EAAEF,IAAP;AAAaG,IAAAA,GAAG,EAAEF;AAAlB,GAAD,EAA2BF,aAA3B,CAApC;;AAEA,MAAID,YAAJ,EAAkB;AAChB,UAAM,CAACM,aAAD,EAAgBC,aAAhB,IAAiCC,KAAK,CAACC,OAAN,CAAcT,YAAd,IACnCA,YAAY,CAAC,CAAD,CAAZ,CAAgBU,KAAhB,CAAsB,GAAtB,CADmC,GAEnCV,YAAY,CAACU,KAAb,CAAmB,GAAnB,CAFJ;AAGA,UAAMC,eAAe,GAAGC,MAAM,CAACN,aAAD,CAA9B;AACA,UAAMO,eAAe,GAAGD,MAAM,CAACL,aAAD,CAA9B;AAEA,WAAO;AACLH,MAAAA,GADK;AAELC,MAAAA,GAFK;AAGLS,MAAAA,IAAI,EAAEb,aAHD;AAILc,MAAAA,QAAQ,EAAEF,eAJL;AAKLG,MAAAA,QAAQ,EAAEL;AALL,KAAP;AAOD;;AAED,SAAO;AACLN,IAAAA,GADK;AAELD,IAAAA,GAFK;AAGLU,IAAAA,IAAI,EAAEb,aAHD;AAILc,IAAAA,QAAQ,EAAEV,GAJL;AAKLW,IAAAA,QAAQ,EAAEZ;AALL,GAAP;AAOD,CA1BD;;AA4BA,eAAeL,aAAf","sourcesContent":["import calculateMinMax from './calculate-min-max';\n\nconst getRangeValue = (rawQueryProp, rangeInterval, _min, _max) => {\n const { min, max } = calculateMinMax({ min: _min, max: _max }, rangeInterval);\n\n if (rawQueryProp) {\n const [queryParamMin, queryParamMax] = Array.isArray(rawQueryProp)\n ? rawQueryProp[0].split('-')\n : rawQueryProp.split('-');\n const updatedMinValue = Number(queryParamMin);\n const updatedMaxValue = Number(queryParamMax);\n\n return {\n min,\n max,\n step: rangeInterval,\n maxValue: updatedMaxValue,\n minValue: updatedMinValue\n };\n }\n\n return {\n max,\n min,\n step: rangeInterval,\n maxValue: max,\n minValue: min\n };\n};\n\nexport default getRangeValue;\n"],"file":"get-range-value.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TABLET_WIDTH } from '../constants';
|
|
2
2
|
|
|
3
|
-
const isDeviceDesktop = () => window.innerWidth > TABLET_WIDTH;
|
|
3
|
+
const isDeviceDesktop = () => typeof window !== 'undefined' ? window.innerWidth > TABLET_WIDTH : false;
|
|
4
4
|
|
|
5
5
|
export default isDeviceDesktop;
|
|
6
6
|
//# sourceMappingURL=is-device-desktop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SearchFilter/helpers/is-device-desktop.js"],"names":["TABLET_WIDTH","isDeviceDesktop","window","innerWidth"],"mappings":"AAAA,SAASA,YAAT,QAA6B,cAA7B;;AAEA,MAAMC,eAAe,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/SearchFilter/helpers/is-device-desktop.js"],"names":["TABLET_WIDTH","isDeviceDesktop","window","innerWidth"],"mappings":"AAAA,SAASA,YAAT,QAA6B,cAA7B;;AAEA,MAAMC,eAAe,GAAG,MACtB,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAM,CAACC,UAAP,GAAoBH,YAApD,GAAmE,KADrE;;AAGA,eAAeC,eAAf","sourcesContent":["import { TABLET_WIDTH } from '../constants';\n\nconst isDeviceDesktop = () =>\n typeof window !== 'undefined' ? window.innerWidth > TABLET_WIDTH : false;\n\nexport default isDeviceDesktop;\n"],"file":"is-device-desktop.js"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["limit", "offset"];
|
|
4
2
|
|
|
5
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
4
|
|
|
7
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
6
|
|
|
9
|
-
import checkSortby from './check-sort-by';
|
|
10
7
|
import getSortbyFieldName from './get-sort-by-field-name';
|
|
11
8
|
import { DEFAULT_LIMIT, DEFAULT_OFFSET } from '../constants';
|
|
12
9
|
|
|
10
|
+
const buildSortValues = (sortFilters, relations, stringProps) => {
|
|
11
|
+
if (!sortFilters || !sortFilters.length) return {
|
|
12
|
+
sort: []
|
|
13
|
+
};
|
|
14
|
+
const sortValues = sortFilters.map(({
|
|
15
|
+
sort,
|
|
16
|
+
propsToDisplay
|
|
17
|
+
}) => !!sort && !!propsToDisplay[0] && `${getSortbyFieldName(relations, propsToDisplay[0], stringProps)}:${sort.toLowerCase()}`).filter(Boolean).join(',');
|
|
18
|
+
return {
|
|
19
|
+
sort: sortValues
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
13
23
|
const getCorrectSort = (relations, filterProps, stringProps, isTextSearchApplied) => {
|
|
14
24
|
if (isTextSearchApplied) {
|
|
15
25
|
return {};
|
|
@@ -17,23 +27,20 @@ const getCorrectSort = (relations, filterProps, stringProps, isTextSearchApplied
|
|
|
17
27
|
|
|
18
28
|
const {
|
|
19
29
|
sort,
|
|
20
|
-
sortby
|
|
30
|
+
sortby,
|
|
31
|
+
sortProperties = []
|
|
21
32
|
} = filterProps;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
sort: sortValue
|
|
27
|
-
} : {};
|
|
33
|
+
return buildSortValues([{
|
|
34
|
+
sort,
|
|
35
|
+
propsToDisplay: [sortby]
|
|
36
|
+
}, ...sortProperties], relations, stringProps);
|
|
28
37
|
};
|
|
29
38
|
|
|
30
|
-
const getGenericRenderVariables = (relations,
|
|
31
|
-
|
|
39
|
+
const getGenericRenderVariables = (relations, filterProps = {}, stringProps = [], rawQueryStringified = '', isTextSearchFilterApplied = false) => {
|
|
40
|
+
const {
|
|
32
41
|
limit = DEFAULT_LIMIT,
|
|
33
42
|
offset
|
|
34
|
-
} =
|
|
35
|
-
filterProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
-
|
|
43
|
+
} = filterProps;
|
|
37
44
|
const sort = getCorrectSort(relations, filterProps, stringProps, isTextSearchFilterApplied);
|
|
38
45
|
const raw = rawQueryStringified ? {
|
|
39
46
|
rawQueryStringified
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/helpers/get-generic-render-variables.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/helpers/get-generic-render-variables.js"],"names":["getSortbyFieldName","DEFAULT_LIMIT","DEFAULT_OFFSET","buildSortValues","sortFilters","relations","stringProps","length","sort","sortValues","map","propsToDisplay","toLowerCase","filter","Boolean","join","getCorrectSort","filterProps","isTextSearchApplied","sortby","sortProperties","getGenericRenderVariables","rawQueryStringified","isTextSearchFilterApplied","limit","offset","raw","Number"],"mappings":";;;;;;AAAA,OAAOA,kBAAP,MAA+B,0BAA/B;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,cAA9C;;AAEA,MAAMC,eAAe,GAAG,CAACC,WAAD,EAAcC,SAAd,EAAyBC,WAAzB,KAAyC;AAC/D,MAAI,CAACF,WAAD,IAAgB,CAACA,WAAW,CAACG,MAAjC,EAAyC,OAAO;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAP;AACzC,QAAMC,UAAU,GAAGL,WAAW,CAC3BM,GADgB,CAEf,CAAC;AAAEF,IAAAA,IAAF;AAAQG,IAAAA;AAAR,GAAD,KACE,CAAC,CAACH,IAAF,IACA,CAAC,CAACG,cAAc,CAAC,CAAD,CADhB,IAEC,GAAEX,kBAAkB,CAACK,SAAD,EAAYM,cAAc,CAAC,CAAD,CAA1B,EAA+BL,WAA/B,CAA4C,IAAGE,IAAI,CAACI,WAAL,EAAmB,EAL1E,EAOhBC,MAPgB,CAOTC,OAPS,EAQhBC,IARgB,CAQX,GARW,CAAnB;AAUA,SAAO;AAAEP,IAAAA,IAAI,EAAEC;AAAR,GAAP;AACD,CAbD;;AAcA,MAAMO,cAAc,GAAG,CAACX,SAAD,EAAYY,WAAZ,EAAyBX,WAAzB,EAAsCY,mBAAtC,KAA8D;AACnF,MAAIA,mBAAJ,EAAyB;AACvB,WAAO,EAAP;AACD;;AACD,QAAM;AAAEV,IAAAA,IAAF;AAAQW,IAAAA,MAAR;AAAgBC,IAAAA,cAAc,GAAG;AAAjC,MAAwCH,WAA9C;AAEA,SAAOd,eAAe,CACpB,CAAC;AAAEK,IAAAA,IAAF;AAAQG,IAAAA,cAAc,EAAE,CAACQ,MAAD;AAAxB,GAAD,EAAqC,GAAGC,cAAxC,CADoB,EAEpBf,SAFoB,EAGpBC,WAHoB,CAAtB;AAKD,CAXD;;AAaA,MAAMe,yBAAyB,GAAG,CAChChB,SADgC,EAEhCY,WAAW,GAAG,EAFkB,EAGhCX,WAAW,GAAG,EAHkB,EAIhCgB,mBAAmB,GAAG,EAJU,EAKhCC,yBAAyB,GAAG,KALI,KAM7B;AACH,QAAM;AAAEC,IAAAA,KAAK,GAAGvB,aAAV;AAAyBwB,IAAAA;AAAzB,MAAoCR,WAA1C;AACA,QAAMT,IAAI,GAAGQ,cAAc,CAACX,SAAD,EAAYY,WAAZ,EAAyBX,WAAzB,EAAsCiB,yBAAtC,CAA3B;AACA,QAAMG,GAAG,GAAGJ,mBAAmB,GAAG;AAAEA,IAAAA;AAAF,GAAH,GAA6B,EAA5D;AAEA;AACEE,IAAAA,KAAK,EAAEG,MAAM,CAACH,KAAK,IAAIvB,aAAV,CADf;AAEEwB,IAAAA,MAAM,EAAEE,MAAM,CAACF,MAAM,IAAIvB,cAAX;AAFhB,KAGKM,IAHL,GAIKkB,GAJL;AAMD,CAjBD;;AAmBA,eAAeL,yBAAf","sourcesContent":["import getSortbyFieldName from './get-sort-by-field-name';\nimport { DEFAULT_LIMIT, DEFAULT_OFFSET } from '../constants';\n\nconst buildSortValues = (sortFilters, relations, stringProps) => {\n if (!sortFilters || !sortFilters.length) return { sort: [] };\n const sortValues = sortFilters\n .map(\n ({ sort, propsToDisplay }) =>\n !!sort &&\n !!propsToDisplay[0] &&\n `${getSortbyFieldName(relations, propsToDisplay[0], stringProps)}:${sort.toLowerCase()}`\n )\n .filter(Boolean)\n .join(',');\n\n return { sort: sortValues };\n};\nconst getCorrectSort = (relations, filterProps, stringProps, isTextSearchApplied) => {\n if (isTextSearchApplied) {\n return {};\n }\n const { sort, sortby, sortProperties = [] } = filterProps;\n\n return buildSortValues(\n [{ sort, propsToDisplay: [sortby] }, ...sortProperties],\n relations,\n stringProps\n );\n};\n\nconst getGenericRenderVariables = (\n relations,\n filterProps = {},\n stringProps = [],\n rawQueryStringified = '',\n isTextSearchFilterApplied = false\n) => {\n const { limit = DEFAULT_LIMIT, offset } = filterProps;\n const sort = getCorrectSort(relations, filterProps, stringProps, isTextSearchFilterApplied);\n const raw = rawQueryStringified ? { rawQueryStringified } : {};\n\n return {\n limit: Number(limit || DEFAULT_LIMIT),\n offset: Number(offset || DEFAULT_OFFSET),\n ...sort,\n ...raw\n };\n};\n\nexport default getGenericRenderVariables;\n"],"file":"get-generic-render-variables.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.114.0-alpha.
|
|
3
|
+
"version": "0.114.0-alpha.4",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@blaze-react/drafteditor": "0.7.0",
|
|
39
39
|
"@blaze-react/input": "0.5.30",
|
|
40
40
|
"@blaze-react/modal": "0.5.19",
|
|
41
|
-
"@blaze-react/range-filter": "0.
|
|
41
|
+
"@blaze-react/range-filter": "0.7.1",
|
|
42
42
|
"@blaze-react/select": "0.5.19",
|
|
43
43
|
"@blaze-react/utils": "0.5.15",
|
|
44
44
|
"core-js": "^3.2.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"lib/*",
|
|
89
89
|
"lib-es/*"
|
|
90
90
|
],
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "aae342c7543d7e447e67aa08e398910d12f79410"
|
|
92
92
|
}
|
|
@@ -9,26 +9,45 @@ import { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';
|
|
|
9
9
|
import {
|
|
10
10
|
getUpdatedFilterBy,
|
|
11
11
|
getEntityData,
|
|
12
|
+
getRequiredSchemas,
|
|
12
13
|
sortResponseData,
|
|
13
14
|
getUnpublishedEntityName,
|
|
14
15
|
renderChildren,
|
|
15
16
|
splitChildren,
|
|
16
17
|
removeExtraItems,
|
|
17
|
-
getRequiredSchemas,
|
|
18
18
|
appendImages
|
|
19
19
|
} from '../../helpers';
|
|
20
20
|
import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn } from './helpers';
|
|
21
21
|
|
|
22
22
|
const CardContainer = dynamic(() => import('./CardContainer'));
|
|
23
23
|
|
|
24
|
-
const CardRender = ({ entity, entityFields, itemsToDisplay, children, ...
|
|
24
|
+
const CardRender = ({ entity, entityFields, itemsToDisplay, children, ...otherProps }) => {
|
|
25
25
|
const {
|
|
26
26
|
parent: { itemId, itemEntity },
|
|
27
27
|
filterBy = [],
|
|
28
28
|
filterByProperty = [],
|
|
29
|
-
sortby
|
|
29
|
+
sortby,
|
|
30
|
+
sort,
|
|
31
|
+
sortProperties = [],
|
|
30
32
|
operator: filterOperator = AND
|
|
31
|
-
} =
|
|
33
|
+
} = otherProps;
|
|
34
|
+
|
|
35
|
+
const updatedSortProperties = [...sortProperties];
|
|
36
|
+
if (!updatedSortProperties.length && sort) {
|
|
37
|
+
updatedSortProperties.unshift({ sort, propsToDisplay: sortby });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const sortbyFilters = updatedSortProperties
|
|
41
|
+
.map(({ propsToDisplay }) => propsToDisplay)
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.flat();
|
|
44
|
+
|
|
45
|
+
const variableProps = {
|
|
46
|
+
...otherProps,
|
|
47
|
+
sortProperties: updatedSortProperties,
|
|
48
|
+
sort: null,
|
|
49
|
+
sortby: null
|
|
50
|
+
};
|
|
32
51
|
|
|
33
52
|
const itemEntityUpdated = getUnpublishedEntityName(itemEntity);
|
|
34
53
|
const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj([
|
|
@@ -70,7 +89,7 @@ const CardRender = ({ entity, entityFields, itemsToDisplay, children, ...variabl
|
|
|
70
89
|
loading: schemaLoading,
|
|
71
90
|
error: schemaError
|
|
72
91
|
} = useGetEntitySchemasAsObj(
|
|
73
|
-
getRequiredSchemas([...filterByProperty, ...
|
|
92
|
+
getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),
|
|
74
93
|
_loading
|
|
75
94
|
);
|
|
76
95
|
|
|
@@ -94,7 +113,6 @@ const CardRender = ({ entity, entityFields, itemsToDisplay, children, ...variabl
|
|
|
94
113
|
itemsToDisplay,
|
|
95
114
|
entitySameAsCurrentItemEntity
|
|
96
115
|
});
|
|
97
|
-
|
|
98
116
|
const { data, error: cardsError, loading: cardsLoading } = useQuery(action, {
|
|
99
117
|
variables,
|
|
100
118
|
skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)
|
|
@@ -47,12 +47,7 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
47
47
|
const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
48
48
|
if (!propValue) return null;
|
|
49
49
|
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
50
|
-
return [
|
|
51
|
-
upperFirst(label) || upperFirst(key),
|
|
52
|
-
propValue,
|
|
53
|
-
linkToPublishedContent,
|
|
54
|
-
modifier
|
|
55
|
-
];
|
|
50
|
+
return [upperFirst(label), propValue, linkToPublishedContent, modifier];
|
|
56
51
|
});
|
|
57
52
|
})
|
|
58
53
|
).filter(Boolean);
|
|
@@ -51,14 +51,15 @@ const ListBuilder = props => {
|
|
|
51
51
|
filterEntitySchema,
|
|
52
52
|
requiredSchema,
|
|
53
53
|
searchValues,
|
|
54
|
-
azFilter
|
|
54
|
+
azFilter,
|
|
55
|
+
sortProperties
|
|
55
56
|
} = props;
|
|
56
57
|
const isInfinite = paginationType === INFINITE;
|
|
57
58
|
const listComponent = getListComponent(isCard, paginationType);
|
|
58
59
|
const propsToDisplayValues = checkPropsToUse(propsToDisplay);
|
|
59
60
|
const entityFields = buildPropsQuery(entitySchema, propsToDisplayValues, props) || '';
|
|
60
61
|
const limitToUse = limit || itemsToDisplay.length;
|
|
61
|
-
const shouldApplyDefaultSort = !
|
|
62
|
+
const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;
|
|
62
63
|
const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);
|
|
63
64
|
const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);
|
|
64
65
|
const { entityType, docType } = getEntityData(entity);
|
|
@@ -105,7 +106,8 @@ const ListBuilder = props => {
|
|
|
105
106
|
limit: itemsPerPageToUse,
|
|
106
107
|
offset: initialOffset,
|
|
107
108
|
sort,
|
|
108
|
-
sortby
|
|
109
|
+
sortby,
|
|
110
|
+
sortProperties
|
|
109
111
|
},
|
|
110
112
|
stringProps,
|
|
111
113
|
JSON.stringify(azRawQuery),
|
|
@@ -147,7 +149,8 @@ const ListBuilder = props => {
|
|
|
147
149
|
limit: itemsPerPageToUse,
|
|
148
150
|
offset: initialOffset,
|
|
149
151
|
sort,
|
|
150
|
-
sortby
|
|
152
|
+
sortby,
|
|
153
|
+
sortProperties
|
|
151
154
|
},
|
|
152
155
|
stringProps,
|
|
153
156
|
JSON.stringify(rawQuery),
|
|
@@ -198,7 +201,8 @@ ListBuilder.propTypes = {
|
|
|
198
201
|
operator: PropTypes.string.isRequired,
|
|
199
202
|
filterOperator: PropTypes.string.isRequired,
|
|
200
203
|
paginationType: PropTypes.string,
|
|
201
|
-
azFilter: PropTypes.string
|
|
204
|
+
azFilter: PropTypes.string,
|
|
205
|
+
sortProperties: PropTypes.array
|
|
202
206
|
};
|
|
203
207
|
|
|
204
208
|
ListBuilder.defaultProps = {
|
|
@@ -209,7 +213,8 @@ ListBuilder.defaultProps = {
|
|
|
209
213
|
offset: 0,
|
|
210
214
|
paginationType: 'infinite',
|
|
211
215
|
inheritedFilters: [],
|
|
212
|
-
azFilter: ''
|
|
216
|
+
azFilter: '',
|
|
217
|
+
sortProperties: []
|
|
213
218
|
};
|
|
214
219
|
|
|
215
220
|
export default ListBuilder;
|
|
@@ -7,7 +7,7 @@ import { MainContext } from '@blaze-cms/nextjs-components';
|
|
|
7
7
|
import { getSingleEntitySchema, generateSingleItemQuery } from '../../application/query';
|
|
8
8
|
import ListBuilder from './ListBuilder';
|
|
9
9
|
import { AZ_LIST_TYPE } from './constants';
|
|
10
|
-
import { getAzQueryFilter } from './helpers';
|
|
10
|
+
import { getAzQueryFilter, getSortProps } from './helpers';
|
|
11
11
|
import {
|
|
12
12
|
getGenericProps,
|
|
13
13
|
getRequiredSchemas,
|
|
@@ -36,7 +36,8 @@ const ListFactory = props => {
|
|
|
36
36
|
sortby: defaultSortBy,
|
|
37
37
|
sort: defaultSort,
|
|
38
38
|
searchFilter,
|
|
39
|
-
operator: filterOperator
|
|
39
|
+
operator: filterOperator,
|
|
40
|
+
sortProperties
|
|
40
41
|
} = props;
|
|
41
42
|
|
|
42
43
|
const { isPreview } = useContext(MainContext);
|
|
@@ -46,8 +47,14 @@ const ListFactory = props => {
|
|
|
46
47
|
const { query, url, query: { sort: querySort, sortby: querySortBy } = {} } = parseUrl(
|
|
47
48
|
parsedQuery
|
|
48
49
|
);
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const { sortbyFilters, updatedSortProperties } = getSortProps({
|
|
51
|
+
querySort,
|
|
52
|
+
sortProperties,
|
|
53
|
+
defaultSort,
|
|
54
|
+
querySortBy,
|
|
55
|
+
defaultSortBy
|
|
56
|
+
});
|
|
57
|
+
|
|
51
58
|
const { itemEntity, itemId } = parent;
|
|
52
59
|
const itemEntityUpdated = getUnpublishedEntityName(itemEntity);
|
|
53
60
|
const paginationIndex = getPaginationIndex(query, name);
|
|
@@ -75,7 +82,7 @@ const ListFactory = props => {
|
|
|
75
82
|
loading: requiredSchemaLoading,
|
|
76
83
|
error: requiredSchemaError
|
|
77
84
|
} = useGetEntitySchemasAsObj(
|
|
78
|
-
getRequiredSchemas([...filterByProperty, ...
|
|
85
|
+
getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),
|
|
79
86
|
schemasLoading
|
|
80
87
|
);
|
|
81
88
|
const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);
|
|
@@ -126,8 +133,9 @@ const ListFactory = props => {
|
|
|
126
133
|
isAZ,
|
|
127
134
|
router,
|
|
128
135
|
entitySchema,
|
|
129
|
-
sort,
|
|
130
|
-
sortby,
|
|
136
|
+
sort: null,
|
|
137
|
+
sortby: null,
|
|
138
|
+
sortProperties: updatedSortProperties,
|
|
131
139
|
azFilter,
|
|
132
140
|
searchValues,
|
|
133
141
|
filterEntitySchema,
|
|
@@ -156,7 +164,8 @@ ListFactory.propTypes = {
|
|
|
156
164
|
name: PropTypes.string,
|
|
157
165
|
sortby: PropTypes.array,
|
|
158
166
|
sort: PropTypes.string,
|
|
159
|
-
searchFilter: PropTypes.object
|
|
167
|
+
searchFilter: PropTypes.object,
|
|
168
|
+
sortProperties: PropTypes.array
|
|
160
169
|
};
|
|
161
170
|
|
|
162
171
|
ListFactory.defaultProps = {
|
|
@@ -165,6 +174,7 @@ ListFactory.defaultProps = {
|
|
|
165
174
|
omitWrappers: false,
|
|
166
175
|
name: '',
|
|
167
176
|
sortby: [],
|
|
177
|
+
sortProperties: [],
|
|
168
178
|
sort: '',
|
|
169
179
|
operator: AND,
|
|
170
180
|
searchFilter: {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const getSortProps = ({ querySort, sortProperties, defaultSort, querySortBy, defaultSortBy }) => {
|
|
2
|
+
const sort = querySort || (sortProperties.length ? null : defaultSort);
|
|
3
|
+
let sortby = null;
|
|
4
|
+
if (querySortBy) sortby = [querySortBy];
|
|
5
|
+
else if (!sortProperties.length) sortby = defaultSortBy;
|
|
6
|
+
|
|
7
|
+
const updatedSortProperties = [...sortProperties];
|
|
8
|
+
if (sort) updatedSortProperties.unshift({ sort, propsToDisplay: sortby });
|
|
9
|
+
|
|
10
|
+
const sortbyFilters = updatedSortProperties
|
|
11
|
+
.map(({ propsToDisplay: filterProps }) => filterProps)
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.flat();
|
|
14
|
+
return { sortbyFilters, updatedSortProperties };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default getSortProps;
|
|
@@ -4,3 +4,4 @@ export { default as buildAzAggregations } from './build-az-aggregations';
|
|
|
4
4
|
export { default as buildAzUrl } from './build-az-url';
|
|
5
5
|
export { default as sortAggs } from './sort-aggs';
|
|
6
6
|
export { default as getItemsPerPageToUse } from './get-items-per-page-to-use';
|
|
7
|
+
export { default as getSortProps } from './get-sort-props';
|
|
@@ -4,7 +4,15 @@ import { MainContext } from '@blaze-cms/nextjs-components';
|
|
|
4
4
|
import { TextSearch, Checkbox, SelectFilter, Range } from '../components';
|
|
5
5
|
import { CHECKBOX, SELECT, TEXT_SEARCH, RANGE, SEARCH_TERM } from '../constants';
|
|
6
6
|
|
|
7
|
-
const FiltersList = ({
|
|
7
|
+
const FiltersList = ({
|
|
8
|
+
data,
|
|
9
|
+
filters,
|
|
10
|
+
hasUrl,
|
|
11
|
+
entity,
|
|
12
|
+
filterValues,
|
|
13
|
+
updateFilterValues,
|
|
14
|
+
shouldSearch
|
|
15
|
+
}) => {
|
|
8
16
|
const { itemId } = useContext(MainContext);
|
|
9
17
|
|
|
10
18
|
return filters.map(({ type, label, propsToDisplay, rangeInterval, elementTitle }, index) => {
|
|
@@ -46,6 +54,7 @@ const FiltersList = ({ data, filters, hasUrl, entity, filterValues, updateFilter
|
|
|
46
54
|
hasUrl={hasUrl}
|
|
47
55
|
filterValues={filterValues}
|
|
48
56
|
updateFilterValues={updateFilterValues}
|
|
57
|
+
shouldSearch={shouldSearch}
|
|
49
58
|
/>
|
|
50
59
|
</div>
|
|
51
60
|
)
|
|
@@ -64,6 +73,7 @@ const FiltersList = ({ data, filters, hasUrl, entity, filterValues, updateFilter
|
|
|
64
73
|
hasUrl={hasUrl}
|
|
65
74
|
filterValues={filterValues}
|
|
66
75
|
updateFilterValues={updateFilterValues}
|
|
76
|
+
shouldSearch={shouldSearch}
|
|
67
77
|
/>
|
|
68
78
|
</div>
|
|
69
79
|
)
|
|
@@ -81,6 +91,7 @@ const FiltersList = ({ data, filters, hasUrl, entity, filterValues, updateFilter
|
|
|
81
91
|
entity={entity}
|
|
82
92
|
filterValues={filterValues}
|
|
83
93
|
updateFilterValues={updateFilterValues}
|
|
94
|
+
shouldSearch={shouldSearch}
|
|
84
95
|
/>
|
|
85
96
|
</div>
|
|
86
97
|
)
|
|
@@ -97,10 +108,12 @@ FiltersList.propTypes = {
|
|
|
97
108
|
filterValues: PropTypes.object.isRequired,
|
|
98
109
|
updateFilterValues: PropTypes.func.isRequired,
|
|
99
110
|
data: PropTypes.object,
|
|
100
|
-
filters: PropTypes.array
|
|
111
|
+
filters: PropTypes.array,
|
|
112
|
+
shouldSearch: PropTypes.bool
|
|
101
113
|
};
|
|
102
114
|
|
|
103
115
|
FiltersList.defaultProps = {
|
|
116
|
+
shouldSearch: false,
|
|
104
117
|
data: {},
|
|
105
118
|
filters: []
|
|
106
119
|
};
|
|
@@ -113,11 +113,12 @@ const SearchFilter = ({
|
|
|
113
113
|
dispatch({ newValues, type: 'reset' });
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const updateFilterValues = (newValues,
|
|
117
|
-
dispatch({ newValues, shouldSearch, type: 'update' });
|
|
116
|
+
const updateFilterValues = (newValues, shouldSubmit) => {
|
|
117
|
+
dispatch({ newValues, shouldSearch: shouldSubmit, type: 'update' });
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
|
|
121
|
+
const shouldSearch = !hasUrl;
|
|
121
122
|
|
|
122
123
|
return (
|
|
123
124
|
<>
|
|
@@ -142,6 +143,7 @@ const SearchFilter = ({
|
|
|
142
143
|
<div className="filter__wrapper filter__wrapper--search-refine">
|
|
143
144
|
{!shouldGroup && (
|
|
144
145
|
<FiltersList
|
|
146
|
+
shouldSearch={shouldSearch}
|
|
145
147
|
data={data}
|
|
146
148
|
filters={filters}
|
|
147
149
|
hasUrl={hasUrl}
|
|
@@ -154,6 +156,7 @@ const SearchFilter = ({
|
|
|
154
156
|
{shouldGroup && (
|
|
155
157
|
<>
|
|
156
158
|
<FiltersList
|
|
159
|
+
shouldSearch={shouldSearch}
|
|
157
160
|
data={data}
|
|
158
161
|
filters={filters.slice(0, groupAfterMobile)}
|
|
159
162
|
hasUrl={hasUrl}
|
|
@@ -174,6 +177,7 @@ const SearchFilter = ({
|
|
|
174
177
|
<div className={moreFiltersMobileWrapperClass}>
|
|
175
178
|
<div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>
|
|
176
179
|
<FiltersList
|
|
180
|
+
shouldSearch={shouldSearch && isDeviceDesktop()}
|
|
177
181
|
data={data}
|
|
178
182
|
filters={filters.slice(
|
|
179
183
|
groupAfterMobile,
|
|
@@ -199,6 +203,7 @@ const SearchFilter = ({
|
|
|
199
203
|
<div className={moreFiltersDesktopWrapperClass}>
|
|
200
204
|
<div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>
|
|
201
205
|
<FiltersList
|
|
206
|
+
shouldSearch={false}
|
|
202
207
|
data={data}
|
|
203
208
|
filters={filters.slice(groupAfterDesktop)}
|
|
204
209
|
hasUrl={hasUrl}
|
|
@@ -8,7 +8,7 @@ import { LIMIT_MIN, LIMIT_MAX, MORE, LESS, DOWN, UP } from '../constants';
|
|
|
8
8
|
|
|
9
9
|
const getButtonInfo = isMore => (isMore ? { icon: DOWN, text: MORE } : { icon: UP, text: LESS });
|
|
10
10
|
|
|
11
|
-
const Checkbox = ({ data, prop, updateFilterValues, filterValues, label }) => {
|
|
11
|
+
const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldSearch }) => {
|
|
12
12
|
const [checkboxLimit, setCheckboxLimit] = useState(null);
|
|
13
13
|
|
|
14
14
|
const handleCheckboxOptions = () => {
|
|
@@ -64,7 +64,7 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label }) => {
|
|
|
64
64
|
const newCheckboxValues = eData
|
|
65
65
|
.filter(({ checked }) => checked)
|
|
66
66
|
.map(({ value }) => value);
|
|
67
|
-
updateFilterValues({ [prop]: newCheckboxValues },
|
|
67
|
+
updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);
|
|
68
68
|
}}
|
|
69
69
|
/>
|
|
70
70
|
{data[prop].buckets.length > LIMIT_MIN && (
|
|
@@ -82,10 +82,12 @@ Checkbox.propTypes = {
|
|
|
82
82
|
prop: PropTypes.string.isRequired,
|
|
83
83
|
filterValues: PropTypes.object.isRequired,
|
|
84
84
|
updateFilterValues: PropTypes.func.isRequired,
|
|
85
|
+
shouldSearch: PropTypes.bool,
|
|
85
86
|
label: PropTypes.string
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
Checkbox.defaultProps = {
|
|
90
|
+
shouldSearch: false,
|
|
89
91
|
label: ''
|
|
90
92
|
};
|
|
91
93
|
|
|
@@ -16,9 +16,11 @@ const Range = ({
|
|
|
16
16
|
entity,
|
|
17
17
|
propsToDisplay,
|
|
18
18
|
updateFilterValues,
|
|
19
|
-
filterValues
|
|
19
|
+
filterValues,
|
|
20
|
+
shouldSearch
|
|
20
21
|
}) => {
|
|
21
22
|
const router = useRouter();
|
|
23
|
+
const debounceAmount = shouldSearch ? 1200 : 100;
|
|
22
24
|
const { query } = parseUrl(decodeValue(router.asPath));
|
|
23
25
|
const hasMultipleOptions = propsToDisplay.length > 1;
|
|
24
26
|
const initialRangeOption = getIntersectedProp(query, propsToDisplay) || propsToDisplay[0];
|
|
@@ -39,8 +41,8 @@ const Range = ({
|
|
|
39
41
|
const shouldShowRange = rangeOption && min !== max;
|
|
40
42
|
|
|
41
43
|
const handleChange = debounce((option, value) => {
|
|
42
|
-
updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } },
|
|
43
|
-
},
|
|
44
|
+
updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } }, shouldSearch);
|
|
45
|
+
}, debounceAmount);
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
48
|
<>
|
|
@@ -86,11 +88,13 @@ Range.propTypes = {
|
|
|
86
88
|
entity: PropTypes.string.isRequired,
|
|
87
89
|
filterValues: PropTypes.object.isRequired,
|
|
88
90
|
updateFilterValues: PropTypes.func.isRequired,
|
|
91
|
+
shouldSearch: PropTypes.bool,
|
|
89
92
|
rangeInterval: PropTypes.number,
|
|
90
93
|
label: PropTypes.string
|
|
91
94
|
};
|
|
92
95
|
|
|
93
96
|
Range.defaultProps = {
|
|
97
|
+
shouldSearch: false,
|
|
94
98
|
rangeInterval: 1,
|
|
95
99
|
label: ''
|
|
96
100
|
};
|
|
@@ -4,7 +4,7 @@ import Select from '@blaze-react/select';
|
|
|
4
4
|
import { withTitle } from '../../../HOC';
|
|
5
5
|
import { DEFAULT_OPTION } from '../constants';
|
|
6
6
|
|
|
7
|
-
const SelectFilter = ({ data, label, prop, updateFilterValues, filterValues }) => {
|
|
7
|
+
const SelectFilter = ({ data, label, prop, updateFilterValues, filterValues, shouldSearch }) => {
|
|
8
8
|
const filterValue = filterValues[prop] || '';
|
|
9
9
|
|
|
10
10
|
const options = data[prop].buckets
|
|
@@ -21,7 +21,7 @@ const SelectFilter = ({ data, label, prop, updateFilterValues, filterValues }) =
|
|
|
21
21
|
id={prop}
|
|
22
22
|
options={optionsJoined}
|
|
23
23
|
onChange={({ value }) => {
|
|
24
|
-
updateFilterValues({ [prop]: value },
|
|
24
|
+
updateFilterValues({ [prop]: value }, shouldSearch);
|
|
25
25
|
}}
|
|
26
26
|
/>
|
|
27
27
|
);
|
|
@@ -32,10 +32,12 @@ SelectFilter.propTypes = {
|
|
|
32
32
|
prop: PropTypes.string.isRequired,
|
|
33
33
|
filterValues: PropTypes.object.isRequired,
|
|
34
34
|
updateFilterValues: PropTypes.func.isRequired,
|
|
35
|
+
shouldSearch: PropTypes.bool,
|
|
35
36
|
label: PropTypes.string
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
SelectFilter.defaultProps = {
|
|
40
|
+
shouldSearch: false,
|
|
39
41
|
label: ''
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -8,12 +8,13 @@ const buildQuery = (filterValues, filters) => {
|
|
|
8
8
|
|
|
9
9
|
filters.forEach(({ propsToDisplay, type }) => {
|
|
10
10
|
if (type === TEXT_SEARCH) return;
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
propsToDisplay.forEach(prop => {
|
|
12
13
|
const value = filterValues[prop];
|
|
13
14
|
const parsedValue = parseFilterValue(prop, type, value);
|
|
14
|
-
if (!parsedValue)
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (parsedValue && !newQuery.includes(parsedValue)) {
|
|
16
|
+
newQuery.push(parsedValue);
|
|
17
|
+
}
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
20
|
|
|
@@ -4,7 +4,9 @@ const getRangeValue = (rawQueryProp, rangeInterval, _min, _max) => {
|
|
|
4
4
|
const { min, max } = calculateMinMax({ min: _min, max: _max }, rangeInterval);
|
|
5
5
|
|
|
6
6
|
if (rawQueryProp) {
|
|
7
|
-
const [queryParamMin, queryParamMax] =
|
|
7
|
+
const [queryParamMin, queryParamMax] = Array.isArray(rawQueryProp)
|
|
8
|
+
? rawQueryProp[0].split('-')
|
|
9
|
+
: rawQueryProp.split('-');
|
|
8
10
|
const updatedMinValue = Number(queryParamMin);
|
|
9
11
|
const updatedMaxValue = Number(queryParamMax);
|
|
10
12
|
|