@blaze-cms/react-page-builder 0.131.1 → 0.132.0-admin-updates.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 +101 -2
- package/lib/components/Button.js +2 -1
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsRender.js +13 -6
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/get-updated-items-to-display.js +55 -0
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib/components/Card/helpers/index.js +7 -0
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
- package/lib/components/Code/Code.js +7 -3
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +6 -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 +3 -2
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/components/List/ListFactory.js +16 -11
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/get-list-query.js +43 -0
- package/lib/components/List/helpers/get-list-query.js.map +1 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js +21 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib/components/List/helpers/index.js +14 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/List/helpers/strip-query-key.js +14 -0
- package/lib/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib/components/SearchContent/SearchContent.js +8 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +17 -13
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +64 -83
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +3 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +17 -0
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js +49 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +32 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js +31 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +18 -11
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +43 -0
- package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js +31 -11
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +19 -5
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +9 -5
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +2 -0
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +5 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-query-key.js +16 -0
- package/lib/helpers/build-query-key.js.map +1 -0
- package/lib/helpers/build-set-filters.js +5 -1
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +8 -2
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-query-filters.js +6 -8
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +13 -2
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +2 -3
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +14 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +13 -8
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +56 -0
- package/lib/helpers/process-data-summary-value.js.map +1 -0
- package/lib-es/components/Button.js +2 -1
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +14 -7
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib-es/components/Card/helpers/index.js +1 -0
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
- package/lib-es/components/Code/Code.js +8 -4
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +6 -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 +4 -3
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +16 -12
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/get-list-query.js +24 -0
- package/lib-es/components/List/helpers/get-list-query.js.map +1 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +12 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +2 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/List/helpers/strip-query-key.js +6 -0
- package/lib-es/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContent.js +8 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +18 -13
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +48 -70
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +2 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +31 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +18 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +19 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +5 -4
- 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/SearchFilter/searchFilterReducer.js +26 -0
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +26 -10
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +21 -4
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +8 -4
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +2 -0
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-query-key.js +7 -0
- package/lib-es/helpers/build-query-key.js.map +1 -0
- package/lib-es/helpers/build-set-filters.js +5 -1
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-entities-with-banner.js +9 -2
- package/lib-es/helpers/get-entities-with-banner.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +6 -8
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +10 -2
- 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 +2 -0
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +12 -9
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/helpers/process-data-summary-value.js +36 -0
- package/lib-es/helpers/process-data-summary-value.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Button.js +2 -1
- package/src/components/Card/CardsRender.js +27 -7
- package/src/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/src/components/Card/helpers/index.js +1 -0
- package/src/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/src/components/Code/Code.js +7 -3
- package/src/components/DataSummary/helpers/build-loop-props-content.js +7 -3
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/src/components/List/ListFactory.js +25 -15
- package/src/components/List/helpers/get-list-query.js +28 -0
- package/src/components/List/helpers/get-list-specific-search-filter.js +10 -0
- package/src/components/List/helpers/index.js +2 -0
- package/src/components/List/helpers/strip-query-key.js +6 -0
- package/src/components/SearchContent/SearchContent.js +8 -8
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +21 -18
- package/src/components/SearchFilter/SearchFilterContainer.js +59 -67
- package/src/components/SearchFilter/helpers/build-filters-query.js +9 -1
- package/src/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/src/components/SearchFilter/helpers/build-url-query.js +33 -0
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +17 -0
- package/src/components/SearchFilter/helpers/get-filter-values.js +21 -0
- package/src/components/SearchFilter/helpers/index.js +9 -7
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilter/searchFilterReducer.js +15 -0
- package/src/components/SearchFilterSort/SearchFilterSort.js +18 -8
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +14 -5
- package/src/components/SearchFilterSort/helpers/update-sort.js +7 -3
- package/src/helpers/build-inherited-filters.js +3 -1
- package/src/helpers/build-props-query.js +4 -2
- package/src/helpers/build-query-key.js +7 -0
- package/src/helpers/build-set-filters.js +2 -1
- package/src/helpers/get-entities-with-banner.js +3 -2
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +12 -4
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +2 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -0
- package/tests/helpers/mocks.js +3 -5
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +72 -0
- package/tests/unit/src/components/Code/Code.test.js +5 -0
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +8 -0
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +50 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
- 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 +24 -7
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
- package/tests/unit/src/helpers/build-props-query.test.js +25 -0
- 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 +4 -0
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-query.js +0 -37
- package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/src/components/SearchFilter/helpers/build-query.js +0 -26
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
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; }
|
|
4
|
+
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) { _defineProperty(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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import components from '../components';
|
|
9
|
+
const {
|
|
10
|
+
code: Code
|
|
11
|
+
} = components;
|
|
12
|
+
const renderCode = value => /*#__PURE__*/React.createElement(Code, {
|
|
13
|
+
code: value,
|
|
14
|
+
disableWrapper: true
|
|
15
|
+
});
|
|
16
|
+
const processDataSummaryValue = (objPropValue, {
|
|
17
|
+
isHtml
|
|
18
|
+
}) => {
|
|
19
|
+
let pValue = objPropValue;
|
|
20
|
+
if (isHtml) {
|
|
21
|
+
pValue = Array.isArray(objPropValue) ? objPropValue.map(_ref => {
|
|
22
|
+
let {
|
|
23
|
+
keyField,
|
|
24
|
+
[keyField]: value
|
|
25
|
+
} = _ref,
|
|
26
|
+
otherProps = _objectWithoutProperties(_ref, ["keyField", keyField].map(_toPropertyKey));
|
|
27
|
+
return _objectSpread({
|
|
28
|
+
[keyField]: renderCode(value),
|
|
29
|
+
keyField
|
|
30
|
+
}, otherProps);
|
|
31
|
+
}) : renderCode(objPropValue);
|
|
32
|
+
}
|
|
33
|
+
return pValue;
|
|
34
|
+
};
|
|
35
|
+
export default processDataSummaryValue;
|
|
36
|
+
//# sourceMappingURL=process-data-summary-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-data-summary-value.js","names":["React","components","code","Code","renderCode","value","createElement","disableWrapper","processDataSummaryValue","objPropValue","isHtml","pValue","Array","isArray","map","_ref","keyField","otherProps","_objectWithoutProperties","_toPropertyKey","_objectSpread"],"sources":["../../src/helpers/process-data-summary-value.js"],"sourcesContent":["import React from 'react';\nimport components from '../components';\n\nconst { code: Code } = components;\n\nconst renderCode = value => <Code code={value} disableWrapper />;\n\nconst processDataSummaryValue = (objPropValue, { isHtml }) => {\n let pValue = objPropValue;\n if (isHtml) {\n pValue = Array.isArray(objPropValue)\n ? objPropValue.map(({ keyField, [keyField]: value, ...otherProps }) => ({\n [keyField]: renderCode(value),\n keyField,\n ...otherProps\n }))\n : renderCode(objPropValue);\n }\n return pValue;\n};\n\nexport default processDataSummaryValue;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAM;EAAEC,IAAI,EAAEC;AAAK,CAAC,GAAGF,UAAU;AAEjC,MAAMG,UAAU,GAAGC,KAAK,iBAAIL,KAAA,CAAAM,aAAA,CAACH,IAAI;EAACD,IAAI,EAAEG,KAAM;EAACE,cAAc;AAAA,CAAE,CAAC;AAEhE,MAAMC,uBAAuB,GAAGA,CAACC,YAAY,EAAE;EAAEC;AAAO,CAAC,KAAK;EAC5D,IAAIC,MAAM,GAAGF,YAAY;EACzB,IAAIC,MAAM,EAAE;IACVC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,GAChCA,YAAY,CAACK,GAAG,CAACC,IAAA;MAAA,IAAC;UAAEC,QAAQ;UAAE,CAACA,QAAQ,GAAGX;QAAqB,CAAC,GAAAU,IAAA;QAAZE,UAAU,GAAAC,wBAAA,CAAAH,IAAA,eAA/BC,QAAQ,EAAAF,GAAA,CAAAK,cAAA;MAAA,OAAAC,aAAA;QACrC,CAACJ,QAAQ,GAAGZ,UAAU,CAACC,KAAK,CAAC;QAC7BW;MAAQ,GACLC,UAAU;IAAA,CACb,CAAC,GACHb,UAAU,CAACK,YAAY,CAAC;EAC9B;EACA,OAAOE,MAAM;AACf,CAAC;AAED,eAAeH,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0-admin-updates.1",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/core-errors-ui": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.132.0-admin-updates.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.132.0-admin-updates.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "0.132.0-admin-updates.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
|
|
34
|
-
"@blaze-cms/nextjs-components": "
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "
|
|
36
|
-
"@blaze-cms/setup-ui": "
|
|
37
|
-
"@blaze-cms/utils": "
|
|
38
|
-
"@blaze-cms/utils-handlebars": "
|
|
34
|
+
"@blaze-cms/nextjs-components": "0.132.0-admin-updates.0",
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.132.0-admin-updates.1",
|
|
36
|
+
"@blaze-cms/setup-ui": "0.132.0-admin-updates.0",
|
|
37
|
+
"@blaze-cms/utils": "0.132.0-admin-updates.0",
|
|
38
|
+
"@blaze-cms/utils-handlebars": "0.132.0-admin-updates.0",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
41
41
|
"@blaze-react/checkboxes": "0.5.31",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "7d0cac53177294b81aa22198200b9236bd922306"
|
|
93
93
|
}
|
package/src/components/Button.js
CHANGED
|
@@ -59,7 +59,8 @@ const Button = props => {
|
|
|
59
59
|
|
|
60
60
|
const logout = () => {
|
|
61
61
|
handleLogout(client);
|
|
62
|
-
|
|
62
|
+
if (hasChildren(children)) return setShowChildren(true);
|
|
63
|
+
return url ? router.reload(urlToUse) : router.reload();
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
const handleClick = () => {
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
filterQuerySetup,
|
|
23
23
|
shouldSkipSingleQuery,
|
|
24
24
|
shouldReturn,
|
|
25
|
-
getUpdatedSortProperties
|
|
25
|
+
getUpdatedSortProperties,
|
|
26
|
+
getUpdatedItemsToDisplay
|
|
26
27
|
} from './helpers';
|
|
27
28
|
|
|
28
29
|
const CardsContainer = dynamic(() => import('./CardsContainer'));
|
|
@@ -95,6 +96,7 @@ const CardsRender = ({
|
|
|
95
96
|
isPreview,
|
|
96
97
|
itemEntityUpdated: unpublishedParentEntityName
|
|
97
98
|
});
|
|
99
|
+
|
|
98
100
|
const {
|
|
99
101
|
data: { entityData: parentEntityData = {} } = {},
|
|
100
102
|
error: _err,
|
|
@@ -122,6 +124,13 @@ const CardsRender = ({
|
|
|
122
124
|
variableProps
|
|
123
125
|
);
|
|
124
126
|
|
|
127
|
+
const updatedItemsToDisplay = getUpdatedItemsToDisplay({
|
|
128
|
+
itemsToDisplay,
|
|
129
|
+
inheritedFilters,
|
|
130
|
+
parentSchema,
|
|
131
|
+
parentEntityData
|
|
132
|
+
});
|
|
133
|
+
|
|
125
134
|
const { limit, variables } = filterQuerySetup({
|
|
126
135
|
getEntitySchemas: Object.values(requiredSchema),
|
|
127
136
|
entity: primaryEntityToUse,
|
|
@@ -130,22 +139,33 @@ const CardsRender = ({
|
|
|
130
139
|
docType: docTypes,
|
|
131
140
|
filterOperator,
|
|
132
141
|
filterEntityRelations,
|
|
133
|
-
itemsToDisplay,
|
|
142
|
+
itemsToDisplay: updatedItemsToDisplay,
|
|
134
143
|
entitySameAsCurrentItemEntity,
|
|
135
144
|
useRandomSort
|
|
136
145
|
});
|
|
146
|
+
|
|
147
|
+
const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
|
|
148
|
+
|
|
137
149
|
const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {
|
|
138
150
|
variables,
|
|
139
151
|
fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
|
|
140
|
-
skip: shouldReturn(
|
|
152
|
+
skip: shouldReturn(
|
|
153
|
+
hasNoFiltersOrItemsToDisplay,
|
|
154
|
+
_loading,
|
|
155
|
+
_load,
|
|
156
|
+
schemaLoading,
|
|
157
|
+
_error,
|
|
158
|
+
_err,
|
|
159
|
+
schemaError
|
|
160
|
+
)
|
|
141
161
|
});
|
|
142
162
|
|
|
143
|
-
const imageIds =
|
|
163
|
+
const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);
|
|
144
164
|
const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);
|
|
145
165
|
const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
|
|
146
166
|
const hasError = shouldReturn(_error, _err, schemaError);
|
|
147
167
|
|
|
148
|
-
if (
|
|
168
|
+
if (hasNoFiltersOrItemsToDisplay) return null;
|
|
149
169
|
if (isLoading) return null;
|
|
150
170
|
if (hasError) return null;
|
|
151
171
|
if (cardsError) return cardsError.message;
|
|
@@ -160,7 +180,7 @@ const CardsRender = ({
|
|
|
160
180
|
|
|
161
181
|
const orderedData = useRandomSort
|
|
162
182
|
? cardDataResults
|
|
163
|
-
: sortResponseData(cardDataResults,
|
|
183
|
+
: sortResponseData(cardDataResults, updatedItemsToDisplay);
|
|
164
184
|
const { regularChildren, gtmChildren } = splitChildren(
|
|
165
185
|
children,
|
|
166
186
|
cardDataResults,
|
|
@@ -169,7 +189,7 @@ const CardsRender = ({
|
|
|
169
189
|
name: variableProps.name
|
|
170
190
|
}
|
|
171
191
|
);
|
|
172
|
-
const updatedCards = appendImages(imagesData, orderedData,
|
|
192
|
+
const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);
|
|
173
193
|
|
|
174
194
|
return (
|
|
175
195
|
<>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const getUpdatedItemsToDisplay = ({
|
|
2
|
+
parentSchema,
|
|
3
|
+
parentEntityData,
|
|
4
|
+
itemsToDisplay = [],
|
|
5
|
+
inheritedFilters = []
|
|
6
|
+
}) => {
|
|
7
|
+
const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);
|
|
8
|
+
|
|
9
|
+
if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
|
|
10
|
+
const { properties } = parentSchema;
|
|
11
|
+
const [, entityKey] = idProp.split('/');
|
|
12
|
+
if (!properties || !entityKey) return itemsToDisplay;
|
|
13
|
+
const queryValue = Object.keys(properties).find(
|
|
14
|
+
propKey =>
|
|
15
|
+
properties[propKey] &&
|
|
16
|
+
properties[propKey].relation &&
|
|
17
|
+
properties[propKey].relation.entityIdentifier === entityKey
|
|
18
|
+
);
|
|
19
|
+
const parentValues = parentEntityData[queryValue];
|
|
20
|
+
if (!parentValues) return itemsToDisplay;
|
|
21
|
+
const updatedItemsToDisplay = [...itemsToDisplay];
|
|
22
|
+
if (Array.isArray(parentValues)) {
|
|
23
|
+
parentValues.forEach(value => {
|
|
24
|
+
updatedItemsToDisplay.push({ displayItems: [value] });
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
updatedItemsToDisplay.push({ displayItems: [parentValues] });
|
|
28
|
+
}
|
|
29
|
+
return updatedItemsToDisplay;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default getUpdatedItemsToDisplay;
|
|
@@ -6,3 +6,4 @@ export { default as filterQuerySetup } from './filter-query-setup';
|
|
|
6
6
|
export { default as shouldReturn } from './should-return';
|
|
7
7
|
export { default as shouldSkipSingleQuery } from './should-skip-single-query';
|
|
8
8
|
export { default as getUpdatedSortProperties } from './get-updated-sort-properties';
|
|
9
|
+
export { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';
|
|
@@ -10,8 +10,8 @@ const SmoothScrollCarousel = ({
|
|
|
10
10
|
}) => {
|
|
11
11
|
const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;
|
|
12
12
|
const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;
|
|
13
|
-
const
|
|
14
|
-
const animationDuration = `${
|
|
13
|
+
const animationTime = (autoScrollTimer * numberOfCards) / 1000;
|
|
14
|
+
const animationDuration = `${animationTime < 1 ? 1 : animationTime}s`;
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div className={wrapperClassName}>
|
|
@@ -7,26 +7,30 @@ import { getClassModifiers } from '../../utils';
|
|
|
7
7
|
import { CODE } from '../../constants';
|
|
8
8
|
import { wrapScriptTags } from './helpers';
|
|
9
9
|
|
|
10
|
-
const Code = memo(({ code: embedCode, parserOptions, ...otherProps }) => {
|
|
10
|
+
const Code = memo(({ code: embedCode, parserOptions, disableWrapper, ...otherProps }) => {
|
|
11
11
|
if (!embedCode) return null;
|
|
12
12
|
|
|
13
13
|
const parsedCode = parseHTML(embedCode, parserOptions);
|
|
14
14
|
const wrappedCode = wrapScriptTags(parsedCode);
|
|
15
15
|
const modifiers = getClassModifiers(CODE, { ...otherProps });
|
|
16
16
|
|
|
17
|
+
if (disableWrapper) return wrappedCode;
|
|
18
|
+
|
|
17
19
|
return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
Code.propTypes = {
|
|
21
23
|
code: PropTypes.string,
|
|
22
24
|
modifier: PropTypes.string,
|
|
23
|
-
parserOptions: PropTypes.object
|
|
25
|
+
parserOptions: PropTypes.object,
|
|
26
|
+
disableWrapper: PropTypes.bool
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
Code.defaultProps = {
|
|
27
30
|
code: '',
|
|
28
31
|
modifier: '',
|
|
29
|
-
parserOptions: {}
|
|
32
|
+
parserOptions: {},
|
|
33
|
+
disableWrapper: false
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
export default withTitle(Code);
|
|
@@ -3,6 +3,7 @@ import flatten from 'lodash.flatten';
|
|
|
3
3
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
4
4
|
import getLoopPropsLimit from './get-loop-props-limit';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
|
+
import { processDataSummaryValue } from '../../../helpers';
|
|
6
7
|
|
|
7
8
|
const getLoopValue = value => {
|
|
8
9
|
const { keyField } = value;
|
|
@@ -44,10 +45,13 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
44
45
|
|
|
45
46
|
return propertiesToDisplay.map(key => {
|
|
46
47
|
const loopValue = loopValues[key];
|
|
47
|
-
const
|
|
48
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
49
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
48
50
|
if (!propValue) return null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
|
|
52
|
+
const processedValue = processDataSummaryValue(propValue, options);
|
|
53
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
54
|
+
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
51
55
|
});
|
|
52
56
|
})
|
|
53
57
|
).filter(Boolean);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import upperFirst from 'lodash.upperfirst';
|
|
2
2
|
import flatten from 'lodash.flatten';
|
|
3
|
-
import { isObject } from '../../../helpers';
|
|
3
|
+
import { isObject, processDataSummaryValue } from '../../../helpers';
|
|
4
4
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
6
|
import getLinkBasedOnValue from './get-link-based-on-value';
|
|
@@ -27,15 +27,18 @@ const buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {
|
|
|
27
27
|
const objPropValue = getPropValue(key, props, options);
|
|
28
28
|
if (!objPropValue) return null;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const processedValue = processDataSummaryValue(objPropValue, options);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const link = getLink(enableLink, key, props, processedValue);
|
|
33
|
+
|
|
34
|
+
return [upperFirst(label), processedValue, link, modifier];
|
|
33
35
|
});
|
|
34
36
|
})
|
|
35
37
|
).filter(Boolean);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export default buildPropsToDisplayWithContent;
|
|
41
|
+
|
|
39
42
|
function getLink(enableLink, key, props, objPropValue) {
|
|
40
43
|
let link = '';
|
|
41
44
|
if (enableLink) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
|
|
5
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
6
|
+
|
|
4
7
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
8
|
return content && content.url ? content.url : '';
|
|
6
9
|
};
|
|
@@ -7,7 +7,13 @@ import { MainContext } from '@blaze-cms/nextjs-components';
|
|
|
7
7
|
import { generateSingleItemQuery, getItemList } from '../../application/query';
|
|
8
8
|
import ListBuilder from './ListBuilder';
|
|
9
9
|
import { AZ_LIST_TYPE } from './constants';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getAzQueryFilter,
|
|
12
|
+
getSortProps,
|
|
13
|
+
hasRequiredItemListDetails,
|
|
14
|
+
getListSpecificSearchFilter,
|
|
15
|
+
getListQuery
|
|
16
|
+
} from './helpers';
|
|
11
17
|
import {
|
|
12
18
|
getGenericProps,
|
|
13
19
|
getRequiredSchemas,
|
|
@@ -37,7 +43,7 @@ const ListFactory = props => {
|
|
|
37
43
|
type,
|
|
38
44
|
sortby: defaultSortBy,
|
|
39
45
|
sort: defaultSort,
|
|
40
|
-
|
|
46
|
+
allSearchFilters,
|
|
41
47
|
operator: filterOperator,
|
|
42
48
|
sortProperties,
|
|
43
49
|
itemListName
|
|
@@ -46,11 +52,13 @@ const ListFactory = props => {
|
|
|
46
52
|
const router = useRouter();
|
|
47
53
|
const { asPath } = router;
|
|
48
54
|
const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = parseUrl(parsedQuery);
|
|
55
|
+
const [searchFilter, hasListSpecificFilters] = getListSpecificSearchFilter(
|
|
56
|
+
allSearchFilters,
|
|
57
|
+
name
|
|
58
|
+
);
|
|
59
|
+
const { query, url, query: { itemListId: queryItemListId } = {} } = parseUrl(parsedQuery);
|
|
60
|
+
const updatedQuery = getListQuery(query, hasListSpecificFilters, name);
|
|
61
|
+
const { sort: querySort, sortby: querySortBy } = updatedQuery;
|
|
54
62
|
const { sortbyFilters, updatedSortProperties } = getSortProps({
|
|
55
63
|
querySort,
|
|
56
64
|
sortProperties,
|
|
@@ -62,8 +70,8 @@ const ListFactory = props => {
|
|
|
62
70
|
const itemListId = getItemListId(itemListName, queryItemListId);
|
|
63
71
|
const { itemEntity: parentEntity, itemId: parentId } = parent;
|
|
64
72
|
const updatedParentEntity = getUnpublishedEntityName(parentEntity);
|
|
65
|
-
const paginationIndex = getPaginationIndex(
|
|
66
|
-
const azFilter = getAzQueryFilter(
|
|
73
|
+
const paginationIndex = getPaginationIndex(updatedQuery, name);
|
|
74
|
+
const azFilter = getAzQueryFilter(updatedQuery, name);
|
|
67
75
|
|
|
68
76
|
const entitiesToUse = entities && entities.length ? entities : [legacyEntity];
|
|
69
77
|
const [filterEntity] = entitiesToUse;
|
|
@@ -123,10 +131,12 @@ const ListFactory = props => {
|
|
|
123
131
|
const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);
|
|
124
132
|
const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;
|
|
125
133
|
const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;
|
|
126
|
-
const valuesText = shouldApplyTextFilter
|
|
127
|
-
|
|
134
|
+
const valuesText = shouldApplyTextFilter
|
|
135
|
+
? buildSearchValuesText(textFilter, updatedQuery, name)
|
|
136
|
+
: [];
|
|
137
|
+
const { valuesAnd, valuesOr } = getQueryFilters(searchFilter, updatedQuery, name);
|
|
128
138
|
const isTextSearchFilterApplied = !!(
|
|
129
|
-
|
|
139
|
+
updatedQuery.search_term &&
|
|
130
140
|
searchFilter &&
|
|
131
141
|
getSearchFilterType(searchFilter, TEXT_SEARCH).length
|
|
132
142
|
);
|
|
@@ -139,7 +149,7 @@ const ListFactory = props => {
|
|
|
139
149
|
const listProps = {
|
|
140
150
|
...props,
|
|
141
151
|
...genericProps,
|
|
142
|
-
query,
|
|
152
|
+
query: updatedQuery,
|
|
143
153
|
url,
|
|
144
154
|
isCard,
|
|
145
155
|
isAZ,
|
|
@@ -179,7 +189,7 @@ ListFactory.propTypes = {
|
|
|
179
189
|
name: PropTypes.string,
|
|
180
190
|
sortby: PropTypes.array,
|
|
181
191
|
sort: PropTypes.string,
|
|
182
|
-
|
|
192
|
+
allSearchFilters: PropTypes.array,
|
|
183
193
|
sortProperties: PropTypes.array,
|
|
184
194
|
itemListName: PropTypes.string
|
|
185
195
|
};
|
|
@@ -195,7 +205,7 @@ ListFactory.defaultProps = {
|
|
|
195
205
|
sortProperties: [],
|
|
196
206
|
sort: '',
|
|
197
207
|
operator: AND,
|
|
198
|
-
|
|
208
|
+
allSearchFilters: [],
|
|
199
209
|
itemListName: ''
|
|
200
210
|
};
|
|
201
211
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import stripQueryKey from './strip-query-key';
|
|
2
|
+
|
|
3
|
+
const getListQuery = (query, hasListSpecificFilters, name) => {
|
|
4
|
+
const updatedQuery = {};
|
|
5
|
+
const listKey = `pb[${name}]`;
|
|
6
|
+
const paginationKey = `${listKey}[page]`;
|
|
7
|
+
const sortKey = `${listKey}[sort]`;
|
|
8
|
+
const sortByKey = `${listKey}[sortby]`;
|
|
9
|
+
|
|
10
|
+
Object.keys(query).forEach(queryKey => {
|
|
11
|
+
const isListKey = queryKey.indexOf(`${listKey}`) !== -1;
|
|
12
|
+
const decodedQueryValue = Array.isArray(query[queryKey])
|
|
13
|
+
? query[queryKey].map(value => decodeURIComponent(value))
|
|
14
|
+
: decodeURIComponent(query[queryKey]);
|
|
15
|
+
if (hasListSpecificFilters) {
|
|
16
|
+
const strippedKey = stripQueryKey(queryKey, listKey, paginationKey);
|
|
17
|
+
if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;
|
|
18
|
+
} else {
|
|
19
|
+
if (queryKey.indexOf('pb[') === -1) updatedQuery[queryKey] = decodedQueryValue;
|
|
20
|
+
if (queryKey.indexOf(paginationKey) !== -1) updatedQuery[queryKey] = decodedQueryValue;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
updatedQuery.sort = query[sortKey] || query.sort;
|
|
24
|
+
updatedQuery.sortby = query[sortByKey] || query.sortby;
|
|
25
|
+
return updatedQuery;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default getListQuery;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const getListSpecificSearchFilter = (searchFilters, listName) => {
|
|
2
|
+
const searchFilterMatch = searchFilters.find(
|
|
3
|
+
({ settings: { listComponentName } }) => listComponentName === listName
|
|
4
|
+
);
|
|
5
|
+
const hasListSpecificFilters = !!searchFilterMatch;
|
|
6
|
+
const searchFilterToUse = searchFilterMatch || searchFilters[0] || {};
|
|
7
|
+
return [searchFilterToUse, hasListSpecificFilters];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default getListSpecificSearchFilter;
|
|
@@ -7,3 +7,5 @@ export { default as getItemsPerPageToUse } from './get-items-per-page-to-use';
|
|
|
7
7
|
export { default as getSortProps } from './get-sort-props';
|
|
8
8
|
export { default as hasRequiredItemListDetails } from './has-required-item-list-details';
|
|
9
9
|
export { default as getListComponent } from './get-list-component';
|
|
10
|
+
export { default as getListQuery } from './get-list-query';
|
|
11
|
+
export { default as getListSpecificSearchFilter } from './get-list-specific-search-filter';
|
|
@@ -10,12 +10,12 @@ const SearchContent = ({
|
|
|
10
10
|
searchInputAlignment,
|
|
11
11
|
searchInputWrapperMobile,
|
|
12
12
|
searchInputWrapperDesktop,
|
|
13
|
-
collapsible,
|
|
14
13
|
isMobile,
|
|
15
14
|
placeholder,
|
|
16
|
-
modifier
|
|
15
|
+
modifier,
|
|
16
|
+
collapsedSearch
|
|
17
17
|
}) => {
|
|
18
|
-
const [collapsed, setCollapsed] = useState(
|
|
18
|
+
const [collapsed, setCollapsed] = useState(collapsedSearch);
|
|
19
19
|
const router = useRouter();
|
|
20
20
|
|
|
21
21
|
const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({
|
|
@@ -50,7 +50,7 @@ const SearchContent = ({
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const handleOnBlur = () => {
|
|
53
|
-
if (!
|
|
53
|
+
if (!collapsedSearch) return;
|
|
54
54
|
if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -118,9 +118,9 @@ SearchContent.propTypes = {
|
|
|
118
118
|
searchInputWrapperDesktop: PropTypes.string,
|
|
119
119
|
placeholder: PropTypes.string,
|
|
120
120
|
isMobile: PropTypes.bool,
|
|
121
|
-
collapsible: PropTypes.bool,
|
|
122
121
|
entities: PropTypes.array.isRequired,
|
|
123
|
-
modifier: PropTypes.string
|
|
122
|
+
modifier: PropTypes.string,
|
|
123
|
+
collapsedSearch: PropTypes.bool
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
SearchContent.defaultProps = {
|
|
@@ -129,8 +129,8 @@ SearchContent.defaultProps = {
|
|
|
129
129
|
searchInputWrapperDesktop: '',
|
|
130
130
|
placeholder: '',
|
|
131
131
|
isMobile: false,
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
modifier: '',
|
|
133
|
+
collapsedSearch: false
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export default SearchContent;
|
|
@@ -3,12 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import debounce from 'lodash.debounce';
|
|
5
5
|
import FiltersList from './FiltersList';
|
|
6
|
-
import {
|
|
7
|
-
isDeviceDesktop,
|
|
8
|
-
buildQuery,
|
|
9
|
-
getInitialFilterValues,
|
|
10
|
-
getResponsiveFilterClassnames
|
|
11
|
-
} from '../helpers';
|
|
6
|
+
import { isDeviceDesktop, buildUrlQuery, getResponsiveFilterClassnames } from '../helpers';
|
|
12
7
|
import CloseMobileForm from './CloseMobileForm';
|
|
13
8
|
import ResetDesktopForm from './ResetDesktopForm';
|
|
14
9
|
import MobileFormToolbar from './MobileFormToolbar';
|
|
@@ -16,6 +11,7 @@ import { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';
|
|
|
16
11
|
|
|
17
12
|
const SearchFilter = ({
|
|
18
13
|
searchFilterRef,
|
|
14
|
+
listComponentName,
|
|
19
15
|
data,
|
|
20
16
|
filters,
|
|
21
17
|
hasUrl,
|
|
@@ -28,13 +24,14 @@ const SearchFilter = ({
|
|
|
28
24
|
groupAfterDesktop,
|
|
29
25
|
groupAfterMobile,
|
|
30
26
|
filterValues,
|
|
31
|
-
setAppliedFilters
|
|
27
|
+
setAppliedFilters,
|
|
28
|
+
query
|
|
32
29
|
}) => {
|
|
33
30
|
const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);
|
|
34
31
|
const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);
|
|
35
32
|
|
|
36
|
-
const doSubmit =
|
|
37
|
-
const newQuery =
|
|
33
|
+
const doSubmit = newValues => {
|
|
34
|
+
const newQuery = buildUrlQuery(newValues, filters, listComponentName, query);
|
|
38
35
|
handleSearch(newQuery);
|
|
39
36
|
setMoreFiltersDesktopCollapsed(true);
|
|
40
37
|
setMoreFiltersMobileCollapsed(true);
|
|
@@ -69,9 +66,8 @@ const SearchFilter = ({
|
|
|
69
66
|
const formId = `filter-${name}-form`;
|
|
70
67
|
|
|
71
68
|
const handleReset = () => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
doSubmit(newValues);
|
|
69
|
+
setAppliedFilters({ type: 'reset' });
|
|
70
|
+
doSubmit();
|
|
75
71
|
};
|
|
76
72
|
|
|
77
73
|
const updateFilterValues = (newValues, shouldSubmit) => {
|
|
@@ -79,7 +75,7 @@ const SearchFilter = ({
|
|
|
79
75
|
};
|
|
80
76
|
|
|
81
77
|
const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
|
|
82
|
-
|
|
78
|
+
|
|
83
79
|
return (
|
|
84
80
|
<>
|
|
85
81
|
<form
|
|
@@ -89,7 +85,7 @@ const SearchFilter = ({
|
|
|
89
85
|
id={formId}
|
|
90
86
|
onSubmit={e => {
|
|
91
87
|
e.preventDefault();
|
|
92
|
-
doSubmit();
|
|
88
|
+
doSubmit(filterValues);
|
|
93
89
|
}}>
|
|
94
90
|
{displaySearchFilter && (
|
|
95
91
|
<CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />
|
|
@@ -101,7 +97,7 @@ const SearchFilter = ({
|
|
|
101
97
|
<div className="filter__wrapper filter__wrapper--search-refine">
|
|
102
98
|
{!shouldGroup && (
|
|
103
99
|
<FiltersList
|
|
104
|
-
shouldSearch={
|
|
100
|
+
shouldSearch={!hasUrl}
|
|
105
101
|
data={data}
|
|
106
102
|
filters={filters}
|
|
107
103
|
hasUrl={hasUrl}
|
|
@@ -114,7 +110,7 @@ const SearchFilter = ({
|
|
|
114
110
|
{shouldGroup && (
|
|
115
111
|
<>
|
|
116
112
|
<FiltersList
|
|
117
|
-
shouldSearch={
|
|
113
|
+
shouldSearch={!hasUrl}
|
|
118
114
|
data={data}
|
|
119
115
|
filters={filters.slice(0, groupAfterMobile)}
|
|
120
116
|
hasUrl={hasUrl}
|
|
@@ -136,7 +132,7 @@ const SearchFilter = ({
|
|
|
136
132
|
<div className={moreFiltersMobileWrapperClass}>
|
|
137
133
|
<div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>
|
|
138
134
|
<FiltersList
|
|
139
|
-
shouldSearch={
|
|
135
|
+
shouldSearch={!hasUrl && isDeviceDesktop()}
|
|
140
136
|
data={data}
|
|
141
137
|
filters={filters.slice(
|
|
142
138
|
groupAfterMobile,
|
|
@@ -233,7 +229,14 @@ SearchFilter.propTypes = {
|
|
|
233
229
|
groupAfterDesktop: PropTypes.number.isRequired,
|
|
234
230
|
groupAfterMobile: PropTypes.number.isRequired,
|
|
235
231
|
filterValues: PropTypes.object.isRequired,
|
|
236
|
-
setAppliedFilters: PropTypes.func.isRequired
|
|
232
|
+
setAppliedFilters: PropTypes.func.isRequired,
|
|
233
|
+
listComponentName: PropTypes.string,
|
|
234
|
+
query: PropTypes.object
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
SearchFilter.defaultProps = {
|
|
238
|
+
listComponentName: '',
|
|
239
|
+
query: {}
|
|
237
240
|
};
|
|
238
241
|
|
|
239
242
|
export default SearchFilter;
|