@blaze-cms/react-page-builder 0.128.0-admin-updates.5 → 0.128.0-admin-updates.8
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 +21 -0
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +53 -24
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/helpers/check-if-should-render-banner.js +27 -5
- package/lib/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
- package/lib/components/List/components/helpers/index.js +8 -2
- package/lib/components/List/components/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +6 -1
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +9 -5
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +9 -5
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +9 -5
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/components/Card/Card.js +1 -1
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/Card/CardsContainer.js +59 -35
- package/lib-es/components/Card/CardsContainer.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
- package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib-es/components/Image/Image.js +1 -1
- package/lib-es/components/Image/Image.js.map +1 -1
- package/lib-es/components/List/components/Full/FullRender.js.map +1 -1
- package/lib-es/components/List/components/helpers/check-if-should-render-banner.js +29 -3
- package/lib-es/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
- package/lib-es/components/List/components/helpers/index.js +3 -2
- package/lib-es/components/List/components/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +6 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Range.js +9 -5
- package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +9 -5
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +9 -5
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Card/Card.js +2 -2
- package/src/components/Card/CardsContainer.js +54 -35
- package/src/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +1 -1
- package/src/components/Image/Image.js +1 -1
- package/src/components/List/components/Full/FullRender.js +0 -1
- package/src/components/List/components/helpers/check-if-should-render-banner.js +24 -3
- package/src/components/List/components/helpers/index.js +4 -2
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +0 -1
- package/src/components/SearchFilter/components/Checkbox.js +4 -0
- package/src/components/SearchFilter/components/Range.js +7 -4
- package/src/components/SearchFilter/components/Select.js +23 -17
- package/src/components/SearchFilter/components/TextSearch.js +30 -26
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +10 -10
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +8 -8
- package/tests/unit/src/components/DataSummary/DataSummaryTypes/__snapshots__/ItemDetailsSummary.test.js.snap +24 -4
- package/tests/unit/src/components/List/components/Cards/__snapshots__/CardsRender.test.js.snap +12 -12
- package/tests/unit/src/components/List/components/helpers/check-if-should-render-banner.test.js +59 -28
|
@@ -9,7 +9,6 @@ import { useRouter } from 'next/router';
|
|
|
9
9
|
import Select from '@blaze-react/select';
|
|
10
10
|
import { parseUrl } from 'query-string';
|
|
11
11
|
import { useGetSingleEntitySchema } from '../../../hooks';
|
|
12
|
-
import { withTitle } from '../../../HOC';
|
|
13
12
|
import { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';
|
|
14
13
|
import { decodeValue } from '../helpers/decode-encode';
|
|
15
14
|
const Range = ({
|
|
@@ -20,7 +19,8 @@ const Range = ({
|
|
|
20
19
|
dataAggregations,
|
|
21
20
|
updateFilterValues,
|
|
22
21
|
filterValues,
|
|
23
|
-
shouldSearch
|
|
22
|
+
shouldSearch,
|
|
23
|
+
elementTitle
|
|
24
24
|
}) => {
|
|
25
25
|
const router = useRouter();
|
|
26
26
|
const debounceAmount = shouldSearch ? 1200 : 400;
|
|
@@ -59,7 +59,9 @@ const Range = ({
|
|
|
59
59
|
})
|
|
60
60
|
}, shouldSearch);
|
|
61
61
|
}, debounceAmount);
|
|
62
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
62
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "heading heading--section"
|
|
64
|
+
}, elementTitle), hasMultipleOptions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(Select, {
|
|
63
65
|
value: rangeOption,
|
|
64
66
|
id: rangeOption,
|
|
65
67
|
options: options,
|
|
@@ -101,12 +103,14 @@ Range.propTypes = {
|
|
|
101
103
|
shouldSearch: PropTypes.bool,
|
|
102
104
|
rangeInterval: PropTypes.number,
|
|
103
105
|
label: PropTypes.string,
|
|
106
|
+
elementTitle: PropTypes.string,
|
|
104
107
|
dataAggregations: PropTypes.object.isRequired
|
|
105
108
|
};
|
|
106
109
|
Range.defaultProps = {
|
|
107
110
|
shouldSearch: false,
|
|
108
111
|
rangeInterval: 1,
|
|
109
|
-
label: ''
|
|
112
|
+
label: '',
|
|
113
|
+
elementTitle: ''
|
|
110
114
|
};
|
|
111
|
-
export default
|
|
115
|
+
export default Range;
|
|
112
116
|
//# sourceMappingURL=Range.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Range.js","names":["React","PropTypes","debounce","RangeFilter","useRouter","Select","parseUrl","useGetSingleEntitySchema","
|
|
1
|
+
{"version":3,"file":"Range.js","names":["React","PropTypes","debounce","RangeFilter","useRouter","Select","parseUrl","useGetSingleEntitySchema","getSelectOptions","getIntersectedProp","getRangeValue","calculateMinMax","decodeValue","Range","rangeInterval","label","entity","propsToDisplay","dataAggregations","updateFilterValues","filterValues","shouldSearch","elementTitle","router","debounceAmount","query","asPath","hasMultipleOptions","length","initialRangeOption","rangeOption","selectedOption","rangeValue","data","getEntitySchema","loading","options","min","max","minValue","maxValue","valueToUse","_objectSpread","handleChange","option","value","createElement","Fragment","className","id","required","onChange","updatedOptions","forEach","prop","eMin","eMax","initValue","key","name","propTypes","array","isRequired","string","object","func","bool","number","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Range.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash.debounce';\nimport RangeFilter from '@blaze-react/range-filter';\nimport { useRouter } from 'next/router';\nimport Select from '@blaze-react/select';\nimport { parseUrl } from 'query-string';\nimport { useGetSingleEntitySchema } from '../../../hooks';\nimport { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';\nimport { decodeValue } from '../helpers/decode-encode';\n\nconst Range = ({\n rangeInterval,\n label,\n entity,\n propsToDisplay,\n dataAggregations,\n updateFilterValues,\n filterValues,\n shouldSearch,\n elementTitle\n}) => {\n const router = useRouter();\n const debounceAmount = shouldSearch ? 1200 : 400;\n const { query } = parseUrl(decodeValue(router.asPath));\n const hasMultipleOptions = propsToDisplay.length > 1;\n const initialRangeOption = getIntersectedProp(query, propsToDisplay) || propsToDisplay[0];\n const rangeOption =\n (filterValues[initialRangeOption] && filterValues[initialRangeOption].selectedOption) ||\n initialRangeOption;\n const rangeValue = filterValues[rangeOption];\n\n const { data: { getEntitySchema = {} } = {}, loading } = useGetSingleEntitySchema(\n entity,\n !hasMultipleOptions\n );\n\n if (loading || !rangeOption || !rangeValue) return '';\n\n const options = getSelectOptions(getEntitySchema, propsToDisplay);\n // get range from aggregations so it updates\n const { min, max } = calculateMinMax(dataAggregations[rangeOption], rangeInterval);\n const minValue = rangeValue.minValue < min ? min : rangeValue.minValue;\n const maxValue = rangeValue.maxValue > max ? max : rangeValue.maxValue;\n const valueToUse = { ...rangeValue, min, max, minValue, maxValue };\n\n const handleChange = debounce((option, value) => {\n updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } }, shouldSearch);\n }, debounceAmount);\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n {hasMultipleOptions && (\n <>\n <label>{label}</label>\n <Select\n value={rangeOption}\n id={rangeOption}\n options={options}\n required\n onChange={({ value }) => {\n const updatedOptions = {};\n propsToDisplay.forEach(prop => {\n const { min: eMin, max: eMax } = filterValues[prop];\n const initValue = getRangeValue(null, rangeInterval, eMin, eMax);\n updatedOptions[prop] = { ...initValue, selectedOption: value };\n });\n\n updateFilterValues(updatedOptions, false);\n }}\n />\n </>\n )}\n <RangeFilter\n key={`${rangeOption}-${minValue}-${maxValue}`}\n name={rangeOption}\n label={hasMultipleOptions ? '' : label}\n value={valueToUse}\n id={rangeOption}\n onChange={({ value }) => {\n handleChange(rangeOption, value);\n }}\n />\n </>\n );\n};\n\nRange.propTypes = {\n propsToDisplay: PropTypes.array.isRequired,\n entity: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n rangeInterval: PropTypes.number,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n dataAggregations: PropTypes.object.isRequired\n};\n\nRange.defaultProps = {\n shouldSearch: false,\n rangeInterval: 1,\n label: '',\n elementTitle: ''\n};\n\nexport default Range;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,eAAe,QAAQ,YAAY;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AAEtD,MAAMC,KAAK,GAAGA,CAAC;EACbC,aAAa;EACbC,KAAK;EACLC,MAAM;EACNC,cAAc;EACdC,gBAAgB;EAChBC,kBAAkB;EAClBC,YAAY;EACZC,YAAY;EACZC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGnB,SAAS,EAAE;EAC1B,MAAMoB,cAAc,GAAGH,YAAY,GAAG,IAAI,GAAG,GAAG;EAChD,MAAM;IAAEI;EAAM,CAAC,GAAGnB,QAAQ,CAACM,WAAW,CAACW,MAAM,CAACG,MAAM,CAAC,CAAC;EACtD,MAAMC,kBAAkB,GAAGV,cAAc,CAACW,MAAM,GAAG,CAAC;EACpD,MAAMC,kBAAkB,GAAGpB,kBAAkB,CAACgB,KAAK,EAAER,cAAc,CAAC,IAAIA,cAAc,CAAC,CAAC,CAAC;EACzF,MAAMa,WAAW,GACdV,YAAY,CAACS,kBAAkB,CAAC,IAAIT,YAAY,CAACS,kBAAkB,CAAC,CAACE,cAAc,IACpFF,kBAAkB;EACpB,MAAMG,UAAU,GAAGZ,YAAY,CAACU,WAAW,CAAC;EAE5C,M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UAAU;EACnC1C,YAAY,EAAEnB,SAAS,CAAC+D,MAAM,CAACF,UAAU;EACzC3C,kBAAkB,EAAElB,SAAS,CAACgE,IAAI,CAACH,UAAU;EAC7CzC,YAAY,EAAEpB,SAAS,CAACiE,IAAI;EAC5BpD,aAAa,EAAEb,SAAS,CAACkE,MAAM;EAC/BpD,KAAK,EAAEd,SAAS,CAAC8D,MAAM;EACvBzC,YAAY,EAAErB,SAAS,CAAC8D,MAAM;EAC9B7C,gBAAgB,EAAEjB,SAAS,CAAC+D,MAAM,CAACF;AACrC,CAAC;AAEDjD,KAAK,CAACuD,YAAY,GAAG;EACnB/C,YAAY,EAAE,KAAK;EACnBP,aAAa,EAAE,CAAC;EAChBC,KAAK,EAAE,EAAE;EACTO,YAAY,EAAE;AAChB,CAAC;AAED,eAAeT,KAAK"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Select from '@blaze-react/select';
|
|
4
|
-
import { withTitle } from '../../../HOC';
|
|
5
4
|
import { DEFAULT_OPTION } from '../constants';
|
|
6
5
|
const SelectFilter = ({
|
|
7
6
|
data,
|
|
@@ -11,7 +10,8 @@ const SelectFilter = ({
|
|
|
11
10
|
filterValues,
|
|
12
11
|
shouldSearch,
|
|
13
12
|
displayLabelAsPlaceholder,
|
|
14
|
-
displayFilterCount
|
|
13
|
+
displayFilterCount,
|
|
14
|
+
elementTitle
|
|
15
15
|
}) => {
|
|
16
16
|
const filterValue = filterValues[prop] || '';
|
|
17
17
|
const disabledOptions = [];
|
|
@@ -33,7 +33,9 @@ const SelectFilter = ({
|
|
|
33
33
|
defaultTextValue = labelToUse;
|
|
34
34
|
labelToUse = null;
|
|
35
35
|
}
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "heading heading--section"
|
|
38
|
+
}, elementTitle), /*#__PURE__*/React.createElement(Select, {
|
|
37
39
|
label: labelToUse,
|
|
38
40
|
value: filterValue,
|
|
39
41
|
id: prop,
|
|
@@ -50,7 +52,7 @@ const SelectFilter = ({
|
|
|
50
52
|
}, shouldSearch);
|
|
51
53
|
},
|
|
52
54
|
disabled: disabledOptions
|
|
53
|
-
});
|
|
55
|
+
}));
|
|
54
56
|
};
|
|
55
57
|
SelectFilter.propTypes = {
|
|
56
58
|
data: PropTypes.object.isRequired,
|
|
@@ -59,6 +61,7 @@ SelectFilter.propTypes = {
|
|
|
59
61
|
updateFilterValues: PropTypes.func.isRequired,
|
|
60
62
|
shouldSearch: PropTypes.bool,
|
|
61
63
|
label: PropTypes.string,
|
|
64
|
+
elementTitle: PropTypes.string,
|
|
62
65
|
displayLabelAsPlaceholder: PropTypes.bool,
|
|
63
66
|
displayFilterCount: PropTypes.bool
|
|
64
67
|
};
|
|
@@ -66,8 +69,9 @@ SelectFilter.defaultProps = {
|
|
|
66
69
|
filterValues: {},
|
|
67
70
|
shouldSearch: false,
|
|
68
71
|
label: '',
|
|
72
|
+
elementTitle: '',
|
|
69
73
|
displayLabelAsPlaceholder: false,
|
|
70
74
|
displayFilterCount: false
|
|
71
75
|
};
|
|
72
|
-
export default
|
|
76
|
+
export default SelectFilter;
|
|
73
77
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["React","PropTypes","Select","
|
|
1
|
+
{"version":3,"file":"Select.js","names":["React","PropTypes","Select","DEFAULT_OPTION","SelectFilter","data","label","prop","updateFilterValues","filterValues","shouldSearch","displayLabelAsPlaceholder","displayFilterCount","elementTitle","filterValue","disabledOptions","buckets","options","map","key","doc_count","count","push","optionLabel","filter","Boolean","sort","labelText","labelToUse","defaultTextValue","createElement","Fragment","className","value","id","onChange","valueToUse","disabled","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Select.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { DEFAULT_OPTION } from '../constants';\n\nconst SelectFilter = ({\n data,\n label,\n prop,\n updateFilterValues,\n filterValues,\n shouldSearch,\n displayLabelAsPlaceholder,\n displayFilterCount,\n elementTitle\n}) => {\n const filterValue = filterValues[prop] || '';\n const disabledOptions = [];\n const { buckets = [] } = data[prop] || {};\n const options = buckets\n .map(({ key, doc_count: count }) => {\n if (!count) disabledOptions.push(key);\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel];\n })\n .filter(Boolean)\n .sort();\n\n const labelText = label || prop;\n let labelToUse = labelText;\n let defaultTextValue = DEFAULT_OPTION;\n if (displayLabelAsPlaceholder) {\n defaultTextValue = labelToUse;\n labelToUse = null;\n }\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <Select\n label={labelToUse}\n value={filterValue}\n id={prop}\n data-testid={`filter-${prop}`}\n options={options}\n defaultTextValue={defaultTextValue}\n onChange={({ value }) => {\n let valueToUse = value;\n if (value === defaultTextValue) valueToUse = '';\n updateFilterValues({ [prop]: valueToUse }, shouldSearch);\n }}\n disabled={disabledOptions}\n />\n </>\n );\n};\n\nSelectFilter.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n\n displayLabelAsPlaceholder: PropTypes.bool,\n displayFilterCount: PropTypes.bool\n};\n\nSelectFilter.defaultProps = {\n filterValues: {},\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayLabelAsPlaceholder: false,\n displayFilterCount: false\n};\n\nexport default SelectFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAAS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3B,IAAK;IACT,eAAc,UAASA,IAAK,EAAE;IAC9BU,OAAO,EAAEA,OAAQ;IACjBY,gBAAgB,EAAEA,gBAAiB;IACnCM,QAAQ,EAAEA,CAAC;MAAEF;IAAM,CAAC,KAAK;MACvB,IAAIG,UAAU,GAAGH,KAAK;MACtB,IAAIA,KAAK,KAAKJ,gBAAgB,EAAEO,UAAU,GAAG,EAAE;MAC/C5B,kBAAkB,CAAC;QAAE,CAACD,IAAI,GAAG6B;MAAW,CAAC,EAAE1B,YAAY,CAAC;IAC1D,CAAE;IACF2B,QAAQ,EAAEtB;EAAgB,EAC1B,CACD;AAEP,CAAC;AAEDX,YAAY,CAACkC,SAAS,GAAG;EACvBjC,IAAI,EAAEJ,SAAS,CAACsC,MAAM,CAACC,UAAU;EACjCjC,IAAI,EAAEN,SAAS,CAACwC,MAAM,CAACD,UAAU;EACjC/B,YAAY,EAAER,SAAS,CAACsC,MAAM;EAC9B/B,kBAAkB,EAAEP,SAAS,CAACyC,IAAI,CAACF,UAAU;EAC7C9B,YAAY,EAAET,SAAS,CAAC0C,IAAI;EAC5BrC,KAAK,EAAEL,SAAS,CAACwC,MAAM;EACvB5B,YAAY,EAAEZ,SAAS,CAACwC,MAAM;EAE9B9B,yBAAyB,EAAEV,SAAS,CAAC0C,IAAI;EACzC/B,kBAAkB,EAAEX,SAAS,CAAC0C;AAChC,CAAC;AAEDvC,YAAY,CAACwC,YAAY,GAAG;EAC1BnC,YAAY,EAAE,CAAC,CAAC;EAChBC,YAAY,EAAE,KAAK;EACnBJ,KAAK,EAAE,EAAE;EACTO,YAAY,EAAE,EAAE;EAChBF,yBAAyB,EAAE,KAAK;EAChCC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeR,YAAY"}
|
|
@@ -2,13 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Input from '@blaze-react/input';
|
|
4
4
|
import { MdSearch } from 'react-icons/md';
|
|
5
|
-
import { withTitle } from '../../../HOC';
|
|
6
5
|
import { SEARCH_TERM } from '../constants';
|
|
7
6
|
const TextSearch = ({
|
|
8
7
|
label,
|
|
9
8
|
searchValue,
|
|
10
|
-
updateFilterValues
|
|
11
|
-
|
|
9
|
+
updateFilterValues,
|
|
10
|
+
elementTitle
|
|
11
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "heading heading--section"
|
|
13
|
+
}, elementTitle), /*#__PURE__*/React.createElement("div", {
|
|
12
14
|
className: "search"
|
|
13
15
|
}, /*#__PURE__*/React.createElement("div", {
|
|
14
16
|
className: "search__wrapper"
|
|
@@ -34,14 +36,16 @@ const TextSearch = ({
|
|
|
34
36
|
[SEARCH_TERM]: searchValue
|
|
35
37
|
}, true);
|
|
36
38
|
}
|
|
37
|
-
}, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdSearch, null)))));
|
|
39
|
+
}, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdSearch, null))))));
|
|
38
40
|
TextSearch.propTypes = {
|
|
39
41
|
searchValue: PropTypes.string.isRequired,
|
|
40
42
|
updateFilterValues: PropTypes.func.isRequired,
|
|
43
|
+
elementTitle: PropTypes.string,
|
|
41
44
|
label: PropTypes.string
|
|
42
45
|
};
|
|
43
46
|
TextSearch.defaultProps = {
|
|
47
|
+
elementTitle: '',
|
|
44
48
|
label: ''
|
|
45
49
|
};
|
|
46
|
-
export default
|
|
50
|
+
export default TextSearch;
|
|
47
51
|
//# sourceMappingURL=TextSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","
|
|
1
|
+
{"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","SEARCH_TERM","TextSearch","label","searchValue","updateFilterValues","elementTitle","createElement","Fragment","className","id","value","placeholder","onChange","eValue","type","onClick","e","preventDefault","propTypes","string","isRequired","func","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/TextSearch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport { MdSearch } from 'react-icons/md';\nimport { SEARCH_TERM } from '../constants';\n\nconst TextSearch = ({ label, searchValue, updateFilterValues, elementTitle }) => (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <div className=\"search\">\n <div className=\"search__wrapper\">\n <div className=\"form-field form-field--input form-field--search\">\n <Input\n id={SEARCH_TERM}\n value={searchValue}\n placeholder={label || 'Search'}\n onChange={({ value: eValue }) => {\n updateFilterValues({ [SEARCH_TERM]: eValue }, false);\n }}\n />\n </div>\n <button\n type=\"button\"\n className=\"icon-button icon-button--search\"\n onClick={e => {\n e.preventDefault();\n updateFilterValues({ [SEARCH_TERM]: searchValue }, true);\n }}>\n <i>\n <MdSearch />\n </i>\n </button>\n </div>\n </div>\n </>\n);\n\nTextSearch.propTypes = {\n searchValue: PropTypes.string.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n elementTitle: PropTypes.string,\n label: PropTypes.string\n};\n\nTextSearch.defaultProps = {\n elementTitle: '',\n label: ''\n};\n\nexport default TextSearch;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC,kBAAkB;EAAEC;AAAa,CAAC,kBAC1ET,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAAW,QAAA,QACGF,YAAY,iBAAIT,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAA0B,GAAEH,YAAY,CAAO,eAC/ET,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAQ,gBACrBZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiB,gBAC9BZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiD,gBAC9DZ,KAAA,CAAAU,aAAA,CAACR,KAAK;EACJW,EAAE,EAAET,WAAY;EAChBU,KAAK,EAAEP,WAAY;EACnBQ,WAAW,EAAET,KAAK,IAAI,QAAS;EAC/BU,QAAQ,EAAEA,CAAC;IAAEF,KAAK,EAAEG;EAAO,CAAC,KAAK;IAC/BT,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGa;IAAO,CAAC,EAAE,KAAK,CAAC;EACtD;AAAE,EACF,CACE,eACNjB,KAAA,CAAAU,aAAA;EACEQ,IAAI,EAAC,QAAQ;EACbN,SAAS,EAAC,iCAAiC;EAC3CO,OAAO,EAAEC,CAAC,IAAI;IACZA,CAAC,CAACC,cAAc,EAAE;IAClBb,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGG;IAAY,CAAC,EAAE,IAAI,CAAC;EAC1D;AAAE,gBACFP,KAAA,CAAAU,aAAA,yBACEV,KAAA,CAAAU,aAAA,CAACP,QAAQ,OAAG,CACV,CACG,CACL,CACF,CAET;AAEDE,UAAU,CAACiB,SAAS,GAAG;EACrBf,WAAW,EAAEN,SAAS,CAACsB,MAAM,CAACC,UAAU;EACxChB,kBAAkB,EAAEP,SAAS,CAACwB,IAAI,CAACD,UAAU;EAC7Cf,YAAY,EAAER,SAAS,CAACsB,MAAM;EAC9BjB,KAAK,EAAEL,SAAS,CAACsB;AACnB,CAAC;AAEDlB,UAAU,CAACqB,YAAY,GAAG;EACxBjB,YAAY,EAAE,EAAE;EAChBH,KAAK,EAAE;AACT,CAAC;AAED,eAAeD,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.128.0-admin-updates.
|
|
3
|
+
"version": "0.128.0-admin-updates.8",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@blaze-cms/core-auth-ui": "0.128.0-admin-updates.0",
|
|
31
31
|
"@blaze-cms/core-errors": "0.128.0-admin-updates.0",
|
|
32
|
-
"@blaze-cms/image-cdn-react": "0.3.0-alpha.
|
|
33
|
-
"@blaze-cms/nextjs-components": "0.128.0-admin-updates.
|
|
32
|
+
"@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
|
|
33
|
+
"@blaze-cms/nextjs-components": "0.128.0-admin-updates.8",
|
|
34
34
|
"@blaze-cms/plugin-search-ui": "0.128.0-admin-updates.3",
|
|
35
35
|
"@blaze-cms/setup-ui": "0.128.0-admin-updates.0",
|
|
36
36
|
"@blaze-cms/utils": "0.128.0-admin-updates.0",
|
|
37
|
-
"@blaze-cms/utils-handlebars": "0.128.0-admin-updates.
|
|
37
|
+
"@blaze-cms/utils-handlebars": "0.128.0-admin-updates.8",
|
|
38
38
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
39
39
|
"@blaze-react/button": "0.5.19",
|
|
40
40
|
"@blaze-react/checkboxes": "0.5.31",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"lib/*",
|
|
89
89
|
"lib-es/*"
|
|
90
90
|
],
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "449a909ce82545a72ed95dfd55eb79a2c3be280b"
|
|
92
92
|
}
|
|
@@ -134,11 +134,11 @@ const Card = ({
|
|
|
134
134
|
<div className="badge badge--label">{label}</div>
|
|
135
135
|
))}
|
|
136
136
|
{displayTitle && (
|
|
137
|
-
<
|
|
137
|
+
<div className={titleWrapperModifier}>
|
|
138
138
|
<BlazeLink title={linkTitle} gtmId={gtmId} href={url} scroll>
|
|
139
139
|
{headline}
|
|
140
140
|
</BlazeLink>
|
|
141
|
-
</
|
|
141
|
+
</div>
|
|
142
142
|
)}
|
|
143
143
|
{!!parsedPropsToDisplay.length && (
|
|
144
144
|
<div className={getModifiers('card__details', modifiers)}>
|
|
@@ -9,8 +9,9 @@ import Card from './Card';
|
|
|
9
9
|
import { getDynamicGridClasses } from './helpers';
|
|
10
10
|
import { getEntitiesWithBanner, parsePropsToDisplay } from '../../helpers';
|
|
11
11
|
import { getPropsToDisplayModifiers } from '../../utils';
|
|
12
|
+
import { checkIfShouldRenderBanner, checkNewBannerSettings } from '../List/components/helpers';
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
+
const CardContainer = ({
|
|
14
15
|
cardData,
|
|
15
16
|
gridModifier,
|
|
16
17
|
style,
|
|
@@ -36,14 +37,20 @@ const CardsContainer = ({
|
|
|
36
37
|
titleOverlayModifier,
|
|
37
38
|
...cardProps
|
|
38
39
|
}) => {
|
|
39
|
-
const cardsWithBanners = getEntitiesWithBanner(cardData, cardProps);
|
|
40
40
|
const { itemId } = useContext(MainContext);
|
|
41
|
+
const { banner } = cardProps;
|
|
42
|
+
// TODO: remove this check and all associated code once old banner setup is no longer supported
|
|
43
|
+
const hasNewBannerSettings = checkNewBannerSettings(banner);
|
|
44
|
+
const parsedCardsData = hasNewBannerSettings
|
|
45
|
+
? cardData
|
|
46
|
+
: getEntitiesWithBanner(cardData, cardProps);
|
|
41
47
|
const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);
|
|
42
48
|
const dynamicWrapperSizes = enableCarousel
|
|
43
49
|
? ''
|
|
44
50
|
: getDynamicGridClasses('grid', itemsPerRow, designConfig);
|
|
45
|
-
let renderCounter = 0;
|
|
46
51
|
const CardWrapper = enableCarousel ? CarouselWrapper : Wrapper;
|
|
52
|
+
let bannerIndex = 0;
|
|
53
|
+
const bannerProps = banner ? { ...cardProps, ...banner, type: 'banner' } : null;
|
|
47
54
|
|
|
48
55
|
return (
|
|
49
56
|
<CardWrapper
|
|
@@ -53,13 +60,48 @@ const CardsContainer = ({
|
|
|
53
60
|
bannerModifier={bannerModifier}
|
|
54
61
|
enableAutoScroll={enableAutoScroll}
|
|
55
62
|
autoScrollTimer={autoScrollTimer}>
|
|
56
|
-
{
|
|
63
|
+
{parsedCardsData.map((currentEntity, index) => {
|
|
64
|
+
const { baseAdunit, id, ...entityProps } = currentEntity;
|
|
65
|
+
const shouldRenderBanner = !!bannerProps && checkIfShouldRenderBanner(index, banner);
|
|
57
66
|
const extraProps = parsePropsToDisplay(entityProps, propsToDisplay);
|
|
58
67
|
const dynamicKey = [itemId, index].join('-');
|
|
59
|
-
if (baseAdunit) renderCounter += 1;
|
|
60
|
-
|
|
61
68
|
const priority = priorityLimit > 0 && index + 1 <= priorityLimit;
|
|
69
|
+
if (hasNewBannerSettings && shouldRenderBanner) bannerIndex += 1;
|
|
70
|
+
if (!hasNewBannerSettings && baseAdunit) bannerIndex += 1;
|
|
71
|
+
const parsedCardProps = {
|
|
72
|
+
key: id,
|
|
73
|
+
id,
|
|
74
|
+
enableCarousel,
|
|
75
|
+
graphqlEntityMap,
|
|
76
|
+
propsToDisplay,
|
|
77
|
+
parsedPropsToDisplay: extraProps,
|
|
78
|
+
propsToDisplayModifiers,
|
|
79
|
+
modifier,
|
|
80
|
+
style,
|
|
81
|
+
cardChildren,
|
|
82
|
+
gtmChildren,
|
|
83
|
+
gtmId: name,
|
|
84
|
+
gridModifier,
|
|
85
|
+
entityProps,
|
|
86
|
+
displayCategory,
|
|
87
|
+
displayThumbnail,
|
|
88
|
+
displayTitle,
|
|
89
|
+
priority,
|
|
90
|
+
enableOverlay,
|
|
91
|
+
overlayModifier,
|
|
92
|
+
titleOverlayModifier,
|
|
93
|
+
...entityProps
|
|
94
|
+
};
|
|
62
95
|
|
|
96
|
+
if (hasNewBannerSettings)
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<Card key={id} {...parsedCardProps} />
|
|
100
|
+
{shouldRenderBanner && (
|
|
101
|
+
<Banner key={dynamicKey} {...bannerProps} renderCounter={bannerIndex} />
|
|
102
|
+
)}
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
63
105
|
return baseAdunit ? (
|
|
64
106
|
<Banner
|
|
65
107
|
key={dynamicKey}
|
|
@@ -67,44 +109,21 @@ const CardsContainer = ({
|
|
|
67
109
|
baseAdunit={baseAdunit}
|
|
68
110
|
{...entityProps}
|
|
69
111
|
modifier={modifier}
|
|
70
|
-
renderCounter={
|
|
112
|
+
renderCounter={bannerIndex}
|
|
71
113
|
/>
|
|
72
114
|
) : (
|
|
73
|
-
<Card
|
|
74
|
-
key={id}
|
|
75
|
-
id={id}
|
|
76
|
-
enableCarousel={enableCarousel}
|
|
77
|
-
graphqlEntityMap={graphqlEntityMap}
|
|
78
|
-
propsToDisplay={propsToDisplay}
|
|
79
|
-
parsedPropsToDisplay={extraProps}
|
|
80
|
-
propsToDisplayModifiers={propsToDisplayModifiers}
|
|
81
|
-
modifier={modifier}
|
|
82
|
-
style={style}
|
|
83
|
-
cardChildren={cardChildren}
|
|
84
|
-
gtmChildren={gtmChildren}
|
|
85
|
-
gtmId={name}
|
|
86
|
-
gridModifier={gridModifier}
|
|
87
|
-
entityProps={entityProps}
|
|
88
|
-
displayCategory={displayCategory}
|
|
89
|
-
displayThumbnail={displayThumbnail}
|
|
90
|
-
displayTitle={displayTitle}
|
|
91
|
-
priority={priority}
|
|
92
|
-
enableOverlay={enableOverlay}
|
|
93
|
-
overlayModifier={overlayModifier}
|
|
94
|
-
titleOverlayModifier={titleOverlayModifier}
|
|
95
|
-
{...entityProps}
|
|
96
|
-
/>
|
|
115
|
+
<Card key={id} {...parsedCardProps} />
|
|
97
116
|
);
|
|
98
117
|
})}
|
|
99
118
|
</CardWrapper>
|
|
100
119
|
);
|
|
101
120
|
};
|
|
102
121
|
|
|
103
|
-
|
|
122
|
+
CardContainer.propTypes = {
|
|
104
123
|
cardData: PropTypes.array.isRequired,
|
|
124
|
+
graphqlEntityMap: PropTypes.object.isRequired,
|
|
105
125
|
name: PropTypes.string,
|
|
106
126
|
entity: PropTypes.string.isRequired,
|
|
107
|
-
graphqlEntityMap: PropTypes.object.isRequired,
|
|
108
127
|
gridModifier: PropTypes.string,
|
|
109
128
|
gtmChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
110
129
|
cardChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
@@ -126,7 +145,7 @@ CardsContainer.propTypes = {
|
|
|
126
145
|
autoScrollTimer: PropTypes.number
|
|
127
146
|
};
|
|
128
147
|
|
|
129
|
-
|
|
148
|
+
CardContainer.defaultProps = {
|
|
130
149
|
gtmChildren: [],
|
|
131
150
|
cardChildren: [],
|
|
132
151
|
name: '',
|
|
@@ -149,4 +168,4 @@ CardsContainer.defaultProps = {
|
|
|
149
168
|
titleOverlayModifier: ''
|
|
150
169
|
};
|
|
151
170
|
|
|
152
|
-
export default withTitle(
|
|
171
|
+
export default withTitle(CardContainer);
|
|
@@ -78,7 +78,7 @@ const Image = ({
|
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<Wrapper ref={outerRef} className={wrapperClassName} modifiers={modifiers} {...otherProps}>
|
|
81
|
-
{elementTitle && <
|
|
81
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
82
82
|
{shouldDisplayImage && (
|
|
83
83
|
<ImgWrapper {...imgWrapperProps}>
|
|
84
84
|
<ImageRender
|
|
@@ -17,7 +17,6 @@ const FullRender = ({ orderedListData, omitWrappers, paginationType, ...props })
|
|
|
17
17
|
? { hasBanner, parent, entity, propsToDisplay, ...banner, type: BANNER }
|
|
18
18
|
: null;
|
|
19
19
|
let bannerIndex = 0;
|
|
20
|
-
|
|
21
20
|
const WrapperToUse = omitWrappers ? Fragment : Wrapper;
|
|
22
21
|
|
|
23
22
|
return (
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (!banner) return false;
|
|
1
|
+
const legacyCheckIfShouldRenderBanner = (elementIndex, banner) => {
|
|
3
2
|
const { interval, repeat, hasBanner } = banner;
|
|
4
3
|
if (!hasBanner || !interval) return false;
|
|
5
4
|
const position = elementIndex + 1;
|
|
@@ -8,5 +7,27 @@ const checkIfShouldRenderBanner = (elementIndex, banner) => {
|
|
|
8
7
|
if (repeat && repeatMatch) return true;
|
|
9
8
|
return false;
|
|
10
9
|
};
|
|
10
|
+
const checkNewBannerSettings = banner => {
|
|
11
|
+
if (!banner) return false;
|
|
12
|
+
|
|
13
|
+
const { repeatEvery, startingPoint, maxRepetitions } = banner;
|
|
14
|
+
return repeatEvery > 0 || startingPoint > 0 || maxRepetitions > 0;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const checkIfShouldRenderBanner = (elementIndex, banner) => {
|
|
18
|
+
if (!banner) return false;
|
|
19
|
+
if (!checkNewBannerSettings(banner)) return legacyCheckIfShouldRenderBanner(elementIndex, banner);
|
|
20
|
+
|
|
21
|
+
const { repeatEvery, startingPoint, maxRepetitions } = banner;
|
|
22
|
+
const position = elementIndex + 1;
|
|
23
|
+
if (position < startingPoint) return false;
|
|
24
|
+
if (position === startingPoint) return true;
|
|
25
|
+
const positionDifference = position - startingPoint;
|
|
26
|
+
if (positionDifference < repeatEvery) return false;
|
|
27
|
+
const timesRepeated = positionDifference / repeatEvery;
|
|
28
|
+
const repeatMatch = Number.isInteger(timesRepeated);
|
|
29
|
+
if (!repeatMatch) return false;
|
|
30
|
+
return timesRepeated < maxRepetitions;
|
|
31
|
+
};
|
|
11
32
|
|
|
12
|
-
export
|
|
33
|
+
export { checkIfShouldRenderBanner, checkNewBannerSettings };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { checkIfShouldRenderBanner, checkNewBannerSettings } from './check-if-should-render-banner';
|
|
2
|
+
import checkIfShouldRenderGtm from './check-if-should-render-gtm';
|
|
3
|
+
|
|
4
|
+
export { checkIfShouldRenderBanner, checkNewBannerSettings, checkIfShouldRenderGtm };
|
|
@@ -13,6 +13,7 @@ const Checkbox = ({
|
|
|
13
13
|
updateFilterValues,
|
|
14
14
|
filterValues,
|
|
15
15
|
label,
|
|
16
|
+
elementTitle,
|
|
16
17
|
shouldSearch,
|
|
17
18
|
displayFilterCount
|
|
18
19
|
}) => {
|
|
@@ -68,6 +69,7 @@ const Checkbox = ({
|
|
|
68
69
|
|
|
69
70
|
return (
|
|
70
71
|
<>
|
|
72
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
71
73
|
{label ? <p>{label}</p> : ''}
|
|
72
74
|
<Checkboxes
|
|
73
75
|
className="form-checkbox"
|
|
@@ -109,12 +111,14 @@ Checkbox.propTypes = {
|
|
|
109
111
|
updateFilterValues: PropTypes.func.isRequired,
|
|
110
112
|
shouldSearch: PropTypes.bool,
|
|
111
113
|
label: PropTypes.string,
|
|
114
|
+
elementTitle: PropTypes.string,
|
|
112
115
|
displayFilterCount: PropTypes.bool
|
|
113
116
|
};
|
|
114
117
|
|
|
115
118
|
Checkbox.defaultProps = {
|
|
116
119
|
shouldSearch: false,
|
|
117
120
|
label: '',
|
|
121
|
+
elementTitle: '',
|
|
118
122
|
displayFilterCount: false
|
|
119
123
|
};
|
|
120
124
|
|
|
@@ -6,7 +6,6 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import Select from '@blaze-react/select';
|
|
7
7
|
import { parseUrl } from 'query-string';
|
|
8
8
|
import { useGetSingleEntitySchema } from '../../../hooks';
|
|
9
|
-
import { withTitle } from '../../../HOC';
|
|
10
9
|
import { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';
|
|
11
10
|
import { decodeValue } from '../helpers/decode-encode';
|
|
12
11
|
|
|
@@ -18,7 +17,8 @@ const Range = ({
|
|
|
18
17
|
dataAggregations,
|
|
19
18
|
updateFilterValues,
|
|
20
19
|
filterValues,
|
|
21
|
-
shouldSearch
|
|
20
|
+
shouldSearch,
|
|
21
|
+
elementTitle
|
|
22
22
|
}) => {
|
|
23
23
|
const router = useRouter();
|
|
24
24
|
const debounceAmount = shouldSearch ? 1200 : 400;
|
|
@@ -50,6 +50,7 @@ const Range = ({
|
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
52
|
<>
|
|
53
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
53
54
|
{hasMultipleOptions && (
|
|
54
55
|
<>
|
|
55
56
|
<label>{label}</label>
|
|
@@ -93,13 +94,15 @@ Range.propTypes = {
|
|
|
93
94
|
shouldSearch: PropTypes.bool,
|
|
94
95
|
rangeInterval: PropTypes.number,
|
|
95
96
|
label: PropTypes.string,
|
|
97
|
+
elementTitle: PropTypes.string,
|
|
96
98
|
dataAggregations: PropTypes.object.isRequired
|
|
97
99
|
};
|
|
98
100
|
|
|
99
101
|
Range.defaultProps = {
|
|
100
102
|
shouldSearch: false,
|
|
101
103
|
rangeInterval: 1,
|
|
102
|
-
label: ''
|
|
104
|
+
label: '',
|
|
105
|
+
elementTitle: ''
|
|
103
106
|
};
|
|
104
107
|
|
|
105
|
-
export default
|
|
108
|
+
export default Range;
|