@blaze-cms/react-page-builder 0.131.0-core-styles.0 → 0.131.0
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 +2 -13
- package/lib/HOC/recreateOnNavigation.js +29 -0
- package/lib/HOC/recreateOnNavigation.js.map +1 -0
- package/lib/components/Button.js +1 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsRender.js +6 -13
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/index.js +0 -7
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Code/Code.js +3 -7
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/Layout/Layout.js +3 -2
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/LayoutFactory.js +35 -0
- package/lib/components/Layout/LayoutFactory.js.map +1 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js +66 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/Layout/index.js.map +1 -1
- package/lib/components/List/ListFactory.js +11 -16
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/index.js +0 -14
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +6 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +11 -17
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +85 -63
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +1 -3
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +15 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js +37 -0
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +43 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +11 -18
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +11 -31
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -19
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +5 -9
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +0 -2
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +2 -5
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-set-filters.js +1 -5
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-filters.js +8 -6
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +2 -13
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +3 -2
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +0 -14
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +8 -13
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib-es/HOC/recreateOnNavigation.js +20 -0
- package/lib-es/HOC/recreateOnNavigation.js.map +1 -0
- package/lib-es/components/Button.js +1 -2
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +7 -14
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/index.js +0 -1
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Code/Code.js +4 -8
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -4
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +3 -2
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/components/Layout/LayoutFactory.js +14 -0
- package/lib-es/components/Layout/LayoutFactory.js.map +1 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js +42 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib-es/components/Layout/index.js +2 -2
- package/lib-es/components/Layout/index.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +12 -16
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/index.js +0 -2
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +6 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +11 -18
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +72 -47
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +0 -2
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js +23 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +26 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +4 -5
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/index.js +2 -2
- package/lib-es/components/SearchFilter/index.js.map +1 -1
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +10 -26
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +4 -21
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +4 -8
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +0 -2
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +2 -4
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-set-filters.js +1 -5
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +8 -6
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +2 -10
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +0 -2
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +9 -12
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/utils/get-class-modifiers.js +1 -1
- package/lib-es/utils/get-class-modifiers.js.map +1 -1
- package/package.json +10 -10
- package/src/HOC/recreateOnNavigation.js +21 -0
- package/src/components/Button.js +1 -2
- package/src/components/Card/CardsRender.js +7 -27
- package/src/components/Card/helpers/index.js +0 -1
- package/src/components/Code/Code.js +3 -7
- package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -4
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -6
- package/src/components/Layout/Layout.js +29 -32
- package/src/components/Layout/LayoutFactory.js +17 -0
- package/src/components/Layout/LayoutWithStickyTimer.js +40 -0
- package/src/components/Layout/index.js +2 -2
- package/src/components/List/ListFactory.js +15 -25
- package/src/components/List/helpers/index.js +0 -2
- package/src/components/SearchContent/SearchContent.js +6 -8
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +12 -21
- package/src/components/SearchFilter/SearchFilterContainer.js +69 -57
- package/src/components/SearchFilter/helpers/build-filters-query.js +1 -9
- package/src/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/src/components/SearchFilter/helpers/build-query.js +26 -0
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +30 -0
- package/src/components/SearchFilter/helpers/index.js +7 -9
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilterSort/SearchFilterSort.js +8 -18
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +5 -14
- package/src/components/SearchFilterSort/helpers/update-sort.js +3 -7
- package/src/helpers/build-inherited-filters.js +1 -3
- package/src/helpers/build-props-query.js +2 -4
- package/src/helpers/build-set-filters.js +1 -2
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +4 -12
- package/src/helpers/get-wrapped-value-with-link.js +3 -6
- package/src/helpers/index.js +0 -2
- package/src/helpers/parse-props-to-display.js +21 -25
- package/src/utils/get-class-modifiers.js +1 -1
- package/tests/helpers/mocks.js +5 -3
- package/tests/unit/src/HOC/recreateOnNavigation.test.js +28 -0
- package/tests/unit/src/components/Code/Code.test.js +0 -5
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +0 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -9
- package/tests/unit/src/components/Layout/Layout.test.js +1 -1
- package/tests/unit/src/components/Layout/LayoutFactory.test.js +53 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +7 -1
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +7 -24
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +1 -4
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +19 -26
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +1 -10
- package/tests/unit/src/helpers/build-props-query.test.js +0 -25
- 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 +0 -4
- package/lib/components/Card/helpers/get-updated-items-to-display.js +0 -55
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib/components/List/helpers/get-list-query.js +0 -43
- package/lib/components/List/helpers/get-list-query.js.map +0 -1
- package/lib/components/List/helpers/get-list-specific-search-filter.js +0 -21
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib/components/List/helpers/strip-query-key.js +0 -14
- package/lib/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +0 -17
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-url-query.js +0 -48
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -32
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-values.js +0 -31
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +0 -45
- package/lib/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib/helpers/build-query-key.js +0 -16
- package/lib/helpers/build-query-key.js.map +0 -1
- package/lib/helpers/process-data-summary-value.js +0 -56
- package/lib/helpers/process-data-summary-value.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-query.js +0 -24
- package/lib-es/components/List/helpers/get-list-query.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +0 -12
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib-es/components/List/helpers/strip-query-key.js +0 -6
- package/lib-es/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +0 -30
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -18
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +0 -19
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +0 -28
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib-es/helpers/build-query-key.js +0 -7
- package/lib-es/helpers/build-query-key.js.map +0 -1
- package/lib-es/helpers/process-data-summary-value.js +0 -36
- package/lib-es/helpers/process-data-summary-value.js.map +0 -1
- package/src/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/src/components/List/helpers/get-list-query.js +0 -28
- package/src/components/List/helpers/get-list-specific-search-filter.js +0 -10
- package/src/components/List/helpers/strip-query-key.js +0 -6
- package/src/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/src/components/SearchFilter/helpers/build-url-query.js +0 -31
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -17
- package/src/components/SearchFilter/helpers/get-filter-values.js +0 -21
- package/src/components/SearchFilter/searchFilterReducer.js +0 -15
- package/src/helpers/build-query-key.js +0 -7
- package/src/helpers/process-data-summary-value.js +0 -22
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +0 -72
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +0 -18
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +0 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-query-props.js","names":["_isFilterEntitysId","_interopRequireDefault","require","_getFilterProps2","_constants","getQueryProps","inheritedFilters","currentSchema","filterEntitySchema","
|
|
1
|
+
{"version":3,"file":"get-query-props.js","names":["_isFilterEntitysId","_interopRequireDefault","require","_getFilterProps2","_constants","getQueryProps","inheritedFilters","currentSchema","filterEntitySchema","length","ID","currentEntityId","identifier","reduce","acc","filter","_getFilterProps","getFilterProps","filterName","relationName","relationProp","relationEntityName","isEntityItself","relationForeignKeys","shouldIgnoreFilter","concat","join","queryProp","queryPropFinalValue","isFilterEntitysId","_default","exports"],"sources":["../../src/helpers/get-query-props.js"],"sourcesContent":["import isFilterEntitysId from './is-filter-entitys-id';\nimport getFilterProps from './get-filter-props';\nimport { ID } from '../constants';\n\nconst getQueryProps = (inheritedFilters, currentSchema, filterEntitySchema) => {\n if (!currentSchema || !inheritedFilters.length) return ID;\n\n const { identifier: currentEntityId } = currentSchema;\n\n return inheritedFilters.reduce((acc, filter) => {\n const {\n filterName,\n relationName,\n relationProp,\n relationEntityName,\n isEntityItself,\n relationForeignKeys,\n shouldIgnoreFilter\n } = getFilterProps(filter, currentSchema, filterEntitySchema);\n\n if (shouldIgnoreFilter) return acc;\n if (relationForeignKeys && relationForeignKeys.length) {\n return `${acc} ${relationForeignKeys.join(' ')}`;\n }\n\n const queryProp = relationEntityName ? `${relationName} { ${relationProp} }` : filterName;\n const queryPropFinalValue =\n isEntityItself && isFilterEntitysId(filterName, currentEntityId) ? ID : queryProp;\n\n return `${acc} ${queryPropFinalValue} `;\n }, ID);\n};\n\nexport default getQueryProps;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,gBAAgB,EAAEC,aAAa,EAAEC,kBAAkB,EAAK;EAC7E,IAAI,CAACD,aAAa,IAAI,CAACD,gBAAgB,CAACG,MAAM,EAAE,OAAOC,aAAE;EAEzD,IAAoBC,eAAe,GAAKJ,aAAa,CAA7CK,UAAU;EAElB,OAAON,gBAAgB,CAACO,MAAM,CAAC,UAACC,GAAG,EAAEC,MAAM,EAAK;IAC9C,IAAAC,eAAA,GAQI,IAAAC,2BAAc,EAACF,MAAM,EAAER,aAAa,EAAEC,kBAAkB,CAAC;MAP3DU,UAAU,GAAAF,eAAA,CAAVE,UAAU;MACVC,YAAY,GAAAH,eAAA,CAAZG,YAAY;MACZC,YAAY,GAAAJ,eAAA,CAAZI,YAAY;MACZC,kBAAkB,GAAAL,eAAA,CAAlBK,kBAAkB;MAClBC,cAAc,GAAAN,eAAA,CAAdM,cAAc;MACdC,mBAAmB,GAAAP,eAAA,CAAnBO,mBAAmB;MACnBC,kBAAkB,GAAAR,eAAA,CAAlBQ,kBAAkB;IAGpB,IAAIA,kBAAkB,EAAE,OAAOV,GAAG;IAClC,IAAIS,mBAAmB,IAAIA,mBAAmB,CAACd,MAAM,EAAE;MACrD,UAAAgB,MAAA,CAAUX,GAAG,OAAAW,MAAA,CAAIF,mBAAmB,CAACG,IAAI,CAAC,GAAG,CAAC;IAChD;IAEA,IAAMC,SAAS,GAAGN,kBAAkB,MAAAI,MAAA,CAAMN,YAAY,SAAAM,MAAA,CAAML,YAAY,UAAOF,UAAU;IACzF,IAAMU,mBAAmB,GACvBN,cAAc,IAAI,IAAAO,6BAAiB,EAACX,UAAU,EAAEP,eAAe,CAAC,GAAGD,aAAE,GAAGiB,SAAS;IAEnF,UAAAF,MAAA,CAAUX,GAAG,OAAAW,MAAA,CAAIG,mBAAmB;EACtC,CAAC,EAAElB,aAAE,CAAC;AACR,CAAC;AAAC,IAAAoB,QAAA,GAEazB,aAAa;AAAA0B,OAAA,cAAAD,QAAA"}
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
require("core-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");
|
|
11
12
|
require("core-js/modules/es.array.join.js");
|
|
12
13
|
var _react = _interopRequireDefault(require("react"));
|
|
13
14
|
var _BlazeLink = _interopRequireDefault(require("../components/BlazeLink"));
|
|
@@ -19,11 +20,11 @@ var getWrappedValueWithLink = function getWrappedValueWithLink(value, link) {
|
|
|
19
20
|
url = arrValue.url;
|
|
20
21
|
var keyValue = arrValue[keyField];
|
|
21
22
|
var isLastItem = index === value.length - 1;
|
|
22
|
-
var keyFieldValue = isLastItem ? keyValue :
|
|
23
|
+
var keyFieldValue = isLastItem ? keyValue : keyValue.concat(',');
|
|
23
24
|
return url ? /*#__PURE__*/_react["default"].createElement(_BlazeLink["default"], {
|
|
24
25
|
key: [keyPrefix, index].join('-'),
|
|
25
26
|
href: url
|
|
26
|
-
},
|
|
27
|
+
}, "".concat(keyFieldValue, " ")) : "".concat(keyFieldValue, " ");
|
|
27
28
|
});
|
|
28
29
|
return arrayResults.length ? arrayResults : null;
|
|
29
30
|
}
|
|
@@ -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","concat","createElement","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 const isLastItem = index === value.length - 1;\n const keyFieldValue = isLastItem ? keyValue : keyValue.concat(',');\n\n return url ? (\n <BlazeLink key={[keyPrefix, index].join('-')} href={url}>{`${keyFieldValue} `}</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;MACnC,IAAMG,UAAU,GAAGJ,KAAK,KAAKX,KAAK,CAACI,MAAM,GAAG,CAAC;MAC7C,IAAMY,aAAa,GAAGD,UAAU,GAAGD,QAAQ,GAAGA,QAAQ,CAACG,MAAM,CAAC,GAAG,CAAC;MAElE,OAAOJ,GAAG,gBACRlB,MAAA,YAAAuB,aAAA,CAACpB,UAAA,WAAS;QAACqB,GAAG,EAAE,CAACjB,SAAS,EAAES,KAAK,CAAC,CAACS,IAAI,CAAC,GAAG,CAAE;QAACC,IAAI,EAAER;MAAI,MAAAI,MAAA,CAAKD,aAAa,MAAe,CAAC,MAAAC,MAAA,CAEvFD,aAAa,MACjB;IACH,CAAC,CAAC;IAEF,OAAOR,YAAY,CAACJ,MAAM,GAAGI,YAAY,GAAG,IAAI;EAClD;EAEA,OAAOP,IAAI,gBAAGN,MAAA,YAAAuB,aAAA,CAACpB,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
|
@@ -41,12 +41,6 @@ Object.defineProperty(exports, "buildQueryFields", {
|
|
|
41
41
|
return _buildQueryFields["default"];
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(exports, "buildQueryKey", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function get() {
|
|
47
|
-
return _buildQueryKey["default"];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
44
|
Object.defineProperty(exports, "buildRawQuery", {
|
|
51
45
|
enumerable: true,
|
|
52
46
|
get: function get() {
|
|
@@ -281,12 +275,6 @@ Object.defineProperty(exports, "parseTextBlock", {
|
|
|
281
275
|
return _parseTextBlock["default"];
|
|
282
276
|
}
|
|
283
277
|
});
|
|
284
|
-
Object.defineProperty(exports, "processDataSummaryValue", {
|
|
285
|
-
enumerable: true,
|
|
286
|
-
get: function get() {
|
|
287
|
-
return _processDataSummaryValue["default"];
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
278
|
Object.defineProperty(exports, "removeExtraItems", {
|
|
291
279
|
enumerable: true,
|
|
292
280
|
get: function get() {
|
|
@@ -388,6 +376,4 @@ var _getParsedPropValues = _interopRequireDefault(require("./get-parsed-prop-val
|
|
|
388
376
|
var _getSanitizedPropValues = _interopRequireDefault(require("./get-sanitized-prop-values"));
|
|
389
377
|
var _appendImages = _interopRequireDefault(require("./append-images"));
|
|
390
378
|
var _parseTextBlock = _interopRequireDefault(require("./parse-TextBlock"));
|
|
391
|
-
var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
|
|
392
|
-
var _buildQueryKey = _interopRequireDefault(require("./build-query-key"));
|
|
393
379
|
//# sourceMappingURL=index.js.map
|
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"
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,sBAAA,CAAAC,OAAA;AACA,IAAAU,yBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,uBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,sBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,cAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,qBAAA,GAAAf,s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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"}
|
|
@@ -16,14 +16,12 @@ 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");
|
|
20
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
20
|
var _lodash = _interopRequireDefault(require("lodash.at"));
|
|
22
21
|
var _isObject = _interopRequireDefault(require("./is-object"));
|
|
23
22
|
var _getParsedPropValues = _interopRequireDefault(require("./get-parsed-prop-values"));
|
|
24
23
|
var _getSanitizedPropValues = _interopRequireDefault(require("./get-sanitized-prop-values"));
|
|
25
24
|
var _constants = require("../constants");
|
|
26
|
-
var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
|
|
27
25
|
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); }
|
|
28
26
|
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; }
|
|
29
27
|
// TODO this helper should be removed if database is wiped clean and all elements change to new props struc
|
|
@@ -31,13 +29,13 @@ var parsePropsToDisplay = function parsePropsToDisplay() {
|
|
|
31
29
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
30
|
var propsToDisplay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
33
31
|
if (!(0, _isObject["default"])(propsToDisplay[0])) return (0, _lodash["default"])(props, propsToDisplay).filter(Boolean);
|
|
34
|
-
return propsToDisplay.map(function (
|
|
35
|
-
var bold =
|
|
36
|
-
propertiesToDisplay =
|
|
37
|
-
prefix =
|
|
38
|
-
suffix =
|
|
39
|
-
shouldStrip =
|
|
40
|
-
enableLink =
|
|
32
|
+
return propsToDisplay.map(function (_ref, currentIndex) {
|
|
33
|
+
var bold = _ref.bold,
|
|
34
|
+
propertiesToDisplay = _ref.propertiesToDisplay,
|
|
35
|
+
prefix = _ref.prefix,
|
|
36
|
+
suffix = _ref.suffix,
|
|
37
|
+
shouldStrip = _ref.shouldStrip,
|
|
38
|
+
enableLink = _ref.enableLink;
|
|
41
39
|
var Wrapper = bold ? _constants.BOLD_TAG : _react.Fragment;
|
|
42
40
|
var parsedPropValues = (0, _getParsedPropValues["default"])({
|
|
43
41
|
propertiesToDisplay: propertiesToDisplay,
|
|
@@ -48,10 +46,7 @@ var parsePropsToDisplay = function parsePropsToDisplay() {
|
|
|
48
46
|
var sanitizedPropValues = (0, _getSanitizedPropValues["default"])(parsedPropValues);
|
|
49
47
|
if (!sanitizedPropValues || !sanitizedPropValues.length) return null;
|
|
50
48
|
var stringEndBlank = currentIndex + 1 === propsToDisplay.length ? '' : _constants.BLANK_SPACE_UNICODE_STRING;
|
|
51
|
-
|
|
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);
|
|
49
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, null, prefix, " ", sanitizedPropValues, " ", suffix, stringEndBlank);
|
|
55
50
|
});
|
|
56
51
|
};
|
|
57
52
|
var _default = parsePropsToDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-props-to-display.js","names":["_react","_interopRequireWildcard","require","_lodash","_interopRequireDefault","_isObject","_getParsedPropValues","_getSanitizedPropValues","_constants","
|
|
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","_ref","currentIndex","bold","propertiesToDisplay","prefix","suffix","shouldStrip","enableLink","Wrapper","BOLD_TAG","Fragment","parsedPropValues","getParsedPropValues","sanitizedPropValues","getSanitizedPropValues","stringEndBlank","BLANK_SPACE_UNICODE_STRING","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';\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(\n ({ bold, propertiesToDisplay, prefix, suffix, shouldStrip, enableLink }, currentIndex) => {\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 return (\n <Wrapper>\n {prefix} {sanitizedPropValues} {suffix}\n {stringEndBlank}\n </Wrapper>\n );\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;AAAoE,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCA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cAAAD,QAAA"}
|
|
@@ -49,7 +49,7 @@ var commonAttributes = {
|
|
|
49
49
|
};
|
|
50
50
|
var supportedTypes = {
|
|
51
51
|
row: {
|
|
52
|
-
props: [WIDTH].concat(responsiveProps, commonProps)
|
|
52
|
+
props: [WIDTH, STICKY].concat(responsiveProps, commonProps)
|
|
53
53
|
},
|
|
54
54
|
column: {
|
|
55
55
|
props: [WIDTH, STICKY].concat(responsiveProps, commonProps)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-class-modifiers.js","names":["_constants","require","_componentsDefaultValues","_interopRequireDefault","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","BUTTON_TYPE","CLASS_MODIFIERS","DEFAULT","DESKTOP","GTM_CLASS_NAME","HIDE","ICON","MOBILE","MODIFIER","SIZE","STICKY","STYLE","TABLET","WIDTH","ALIGNMENT","commonProps","responsiveProps","buttonProps","concat","iconProps","commonAttributes","props","prefix","supportedTypes","row","column","button","BUTTON","icon","ICON_BUTTON","textBlock","banner","image","hero","video","list","code","CODE","getClassModifiers","type","_ref","supportedProps","defaultValues","COMPONENTS_DEFAULT_VALUES","modifiers","map","prop","propValue","stringValue","isResponsiveProp","includes","BUTTON_ICON","undefined","LINK","Boolean","unshift","join"],"sources":["../../src/utils/get-class-modifiers.js"],"sourcesContent":["import { BUTTON, BUTTON_ICON, CLASS_MODIFIERS, ICON_BUTTON, LINK, CODE } from '../constants';\nimport COMPONENTS_DEFAULT_VALUES from '../constants/componentsDefaultValues';\n\nconst {\n BUTTON_TYPE,\n DEFAULT,\n DESKTOP,\n GTM_CLASS_NAME,\n HIDE,\n ICON,\n MOBILE,\n MODIFIER,\n SIZE,\n STICKY,\n STYLE,\n TABLET,\n WIDTH,\n ALIGNMENT\n} = CLASS_MODIFIERS;\nconst commonProps = [GTM_CLASS_NAME, MODIFIER];\nconst responsiveProps = [DESKTOP, TABLET, MOBILE];\nconst buttonProps = [SIZE, BUTTON_TYPE, ICON, STYLE, ALIGNMENT, ...commonProps];\nconst iconProps = [BUTTON_TYPE, ...commonProps];\n\nconst commonAttributes = { props: commonProps, prefix: null };\n\nconst supportedTypes = {\n row: { props: [WIDTH, ...responsiveProps, ...commonProps] },\n column: { props: [WIDTH, STICKY, ...responsiveProps, ...commonProps] },\n button: {\n props: buttonProps,\n prefix: BUTTON\n },\n icon: { props: iconProps, prefix: ICON_BUTTON },\n textBlock: { ...commonAttributes },\n banner: { ...commonAttributes },\n image: { ...commonAttributes },\n hero: { ...commonAttributes },\n video: { ...commonAttributes },\n list: { ...commonAttributes },\n code: { ...commonAttributes, prefix: CODE }\n};\n\nexport default function getClassModifiers(type, props) {\n const { props: supportedProps, prefix } = supportedTypes[type] || {};\n const defaultValues = COMPONENTS_DEFAULT_VALUES[type] || {};\n if (!supportedProps) return '';\n\n const modifiers = supportedProps\n .map(prop => {\n const propValue = props[prop];\n const stringValue = typeof propValue === 'boolean' ? prop : propValue;\n const isResponsiveProp = responsiveProps.includes(prop);\n if (prop === ICON) return propValue ? BUTTON_ICON : '';\n if (prop === MODIFIER && propValue) return `${propValue}`;\n if (propValue === DEFAULT || stringValue === type) return '';\n if (isResponsiveProp) return propValue ? '' : `${HIDE}-${prop}`;\n if (propValue === null || propValue === undefined) return defaultValues[prop] || '';\n if (prop === WIDTH || prop === LINK) return `${type}--${propValue}`;\n if (prop === GTM_CLASS_NAME) return `${propValue}`;\n if (prop === STICKY) return propValue ? `${type}--${stringValue}` : '';\n\n return stringValue ? `${type}--${stringValue}` : '';\n })\n .filter(Boolean);\n if (prefix) modifiers.unshift(prefix);\n\n return modifiers.join(' ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAC,sBAAA,CAAAF,OAAA;A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ASFL,0BAAe,CATjBK,IAAI;EACJC,MAAM,GAQJN,0BAAe,CARjBM,MAAM;EACNC,QAAQ,GAONP,0BAAe,CAPjBO,QAAQ;EACRC,IAAI,GAMFR,0BAAe,CANjBQ,IAAI;EACJC,MAAM,GAKJT,0BAAe,CALjBS,MAAM;EACNC,KAAK,GAIHV,0BAAe,CAJjBU,KAAK;EACLC,MAAM,GAGJX,0BAAe,CAHjBW,MAAM;EACNC,KAAK,GAEHZ,0BAAe,CAFjBY,KAAK;EACLC,SAAS,GACPb,0BAAe,CADjBa,SAAS;AAEX,IAAMC,WAAW,GAAG,CAACX,cAAc,EAAEI,QAAQ,CAAC;AAC9C,IAAMQ,eAAe,GAAG,CAACb,OAAO,EAAES,MAAM,EAAEL,MAAM,CAAC;AACjD,IAAMU,WAAW,IAAIR,IAAI,EAAET,WAAW,EAAEM,IAAI,EAAEK,KAAK,EAAEG,SAAS,EAAAI,MAAA,CAAKH,WAAW,CAAC;AAC/E,IAAMI,SAAS,IAAInB,WAAW,EAAAkB,MAAA,CAAKH,WAAW,CAAC;AAE/C,IAAMK,gBAAgB,GAAG;EAAEC,KAAK,EAAEN,WAAW;EAAEO,MAAM,EAAE;AAAK,CAAC;AAE7D,IAAMC,cAAc,GAAG;EACrBC,GAAG,EAAE;IAAEH,KAAK,GAAGR,KAAK,
|
|
1
|
+
{"version":3,"file":"get-class-modifiers.js","names":["_constants","require","_componentsDefaultValues","_interopRequireDefault","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","BUTTON_TYPE","CLASS_MODIFIERS","DEFAULT","DESKTOP","GTM_CLASS_NAME","HIDE","ICON","MOBILE","MODIFIER","SIZE","STICKY","STYLE","TABLET","WIDTH","ALIGNMENT","commonProps","responsiveProps","buttonProps","concat","iconProps","commonAttributes","props","prefix","supportedTypes","row","column","button","BUTTON","icon","ICON_BUTTON","textBlock","banner","image","hero","video","list","code","CODE","getClassModifiers","type","_ref","supportedProps","defaultValues","COMPONENTS_DEFAULT_VALUES","modifiers","map","prop","propValue","stringValue","isResponsiveProp","includes","BUTTON_ICON","undefined","LINK","Boolean","unshift","join"],"sources":["../../src/utils/get-class-modifiers.js"],"sourcesContent":["import { BUTTON, BUTTON_ICON, CLASS_MODIFIERS, ICON_BUTTON, LINK, CODE } from '../constants';\nimport COMPONENTS_DEFAULT_VALUES from '../constants/componentsDefaultValues';\n\nconst {\n BUTTON_TYPE,\n DEFAULT,\n DESKTOP,\n GTM_CLASS_NAME,\n HIDE,\n ICON,\n MOBILE,\n MODIFIER,\n SIZE,\n STICKY,\n STYLE,\n TABLET,\n WIDTH,\n ALIGNMENT\n} = CLASS_MODIFIERS;\nconst commonProps = [GTM_CLASS_NAME, MODIFIER];\nconst responsiveProps = [DESKTOP, TABLET, MOBILE];\nconst buttonProps = [SIZE, BUTTON_TYPE, ICON, STYLE, ALIGNMENT, ...commonProps];\nconst iconProps = [BUTTON_TYPE, ...commonProps];\n\nconst commonAttributes = { props: commonProps, prefix: null };\n\nconst supportedTypes = {\n row: { props: [WIDTH, STICKY, ...responsiveProps, ...commonProps] },\n column: { props: [WIDTH, STICKY, ...responsiveProps, ...commonProps] },\n button: {\n props: buttonProps,\n prefix: BUTTON\n },\n icon: { props: iconProps, prefix: ICON_BUTTON },\n textBlock: { ...commonAttributes },\n banner: { ...commonAttributes },\n image: { ...commonAttributes },\n hero: { ...commonAttributes },\n video: { ...commonAttributes },\n list: { ...commonAttributes },\n code: { ...commonAttributes, prefix: CODE }\n};\n\nexport default function getClassModifiers(type, props) {\n const { props: supportedProps, prefix } = supportedTypes[type] || {};\n const defaultValues = COMPONENTS_DEFAULT_VALUES[type] || {};\n if (!supportedProps) return '';\n\n const modifiers = supportedProps\n .map(prop => {\n const propValue = props[prop];\n const stringValue = typeof propValue === 'boolean' ? prop : propValue;\n const isResponsiveProp = responsiveProps.includes(prop);\n if (prop === ICON) return propValue ? BUTTON_ICON : '';\n if (prop === MODIFIER && propValue) return `${propValue}`;\n if (propValue === DEFAULT || stringValue === type) return '';\n if (isResponsiveProp) return propValue ? '' : `${HIDE}-${prop}`;\n if (propValue === null || propValue === undefined) return defaultValues[prop] || '';\n if (prop === WIDTH || prop === LINK) return `${type}--${propValue}`;\n if (prop === GTM_CLASS_NAME) return `${propValue}`;\n if (prop === STICKY) return propValue ? `${type}--${stringValue}` : '';\n\n return stringValue ? `${type}--${stringValue}` : '';\n })\n .filter(Boolean);\n if (prefix) modifiers.unshift(prefix);\n\n return modifiers.join(' ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6E,SAAAG,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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,CAACY,IAAI,CAAC,GAAG,CAAC;AAC5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
const recreateOnNavigation = Component => {
|
|
5
|
+
const InnerComponent = props => {
|
|
6
|
+
const {
|
|
7
|
+
name
|
|
8
|
+
} = props;
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const key = `${router.asPath}:${name}`;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
12
|
+
key: key
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
InnerComponent.WrappedComponent = Component;
|
|
16
|
+
InnerComponent.displayName = `recreateOnNavigation(${Component.displayName || Component.name || 'Component'})`;
|
|
17
|
+
return InnerComponent;
|
|
18
|
+
};
|
|
19
|
+
export default recreateOnNavigation;
|
|
20
|
+
//# sourceMappingURL=recreateOnNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recreateOnNavigation.js","names":["React","useRouter","recreateOnNavigation","Component","InnerComponent","props","name","router","key","asPath","createElement","_extends","WrappedComponent","displayName"],"sources":["../../src/HOC/recreateOnNavigation.js"],"sourcesContent":["import React from 'react';\nimport { useRouter } from 'next/router';\n\nconst recreateOnNavigation = Component => {\n const InnerComponent = props => {\n const { name } = props;\n const router = useRouter();\n const key = `${router.asPath}:${name}`;\n return <Component {...props} key={key} />;\n };\n\n InnerComponent.WrappedComponent = Component;\n\n InnerComponent.displayName = `recreateOnNavigation(${Component.displayName ||\n Component.name ||\n 'Component'})`;\n\n return InnerComponent;\n};\n\nexport default recreateOnNavigation;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,oBAAoB,GAAGC,SAAS,IAAI;EACxC,MAAMC,cAAc,GAAGC,KAAK,IAAI;IAC9B,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK;IACtB,MAAME,MAAM,GAAGN,SAAS,CAAC,CAAC;IAC1B,MAAMO,GAAG,GAAI,GAAED,MAAM,CAACE,MAAO,IAAGH,IAAK,EAAC;IACtC,oBAAON,KAAA,CAAAU,aAAA,CAACP,SAAS,EAAAQ,QAAA,KAAKN,KAAK;MAAEG,GAAG,EAAEA;IAAI,EAAE,CAAC;EAC3C,CAAC;EAEDJ,cAAc,CAACQ,gBAAgB,GAAGT,SAAS;EAE3CC,cAAc,CAACS,WAAW,GAAI,wBAAuBV,SAAS,CAACU,WAAW,IACxEV,SAAS,CAACG,IAAI,IACd,WAAY,GAAE;EAEhB,OAAOF,cAAc;AACvB,CAAC;AAED,eAAeF,oBAAoB"}
|
|
@@ -55,8 +55,7 @@ const Button = props => {
|
|
|
55
55
|
};
|
|
56
56
|
const logout = () => {
|
|
57
57
|
handleLogout(client);
|
|
58
|
-
|
|
59
|
-
return url ? router.reload(urlToUse) : router.reload();
|
|
58
|
+
url ? router.reload(urlToUse) : router.reload();
|
|
60
59
|
};
|
|
61
60
|
const handleClick = () => {
|
|
62
61
|
if (isLogoutButton) logout();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","_objectSpread","currentProps","href","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","_objectSpread","currentProps","href","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC5D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,UAAU,MAAM,YAAY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kB,KAAK,EAAEpB,SAAS,CAACE,MAAM;EACvBqB,kBAAkB,EAAEtB,IAAI;EACxBoB,QAAQ,EAAErB,SAAS,CAACoE,SAAS,CAAC,CAACpE,SAAS,CAACqE,OAAO,CAACrE,SAAS,CAACsE,IAAI,CAAC,EAAEtE,SAAS,CAACsE,IAAI,CAAC;AACnF,CAAC;AAEDzD,MAAM,CAAC0D,YAAY,GAAG;EACpB9C,MAAM,EAAE,CAAC,CAAC;EACVH,WAAW,EAAE,EAAE;EACfN,IAAI,EAAE,EAAE;EACRQ,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACTkD,IAAI,EAAE,EAAE;EACRjD,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAejB,SAAS,CAACO,MAAM,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { generateSingleItemQuery } from '../../application/query';
|
|
|
13
13
|
import { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';
|
|
14
14
|
import { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';
|
|
15
15
|
import { getUpdatedFilterBy, getEntityData, getRequiredSchemas, sortResponseData, getUnpublishedEntityName, renderChildren, splitChildren, removeExtraItems, appendImages } from '../../helpers';
|
|
16
|
-
import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn, getUpdatedSortProperties
|
|
16
|
+
import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn, getUpdatedSortProperties } from './helpers';
|
|
17
17
|
const CardsContainer = dynamic(() => import('./CardsContainer'));
|
|
18
18
|
const CardsRender = _ref => {
|
|
19
19
|
let {
|
|
@@ -104,12 +104,6 @@ const CardsRender = _ref => {
|
|
|
104
104
|
error: schemaError
|
|
105
105
|
} = useGetEntitySchemasAsObj(getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema), _loading);
|
|
106
106
|
const updatedFilterBy = getUpdatedFilterBy(inheritedFilters, parentEntityData, parentSchema, filterEntitySchema, parentId, variableProps);
|
|
107
|
-
const updatedItemsToDisplay = getUpdatedItemsToDisplay({
|
|
108
|
-
itemsToDisplay,
|
|
109
|
-
inheritedFilters,
|
|
110
|
-
parentSchema,
|
|
111
|
-
parentEntityData
|
|
112
|
-
});
|
|
113
107
|
const {
|
|
114
108
|
limit,
|
|
115
109
|
variables
|
|
@@ -121,11 +115,10 @@ const CardsRender = _ref => {
|
|
|
121
115
|
docType: docTypes,
|
|
122
116
|
filterOperator,
|
|
123
117
|
filterEntityRelations,
|
|
124
|
-
itemsToDisplay
|
|
118
|
+
itemsToDisplay,
|
|
125
119
|
entitySameAsCurrentItemEntity,
|
|
126
120
|
useRandomSort
|
|
127
121
|
});
|
|
128
|
-
const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
|
|
129
122
|
const {
|
|
130
123
|
data: cardData,
|
|
131
124
|
error: cardsError,
|
|
@@ -133,9 +126,9 @@ const CardsRender = _ref => {
|
|
|
133
126
|
} = useQuery(action, {
|
|
134
127
|
variables,
|
|
135
128
|
fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
|
|
136
|
-
skip: shouldReturn(
|
|
129
|
+
skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)
|
|
137
130
|
});
|
|
138
|
-
const imageIds =
|
|
131
|
+
const imageIds = itemsToDisplay.map(({
|
|
139
132
|
imageId
|
|
140
133
|
}) => imageId).filter(Boolean);
|
|
141
134
|
const {
|
|
@@ -144,7 +137,7 @@ const CardsRender = _ref => {
|
|
|
144
137
|
} = useGetImages(imageIds, true);
|
|
145
138
|
const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
|
|
146
139
|
const hasError = shouldReturn(_error, _err, schemaError);
|
|
147
|
-
if (
|
|
140
|
+
if (!updatedFilterBy) return null;
|
|
148
141
|
if (isLoading) return null;
|
|
149
142
|
if (hasError) return null;
|
|
150
143
|
if (cardsError) return cardsError.message;
|
|
@@ -154,14 +147,14 @@ const CardsRender = _ref => {
|
|
|
154
147
|
if (!cardDataResults || !cardDataResults.length) return null;
|
|
155
148
|
cardDataResults = entitySameAsCurrentItemEntity ? removeExtraItems(cardDataResults, limit, parentId) : cardDataResults;
|
|
156
149
|
if (!cardDataResults.length) return null;
|
|
157
|
-
const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults,
|
|
150
|
+
const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults, itemsToDisplay);
|
|
158
151
|
const {
|
|
159
152
|
regularChildren,
|
|
160
153
|
gtmChildren
|
|
161
154
|
} = splitChildren(children, cardDataResults, graphqlEntityMap, {
|
|
162
155
|
name: variableProps.name
|
|
163
156
|
});
|
|
164
|
-
const updatedCards = appendImages(imagesData, orderedData,
|
|
157
|
+
const updatedCards = appendImages(imagesData, orderedData, itemsToDisplay);
|
|
165
158
|
return /*#__PURE__*/React.createElement(React.Fragment, null, gtmChildren && renderChildren(gtmChildren), /*#__PURE__*/React.createElement(CardsContainer, _extends({
|
|
166
159
|
cardData: updatedCards,
|
|
167
160
|
entity: primaryEntityToUse,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","getUpdatedItemsToDisplay","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","updatedItemsToDisplay","limit","getEntitySchemas","Object","values","hasNoFiltersOrItemsToDisplay","length","cardData","cardsError","cardsLoading","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,wBAAwB,EAAEC,GAAG,QAAQ,iBAAiB;AAC/D,SAASC,wBAAwB,EAAEC,YAAY,QAAQ,aAAa;AACpE,SACEC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,cAAc,EACdC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AACtB,SACEC,YAAY,EACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,wBAAwB,EACxBC,wBAAwB,QACnB,WAAW;AAElB,MAAMC,cAAc,GAAGvB,OAAO,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAMwB,WAAW,GAAGC,IAAA,IAOd;EAAA,IAPe;MACnBC,MAAM,EAAEC,YAAY;MACpBC,QAAQ;MACRC,YAAY;MAC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,IAAI,EAAExE,aAAa,CAACwE;EACtB,CACF,CAAC;EACD,MAAMC,YAAY,GAAG5G,YAAY,CAACiG,UAAU,EAAEO,WAAW,EAAEtB,qBAAqB,CAAC;EAEjF,oBACErG,KAAA,CAAAgI,aAAA,CAAAhI,KAAA,CAAAiI,QAAA,QACGJ,WAAW,IAAI7G,cAAc,CAAC6G,WAAW,CAAC,eAC3C7H,KAAA,CAAAgI,aAAA,CAACtG,cAAc,EAAAwG,QAAA;IACbtB,QAAQ,EAAEmB,YAAa;IACvBlG,MAAM,EAAE4B,kBAAmB;IAC3BoE,WAAW,EAAEA,WAAY;IACzBM,YAAY,EAAEP,eAAgB;IAC9BnD,gBAAgB,EAAEA;EAAiB,GAC/BnB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAED3B,WAAW,CAACyG,SAAS,GAAG;EACtBlG,QAAQ,EAAE9B,SAAS,CAACiI,SAAS,CAAC,CAACjI,SAAS,CAACkI,OAAO,CAAClI,SAAS,CAACmI,IAAI,CAAC,EAAEnI,SAAS,CAACmI,IAAI,CAAC,CAAC;EAClF1G,MAAM,EAAEzB,SAAS,CAACoI,MAAM,CAACC,UAAU;EACnCzG,YAAY,EAAE5B,SAAS,CAACoI,MAAM,CAACC,UAAU;EACzCxG,cAAc,EAAE7B,SAAS,CAACsI,KAAK;EAC/B3G,QAAQ,EAAE3B,SAAS,CAACsI;AACtB,CAAC;AAED/G,WAAW,CAACgH,YAAY,GAAG;EACzBzG,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
|
|
1
|
+
{"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","limit","getEntitySchemas","Object","values","cardData","cardsError","cardsLoading","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","length","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)\n });\n\n const imageIds = itemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (!updatedFilterBy) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, itemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, itemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,wBAAwB,EAAEC,GAAG,QAAQ,iBAAiB;AAC/D,SAASC,wBAAwB,EAAEC,YAAY,QAAQ,aAAa;AACpE,SACEC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,cAAc,EACdC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AACtB,SACEC,YAAY,EACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,wBAAwB,QACnB,WAAW;AAElB,MAAMC,cAAc,GAAGtB,OAAO,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAMuB,WAAW,GAAGC,IAAA,IAOd;EAAA,IAPe;MACnBC,MAAM,EAAEC,YAAY;MACpBC,QAAQ;MACRC,YAAY;MACZC,cAAc;MACdC;IAEF,CAAC,GAAAN,IAAA;IADIO,UAAU,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA;EAEb,MAAM;IAAEC;EAA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AAa;IACvBhG,MAAM,EAAE4B,kBAAmB;IAC3BkE,WAAW,EAAEA,WAAY;IACzBM,YAAY,EAAEP,eAAgB;IAC9BjD,gBAAgB,EAAEA;EAAiB,GAC/BnB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAED3B,WAAW,CAACuG,SAAS,GAAG;EACtBhG,QAAQ,EAAE7B,SAAS,CAAC8H,SAAS,CAAC,CAAC9H,SAAS,CAAC+H,OAAO,CAAC/H,SAAS,CAACgI,IAAI,CAAC,EAAEhI,SAAS,CAACgI,IAAI,CAAC,CAAC;EAClFxG,MAAM,EAAExB,SAAS,CAACiI,MAAM,CAACC,UAAU;EACnCvG,YAAY,EAAE3B,SAAS,CAACiI,MAAM,CAACC,UAAU;EACzCtG,cAAc,EAAE5B,SAAS,CAACmI,KAAK;EAC/BzG,QAAQ,EAAE1B,SAAS,CAACmI;AACtB,CAAC;AAED7G,WAAW,CAAC8G,YAAY,GAAG;EACzBvG,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
|
|
@@ -6,5 +6,4 @@ export { default as filterQuerySetup } from './filter-query-setup';
|
|
|
6
6
|
export { default as shouldReturn } from './should-return';
|
|
7
7
|
export { default as shouldSkipSingleQuery } from './should-skip-single-query';
|
|
8
8
|
export { default as getUpdatedSortProperties } from './get-updated-sort-properties';
|
|
9
|
-
export { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASH,OAAO,IAAII,YAAY,QAAQ,iBAAiB;AACzD,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,sBAAsB;AAClE,SAASL,OAAO,IAAIM,YAAY,QAAQ,iBAAiB;AACzD,SAASN,OAAO,IAAIO,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,+BAA+B"}
|
|
@@ -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"];
|
|
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,15 +14,13 @@ import { wrapScriptTags } from './helpers';
|
|
|
14
14
|
const Code = memo(_ref => {
|
|
15
15
|
let {
|
|
16
16
|
code: embedCode,
|
|
17
|
-
parserOptions
|
|
18
|
-
disableWrapper
|
|
17
|
+
parserOptions
|
|
19
18
|
} = _ref,
|
|
20
19
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
20
|
if (!embedCode) return null;
|
|
22
21
|
const parsedCode = parseHTML(embedCode, parserOptions);
|
|
23
22
|
const wrappedCode = wrapScriptTags(parsedCode);
|
|
24
23
|
const modifiers = getClassModifiers(CODE, _objectSpread({}, otherProps));
|
|
25
|
-
if (disableWrapper) return wrappedCode;
|
|
26
24
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
27
25
|
modifiers: modifiers
|
|
28
26
|
}, wrappedCode);
|
|
@@ -30,14 +28,12 @@ const Code = memo(_ref => {
|
|
|
30
28
|
Code.propTypes = {
|
|
31
29
|
code: PropTypes.string,
|
|
32
30
|
modifier: PropTypes.string,
|
|
33
|
-
parserOptions: PropTypes.object
|
|
34
|
-
disableWrapper: PropTypes.bool
|
|
31
|
+
parserOptions: PropTypes.object
|
|
35
32
|
};
|
|
36
33
|
Code.defaultProps = {
|
|
37
34
|
code: '',
|
|
38
35
|
modifier: '',
|
|
39
|
-
parserOptions: {}
|
|
40
|
-
disableWrapper: false
|
|
36
|
+
parserOptions: {}
|
|
41
37
|
};
|
|
42
38
|
export default withTitle(Code);
|
|
43
39
|
//# 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","
|
|
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,IAAuD;EAAA,IAAtD;MAAEC,IAAI,EAAEC,SAAS;MAAEC;IAA6B,CAAC,GAAAH,IAAA;IAAZI,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAChE,IAAI,CAACJ,SAAS,EAAE,OAAO,IAAI;EAE3B,MAAMK,UAAU,GAAGd,SAAS,CAACS,SAAS,EAAEC,aAAa,CAAC;EACtD,MAAMK,WAAW,GAAGV,cAAc,CAACS,UAAU,CAAC;EAC9C,MAAME,SAAS,GAAGb,iBAAiB,CAACC,IAAI,EAAAa,aAAA,KAAON,UAAU,CAAE,CAAC;EAE5D,oBAAOd,KAAA,CAAAqB,aAAA,CAACjB,OAAO;IAACe,SAAS,EAAEA;EAAU,GAAED,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFT,IAAI,CAACa,SAAS,GAAG;EACfX,IAAI,EAAET,SAAS,CAACqB,MAAM;EACtBC,QAAQ,EAAEtB,SAAS,CAACqB,MAAM;EAC1BV,aAAa,EAAEX,SAAS,CAACuB;AAC3B,CAAC;AAEDhB,IAAI,CAACiB,YAAY,GAAG;EAClBf,IAAI,EAAE,EAAE;EACRa,QAAQ,EAAE,EAAE;EACZX,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,eAAeR,SAAS,CAACI,IAAI,CAAC"}
|