@blaze-cms/react-page-builder 0.130.0-admin-updates.2 → 0.130.0-admin-updates.6
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 +25 -0
- 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 +3 -1
- 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/SearchContent/SearchContent.js +8 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -2
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.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 +7 -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/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 +3 -1
- 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/SearchContent/SearchContent.js +8 -6
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +7 -2
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib-es/components/SearchFilterSort/helpers/update-sort.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 +1 -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 +3 -3
- package/src/components/Code/Code.js +7 -3
- package/src/components/DataSummary/helpers/build-loop-props-content.js +4 -1
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
- package/src/components/SearchContent/SearchContent.js +8 -6
- package/src/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +7 -3
- package/src/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +1 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -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 +9 -0
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +15 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +9 -3
- 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/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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.130.0-admin-updates.6](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.5...v0.130.0-admin-updates.6) (2023-06-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([4581f67](https://github.com/thebyte9/blaze/commit/4581f671fc5712fe1a38837cef9b87d1f444307d))
|
|
12
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([263b2be](https://github.com/thebyte9/blaze/commit/263b2be88f9fe4f10c05d8f922ad5f4853c133e1))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([8724c96](https://github.com/thebyte9/blaze/commit/8724c96d6dee42355d2fb4557c7f011f9ac4eb38))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# [0.130.0-admin-updates.4](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.3...v0.130.0-admin-updates.4) (2023-06-23)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
6
31
|
# [0.130.0-admin-updates.2](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.1...v0.130.0-admin-updates.2) (2023-06-13)
|
|
7
32
|
|
|
8
33
|
|
|
@@ -30,7 +30,7 @@ var _HOC = require("../../HOC");
|
|
|
30
30
|
var _utils = require("../../utils");
|
|
31
31
|
var _constants = require("../../constants");
|
|
32
32
|
var _helpers = require("./helpers");
|
|
33
|
-
var _excluded = ["code", "parserOptions"];
|
|
33
|
+
var _excluded = ["code", "parserOptions", "disableWrapper"];
|
|
34
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
36
36
|
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; }
|
|
@@ -38,11 +38,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
38
38
|
var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
39
39
|
var embedCode = _ref.code,
|
|
40
40
|
parserOptions = _ref.parserOptions,
|
|
41
|
+
disableWrapper = _ref.disableWrapper,
|
|
41
42
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
42
43
|
if (!embedCode) return null;
|
|
43
44
|
var parsedCode = (0, _htmlReactParser["default"])(embedCode, parserOptions);
|
|
44
45
|
var wrappedCode = (0, _helpers.wrapScriptTags)(parsedCode);
|
|
45
46
|
var modifiers = (0, _utils.getClassModifiers)(_constants.CODE, _objectSpread({}, otherProps));
|
|
47
|
+
if (disableWrapper) return wrappedCode;
|
|
46
48
|
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
47
49
|
modifiers: modifiers
|
|
48
50
|
}, wrappedCode);
|
|
@@ -50,12 +52,14 @@ var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
50
52
|
Code.propTypes = {
|
|
51
53
|
code: _propTypes["default"].string,
|
|
52
54
|
modifier: _propTypes["default"].string,
|
|
53
|
-
parserOptions: _propTypes["default"].object
|
|
55
|
+
parserOptions: _propTypes["default"].object,
|
|
56
|
+
disableWrapper: _propTypes["default"].bool
|
|
54
57
|
};
|
|
55
58
|
Code.defaultProps = {
|
|
56
59
|
code: '',
|
|
57
60
|
modifier: '',
|
|
58
|
-
parserOptions: {}
|
|
61
|
+
parserOptions: {},
|
|
62
|
+
disableWrapper: false
|
|
59
63
|
};
|
|
60
64
|
var _default = (0, _HOC.withTitle)(Code);
|
|
61
65
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_htmlReactParser","_Wrapper","_HOC","_utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Code","memo","_ref","embedCode","code","parserOptions","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/Code/Code.js"],"sourcesContent":["import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport Wrapper from '../Wrapper';\nimport { withTitle } from '../../HOC';\nimport { getClassModifiers } from '../../utils';\nimport { CODE } from '../../constants';\nimport { wrapScriptTags } from './helpers';\n\nconst Code = memo(({ code: embedCode, parserOptions, ...otherProps }) => {\n if (!embedCode) return null;\n\n const parsedCode = parseHTML(embedCode, parserOptions);\n const wrappedCode = wrapScriptTags(parsedCode);\n const modifiers = getClassModifiers(CODE, { ...otherProps });\n\n return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;\n});\n\nCode.propTypes = {\n code: PropTypes.string,\n modifier: PropTypes.string,\n parserOptions: PropTypes.object\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\n parserOptions: {}\n};\n\nexport default withTitle(Code);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAA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utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Code","memo","_ref","embedCode","code","parserOptions","disableWrapper","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","bool","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/Code/Code.js"],"sourcesContent":["import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport Wrapper from '../Wrapper';\nimport { withTitle } from '../../HOC';\nimport { getClassModifiers } from '../../utils';\nimport { CODE } from '../../constants';\nimport { wrapScriptTags } from './helpers';\n\nconst Code = memo(({ code: embedCode, parserOptions, disableWrapper, ...otherProps }) => {\n if (!embedCode) return null;\n\n const parsedCode = parseHTML(embedCode, parserOptions);\n const wrappedCode = wrapScriptTags(parsedCode);\n const modifiers = getClassModifiers(CODE, { ...otherProps });\n\n if (disableWrapper) return wrappedCode;\n\n return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;\n});\n\nCode.propTypes = {\n code: PropTypes.string,\n modifier: PropTypes.string,\n parserOptions: PropTypes.object,\n disableWrapper: PropTypes.bool\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\n parserOptions: {},\n disableWrapper: false\n};\n\nexport default withTitle(Code);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sB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EC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IAAKC,UAAU,OAAAC,yBAAA,aAAAN,IAAA,EAAA9C,SAAA;EAChF,IAAI,CAAC+C,SAAS,EAAE,OAAO,IAAI;EAE3B,IAAMM,UAAU,GAAG,IAAAC,2BAAS,EAACP,SAAS,EAAEE,aAAa,CAAC;EACtD,IAAMM,WAAW,GAAG,IAAAC,uBAAc,EAACH,UAAU,CAAC;EAC9C,IAAMI,SAAS,GAAG,IAAAC,wBAAiB,EAACC,eAAI,EAAAzB,aAAA,KAAOiB,UAAU,CAAE,CAAC;EAE5D,IAAID,cAAc,EAAE,OAAOK,WAAW;EAEtC,oBAAOlE,MAAA,YAAAuE,aAAA,CAACjE,QAAA,WAAO;IAAC8D,SAAS,EAAEA;EAAU,GAAEF,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFX,IAAI,CAACiB,SAAS,GAAG;EACfb,IAAI,EAAEc,qBAAS,CAACC,MAAM;EACtBC,QAAQ,EAAEF,qBAAS,CAACC,MAAM;EAC1Bd,aAAa,EAAEa,qBAAS,CAACtC,MAAM;EAC/B0B,cAAc,EAAEY,qBAAS,CAACG;AAC5B,CAAC;AAEDrB,IAAI,CAACsB,YAAY,GAAG;EAClBlB,IAAI,EAAE,EAAE;EACRgB,QAAQ,EAAE,EAAE;EACZf,aAAa,EAAE,CAAC,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC;AAAC,IAAAiB,QAAA,GAEa,IAAAC,cAAS,EAACxB,IAAI,CAAC;AAAAyB,OAAA,cAAAF,QAAA"}
|
|
@@ -20,6 +20,7 @@ var _lodash2 = _interopRequireDefault(require("lodash.flatten"));
|
|
|
20
20
|
var _getLinkToPublishedContent = _interopRequireDefault(require("./get-link-to-published-content"));
|
|
21
21
|
var _getLoopPropsLimit = _interopRequireDefault(require("./get-loop-props-limit"));
|
|
22
22
|
var _getPropValue = _interopRequireDefault(require("./get-prop-value"));
|
|
23
|
+
var _helpers = require("../../../helpers");
|
|
23
24
|
var getLoopValue = function getLoopValue(value) {
|
|
24
25
|
var keyField = value.keyField;
|
|
25
26
|
return value[keyField];
|
|
@@ -64,8 +65,9 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
64
65
|
var loopValue = loopValues[key];
|
|
65
66
|
var propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
66
67
|
if (!propValue) return null;
|
|
68
|
+
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
67
69
|
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
|
|
68
|
-
return [(0, _lodash["default"])(label),
|
|
70
|
+
return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
|
|
69
71
|
});
|
|
70
72
|
})).filter(Boolean);
|
|
71
73
|
loopPropsWithContent.push(propsArray);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label),
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAA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C,qCAAyB,EAACN,GAAG,EAAEhC,IAAI,CAAC;QACnE,OAAO,CAAC,IAAAuC,kBAAU,EAACV,KAAK,CAAC,EAAEM,cAAc,EAAEE,sBAAsB,EAAEN,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACS,MAAM,CAACC,OAAO,CAAC;IACjBvB,oBAAoB,CAACwB,IAAI,CAAChB,UAAU,CAAC;EACvC,CAAC;EAjBD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAmBrC,OAAO,IAAAE,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAAyB,QAAA,GAEa9B,qBAAqB;AAAA+B,OAAA,cAAAD,QAAA"}
|
|
@@ -37,8 +37,9 @@ var buildPropsToDisplayWithContent = function buildPropsToDisplayWithContent(pro
|
|
|
37
37
|
if (!key) return null;
|
|
38
38
|
var objPropValue = (0, _getPropValue["default"])(key, props, options);
|
|
39
39
|
if (!objPropValue) return null;
|
|
40
|
-
var
|
|
41
|
-
|
|
40
|
+
var processedValue = (0, _helpers.processDataSummaryValue)(objPropValue, options);
|
|
41
|
+
var link = getLink(enableLink, key, props, processedValue);
|
|
42
|
+
return [(0, _lodash["default"])(label), processedValue, link, modifier];
|
|
42
43
|
});
|
|
43
44
|
})).filter(Boolean);
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","link","getLink","_default","exports","getLinkToPublishedContent","getLinkBasedOnValue"],"sources":["../../../../src/components/DataSummary/helpers/build-props-to-display-with-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport { isObject } from '../../../helpers';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getPropValue from './get-prop-value';\nimport getLinkBasedOnValue from './get-link-based-on-value';\n\nconst buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) {\n return propsToDisplay\n .map(key => {\n if (!key) return null;\n const propValue = getPropValue(key, props);\n if (!propValue) return null;\n const propName = key.split('.').join(' ');\n return [upperFirst(propName), propValue, '', ''];\n })\n .filter(Boolean);\n }\n\n return flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '', enableLink } = options;\n return propertiesToDisplay.map(key => {\n if (!key) return null;\n\n const objPropValue = getPropValue(key, props, options);\n if (!objPropValue) return null;\n\n const link = getLink(enableLink, key, props,
|
|
1
|
+
{"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","processedValue","processDataSummaryValue","link","getLink","_default","exports","getLinkToPublishedContent","getLinkBasedOnValue"],"sources":["../../../../src/components/DataSummary/helpers/build-props-to-display-with-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport { isObject, processDataSummaryValue } from '../../../helpers';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getPropValue from './get-prop-value';\nimport getLinkBasedOnValue from './get-link-based-on-value';\n\nconst buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) {\n return propsToDisplay\n .map(key => {\n if (!key) return null;\n const propValue = getPropValue(key, props);\n if (!propValue) return null;\n const propName = key.split('.').join(' ');\n return [upperFirst(propName), propValue, '', ''];\n })\n .filter(Boolean);\n }\n\n return flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '', enableLink } = options;\n return propertiesToDisplay.map(key => {\n if (!key) return null;\n\n const objPropValue = getPropValue(key, props, options);\n if (!objPropValue) return null;\n\n const processedValue = processDataSummaryValue(objPropValue, options);\n\n const link = getLink(enableLink, key, props, processedValue);\n\n return [upperFirst(label), processedValue, link, modifier];\n });\n })\n ).filter(Boolean);\n};\n\nexport default buildPropsToDisplayWithContent;\n\nfunction getLink(enableLink, key, props, objPropValue) {\n let link = '';\n if (enableLink) {\n link = getLinkToPublishedContent(key, props);\n if (!link) {\n link = getLinkBasedOnValue(objPropValue);\n }\n }\n return link;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAMM,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAIC,KAAK,EAA0B;EAAA,IAAxBC,cAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAChE,IAAI,CAAC,IAAAG,iBAAQ,EAACJ,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;IAChC,OAAOA,cAAc,CAClBK,GAAG,CAAC,UAAAC,GAAG,EAAI;MACV,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MACrB,IAAMC,SAAS,GAAG,IAAAC,wBAAY,EAACF,GAAG,EAAEP,KAAK,CAAC;MAC1C,IAAI,CAACQ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SAASD,OAAOA,CAACL,UAAU,EAAEf,GAAG,EAAEP,KAAK,EAAEuB,YAAY,EAAE;EACrD,IAAIG,IAAI,GAAG,EAAE;EACb,IAAIJ,UAAU,EAAE;IACdI,IAAI,GAAG,IAAAI,qCAAyB,EAACvB,GAAG,EAAEP,KAAK,CAAC;IAC5C,IAAI,CAAC0B,IAAI,EAAE;MACTA,IAAI,GAAG,IAAAK,+BAAmB,EAACR,YAAY,CAAC;IAC1C;EACF;EACA,OAAOG,IAAI;AACb"}
|
|
@@ -29,11 +29,11 @@ var SearchContent = function SearchContent(_ref) {
|
|
|
29
29
|
searchInputAlignment = _ref.searchInputAlignment,
|
|
30
30
|
searchInputWrapperMobile = _ref.searchInputWrapperMobile,
|
|
31
31
|
searchInputWrapperDesktop = _ref.searchInputWrapperDesktop,
|
|
32
|
-
collapsible = _ref.collapsible,
|
|
33
32
|
isMobile = _ref.isMobile,
|
|
34
33
|
placeholder = _ref.placeholder,
|
|
35
|
-
modifier = _ref.modifier
|
|
36
|
-
|
|
34
|
+
modifier = _ref.modifier,
|
|
35
|
+
collapsedSearch = _ref.collapsedSearch;
|
|
36
|
+
var _useState = (0, _react.useState)(collapsedSearch),
|
|
37
37
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
38
38
|
collapsed = _useState2[0],
|
|
39
39
|
setCollapsed = _useState2[1];
|
|
@@ -67,7 +67,7 @@ var SearchContent = function SearchContent(_ref) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
var handleOnBlur = function handleOnBlur() {
|
|
70
|
-
if (!
|
|
70
|
+
if (!collapsedSearch) return;
|
|
71
71
|
if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
|
|
72
72
|
};
|
|
73
73
|
var handleClearSearchResults = function handleClearSearchResults() {
|
|
@@ -135,7 +135,8 @@ SearchContent.propTypes = {
|
|
|
135
135
|
isMobile: _propTypes["default"].bool,
|
|
136
136
|
collapsible: _propTypes["default"].bool,
|
|
137
137
|
entities: _propTypes["default"].array.isRequired,
|
|
138
|
-
modifier: _propTypes["default"].string
|
|
138
|
+
modifier: _propTypes["default"].string,
|
|
139
|
+
collapsedSearch: _propTypes["default"].bool
|
|
139
140
|
};
|
|
140
141
|
SearchContent.defaultProps = {
|
|
141
142
|
searchInputAlignment: '',
|
|
@@ -144,7 +145,8 @@ SearchContent.defaultProps = {
|
|
|
144
145
|
placeholder: '',
|
|
145
146
|
isMobile: false,
|
|
146
147
|
collapsible: false,
|
|
147
|
-
modifier: ''
|
|
148
|
+
modifier: '',
|
|
149
|
+
collapsedSearch: false
|
|
148
150
|
};
|
|
149
151
|
var _default = SearchContent;
|
|
150
152
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_router","_pluginSearchUi","_SearchContentResults","_SearchContentToggleIcon","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","SearchContent","_ref","entities","searchInputAlignment","searchInputWrapperMobile","searchInputWrapperDesktop","collapsible","isMobile","placeholder","modifier","_useState","useState","_useState2","_slicedToArray2","collapsed","setCollapsed","router","useRouter","_useDebounceSearch","useDebounceSearch","initialSearchTerm","resultKeys","results","searchTerm","setSearchTerm","debouncedSearchTerm","useEffect","handleRouteChange","events","on","off","responsiveClasses","handleClick","e","url","preventDefault","push","handleKeyPress","target","value","concat","handleOnBlur","handleClearSearchResults","className","filter","Boolean","join","createElement","viewBox","fillRule","d","clipRule","onFocus","onChange","type","name","Fragment","onClear","onKeyPress","onBlur","propTypes","PropTypes","string","bool","array","isRequired","defaultProps","_default","exports"],"sources":["../../../src/components/SearchContent/SearchContent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { useDebounceSearch } from '@blaze-cms/plugin-search-ui';\nimport SearchContentResults from './SearchContentResults';\nimport SearchContentToggleIcon from './SearchContentToggleIcon';\n\nconst SearchContent = ({\n entities,\n searchInputAlignment,\n searchInputWrapperMobile,\n searchInputWrapperDesktop,\n collapsible,\n isMobile,\n placeholder,\n modifier\n}) => {\n const [collapsed, setCollapsed] = useState(collapsible);\n const router = useRouter();\n\n const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({\n entities,\n initialSearchTerm: '',\n resultKeys: 'id, name, image { url }, url'\n });\n\n useEffect(\n () => {\n const handleRouteChange = () => setSearchTerm('');\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n },\n [router.events, setSearchTerm]\n );\n\n const responsiveClasses = isMobile ? searchInputWrapperMobile : searchInputWrapperDesktop;\n\n const handleClick = (e, url) => {\n e.preventDefault();\n router.push(url);\n };\n\n const handleKeyPress = e => {\n if (e.key === 'Enter' && e.target.value !== '') {\n router.push(`/search?search_term=${e.target.value}`);\n }\n };\n\n const handleOnBlur = () => {\n if (!collapsible) return;\n if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);\n };\n\n const handleClearSearchResults = () => {\n setSearchTerm('');\n };\n\n const className = ['search-content', modifier, responsiveClasses].filter(Boolean).join(' ');\n return collapsed ? (\n <div className={className}>\n <div className=\"search-content--collapse__wrapper\">\n <label className=\"search-content--collapse__label\">\n <span className=\"search-content--collapse__icon_wrapper\">\n <svg className=\"search-content--collapse__icon\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </span>\n <input\n onFocus={() => setCollapsed(false)}\n onChange={e => setSearchTerm(e.target.value)}\n type=\"text\"\n name=\"search\"\n className=\"search-content--collapse__input\"\n />\n </label>\n </div>\n </div>\n ) : (\n <>\n <div className={className}>\n <div className=\"search-content--expanded__wrapper\">\n <label className=\"search-content--expanded__label\">\n <span className=\"search-content--expanded__icon_wrapper\">\n <SearchContentToggleIcon results={results} onClear={handleClearSearchResults} />\n </span>\n <input\n type=\"text\"\n name=\"search\"\n onChange={e => setSearchTerm(e.target.value)}\n onKeyPress={handleKeyPress}\n className=\"search-content--expanded__input\"\n placeholder={placeholder}\n value={searchTerm}\n onBlur={handleOnBlur}\n />\n </label>\n </div>\n <SearchContentResults\n results={results}\n debouncedSearchTerm={debouncedSearchTerm}\n handleClick={handleClick}\n />\n </div>\n </>\n );\n};\n\nSearchContent.propTypes = {\n searchInputAlignment: PropTypes.string,\n searchInputWrapperMobile: PropTypes.string,\n searchInputWrapperDesktop: PropTypes.string,\n placeholder: PropTypes.string,\n isMobile: PropTypes.bool,\n collapsible: PropTypes.bool,\n entities: PropTypes.array.isRequired,\n modifier: PropTypes.string\n};\n\nSearchContent.defaultProps = {\n searchInputAlignment: '',\n searchInputWrapperMobile: '',\n searchInputWrapperDesktop: '',\n placeholder: '',\n isMobile: false,\n collapsible: false,\n modifier: ''\n};\n\nexport default SearchContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,wBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAAgE,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA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EAAE0D,qBAAS,CAACC,MAAM;EACtC1D,wBAAwB,EAAEyD,qBAAS,CAACC,MAAM;EAC1CzD,yBAAyB,EAAEwD,qBAAS,CAACC,MAAM;EAC3CtD,WAAW,EAAEqD,qBAAS,CAACC,MAAM;EAC7BvD,QAAQ,EAAEsD,qBAAS,CAACE,IAAI;EACxBzD,WAAW,EAAEuD,qBAAS,CAACE,IAAI;EAC3B7D,QAAQ,EAAE2D,qBAAS,CAACG,KAAK,CAACC,UAAU;EACpCxD,QAAQ,EAAEoD,qBAAS,CAACC;AACtB,CAAC;AAED9D,aAAa,CAACkE,YAAY,GAAG;EAC3B/D,oBAAoB,EAAE,EAAE;EACxBC,wBAAwB,EAAE,EAAE;EAC5BC,yBAAyB,EAAE,EAAE;EAC7BG,WAAW,EAAE,EAAE;EACfD,QAAQ,EAAE,KAAK;EACfD,WAAW,EAAE,KAAK;EAClBG,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA0D,QAAA,GAEanE,aAAa;AAAAoE,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"SearchContent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_router","_pluginSearchUi","_SearchContentResults","_SearchContentToggleIcon","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","SearchContent","_ref","entities","searchInputAlignment","searchInputWrapperMobile","searchInputWrapperDesktop","isMobile","placeholder","modifier","collapsedSearch","_useState","useState","_useState2","_slicedToArray2","collapsed","setCollapsed","router","useRouter","_useDebounceSearch","useDebounceSearch","initialSearchTerm","resultKeys","results","searchTerm","setSearchTerm","debouncedSearchTerm","useEffect","handleRouteChange","events","on","off","responsiveClasses","handleClick","e","url","preventDefault","push","handleKeyPress","target","value","concat","handleOnBlur","handleClearSearchResults","className","filter","Boolean","join","createElement","viewBox","fillRule","d","clipRule","onFocus","onChange","type","name","Fragment","onClear","onKeyPress","onBlur","propTypes","PropTypes","string","bool","collapsible","array","isRequired","defaultProps","_default","exports"],"sources":["../../../src/components/SearchContent/SearchContent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { useDebounceSearch } from '@blaze-cms/plugin-search-ui';\nimport SearchContentResults from './SearchContentResults';\nimport SearchContentToggleIcon from './SearchContentToggleIcon';\n\nconst SearchContent = ({\n entities,\n searchInputAlignment,\n searchInputWrapperMobile,\n searchInputWrapperDesktop,\n isMobile,\n placeholder,\n modifier,\n collapsedSearch\n}) => {\n const [collapsed, setCollapsed] = useState(collapsedSearch);\n const router = useRouter();\n\n const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({\n entities,\n initialSearchTerm: '',\n resultKeys: 'id, name, image { url }, url'\n });\n\n useEffect(\n () => {\n const handleRouteChange = () => setSearchTerm('');\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n },\n [router.events, setSearchTerm]\n );\n\n const responsiveClasses = isMobile ? searchInputWrapperMobile : searchInputWrapperDesktop;\n\n const handleClick = (e, url) => {\n e.preventDefault();\n router.push(url);\n };\n\n const handleKeyPress = e => {\n if (e.key === 'Enter' && e.target.value !== '') {\n router.push(`/search?search_term=${e.target.value}`);\n }\n };\n\n const handleOnBlur = () => {\n if (!collapsedSearch) return;\n if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);\n };\n\n const handleClearSearchResults = () => {\n setSearchTerm('');\n };\n\n const className = ['search-content', modifier, responsiveClasses].filter(Boolean).join(' ');\n return collapsed ? (\n <div className={className}>\n <div className=\"search-content--collapse__wrapper\">\n <label className=\"search-content--collapse__label\">\n <span className=\"search-content--collapse__icon_wrapper\">\n <svg className=\"search-content--collapse__icon\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </span>\n <input\n onFocus={() => setCollapsed(false)}\n onChange={e => setSearchTerm(e.target.value)}\n type=\"text\"\n name=\"search\"\n className=\"search-content--collapse__input\"\n />\n </label>\n </div>\n </div>\n ) : (\n <>\n <div className={className}>\n <div className=\"search-content--expanded__wrapper\">\n <label className=\"search-content--expanded__label\">\n <span className=\"search-content--expanded__icon_wrapper\">\n <SearchContentToggleIcon results={results} onClear={handleClearSearchResults} />\n </span>\n <input\n type=\"text\"\n name=\"search\"\n onChange={e => setSearchTerm(e.target.value)}\n onKeyPress={handleKeyPress}\n className=\"search-content--expanded__input\"\n placeholder={placeholder}\n value={searchTerm}\n onBlur={handleOnBlur}\n />\n </label>\n </div>\n <SearchContentResults\n results={results}\n debouncedSearchTerm={debouncedSearchTerm}\n handleClick={handleClick}\n />\n </div>\n </>\n );\n};\n\nSearchContent.propTypes = {\n searchInputAlignment: PropTypes.string,\n searchInputWrapperMobile: PropTypes.string,\n searchInputWrapperDesktop: PropTypes.string,\n placeholder: PropTypes.string,\n isMobile: PropTypes.bool,\n collapsible: PropTypes.bool,\n entities: PropTypes.array.isRequired,\n modifier: PropTypes.string,\n collapsedSearch: PropTypes.bool\n};\n\nSearchContent.defaultProps = {\n searchInputAlignment: '',\n searchInputWrapperMobile: '',\n searchInputWrapperDesktop: '',\n placeholder: '',\n isMobile: false,\n collapsible: false,\n modifier: '',\n collapsedSearch: false\n};\n\nexport default SearchContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,q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,CACtB,CACI,CACJ,CAAC,eACNxE,MAAA,YAAA8E,aAAA,CAACvE,qBAAA,WAAoB;IACnB8C,OAAO,EAAEA,OAAQ;IACjBG,mBAAmB,EAAEA,mBAAoB;IACzCO,WAAW,EAAEA;EAAY,CAC1B,CACE,CACL,CACH;AACH,CAAC;AAEDhC,aAAa,CAAC4D,SAAS,GAAG;EACxBzD,oBAAoB,EAAE0D,qBAAS,CAACC,MAAM;EACtC1D,wBAAwB,EAAEyD,qBAAS,CAACC,MAAM;EAC1CzD,yBAAyB,EAAEwD,qBAAS,CAACC,MAAM;EAC3CvD,WAAW,EAAEsD,qBAAS,CAACC,MAAM;EAC7BxD,QAAQ,EAAEuD,qBAAS,CAACE,IAAI;EACxBC,WAAW,EAAEH,qBAAS,CAACE,IAAI;EAC3B7D,QAAQ,EAAE2D,qBAAS,CAACI,KAAK,CAACC,UAAU;EACpC1D,QAAQ,EAAEqD,qBAAS,CAACC,MAAM;EAC1BrD,eAAe,EAAEoD,qBAAS,CAACE;AAC7B,CAAC;AAED/D,aAAa,CAACmE,YAAY,GAAG;EAC3BhE,oBAAoB,EAAE,EAAE;EACxBC,wBAAwB,EAAE,EAAE;EAC5BC,yBAAyB,EAAE,EAAE;EAC7BE,WAAW,EAAE,EAAE;EACfD,QAAQ,EAAE,KAAK;EACf0D,WAAW,EAAE,KAAK;EAClBxD,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAC;AAAC,IAAA2D,QAAA,GAEapE,aAAa;AAAAqE,OAAA,cAAAD,QAAA"}
|
|
@@ -174,7 +174,8 @@ var SearchFilterContainer = function SearchFilterContainer(_ref) {
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
var
|
|
177
|
+
var hashBit = asPath.split('#')[1];
|
|
178
|
+
var newUrl = (0, _helpers.buildNewQuery)(url, currentUrl, newQuery, sortValues, hashBit);
|
|
178
179
|
scrollToFirstList();
|
|
179
180
|
setUrlPath(newUrl);
|
|
180
181
|
return router.push('/Resolver', newUrl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilterContainer.js","names":["_react","_interopRequireWildcard","require","_router","_client","_propTypes","_interopRequireDefault","_queryString","_SearchFilter","_HOC","_query","_helpers","_helpers2","_constants","_constants2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","reducer","state","action","newValues","type","_action$shouldSearch","shouldSearch","Error","SearchFilterContainer","_ref","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","useRouter","asPath","searchFilterRef","useRef","_useState","useState","concat","_useState2","_slicedToArray2","setKey","_useState3","_useState4","displaySearchFilter","setDisplaySearchFilter","_useState5","_useState6","urlPath","setUrlPath","_parseUrl","parseUrl","currentUrl","_parseUrl$query","query","sort","sortby","_useReducer","useReducer","getInitialFilterValues","_useReducer2","filterValues","dispatch","useEffect","hasUrl","sortValues","stringify","baseQuery","getSearchPublishedContent","RAW_RESULTS","checkboxSelectValues","rangeValues","_ref2","propsToDisplay","CHECKBOX_SELECT","includes","RANGE","_toConsumableArray2","_getEntityData","getEntityData","docType","filtersQuery","buildFiltersQuery","queryKeys","rawQueryStringified","buildRawQueryStringified","_useQuery","useQuery","variables","limit","skip","data","error","message","_ref3","_ref3$searchPublished","searchPublishedContent","_ref3$searchPublished2","_ref3$searchPublished3","rawResults","_ref3$searchPublished4","filterData","aggregations","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","newUrl","buildNewQuery","_document$getElements","document","getElementsByClassName","_document$getElements2","list","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","SCROLL_OFFSET","getBoundingClientRect","createElement","setAppliedFilters","propTypes","PropTypes","string","array","isRequired","bool","number","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useRef, useReducer, useEffect } from 'react';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl, stringify } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildNewQuery,\n buildRawQueryStringified,\n getInitialFilterValues,\n buildFiltersQuery\n} from './helpers';\nimport { getEntityData } from '../../helpers';\nimport { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch: false };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters\n}) => {\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const {\n url: currentUrl,\n query: { sort, sortby },\n query\n } = parseUrl(urlPath);\n const [filterValues, dispatch] = useReducer(\n reducer,\n getInitialFilterValues(null, filters, query)\n );\n\n useEffect(\n () => {\n if (asPath) setUrlPath(asPath);\n },\n [asPath]\n );\n\n const hasUrl = !!url;\n\n const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';\n const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const checkboxSelectValues = [];\n const rangeValues = [];\n\n filters.forEach(({ type, propsToDisplay }) => {\n if (CHECKBOX_SELECT.includes(type)) {\n checkboxSelectValues.push(propsToDisplay[0]);\n } else if (type === RANGE) {\n rangeValues.push(...propsToDisplay);\n }\n });\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = shouldAddFilters\n ? buildFiltersQuery({\n query: filterValues,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys: Object.keys(query)\n })\n : [];\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (filterValues.dataNotSet && filterData) {\n const initialFilterValues = getInitialFilterValues(filterData, filters, query);\n dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n\n if (!newQuery) {\n scrollToFirstList();\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !hasUrl, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues);\n scrollToFirstList();\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !hasUrl && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n if (!filterValues) return '';\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAAgD,SAAAa,yB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gBAAgB,EAAEA,gBAAiB;IACnCC,iBAAiB,EAAEA;EAAkB,CACtC,CAAC;AAEN,CAAC;AAEDR,qBAAqB,CAAC+G,SAAS,GAAG;EAChC7G,MAAM,EAAE8G,qBAAS,CAACC,MAAM;EACxB9G,GAAG,EAAE6G,qBAAS,CAACC,MAAM;EACrB7G,OAAO,EAAE4G,qBAAS,CAACE,KAAK;EACxB7G,IAAI,EAAE2G,qBAAS,CAACC,MAAM,CAACE,UAAU;EACjC7G,uBAAuB,EAAE0G,qBAAS,CAACI,IAAI;EACvC7G,gBAAgB,EAAEyG,qBAAS,CAACK,MAAM;EAClC7G,iBAAiB,EAAEwG,qBAAS,CAACK,MAAM;EACnC5G,QAAQ,EAAEuG,qBAAS,CAACE,KAAK;EACzBxG,gBAAgB,EAAEsG,qBAAS,CAACE,KAAK;EACjCvG,gBAAgB,EAAEqG,qBAAS,CAACI;AAC9B,CAAC;AAEDpH,qBAAqB,CAACsH,YAAY,GAAG;EACnCnH,GAAG,EAAE,IAAI;EACTC,OAAO,EAAE,EAAE;EACXF,MAAM,EAAE,EAAE;EACVI,uBAAuB,EAAE,IAAI;EAC7BC,gBAAgB,EAAE,CAAC;EACnBC,iBAAiB,EAAE,CAAC;EACpBC,QAAQ,EAAE,EAAE;EACZC,gBAAgB,EAAE,EAAE;EACpBC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAA4G,QAAA,GAEa,IAAAC,cAAS,EAACxH,qBAAqB,CAAC;AAAAyH,OAAA,cAAAF,QAAA"}
|
|
1
|
+
{"version":3,"file":"SearchFilterContainer.js","names":["_react","_interopRequireWildcard","require","_router","_client","_propTypes","_interopRequireDefault","_queryString","_SearchFilter","_HOC","_query","_helpers","_helpers2","_constants","_constants2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","reducer","state","action","newValues","type","_action$shouldSearch","shouldSearch","Error","SearchFilterContainer","_ref","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","useRouter","asPath","searchFilterRef","useRef","_useState","useState","concat","_useState2","_slicedToArray2","setKey","_useState3","_useState4","displaySearchFilter","setDisplaySearchFilter","_useState5","_useState6","urlPath","setUrlPath","_parseUrl","parseUrl","currentUrl","_parseUrl$query","query","sort","sortby","_useReducer","useReducer","getInitialFilterValues","_useReducer2","filterValues","dispatch","useEffect","hasUrl","sortValues","stringify","baseQuery","getSearchPublishedContent","RAW_RESULTS","checkboxSelectValues","rangeValues","_ref2","propsToDisplay","CHECKBOX_SELECT","includes","RANGE","_toConsumableArray2","_getEntityData","getEntityData","docType","filtersQuery","buildFiltersQuery","queryKeys","rawQueryStringified","buildRawQueryStringified","_useQuery","useQuery","variables","limit","skip","data","error","message","_ref3","_ref3$searchPublished","searchPublishedContent","_ref3$searchPublished2","_ref3$searchPublished3","rawResults","_ref3$searchPublished4","filterData","aggregations","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","hashBit","split","newUrl","buildNewQuery","_document$getElements","document","getElementsByClassName","_document$getElements2","list","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","SCROLL_OFFSET","getBoundingClientRect","createElement","setAppliedFilters","propTypes","PropTypes","string","array","isRequired","bool","number","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useRef, useReducer, useEffect } from 'react';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl, stringify } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildNewQuery,\n buildRawQueryStringified,\n getInitialFilterValues,\n buildFiltersQuery\n} from './helpers';\nimport { getEntityData } from '../../helpers';\nimport { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch: false };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters\n}) => {\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const {\n url: currentUrl,\n query: { sort, sortby },\n query\n } = parseUrl(urlPath);\n const [filterValues, dispatch] = useReducer(\n reducer,\n getInitialFilterValues(null, filters, query)\n );\n\n useEffect(\n () => {\n if (asPath) setUrlPath(asPath);\n },\n [asPath]\n );\n\n const hasUrl = !!url;\n\n const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';\n const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const checkboxSelectValues = [];\n const rangeValues = [];\n\n filters.forEach(({ type, propsToDisplay }) => {\n if (CHECKBOX_SELECT.includes(type)) {\n checkboxSelectValues.push(propsToDisplay[0]);\n } else if (type === RANGE) {\n rangeValues.push(...propsToDisplay);\n }\n });\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = shouldAddFilters\n ? buildFiltersQuery({\n query: filterValues,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys: Object.keys(query)\n })\n : [];\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (filterValues.dataNotSet && filterData) {\n const initialFilterValues = getInitialFilterValues(filterData, filters, query);\n dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n\n if (!newQuery) {\n scrollToFirstList();\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !hasUrl, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const hashBit = asPath.split('#')[1];\n const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues, hashBit);\n scrollToFirstList();\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !hasUrl && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n if (!filterValues) return '';\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAMA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAAgD,SAAAa,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAf,wBAAAmB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OA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O,EAAE8G,qBAAS,CAACE,KAAK;EACxB/G,IAAI,EAAE6G,qBAAS,CAACC,MAAM,CAACE,UAAU;EACjC/G,uBAAuB,EAAE4G,qBAAS,CAACI,IAAI;EACvC/G,gBAAgB,EAAE2G,qBAAS,CAACK,MAAM;EAClC/G,iBAAiB,EAAE0G,qBAAS,CAACK,MAAM;EACnC9G,QAAQ,EAAEyG,qBAAS,CAACE,KAAK;EACzB1G,gBAAgB,EAAEwG,qBAAS,CAACE,KAAK;EACjCzG,gBAAgB,EAAEuG,qBAAS,CAACI;AAC9B,CAAC;AAEDtH,qBAAqB,CAACwH,YAAY,GAAG;EACnCrH,GAAG,EAAE,IAAI;EACTC,OAAO,EAAE,EAAE;EACXF,MAAM,EAAE,EAAE;EACVI,uBAAuB,EAAE,IAAI;EAC7BC,gBAAgB,EAAE,CAAC;EACnBC,iBAAiB,EAAE,CAAC;EACpBC,QAAQ,EAAE,EAAE;EACZC,gBAAgB,EAAE,EAAE;EACpBC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAA8G,QAAA,GAEa,IAAAC,cAAS,EAAC1H,qBAAqB,CAAC;AAAA2H,OAAA,cAAAF,QAAA"}
|
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
require("core-js/modules/es.array.concat.js");
|
|
9
|
-
var buildNewQuery = function buildNewQuery(url, currentUrl, queryParams, sortValues) {
|
|
9
|
+
var buildNewQuery = function buildNewQuery(url, currentUrl, queryParams, sortValues, hashBit) {
|
|
10
10
|
var newUrl = url ? "".concat(url, "?").concat(queryParams) : "".concat(currentUrl, "?").concat(queryParams);
|
|
11
|
-
|
|
11
|
+
var withSortValues = sortValues ? "".concat(newUrl, "&").concat(sortValues) : newUrl;
|
|
12
|
+
return hashBit ? "".concat(withSortValues, "#").concat(hashBit) : withSortValues;
|
|
12
13
|
};
|
|
13
14
|
var _default = buildNewQuery;
|
|
14
15
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","newUrl","concat","_default","exports"],"sources":["../../../../src/components/SearchFilter/helpers/build-new-query.js"],"sourcesContent":["const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {\n const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;\n
|
|
1
|
+
{"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","hashBit","newUrl","concat","withSortValues","_default","exports"],"sources":["../../../../src/components/SearchFilter/helpers/build-new-query.js"],"sourcesContent":["const buildNewQuery = (url, currentUrl, queryParams, sortValues, hashBit) => {\n const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;\n const withSortValues = sortValues ? `${newUrl}&${sortValues}` : newUrl;\n return hashBit ? `${withSortValues}#${hashBit}` : withSortValues;\n};\n\nexport default buildNewQuery;\n"],"mappings":";;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,GAAG,EAAEC,UAAU,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAK;EAC3E,IAAMC,MAAM,GAAGL,GAAG,MAAAM,MAAA,CAAMN,GAAG,OAAAM,MAAA,CAAIJ,WAAW,OAAAI,MAAA,CAAQL,UAAU,OAAAK,MAAA,CAAIJ,WAAW,CAAE;EAC7E,IAAMK,cAAc,GAAGJ,UAAU,MAAAG,MAAA,CAAMD,MAAM,OAAAC,MAAA,CAAIH,UAAU,IAAKE,MAAM;EACtE,OAAOD,OAAO,MAAAE,MAAA,CAAMC,cAAc,OAAAD,MAAA,CAAIF,OAAO,IAAKG,cAAc;AAClE,CAAC;AAAC,IAAAC,QAAA,GAEaT,aAAa;AAAAU,OAAA,cAAAD,QAAA"}
|
|
@@ -21,15 +21,18 @@ var handleSortUpdate = function handleSortUpdate(router, value, query, url, sele
|
|
|
21
21
|
shallow: true,
|
|
22
22
|
scroll: false
|
|
23
23
|
};
|
|
24
|
+
var asPath = router.asPath;
|
|
25
|
+
var hashBit = asPath.split('#')[1];
|
|
26
|
+
var parsedHash = hashBit ? "#".concat(hashBit) : '';
|
|
24
27
|
Object.keys(query).forEach(function (key) {
|
|
25
28
|
if (key.indexOf(_constants.PAGINATION_QUERY) !== -1) return;
|
|
26
29
|
if (key !== _constants.SORTBY && key !== _constants.SORT) queryWithoutSort[key] = query[key];
|
|
27
30
|
});
|
|
28
31
|
if (value === _constants.DEFAULT_SORT || value === selectLabel) {
|
|
29
32
|
var stringifiedQuery = (0, _queryString.stringify)(queryWithoutSort);
|
|
30
|
-
return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery), routerOptions) : router.push("/Resolver", url, routerOptions);
|
|
33
|
+
return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery).concat(parsedHash), routerOptions) : router.push("/Resolver", "".concat(url).concat(parsedHash), routerOptions);
|
|
31
34
|
}
|
|
32
|
-
var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url);
|
|
35
|
+
var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url, parsedHash);
|
|
33
36
|
return router.push('/Resolver', updatedSortUrl, routerOptions);
|
|
34
37
|
};
|
|
35
38
|
var _default = handleSortUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","Object","keys","forEach","key","indexOf","PAGINATION_QUERY","SORTBY","SORT","DEFAULT_SORT","stringifiedQuery","stringify","push","
|
|
1
|
+
{"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","asPath","hashBit","split","parsedHash","concat","Object","keys","forEach","key","indexOf","PAGINATION_QUERY","SORTBY","SORT","DEFAULT_SORT","stringifiedQuery","stringify","push","updatedSortUrl","updateSort","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = (router, value, query, url, selectLabel) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n\n const { asPath } = router;\n const hashBit = asPath.split('#')[1];\n const parsedHash = hashBit ? `#${hashBit}` : '';\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions)\n : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);\n }\n const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash);\n return router.push('/Resolver', updatedSortUrl, routerOptions);\n};\n\nexport default handleSortUpdate;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAMI,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,GAAG,EAAEC,WAAW,EAAK;EACnE,IAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,IAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EAEtD,IAAQC,MAAM,GAAKT,MAAM,CAAjBS,MAAM;EACd,IAAMC,OAAO,GAAGD,MAAM,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EACpC,IAAMC,UAAU,GAAGF,OAAO,OAAAG,MAAA,CAAOH,OAAO,IAAK,EAAE;EAC/CI,MAAM,CAACC,IAAI,CAACb,KAAK,CAAC,CAACc,OAAO,CAAC,UAAAC,GAAG,EAAI;IAChC,IAAIA,GAAG,CAACC,OAAO,CAACC,2BAAgB,CAAC,KAAK,CAAC,CAAC,EAAE;IAC1C,IAAIF,GAAG,KAAKG,iBAAM,IAAIH,GAAG,KAAKI,eAAI,EAAEhB,gBAAgB,CAACY,GAAG,CAAC,GAAGf,KAAK,CAACe,GAAG,CAAC;EACxE,CAAC,CAAC;EACF,IAAIhB,KAAK,KAAKqB,uBAAY,IAAIrB,KAAK,KAAKG,WAAW,EAAE;IACnD,IAAMmB,gBAAgB,GAAG,IAAAC,sBAAS,EAACnB,gBAAgB,CAAC;IAEpD,OAAOkB,gBAAgB,GACnBvB,MAAM,CAACyB,IAAI,iBAAAZ,MAAA,CAAiBV,GAAG,OAAAU,MAAA,CAAIU,gBAAgB,EAAAV,MAAA,CAAGD,UAAU,GAAIN,aAAa,CAAC,GAClFN,MAAM,CAACyB,IAAI,iBAAAZ,MAAA,CAAiBV,GAAG,EAAAU,MAAA,CAAGD,UAAU,GAAIN,aAAa,CAAC;EACpE;EACA,IAAMoB,cAAc,GAAG,IAAAC,sBAAU,EAAC1B,KAAK,EAAEI,gBAAgB,EAAEF,GAAG,EAAES,UAAU,CAAC;EAC3E,OAAOZ,MAAM,CAACyB,IAAI,CAAC,WAAW,EAAEC,cAAc,EAAEpB,aAAa,CAAC;AAChE,CAAC;AAAC,IAAAsB,QAAA,GAEa7B,gBAAgB;AAAA8B,OAAA,cAAAD,QAAA"}
|
|
@@ -22,6 +22,7 @@ var _queryString = require("query-string");
|
|
|
22
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
24
|
var updateSort = function updateSort(value, query, url) {
|
|
25
|
+
var hashBit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
25
26
|
var _value$split = value.split(':'),
|
|
26
27
|
_value$split2 = (0, _slicedToArray2["default"])(_value$split, 2),
|
|
27
28
|
newSortBy = _value$split2[0],
|
|
@@ -31,7 +32,7 @@ var updateSort = function updateSort(value, query, url) {
|
|
|
31
32
|
sort: newSort
|
|
32
33
|
});
|
|
33
34
|
var parsedQuery = (0, _queryString.stringify)(updatedQuery);
|
|
34
|
-
return "".concat(url, "?").concat(parsedQuery);
|
|
35
|
+
return "".concat(url, "?").concat(parsedQuery).concat(hashBit);
|
|
35
36
|
};
|
|
36
37
|
var _default = updateSort;
|
|
37
38
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sort.js","names":["_queryString","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","sortby","sort","parsedQuery","stringify","concat","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\n\nconst updateSort = (value, query, url) => {\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, sortby: newSortBy, sort: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAyC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAkB,yBAAA,GAAAlB,MAAA,CAAAmB,gBAAA,CAAAT,MAAA,EAAAV,MAAA,CAAAkB,yBAAA,CAAAJ,MAAA,KAAAlB,OAAA,CAAAI,MAAA,CAAAc,MAAA,GAAAC,OAAA,WAAAC,GAAA,IAAAhB,MAAA,CAAAoB,cAAA,CAAAV,MAAA,EAAAM,GAAA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAEzC,IAAMW,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAK,EAAEC,KAAK,EAAEC,GAAG,
|
|
1
|
+
{"version":3,"file":"update-sort.js","names":["_queryString","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","hashBit","undefined","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","sortby","sort","parsedQuery","stringify","concat","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\n\nconst updateSort = (value, query, url, hashBit = '') => {\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, sortby: newSortBy, sort: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}${hashBit}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAyC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,Q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js/modules/es.array.is-array.js");
|
|
10
10
|
require("core-js/modules/es.array.map.js");
|
|
11
|
-
require("core-js/modules/es.array.concat.js");
|
|
12
11
|
require("core-js/modules/es.array.join.js");
|
|
13
12
|
var _react = _interopRequireDefault(require("react"));
|
|
14
13
|
var _BlazeLink = _interopRequireDefault(require("../components/BlazeLink"));
|
|
@@ -20,11 +19,11 @@ var getWrappedValueWithLink = function getWrappedValueWithLink(value, link) {
|
|
|
20
19
|
url = arrValue.url;
|
|
21
20
|
var keyValue = arrValue[keyField];
|
|
22
21
|
var isLastItem = index === value.length - 1;
|
|
23
|
-
var keyFieldValue = isLastItem ? keyValue :
|
|
22
|
+
var keyFieldValue = isLastItem ? keyValue : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyValue, ", ");
|
|
24
23
|
return url ? /*#__PURE__*/_react["default"].createElement(_BlazeLink["default"], {
|
|
25
24
|
key: [keyPrefix, index].join('-'),
|
|
26
25
|
href: url
|
|
27
|
-
}, "".
|
|
26
|
+
}, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyFieldValue, " ")) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyFieldValue, " ");
|
|
28
27
|
});
|
|
29
28
|
return arrayResults.length ? arrayResults : null;
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-wrapped-value-with-link.js","names":["_react","_interopRequireDefault","require","_BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","arguments","length","undefined","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","keyFieldValue","
|
|
1
|
+
{"version":3,"file":"get-wrapped-value-with-link.js","names":["_react","_interopRequireDefault","require","_BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","arguments","length","undefined","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","keyFieldValue","createElement","Fragment","key","join","href","_default","exports"],"sources":["../../src/helpers/get-wrapped-value-with-link.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../components/BlazeLink';\n\nconst getWrappedValueWithLink = (value, link, keyPrefix = '') => {\n if (Array.isArray(value)) {\n const arrayResults = value.map((arrValue, index) => {\n const { keyField, url } = arrValue;\n const keyValue = arrValue[keyField];\n\n const isLastItem = index === value.length - 1;\n const keyFieldValue = isLastItem ? keyValue : <>{keyValue}, </>;\n\n return url ? (\n <BlazeLink key={[keyPrefix, index].join('-')} href={url}>\n {<>{keyFieldValue} </>}\n </BlazeLink>\n ) : (\n <>{keyFieldValue} </>\n );\n });\n\n return arrayResults.length ? arrayResults : null;\n }\n\n return link ? <BlazeLink href={link}>{value}</BlazeLink> : value;\n};\n\nexport default getWrappedValueWithLink;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,KAAK,EAAEC,IAAI,EAAqB;EAAA,IAAnBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC1D,IAAIG,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,EAAE;IACxB,IAAMQ,YAAY,GAAGR,KAAK,CAACS,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK,EAAK;MAClD,IAAQC,QAAQ,GAAUF,QAAQ,CAA1BE,QAAQ;QAAEC,GAAG,GAAKH,QAAQ,CAAhBG,GAAG;MACrB,IAAMC,QAAQ,GAAGJ,QAAQ,CAACE,QAAQ,CAAC;MAEnC,IAAMG,UAAU,GAAGJ,KAAK,KAAKX,KAAK,CAACI,MAAM,GAAG,CAAC;MAC7C,IAAMY,aAAa,GAAGD,UAAU,GAAGD,QAAQ,gBAAGnB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGJ,QAAQ,EAAC,IAAI,CAAC;MAE/D,OAAOD,GAAG,gBACRlB,MAAA,YAAAsB,aAAA,CAACnB,UAAA,WAAS;QAACqB,GAAG,EAAE,CAACjB,SAAS,EAAES,KAAK,CAAC,CAACS,IAAI,CAAC,GAAG,CAAE;QAACC,IAAI,EAAER;MAAI,gBACrDlB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGF,aAAa,EAAC,GAAG,CACZ,CAAC,gBAEZrB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGF,aAAa,EAAC,GAAG,CACrB;IACH,CAAC,CAAC;IAEF,OAAOR,YAAY,CAACJ,MAAM,GAAGI,YAAY,GAAG,IAAI;EAClD;EAEA,OAAOP,IAAI,gBAAGN,MAAA,YAAAsB,aAAA,CAACnB,UAAA,WAAS;IAACuB,IAAI,EAAEpB;EAAK,GAAED,KAAiB,CAAC,GAAGA,KAAK;AAClE,CAAC;AAAC,IAAAsB,QAAA,GAEavB,uBAAuB;AAAAwB,OAAA,cAAAD,QAAA"}
|
package/lib/helpers/index.js
CHANGED
|
@@ -275,6 +275,12 @@ Object.defineProperty(exports, "parseTextBlock", {
|
|
|
275
275
|
return _parseTextBlock["default"];
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
+
Object.defineProperty(exports, "processDataSummaryValue", {
|
|
279
|
+
enumerable: true,
|
|
280
|
+
get: function get() {
|
|
281
|
+
return _processDataSummaryValue["default"];
|
|
282
|
+
}
|
|
283
|
+
});
|
|
278
284
|
Object.defineProperty(exports, "removeExtraItems", {
|
|
279
285
|
enumerable: true,
|
|
280
286
|
get: function get() {
|
|
@@ -376,4 +382,5 @@ var _getParsedPropValues = _interopRequireDefault(require("./get-parsed-prop-val
|
|
|
376
382
|
var _getSanitizedPropValues = _interopRequireDefault(require("./get-sanitized-prop-values"));
|
|
377
383
|
var _appendImages = _interopRequireDefault(require("./append-images"));
|
|
378
384
|
var _parseTextBlock = _interopRequireDefault(require("./parse-TextBlock"));
|
|
385
|
+
var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
|
|
379
386
|
//# sourceMappingURL=index.js.map
|