@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/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_buildInheritedFilters","_interopRequireDefault","require","_buildLinkExtraProps","_buildPropsQuery","_buildQueryFields","_buildRawQuery","_buildRawQueryBase","_buildSearchValuesCheckboxSelect","_buildSearchValuesText","_buildSetFilters","_checkPropsToUse","_getElasticsearchOperator","_getClickWrapperOptions","_getEntitiesWithBanner","_getEntityData","_getEntityRenderProps","_getGenericProps","_getGenericRenderVariables","_getImageIds","_getInheritedFilters","_getModifiers","_getNotEqualQuery","_getPaginationIndex","_getParsedSummaryValue","_getQueryFilters","_getQueryProps","_getRequiredSchemas","_getSearchFilterType","_getUnpublishedEntityName","_getWrappedValueWithLink","_getItemsToDisplayIds","_isBrowser","_isFilterEntitysId","_isObject","_isUsingRelationImage","_parsePropsToDisplay","_renderChildren","_shouldRenderWaypoint","_shouldShowProperty","_sortResponseData","_splitChildren","_getCurrentOffset","_updateChildrensParent","_getDisplayCountData","_buildImageProperties","_getUpdatedFilterBy","_checkForError","_removeUnwantedCharacters","_hasChildren","_removeExtraItems","_getParsedPropValues","_getSanitizedPropValues","_appendImages","_parseTextBlock"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildInheritedFilters","_interopRequireDefault","require","_buildLinkExtraProps","_buildPropsQuery","_buildQueryFields","_buildRawQuery","_buildRawQueryBase","_buildSearchValuesCheckboxSelect","_buildSearchValuesText","_buildSetFilters","_checkPropsToUse","_getElasticsearchOperator","_getClickWrapperOptions","_getEntitiesWithBanner","_getEntityData","_getEntityRenderProps","_getGenericProps","_getGenericRenderVariables","_getImageIds","_getInheritedFilters","_getModifiers","_getNotEqualQuery","_getPaginationIndex","_getParsedSummaryValue","_getQueryFilters","_getQueryProps","_getRequiredSchemas","_getSearchFilterType","_getUnpublishedEntityName","_getWrappedValueWithLink","_getItemsToDisplayIds","_isBrowser","_isFilterEntitysId","_isObject","_isUsingRelationImage","_parsePropsToDisplay","_renderChildren","_shouldRenderWaypoint","_shouldShowProperty","_sortResponseData","_splitChildren","_getCurrentOffset","_updateChildrensParent","_getDisplayCountData","_buildImageProperties","_getUpdatedFilterBy","_checkForError","_removeUnwantedCharacters","_hasChildren","_removeExtraItems","_getParsedPropValues","_getSanitizedPropValues","_appendImages","_parseTextBlock","_processDataSummaryValue"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\nexport { default as processDataSummaryValue } from './process-data-summary-value';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,kBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gCAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,sBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,gBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAV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;AACA,IAAAmC,eAAA,GAAApC,sBAAA,CAAAC,OAAA;AACA,IAAAoC,qBAAA,GAAArC,sBAAA,CAAAC,OAAA;AACA,IAAAqC,mBAAA,GAAAtC,sBAAA,CAAAC,OAAA;AACA,IAAAsC,iBAAA,GAAAvC,sBAAA,CAAAC,OAAA;AACA,IAAAuC,cAAA,GAAAxC,sBAAA,CAAAC,OAAA;AACA,IAAAwC,iBAAA,GAAAzC,sBAAA,CAAAC,OAAA;AACA,IAAAyC,sBAAA,GAAA1C,sBAAA,CAAAC,OAAA;AACA,IAAA0C,oBAAA,GAAA3C,sBAAA,CAAAC,OAAA;AACA,IAAA2C,qBAAA,GAAA5C,sBAAA,CAAAC,OAAA;AACA,IAAA4C,mBAAA,GAAA7C,sBAAA,CAAAC,OAAA;AACA,IAAA6C,cAAA,GAAA9C,sBAAA,CAAAC,OAAA;AACA,IAAA8C,yBAAA,GAAA/C,sBAAA,CAAAC,OAAA;AACA,IAAA+C,YAAA,GAAAhD,sBAAA,CAAAC,OAAA;AACA,IAAAgD,iBAAA,GAAAjD,sBAAA,CAAAC,OAAA;AACA,IAAAiD,oBAAA,GAAAlD,sBAAA,CAAAC,OAAA;AACA,IAAAkD,uBAAA,GAAAnD,sBAAA,CAAAC,OAAA;AACA,IAAAmD,aAAA,GAAApD,sBAAA,CAAAC,OAAA;AACA,IAAAoD,eAAA,GAAArD,sBAAA,CAAAC,OAAA;AACA,IAAAqD,wBAAA,GAAAtD,sBAAA,CAAAC,OAAA"}
|
|
@@ -16,12 +16,14 @@ require("core-js/modules/es.array.filter.js");
|
|
|
16
16
|
require("core-js/modules/es.object.to-string.js");
|
|
17
17
|
require("core-js/modules/es.array.map.js");
|
|
18
18
|
require("core-js/modules/es.string.bold.js");
|
|
19
|
+
require("core-js/modules/es.array.is-array.js");
|
|
19
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
21
|
var _lodash = _interopRequireDefault(require("lodash.at"));
|
|
21
22
|
var _isObject = _interopRequireDefault(require("./is-object"));
|
|
22
23
|
var _getParsedPropValues = _interopRequireDefault(require("./get-parsed-prop-values"));
|
|
23
24
|
var _getSanitizedPropValues = _interopRequireDefault(require("./get-sanitized-prop-values"));
|
|
24
25
|
var _constants = require("../constants");
|
|
26
|
+
var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
|
|
25
27
|
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); }
|
|
26
28
|
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; }
|
|
27
29
|
// TODO this helper should be removed if database is wiped clean and all elements change to new props struc
|
|
@@ -29,13 +31,13 @@ var parsePropsToDisplay = function parsePropsToDisplay() {
|
|
|
29
31
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
32
|
var propsToDisplay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
31
33
|
if (!(0, _isObject["default"])(propsToDisplay[0])) return (0, _lodash["default"])(props, propsToDisplay).filter(Boolean);
|
|
32
|
-
return propsToDisplay.map(function (
|
|
33
|
-
var bold =
|
|
34
|
-
propertiesToDisplay =
|
|
35
|
-
prefix =
|
|
36
|
-
suffix =
|
|
37
|
-
shouldStrip =
|
|
38
|
-
enableLink =
|
|
34
|
+
return propsToDisplay.map(function (options, currentIndex) {
|
|
35
|
+
var bold = options.bold,
|
|
36
|
+
propertiesToDisplay = options.propertiesToDisplay,
|
|
37
|
+
prefix = options.prefix,
|
|
38
|
+
suffix = options.suffix,
|
|
39
|
+
shouldStrip = options.shouldStrip,
|
|
40
|
+
enableLink = options.enableLink;
|
|
39
41
|
var Wrapper = bold ? _constants.BOLD_TAG : _react.Fragment;
|
|
40
42
|
var parsedPropValues = (0, _getParsedPropValues["default"])({
|
|
41
43
|
propertiesToDisplay: propertiesToDisplay,
|
|
@@ -46,7 +48,10 @@ var parsePropsToDisplay = function parsePropsToDisplay() {
|
|
|
46
48
|
var sanitizedPropValues = (0, _getSanitizedPropValues["default"])(parsedPropValues);
|
|
47
49
|
if (!sanitizedPropValues || !sanitizedPropValues.length) return null;
|
|
48
50
|
var stringEndBlank = currentIndex + 1 === propsToDisplay.length ? '' : _constants.BLANK_SPACE_UNICODE_STRING;
|
|
49
|
-
|
|
51
|
+
var processedValue = Array.isArray(sanitizedPropValues) ? sanitizedPropValues.map(function (value) {
|
|
52
|
+
return (0, _processDataSummaryValue["default"])(value, options);
|
|
53
|
+
}) : (0, _processDataSummaryValue["default"])(sanitizedPropValues, options);
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, null, prefix, " ", processedValue, " ", suffix, stringEndBlank);
|
|
50
55
|
});
|
|
51
56
|
};
|
|
52
57
|
var _default = parsePropsToDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-props-to-display.js","names":["_react","_interopRequireWildcard","require","_lodash","_interopRequireDefault","_isObject","_getParsedPropValues","_getSanitizedPropValues","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","parsePropsToDisplay","props","arguments","length","undefined","propsToDisplay","isObject","at","filter","Boolean","map","
|
|
1
|
+
{"version":3,"file":"parse-props-to-display.js","names":["_react","_interopRequireWildcard","require","_lodash","_interopRequireDefault","_isObject","_getParsedPropValues","_getSanitizedPropValues","_constants","_processDataSummaryValue","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","parsePropsToDisplay","props","arguments","length","undefined","propsToDisplay","isObject","at","filter","Boolean","map","options","currentIndex","bold","propertiesToDisplay","prefix","suffix","shouldStrip","enableLink","Wrapper","BOLD_TAG","Fragment","parsedPropValues","getParsedPropValues","sanitizedPropValues","getSanitizedPropValues","stringEndBlank","BLANK_SPACE_UNICODE_STRING","processedValue","Array","isArray","value","processDataSummaryValue","createElement","_default","exports"],"sources":["../../src/helpers/parse-props-to-display.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport at from 'lodash.at';\nimport isObject from './is-object';\nimport getParsedPropValues from './get-parsed-prop-values';\nimport getSanitizedPropValues from './get-sanitized-prop-values';\nimport { BOLD_TAG, BLANK_SPACE_UNICODE_STRING } from '../constants';\nimport processDataSummaryValue from './process-data-summary-value';\n\n// TODO this helper should be removed if database is wiped clean and all elements change to new props struc\nconst parsePropsToDisplay = (props = {}, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) return at(props, propsToDisplay).filter(Boolean);\n\n return propsToDisplay.map((options, currentIndex) => {\n const { bold, propertiesToDisplay, prefix, suffix, shouldStrip, enableLink } = options;\n const Wrapper = bold ? BOLD_TAG : Fragment;\n\n const parsedPropValues = getParsedPropValues({\n propertiesToDisplay,\n props,\n enableLink,\n shouldStrip\n });\n\n const sanitizedPropValues = getSanitizedPropValues(parsedPropValues);\n if (!sanitizedPropValues || !sanitizedPropValues.length) return null;\n const stringEndBlank =\n currentIndex + 1 === propsToDisplay.length ? '' : BLANK_SPACE_UNICODE_STRING;\n\n const processedValue = Array.isArray(sanitizedPropValues)\n ? sanitizedPropValues.map(value => processDataSummaryValue(value, options))\n : processDataSummaryValue(sanitizedPropValues, options);\n\n return (\n <Wrapper>\n {prefix} {processedValue} {suffix}\n {stringEndBlank}\n </Wrapper>\n );\n });\n};\n\nexport default parsePropsToDisplay;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,uBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAL,sBAAA,CAAAF,OAAA;AAAmE,SAAAQ,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,SAAAV,wBAAAc,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,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,IAAMC,OAAO,GAAGN,IAAI,GAAGO,mBAAQ,GAAGC,eAAQ;IAE1C,IAAMC,gBAAgB,GAAG,IAAAC,+BAAmB,EAAC;MAC3CT,mBAAmB,EAAnBA,mBAAmB;MACnBb,KAAK,EAALA,KAAK;MACLiB,UAAU,EAAVA,UAAU;MACVD,WAAW,EAAXA;IACF,CAAC,CAAC;IAEF,IAAMO,mBAAmB,GAAG,IAAAC,kCAAsB,EAACH,gBAAgB,CAAC;IACpE,IAAI,CAACE,mBAAmB,IAAI,CAACA,mBAAmB,CAACrB,MAAM,EAAE,OAAO,IAAI;IACpE,IAAMuB,cAAc,GAClBd,YAAY,GAAG,CAAC,KAAKP,cAAc,CAACF,MAAM,GAAG,EAAE,GAAGwB,qCAA0B;IAE9E,IAAMC,cAAc,GAAGC,KAAK,CAACC,OAAO,CAACN,mBAAmB,CAAC,GACrDA,mBAAmB,CAACd,GAAG,CAAC,UAAAqB,KAAK;MAAA,OAAI,IAAAC,mCAAuB,EAACD,KAAK,EAAEpB,OAAO,CAAC;IAAA,EAAC,GACzE,IAAAqB,mCAAuB,EAACR,mBAAmB,EAAEb,OAAO,CAAC;IAEzD,oBACE3C,MAAA,YAAAiE,aAAA,CAACd,OAAO,QACLJ,MAAM,EAAC,GAAC,EAACa,cAAc,EAAC,GAAC,EAACZ,MAAM,EAChCU,cACM,CAAC;EAEd,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAQ,QAAA,GAEalC,mBAAmB;AAAAmC,OAAA,cAAAD,QAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
|
4
|
+
require("core-js/modules/es.date.to-primitive.js");
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
require("core-js/modules/es.symbol.description.js");
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
require("core-js/modules/es.number.constructor.js");
|
|
9
|
+
require("core-js/modules/es.object.keys.js");
|
|
10
|
+
require("core-js/modules/es.array.filter.js");
|
|
11
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
+
require("core-js/modules/es.array.for-each.js");
|
|
13
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
15
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
16
|
+
require("core-js/modules/es.object.define-property.js");
|
|
17
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
18
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports["default"] = void 0;
|
|
23
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
25
|
+
require("core-js/modules/es.array.is-array.js");
|
|
26
|
+
require("core-js/modules/es.array.map.js");
|
|
27
|
+
var _react = _interopRequireDefault(require("react"));
|
|
28
|
+
var _components = _interopRequireDefault(require("../components"));
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
32
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
33
|
+
var Code = _components["default"].code;
|
|
34
|
+
var renderCode = function renderCode(value) {
|
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(Code, {
|
|
36
|
+
code: value,
|
|
37
|
+
disableWrapper: true
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var processDataSummaryValue = function processDataSummaryValue(objPropValue, _ref) {
|
|
41
|
+
var isHtml = _ref.isHtml;
|
|
42
|
+
var pValue = objPropValue;
|
|
43
|
+
if (isHtml) {
|
|
44
|
+
pValue = Array.isArray(objPropValue) ? objPropValue.map(function (_ref2) {
|
|
45
|
+
var _objectSpread2;
|
|
46
|
+
var keyField = _ref2.keyField,
|
|
47
|
+
value = _ref2[keyField],
|
|
48
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, ["keyField", keyField].map(_toPropertyKey));
|
|
49
|
+
return _objectSpread((_objectSpread2 = {}, (0, _defineProperty2["default"])(_objectSpread2, keyField, renderCode(value)), (0, _defineProperty2["default"])(_objectSpread2, "keyField", keyField), _objectSpread2), otherProps);
|
|
50
|
+
}) : renderCode(objPropValue);
|
|
51
|
+
}
|
|
52
|
+
return pValue;
|
|
53
|
+
};
|
|
54
|
+
var _default = processDataSummaryValue;
|
|
55
|
+
exports["default"] = _default;
|
|
56
|
+
//# sourceMappingURL=process-data-summary-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-data-summary-value.js","names":["_react","_interopRequireDefault","require","_components","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","_toPropertyKey","arg","_toPrimitive","_typeof","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Code","components","code","renderCode","value","createElement","disableWrapper","processDataSummaryValue","objPropValue","_ref","isHtml","pValue","Array","isArray","map","_ref2","_objectSpread2","keyField","otherProps","_objectWithoutProperties2","_default","exports"],"sources":["../../src/helpers/process-data-summary-value.js"],"sourcesContent":["import React from 'react';\nimport components from '../components';\n\nconst { code: Code } = components;\n\nconst renderCode = value => <Code code={value} disableWrapper />;\n\nconst processDataSummaryValue = (objPropValue, { isHtml }) => {\n let pValue = objPropValue;\n if (isHtml) {\n pValue = Array.isArray(objPropValue)\n ? objPropValue.map(({ keyField, [keyField]: value, ...otherProps }) => ({\n [keyField]: renderCode(value),\n keyField,\n ...otherProps\n }))\n : renderCode(objPropValue);\n }\n return pValue;\n};\n\nexport default processDataSummaryValue;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAuC,SAAAE,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,S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AAA,CAAE,CAAC;AAAA;AAEhE,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,YAAY,EAAAC,IAAA,EAAiB;EAAA,IAAbC,MAAM,GAAAD,IAAA,CAANC,MAAM;EACrD,IAAIC,MAAM,GAAGH,YAAY;EACzB,IAAIE,MAAM,EAAE;IACVC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACL,YAAY,CAAC,GAChCA,YAAY,CAACM,GAAG,CAAC,UAAAC,KAAA;MAAA,IAAAC,cAAA;MAAA,IAAGC,QAAQ,GAAAF,KAAA,CAARE,QAAQ;QAAcb,KAAK,GAAAW,KAAA,CAAhBE,QAAQ;QAAaC,UAAU,OAAAC,yBAAA,aAAAJ,KAAA,eAA/BE,QAAQ,EAAAH,GAAA,CAAA7B,cAAA;MAAA,OAAAZ,aAAA,EAAA2C,cAAA,WAAAnC,gBAAA,aAAAmC,cAAA,EACpCC,QAAQ,EAAGd,UAAU,CAACC,KAAK,CAAC,OAAAvB,gBAAA,aAAAmC,cAAA,cAC7BC,QAAQ,GAAAD,cAAA,GACLE,UAAU;IAAA,CACb,CAAC,GACHf,UAAU,CAACK,YAAY,CAAC;EAC9B;EACA,OAAOG,MAAM;AACf,CAAC;AAAC,IAAAS,QAAA,GAEab,uBAAuB;AAAAc,OAAA,cAAAD,QAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["code", "parserOptions"];
|
|
3
|
+
const _excluded = ["code", "parserOptions", "disableWrapper"];
|
|
4
4
|
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; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import React, { memo } from 'react';
|
|
@@ -14,13 +14,15 @@ import { wrapScriptTags } from './helpers';
|
|
|
14
14
|
const Code = memo(_ref => {
|
|
15
15
|
let {
|
|
16
16
|
code: embedCode,
|
|
17
|
-
parserOptions
|
|
17
|
+
parserOptions,
|
|
18
|
+
disableWrapper
|
|
18
19
|
} = _ref,
|
|
19
20
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
20
21
|
if (!embedCode) return null;
|
|
21
22
|
const parsedCode = parseHTML(embedCode, parserOptions);
|
|
22
23
|
const wrappedCode = wrapScriptTags(parsedCode);
|
|
23
24
|
const modifiers = getClassModifiers(CODE, _objectSpread({}, otherProps));
|
|
25
|
+
if (disableWrapper) return wrappedCode;
|
|
24
26
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
25
27
|
modifiers: modifiers
|
|
26
28
|
}, wrappedCode);
|
|
@@ -28,12 +30,14 @@ const Code = memo(_ref => {
|
|
|
28
30
|
Code.propTypes = {
|
|
29
31
|
code: PropTypes.string,
|
|
30
32
|
modifier: PropTypes.string,
|
|
31
|
-
parserOptions: PropTypes.object
|
|
33
|
+
parserOptions: PropTypes.object,
|
|
34
|
+
disableWrapper: PropTypes.bool
|
|
32
35
|
};
|
|
33
36
|
Code.defaultProps = {
|
|
34
37
|
code: '',
|
|
35
38
|
modifier: '',
|
|
36
|
-
parserOptions: {}
|
|
39
|
+
parserOptions: {},
|
|
40
|
+
disableWrapper: false
|
|
37
41
|
};
|
|
38
42
|
export default withTitle(Code);
|
|
39
43
|
//# sourceMappingURL=Code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","names":["React","memo","PropTypes","parseHTML","Wrapper","withTitle","getClassModifiers","CODE","wrapScriptTags","Code","_ref","code","embedCode","parserOptions","otherProps","_objectWithoutProperties","_excluded","parsedCode","wrappedCode","modifiers","_objectSpread","createElement","propTypes","string","modifier","object","defaultProps"],"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,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,SAASC,cAAc,QAAQ,WAAW;AAE1C,MAAMC,IAAI,GAAGR,IAAI,CAACS,IAAA,
|
|
1
|
+
{"version":3,"file":"Code.js","names":["React","memo","PropTypes","parseHTML","Wrapper","withTitle","getClassModifiers","CODE","wrapScriptTags","Code","_ref","code","embedCode","parserOptions","disableWrapper","otherProps","_objectWithoutProperties","_excluded","parsedCode","wrappedCode","modifiers","_objectSpread","createElement","propTypes","string","modifier","object","bool","defaultProps"],"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,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,SAASC,cAAc,QAAQ,WAAW;AAE1C,MAAMC,IAAI,GAAGR,IAAI,CAACS,IAAA,IAAuE;EAAA,IAAtE;MAAEC,IAAI,EAAEC,SAAS;MAAEC,aAAa;MAAEC;IAA8B,CAAC,GAAAJ,IAAA;IAAZK,UAAU,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA;EAChF,IAAI,CAACL,SAAS,EAAE,OAAO,IAAI;EAE3B,MAAMM,UAAU,GAAGf,SAAS,CAACS,SAAS,EAAEC,aAAa,CAAC;EACtD,MAAMM,WAAW,GAAGX,cAAc,CAACU,UAAU,CAAC;EAC9C,MAAME,SAAS,GAAGd,iBAAiB,CAACC,IAAI,EAAAc,aAAA,KAAON,UAAU,CAAE,CAAC;EAE5D,IAAID,cAAc,EAAE,OAAOK,WAAW;EAEtC,oBAAOnB,KAAA,CAAAsB,aAAA,CAAClB,OAAO;IAACgB,SAAS,EAAEA;EAAU,GAAED,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFV,IAAI,CAACc,SAAS,GAAG;EACfZ,IAAI,EAAET,SAAS,CAACsB,MAAM;EACtBC,QAAQ,EAAEvB,SAAS,CAACsB,MAAM;EAC1BX,aAAa,EAAEX,SAAS,CAACwB,MAAM;EAC/BZ,cAAc,EAAEZ,SAAS,CAACyB;AAC5B,CAAC;AAEDlB,IAAI,CAACmB,YAAY,GAAG;EAClBjB,IAAI,EAAE,EAAE;EACRc,QAAQ,EAAE,EAAE;EACZZ,aAAa,EAAE,CAAC,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC;AAED,eAAeT,SAAS,CAACI,IAAI,CAAC"}
|
|
@@ -3,6 +3,7 @@ import flatten from 'lodash.flatten';
|
|
|
3
3
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
4
4
|
import getLoopPropsLimit from './get-loop-props-limit';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
|
+
import { processDataSummaryValue } from '../../../helpers';
|
|
6
7
|
const getLoopValue = value => {
|
|
7
8
|
const {
|
|
8
9
|
keyField
|
|
@@ -45,8 +46,9 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
45
46
|
const loopValue = loopValues[key];
|
|
46
47
|
const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
47
48
|
if (!propValue) return null;
|
|
49
|
+
const processedValue = processDataSummaryValue(propValue, options);
|
|
48
50
|
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
49
|
-
return [upperFirst(label),
|
|
51
|
+
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
50
52
|
});
|
|
51
53
|
})).filter(Boolean);
|
|
52
54
|
loopPropsWithContent.push(propsArray);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","propValue","linkToPublishedContent","filter","Boolean","push"],"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":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"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,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1D,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,OAAOA,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,MAAMC,cAAc,GAAGA,CAACC,cAAc,EAAEC,SAAS,EAAEC,IAAI,KAAK;EAC1D,MAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,MAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAACC,OAAO,IAAI;IAChC,MAAM;MAAEC;IAAoB,CAAC,GAAGD,OAAO;IACvCC,mBAAmB,CAACF,OAAO,CAACG,IAAI,IAAI;MAClC,MAAMX,KAAK,GAAGH,YAAY,CAACc,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,MAAMG,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC;MACzC,IAAI,CAACA,KAAK,EAAE;MACZ,MAAMe,cAAc,GAAGX,SAAS,CAAC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BAAsB,GAAGnC,yBAAyB,CAAC+B,GAAG,EAAErB,IAAI,CAAC;QACnE,OAAO,CAACZ,UAAU,CAAC+B,KAAK,CAAC,EAAEK,cAAc,EAAEC,sBAAsB,EAAEL,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACM,MAAM,CAACC,OAAO,CAAC;IACjBb,oBAAoB,CAACc,IAAI,CAACX,UAAU,CAAC;EACvC;EAEA,OAAO5B,OAAO,CAACyB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import upperFirst from 'lodash.upperfirst';
|
|
2
2
|
import flatten from 'lodash.flatten';
|
|
3
|
-
import { isObject } from '../../../helpers';
|
|
3
|
+
import { isObject, processDataSummaryValue } from '../../../helpers';
|
|
4
4
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
6
|
import getLinkBasedOnValue from './get-link-based-on-value';
|
|
@@ -25,8 +25,9 @@ const buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {
|
|
|
25
25
|
if (!key) return null;
|
|
26
26
|
const objPropValue = getPropValue(key, props, options);
|
|
27
27
|
if (!objPropValue) return null;
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const processedValue = processDataSummaryValue(objPropValue, options);
|
|
29
|
+
const link = getLink(enableLink, key, props, processedValue);
|
|
30
|
+
return [upperFirst(label), processedValue, link, modifier];
|
|
30
31
|
});
|
|
31
32
|
})).filter(Boolean);
|
|
32
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-to-display-with-content.js","names":["upperFirst","flatten","isObject","getLinkToPublishedContent","getPropValue","getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","map","key","propValue","propName","split","join","filter","Boolean","options","propertiesToDisplay","label","modifier","enableLink","objPropValue","link","getLink"],"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":["upperFirst","flatten","isObject","processDataSummaryValue","getLinkToPublishedContent","getPropValue","getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","map","key","propValue","propName","split","join","filter","Boolean","options","propertiesToDisplay","label","modifier","enableLink","objPropValue","processedValue","link","getLink"],"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,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,QAAQ,EAAEC,uBAAuB,QAAQ,kBAAkB;AACpE,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,mBAAmB,MAAM,2BAA2B;AAE3D,MAAMC,8BAA8B,GAAGA,CAACC,KAAK,EAAEC,cAAc,GAAG,EAAE,KAAK;EACrE,IAAI,CAACP,QAAQ,CAACO,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;IAChC,OAAOA,cAAc,CAClBC,GAAG,CAACC,GAAG,IAAI;MACV,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MACrB,MAAMC,SAAS,GAAGP,YAAY,CAACM,GAAG,EAAEH,KAAK,CAAC;MAC1C,IAAI,CAACI,SAAS,EAAE,OAAO,IAAI;MAC3B,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MACzC,OAAO,CAACf,UAAU,CAACa,QAAQ,CAAC,EAAED,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOhB,OAAO,CACZQ,cAAc,CAACC,GAAG,CAACQ,OAAO,IAAI;IAC5B,MAAM;MAAEC,mBAAmB;MAAEC,KAAK;MAAEC,QAAQ,GAAG,EAAE;MAAEC;IAAW,CAAC,GAAGJ,OAAO;IACzE,OAAOC,mBAAmB,CAACT,GAAG,CAACC,GAAG,IAAI;MACpC,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MAErB,MAAMY,YAAY,GAAGlB,YAAY,CAACM,GAAG,EAAEH,KAAK,EAAEU,OAAO,CAAC;MACtD,IAAI,CAACK,YAAY,EAAE,OAAO,IAAI;MAE9B,MAAMC,cAAc,GAAGrB,uBAAuB,CAACoB,YAAY,EAAEL,OAAO,CAAC;MAErE,MAAMO,IAAI,GAAGC,OAAO,CAACJ,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEgB,cAAc,CAAC;MAE5D,OAAO,CAACxB,UAAU,CAACoB,KAAK,CAAC,EAAEI,cAAc,EAAEC,IAAI,EAAEJ,QAAQ,CAAC;IAC5D,CAAC,CAAC;EACJ,CAAC,CACH,CAAC,CAACL,MAAM,CAACC,OAAO,CAAC;AACnB,CAAC;AAED,eAAeV,8BAA8B;AAE7C,SAASmB,OAAOA,CAACJ,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEe,YAAY,EAAE;EACrD,IAAIE,IAAI,GAAG,EAAE;EACb,IAAIH,UAAU,EAAE;IACdG,IAAI,GAAGrB,yBAAyB,CAACO,GAAG,EAAEH,KAAK,CAAC;IAC5C,IAAI,CAACiB,IAAI,EAAE;MACTA,IAAI,GAAGnB,mBAAmB,CAACiB,YAAY,CAAC;IAC1C;EACF;EACA,OAAOE,IAAI;AACb"}
|
|
@@ -9,12 +9,12 @@ const SearchContent = ({
|
|
|
9
9
|
searchInputAlignment,
|
|
10
10
|
searchInputWrapperMobile,
|
|
11
11
|
searchInputWrapperDesktop,
|
|
12
|
-
collapsible,
|
|
13
12
|
isMobile,
|
|
14
13
|
placeholder,
|
|
15
|
-
modifier
|
|
14
|
+
modifier,
|
|
15
|
+
collapsedSearch
|
|
16
16
|
}) => {
|
|
17
|
-
const [collapsed, setCollapsed] = useState(
|
|
17
|
+
const [collapsed, setCollapsed] = useState(collapsedSearch);
|
|
18
18
|
const router = useRouter();
|
|
19
19
|
const {
|
|
20
20
|
results,
|
|
@@ -44,7 +44,7 @@ const SearchContent = ({
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
const handleOnBlur = () => {
|
|
47
|
-
if (!
|
|
47
|
+
if (!collapsedSearch) return;
|
|
48
48
|
if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
|
|
49
49
|
};
|
|
50
50
|
const handleClearSearchResults = () => {
|
|
@@ -106,7 +106,8 @@ SearchContent.propTypes = {
|
|
|
106
106
|
isMobile: PropTypes.bool,
|
|
107
107
|
collapsible: PropTypes.bool,
|
|
108
108
|
entities: PropTypes.array.isRequired,
|
|
109
|
-
modifier: PropTypes.string
|
|
109
|
+
modifier: PropTypes.string,
|
|
110
|
+
collapsedSearch: PropTypes.bool
|
|
110
111
|
};
|
|
111
112
|
SearchContent.defaultProps = {
|
|
112
113
|
searchInputAlignment: '',
|
|
@@ -115,7 +116,8 @@ SearchContent.defaultProps = {
|
|
|
115
116
|
placeholder: '',
|
|
116
117
|
isMobile: false,
|
|
117
118
|
collapsible: false,
|
|
118
|
-
modifier: ''
|
|
119
|
+
modifier: '',
|
|
120
|
+
collapsedSearch: false
|
|
119
121
|
};
|
|
120
122
|
export default SearchContent;
|
|
121
123
|
//# sourceMappingURL=SearchContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContent.js","names":["React","useState","useEffect","PropTypes","useRouter","useDebounceSearch","SearchContentResults","SearchContentToggleIcon","SearchContent","entities","searchInputAlignment","searchInputWrapperMobile","searchInputWrapperDesktop","
|
|
1
|
+
{"version":3,"file":"SearchContent.js","names":["React","useState","useEffect","PropTypes","useRouter","useDebounceSearch","SearchContentResults","SearchContentToggleIcon","SearchContent","entities","searchInputAlignment","searchInputWrapperMobile","searchInputWrapperDesktop","isMobile","placeholder","modifier","collapsedSearch","collapsed","setCollapsed","router","results","searchTerm","setSearchTerm","debouncedSearchTerm","initialSearchTerm","resultKeys","handleRouteChange","events","on","off","responsiveClasses","handleClick","e","url","preventDefault","push","handleKeyPress","key","target","value","handleOnBlur","handleClearSearchResults","className","filter","Boolean","join","createElement","viewBox","fillRule","d","clipRule","onFocus","onChange","type","name","Fragment","onClear","onKeyPress","onBlur","propTypes","string","bool","collapsible","array","isRequired","defaultProps"],"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: '',\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AAyB,EAAET,SAAS,CAACyD,MAAM;EAC3C9C,WAAW,EAAEX,SAAS,CAACyD,MAAM;EAC7B/C,QAAQ,EAAEV,SAAS,CAAC0D,IAAI;EACxBC,WAAW,EAAE3D,SAAS,CAAC0D,IAAI;EAC3BpD,QAAQ,EAAEN,SAAS,CAAC4D,KAAK,CAACC,UAAU;EACpCjD,QAAQ,EAAEZ,SAAS,CAACyD,MAAM;EAC1B5C,eAAe,EAAEb,SAAS,CAAC0D;AAC7B,CAAC;AAEDrD,aAAa,CAACyD,YAAY,GAAG;EAC3BvD,oBAAoB,EAAE,EAAE;EACxBC,wBAAwB,EAAE,EAAE;EAC5BC,yBAAyB,EAAE,EAAE;EAC7BE,WAAW,EAAE,EAAE;EACfD,QAAQ,EAAE,KAAK;EACfiD,WAAW,EAAE,KAAK;EAClB/C,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,eAAeR,aAAa"}
|
|
@@ -139,7 +139,8 @@ const SearchFilterContainer = ({
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const
|
|
142
|
+
const hashBit = asPath.split('#')[1];
|
|
143
|
+
const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues, hashBit);
|
|
143
144
|
scrollToFirstList();
|
|
144
145
|
setUrlPath(newUrl);
|
|
145
146
|
return router.push('/Resolver', newUrl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useRef","useReducer","useEffect","useRouter","useQuery","PropTypes","parseUrl","stringify","SearchFilter","withTitle","getSearchPublishedContent","buildNewQuery","buildRawQueryStringified","getInitialFilterValues","buildFiltersQuery","getEntityData","RAW_RESULTS","RANGE","CHECKBOX_SELECT","SCROLL_OFFSET","reducer","state","action","newValues","type","shouldSearch","_objectSpread","Error","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","currentUrl","query","sort","sortby","filterValues","dispatch","hasUrl","sortValues","baseQuery","checkboxSelectValues","rangeValues","forEach","propsToDisplay","includes","push","docType","filtersQuery","queryKeys","Object","keys","rawQueryStringified","data","error","variables","limit","skip","message","length","searchPublishedContent","rawResults","aggregations","filterData","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","propTypes","string","array","isRequired","bool","number","defaultProps"],"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,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACtE,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QA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,EAAE;EACpBC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAe7B,SAAS,CAACmB,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useRef","useReducer","useEffect","useRouter","useQuery","PropTypes","parseUrl","stringify","SearchFilter","withTitle","getSearchPublishedContent","buildNewQuery","buildRawQueryStringified","getInitialFilterValues","buildFiltersQuery","getEntityData","RAW_RESULTS","RANGE","CHECKBOX_SELECT","SCROLL_OFFSET","reducer","state","action","newValues","type","shouldSearch","_objectSpread","Error","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","currentUrl","query","sort","sortby","filterValues","dispatch","hasUrl","sortValues","baseQuery","checkboxSelectValues","rangeValues","forEach","propsToDisplay","includes","push","docType","filtersQuery","queryKeys","Object","keys","rawQueryStringified","data","error","variables","limit","skip","message","length","searchPublishedContent","rawResults","aggregations","filterData","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","hashBit","split","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","propTypes","string","array","isRequired","bool","number","defaultProps"],"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,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACtE,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,cAAc;AAClD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SACEC,aAAa,EACbC,wBAAwB,EACxBC,sBAAsB,EACtBC,iBAAiB,QACZ,WAAW;AAClB,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,EAAEC,KAAK,EAAEC,eAAe,QAAQ,aAAa;AACjE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,OAAO,GAAGA,CAACC,KAAK,EAAEC,MAAM,KAAK;EACjC,MAAM;IAAEC,SAAS;IAAEC,IAAI;IAAEC,YAAY,GAAG;EAAK,CAAC,GAAGH,MAAM;EAEvD,QAAQE,IAAI;IACV,KAAK,QAAQ;MACX,OAAAE,aAAA,CAAAA,aAAA,CAAAA,aAAA,KAAYL,KAAK,GAAKE,SAAS;QAAEE;MAAY;IAC/C,KAAK,aAAa;MAChB,OAAAC,aAAA,CAAAA,aAAA,KAAYL,KAAK;QAAEI,YAAY,EAAE;MAAK;IACxC,KAAK,OAAO;MACV,OAAAC,aAAA,CAAAA,aAAA,KAAYH,SAAS;QAAEE,YAAY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AK;EACxB3E,IAAI,EAAE3B,SAAS,CAACqG,MAAM,CAACE,UAAU;EACjC3E,uBAAuB,EAAE5B,SAAS,CAACwG,IAAI;EACvC3E,gBAAgB,EAAE7B,SAAS,CAACyG,MAAM;EAClC3E,iBAAiB,EAAE9B,SAAS,CAACyG,MAAM;EACnC1E,QAAQ,EAAE/B,SAAS,CAACsG,KAAK;EACzBtE,gBAAgB,EAAEhC,SAAS,CAACsG,KAAK;EACjCrE,gBAAgB,EAAEjC,SAAS,CAACwG;AAC9B,CAAC;AAEDjF,qBAAqB,CAACmF,YAAY,GAAG;EACnCjF,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;AAED,eAAe7B,SAAS,CAACmB,qBAAqB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {
|
|
1
|
+
const buildNewQuery = (url, currentUrl, queryParams, sortValues, hashBit) => {
|
|
2
2
|
const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;
|
|
3
|
-
|
|
3
|
+
const withSortValues = sortValues ? `${newUrl}&${sortValues}` : newUrl;
|
|
4
|
+
return hashBit ? `${withSortValues}#${hashBit}` : withSortValues;
|
|
4
5
|
};
|
|
5
6
|
export default buildNewQuery;
|
|
6
7
|
//# sourceMappingURL=build-new-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","newUrl"],"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","withSortValues"],"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,MAAMA,aAAa,GAAGA,CAACC,GAAG,EAAEC,UAAU,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,KAAK;EAC3E,MAAMC,MAAM,GAAGL,GAAG,GAAI,GAAEA,GAAI,IAAGE,WAAY,EAAC,GAAI,GAAED,UAAW,IAAGC,WAAY,EAAC;EAC7E,MAAMI,cAAc,GAAGH,UAAU,GAAI,GAAEE,MAAO,IAAGF,UAAW,EAAC,GAAGE,MAAM;EACtE,OAAOD,OAAO,GAAI,GAAEE,cAAe,IAAGF,OAAQ,EAAC,GAAGE,cAAc;AAClE,CAAC;AAED,eAAeP,aAAa"}
|
|
@@ -7,15 +7,20 @@ const handleSortUpdate = (router, value, query, url, selectLabel) => {
|
|
|
7
7
|
shallow: true,
|
|
8
8
|
scroll: false
|
|
9
9
|
};
|
|
10
|
+
const {
|
|
11
|
+
asPath
|
|
12
|
+
} = router;
|
|
13
|
+
const hashBit = asPath.split('#')[1];
|
|
14
|
+
const parsedHash = hashBit ? `#${hashBit}` : '';
|
|
10
15
|
Object.keys(query).forEach(key => {
|
|
11
16
|
if (key.indexOf(PAGINATION_QUERY) !== -1) return;
|
|
12
17
|
if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];
|
|
13
18
|
});
|
|
14
19
|
if (value === DEFAULT_SORT || value === selectLabel) {
|
|
15
20
|
const stringifiedQuery = stringify(queryWithoutSort);
|
|
16
|
-
return stringifiedQuery ? router.push(`/Resolver`, `${url}?${stringifiedQuery}`, routerOptions) : router.push(`/Resolver`, url
|
|
21
|
+
return stringifiedQuery ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions) : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);
|
|
17
22
|
}
|
|
18
|
-
const updatedSortUrl = updateSort(value, queryWithoutSort, url);
|
|
23
|
+
const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash);
|
|
19
24
|
return router.push('/Resolver', updatedSortUrl, routerOptions);
|
|
20
25
|
};
|
|
21
26
|
export default handleSortUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-sort-update.js","names":["stringify","DEFAULT_SORT","SORT","SORTBY","PAGINATION_QUERY","updateSort","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","Object","keys","forEach","key","indexOf","stringifiedQuery","push","updatedSortUrl"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = (router, value, query, url, selectLabel) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}`, routerOptions)\n : router.push(`/Resolver`, url
|
|
1
|
+
{"version":3,"file":"handle-sort-update.js","names":["stringify","DEFAULT_SORT","SORT","SORTBY","PAGINATION_QUERY","updateSort","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","asPath","hashBit","split","parsedHash","Object","keys","forEach","key","indexOf","stringifiedQuery","push","updatedSortUrl"],"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,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,YAAY,EAAEC,IAAI,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AAC3E,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAMC,gBAAgB,GAAGA,CAACC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,GAAG,EAAEC,WAAW,KAAK;EACnE,MAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,MAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EAEtD,MAAM;IAAEC;EAAO,CAAC,GAAGT,MAAM;EACzB,MAAMU,OAAO,GAAGD,MAAM,CAACE,KAAK,C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