@blaze-cms/react-page-builder 0.130.0 → 0.131.0-admin-updates.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 +28 -0
- package/lib/components/Card/CardsRender.js +13 -6
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/get-updated-items-to-display.js +55 -0
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib/components/Card/helpers/index.js +7 -0
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/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/List/ListFactory.js +16 -11
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/get-list-query.js +43 -0
- package/lib/components/List/helpers/get-list-query.js.map +1 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js +21 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib/components/List/helpers/index.js +14 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/List/helpers/strip-query-key.js +14 -0
- package/lib/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib/components/SearchContent/SearchContent.js +8 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +17 -11
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +63 -85
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +3 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +17 -0
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js +48 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +32 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js +31 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +18 -11
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +45 -0
- package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js +31 -11
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +19 -5
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +9 -5
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +2 -0
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +5 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-query-key.js +16 -0
- package/lib/helpers/build-query-key.js.map +1 -0
- package/lib/helpers/build-set-filters.js +5 -1
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-filters.js +6 -8
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +13 -2
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +2 -3
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +14 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +13 -8
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +56 -0
- package/lib/helpers/process-data-summary-value.js.map +1 -0
- package/lib-es/components/Card/CardsRender.js +14 -7
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib-es/components/Card/helpers/index.js +1 -0
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/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/List/ListFactory.js +16 -12
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/get-list-query.js +24 -0
- package/lib-es/components/List/helpers/get-list-query.js.map +1 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +12 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +2 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/List/helpers/strip-query-key.js +6 -0
- package/lib-es/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContent.js +8 -6
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +18 -11
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +47 -72
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +2 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +30 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +18 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +19 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +5 -4
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/index.js +2 -2
- package/lib-es/components/SearchFilter/index.js.map +1 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +28 -0
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +26 -10
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +21 -4
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +8 -4
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +2 -0
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-query-key.js +7 -0
- package/lib-es/helpers/build-query-key.js.map +1 -0
- package/lib-es/helpers/build-set-filters.js +5 -1
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +6 -8
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +10 -2
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +2 -0
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +12 -9
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/helpers/process-data-summary-value.js +36 -0
- package/lib-es/helpers/process-data-summary-value.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Card/CardsRender.js +27 -7
- package/src/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/src/components/Card/helpers/index.js +1 -0
- package/src/components/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/List/ListFactory.js +25 -15
- package/src/components/List/helpers/get-list-query.js +28 -0
- package/src/components/List/helpers/get-list-specific-search-filter.js +10 -0
- package/src/components/List/helpers/index.js +2 -0
- package/src/components/List/helpers/strip-query-key.js +6 -0
- package/src/components/SearchContent/SearchContent.js +8 -6
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +21 -12
- package/src/components/SearchFilter/SearchFilterContainer.js +57 -69
- package/src/components/SearchFilter/helpers/build-filters-query.js +9 -1
- package/src/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/src/components/SearchFilter/helpers/build-url-query.js +31 -0
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +17 -0
- package/src/components/SearchFilter/helpers/get-filter-values.js +21 -0
- package/src/components/SearchFilter/helpers/index.js +9 -7
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilter/searchFilterReducer.js +15 -0
- package/src/components/SearchFilterSort/SearchFilterSort.js +18 -8
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +14 -5
- package/src/components/SearchFilterSort/helpers/update-sort.js +7 -3
- package/src/helpers/build-inherited-filters.js +3 -1
- package/src/helpers/build-props-query.js +4 -2
- package/src/helpers/build-query-key.js +7 -0
- package/src/helpers/build-set-filters.js +2 -1
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +12 -4
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +2 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -0
- package/tests/helpers/mocks.js +3 -5
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +72 -0
- package/tests/unit/src/components/Code/Code.test.js +5 -0
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +8 -0
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +9 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +24 -7
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
- package/tests/unit/src/helpers/build-props-query.test.js +25 -0
- package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
- package/tests/unit/src/helpers/parse-props-to-display.test.js +4 -0
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-query.js +0 -37
- package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/src/components/SearchFilter/helpers/build-query.js +0 -26
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
|
@@ -12,17 +12,15 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
12
12
|
var _getSearchFilterType = _interopRequireDefault(require("./get-search-filter-type"));
|
|
13
13
|
var _buildSearchValuesCheckboxSelect = _interopRequireDefault(require("./build-search-values-checkbox-select"));
|
|
14
14
|
var _constants = require("../constants");
|
|
15
|
-
var getQueryFilters = function getQueryFilters(searchFilter, query) {
|
|
16
|
-
if (!searchFilter.settings || !searchFilter.settings.filters) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
}
|
|
15
|
+
var getQueryFilters = function getQueryFilters(searchFilter, query, listName) {
|
|
16
|
+
if (!searchFilter.settings || !searchFilter.settings.filters) return {
|
|
17
|
+
valuesAnd: [],
|
|
18
|
+
valuesOr: []
|
|
19
|
+
};
|
|
22
20
|
var rangeFilters = (0, _getSearchFilterType["default"])(searchFilter, _constants.RANGE);
|
|
23
21
|
var checkboxFilters = (0, _getSearchFilterType["default"])(searchFilter, _constants.CHECKBOX);
|
|
24
22
|
var selectFilters = (0, _getSearchFilterType["default"])(searchFilter, _constants.SELECT);
|
|
25
|
-
var _buildSearchValuesChe = (0, _buildSearchValuesCheckboxSelect["default"])(query, rangeFilters, checkboxFilters, selectFilters),
|
|
23
|
+
var _buildSearchValuesChe = (0, _buildSearchValuesCheckboxSelect["default"])(query, rangeFilters, checkboxFilters, selectFilters, listName),
|
|
26
24
|
valuesAnd = _buildSearchValuesChe.values,
|
|
27
25
|
valuesOr = _buildSearchValuesChe.valuesOr;
|
|
28
26
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-query-filters.js","names":["_getSearchFilterType","_interopRequireDefault","require","_buildSearchValuesCheckboxSelect","_constants","getQueryFilters","searchFilter","query","settings","filters","valuesAnd","valuesOr","rangeFilters","getSearchFilterType","RANGE","checkboxFilters","CHECKBOX","selectFilters","SELECT","_buildSearchValuesChe","buildSearchValuesCheckboxSelect","values","_default","exports"],"sources":["../../src/helpers/get-query-filters.js"],"sourcesContent":["import getSearchFilterType from './get-search-filter-type';\nimport buildSearchValuesCheckboxSelect from './build-search-values-checkbox-select';\nimport { RANGE, CHECKBOX, SELECT } from '../constants';\n\nconst getQueryFilters = (searchFilter, query) => {\n if (!searchFilter.settings || !searchFilter.settings.filters)
|
|
1
|
+
{"version":3,"file":"get-query-filters.js","names":["_getSearchFilterType","_interopRequireDefault","require","_buildSearchValuesCheckboxSelect","_constants","getQueryFilters","searchFilter","query","listName","settings","filters","valuesAnd","valuesOr","rangeFilters","getSearchFilterType","RANGE","checkboxFilters","CHECKBOX","selectFilters","SELECT","_buildSearchValuesChe","buildSearchValuesCheckboxSelect","values","_default","exports"],"sources":["../../src/helpers/get-query-filters.js"],"sourcesContent":["import getSearchFilterType from './get-search-filter-type';\nimport buildSearchValuesCheckboxSelect from './build-search-values-checkbox-select';\nimport { RANGE, CHECKBOX, SELECT } from '../constants';\n\nconst getQueryFilters = (searchFilter, query, listName) => {\n if (!searchFilter.settings || !searchFilter.settings.filters)\n return { valuesAnd: [], valuesOr: [] };\n\n const rangeFilters = getSearchFilterType(searchFilter, RANGE);\n const checkboxFilters = getSearchFilterType(searchFilter, CHECKBOX);\n const selectFilters = getSearchFilterType(searchFilter, SELECT);\n\n const { values: valuesAnd, valuesOr } = buildSearchValuesCheckboxSelect(\n query,\n rangeFilters,\n checkboxFilters,\n selectFilters,\n listName\n );\n return { valuesAnd, valuesOr };\n};\n\nexport default getQueryFilters;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gCAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAK;EACzD,IAAI,CAACF,YAAY,CAACG,QAAQ,IAAI,CAACH,YAAY,CAACG,QAAQ,CAACC,OAAO,EAC1D,OAAO;IAAEC,SAAS,EAAE,EAAE;IAAEC,QAAQ,EAAE;EAAG,CAAC;EAExC,IAAMC,YAAY,GAAG,IAAAC,+BAAmB,EAACR,YAAY,EAAES,gBAAK,CAAC;EAC7D,IAAMC,eAAe,GAAG,IAAAF,+BAAmB,EAACR,YAAY,EAAEW,mBAAQ,CAAC;EACnE,IAAMC,aAAa,GAAG,IAAAJ,+BAAmB,EAACR,YAAY,EAAEa,iBAAM,CAAC;EAE/D,IAAAC,qBAAA,GAAwC,IAAAC,2CAA+B,EACrEd,KAAK,EACLM,YAAY,EACZG,eAAe,EACfE,aAAa,EACbV,QACF,CAAC;IANeG,SAAS,GAAAS,qBAAA,CAAjBE,MAAM;IAAaV,QAAQ,GAAAQ,qBAAA,CAARR,QAAQ;EAOnC,OAAO;IAAED,SAAS,EAATA,SAAS;IAAEC,QAAQ,EAARA;EAAS,CAAC;AAChC,CAAC;AAAC,IAAAW,QAAA,GAEalB,eAAe;AAAAmB,OAAA,cAAAD,QAAA"}
|
|
@@ -10,12 +10,17 @@ require("core-js/modules/es.array.reduce.js");
|
|
|
10
10
|
require("core-js/modules/es.object.to-string.js");
|
|
11
11
|
require("core-js/modules/es.array.concat.js");
|
|
12
12
|
require("core-js/modules/es.array.join.js");
|
|
13
|
+
require("core-js/modules/es.array.find.js");
|
|
14
|
+
require("core-js/modules/es.object.keys.js");
|
|
13
15
|
var _isFilterEntitysId = _interopRequireDefault(require("./is-filter-entitys-id"));
|
|
14
16
|
var _getFilterProps2 = _interopRequireDefault(require("./get-filter-props"));
|
|
15
17
|
var _constants = require("../constants");
|
|
16
|
-
var getQueryProps = function getQueryProps(inheritedFilters, currentSchema
|
|
18
|
+
var getQueryProps = function getQueryProps(inheritedFilters, currentSchema) {
|
|
19
|
+
var filterEntitySchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
17
20
|
if (!currentSchema || !inheritedFilters.length) return _constants.ID;
|
|
18
|
-
var currentEntityId = currentSchema.identifier
|
|
21
|
+
var currentEntityId = currentSchema.identifier,
|
|
22
|
+
properties = currentSchema.properties;
|
|
23
|
+
var filterEntityId = filterEntitySchema.identifier;
|
|
19
24
|
return inheritedFilters.reduce(function (acc, filter) {
|
|
20
25
|
var _getFilterProps = (0, _getFilterProps2["default"])(filter, currentSchema, filterEntitySchema),
|
|
21
26
|
filterName = _getFilterProps.filterName,
|
|
@@ -29,6 +34,12 @@ var getQueryProps = function getQueryProps(inheritedFilters, currentSchema, filt
|
|
|
29
34
|
if (relationForeignKeys && relationForeignKeys.length) {
|
|
30
35
|
return "".concat(acc, " ").concat(relationForeignKeys.join(' '));
|
|
31
36
|
}
|
|
37
|
+
if (filterName === _constants.ID) {
|
|
38
|
+
var queryValue = Object.keys(properties).find(function (propKey) {
|
|
39
|
+
return properties[propKey] && properties[propKey].relation && properties[propKey].relation.entityIdentifier === filterEntityId;
|
|
40
|
+
});
|
|
41
|
+
if (queryValue) return "".concat(acc, " ").concat(queryValue, " ");
|
|
42
|
+
}
|
|
32
43
|
var queryProp = relationEntityName ? "".concat(relationName, " { ").concat(relationProp, " }") : filterName;
|
|
33
44
|
var queryPropFinalValue = isEntityItself && (0, _isFilterEntitysId["default"])(filterName, currentEntityId) ? _constants.ID : queryProp;
|
|
34
45
|
return "".concat(acc, " ").concat(queryPropFinalValue, " ");
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"file":"get-query-props.js","names":["_isFilterEntitysId","_interopRequireDefault","require","_getFilterProps2","_constants","getQueryProps","inheritedFilters","currentSchema","filterEntitySchema","arguments","length","undefined","ID","currentEntityId","identifier","properties","filterEntityId","reduce","acc","filter","_getFilterProps","getFilterProps","filterName","relationName","relationProp","relationEntityName","isEntityItself","relationForeignKeys","shouldIgnoreFilter","concat","join","queryValue","Object","keys","find","propKey","relation","entityIdentifier","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, properties } = currentSchema;\n const { identifier: filterEntityId } = filterEntitySchema;\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 if (shouldIgnoreFilter) return acc;\n if (relationForeignKeys && relationForeignKeys.length) {\n return `${acc} ${relationForeignKeys.join(' ')}`;\n }\n if (filterName === ID) {\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === filterEntityId\n );\n if (queryValue) return `${acc} ${queryValue} `;\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,EAA8B;EAAA,IAA5BC,kBAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC7E,IAAI,CAACF,aAAa,IAAI,CAACD,gBAAgB,CAACI,MAAM,EAAE,OAAOE,aAAE;EAEzD,IAAoBC,eAAe,GAAiBN,aAAa,CAAzDO,UAAU;IAA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AAOF,UAAU;IACzF,IAAMiB,mBAAmB,GACvBb,cAAc,IAAI,IAAAc,6BAAiB,EAAClB,UAAU,EAAET,eAAe,CAAC,GAAGD,aAAE,GAAG0B,SAAS;IAEnF,UAAAT,MAAA,CAAUX,GAAG,OAAAW,MAAA,CAAIU,mBAAmB;EACtC,CAAC,EAAE3B,aAAE,CAAC;AACR,CAAC;AAAC,IAAA6B,QAAA,GAEapC,aAAa;AAAAqC,OAAA,cAAAD,QAAA"}
|
|
@@ -8,7 +8,6 @@ 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");
|
|
12
11
|
require("core-js/modules/es.array.join.js");
|
|
13
12
|
var _react = _interopRequireDefault(require("react"));
|
|
14
13
|
var _BlazeLink = _interopRequireDefault(require("../components/BlazeLink"));
|
|
@@ -20,11 +19,11 @@ var getWrappedValueWithLink = function getWrappedValueWithLink(value, link) {
|
|
|
20
19
|
url = arrValue.url;
|
|
21
20
|
var keyValue = arrValue[keyField];
|
|
22
21
|
var isLastItem = index === value.length - 1;
|
|
23
|
-
var keyFieldValue = isLastItem ? keyValue :
|
|
22
|
+
var keyFieldValue = isLastItem ? keyValue : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyValue, ", ");
|
|
24
23
|
return url ? /*#__PURE__*/_react["default"].createElement(_BlazeLink["default"], {
|
|
25
24
|
key: [keyPrefix, index].join('-'),
|
|
26
25
|
href: url
|
|
27
|
-
}, "".
|
|
26
|
+
}, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyFieldValue, " ")) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, keyFieldValue, " ");
|
|
28
27
|
});
|
|
29
28
|
return arrayResults.length ? arrayResults : null;
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-wrapped-value-with-link.js","names":["_react","_interopRequireDefault","require","_BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","arguments","length","undefined","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","keyFieldValue","
|
|
1
|
+
{"version":3,"file":"get-wrapped-value-with-link.js","names":["_react","_interopRequireDefault","require","_BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","arguments","length","undefined","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","keyFieldValue","createElement","Fragment","key","join","href","_default","exports"],"sources":["../../src/helpers/get-wrapped-value-with-link.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../components/BlazeLink';\n\nconst getWrappedValueWithLink = (value, link, keyPrefix = '') => {\n if (Array.isArray(value)) {\n const arrayResults = value.map((arrValue, index) => {\n const { keyField, url } = arrValue;\n const keyValue = arrValue[keyField];\n\n const isLastItem = index === value.length - 1;\n const keyFieldValue = isLastItem ? keyValue : <>{keyValue}, </>;\n\n return url ? (\n <BlazeLink key={[keyPrefix, index].join('-')} href={url}>\n {<>{keyFieldValue} </>}\n </BlazeLink>\n ) : (\n <>{keyFieldValue} </>\n );\n });\n\n return arrayResults.length ? arrayResults : null;\n }\n\n return link ? <BlazeLink href={link}>{value}</BlazeLink> : value;\n};\n\nexport default getWrappedValueWithLink;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIC,KAAK,EAAEC,IAAI,EAAqB;EAAA,IAAnBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC1D,IAAIG,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,EAAE;IACxB,IAAMQ,YAAY,GAAGR,KAAK,CAACS,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK,EAAK;MAClD,IAAQC,QAAQ,GAAUF,QAAQ,CAA1BE,QAAQ;QAAEC,GAAG,GAAKH,QAAQ,CAAhBG,GAAG;MACrB,IAAMC,QAAQ,GAAGJ,QAAQ,CAACE,QAAQ,CAAC;MAEnC,IAAMG,UAAU,GAAGJ,KAAK,KAAKX,KAAK,CAACI,MAAM,GAAG,CAAC;MAC7C,IAAMY,aAAa,GAAGD,UAAU,GAAGD,QAAQ,gBAAGnB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGJ,QAAQ,EAAC,IAAI,CAAC;MAE/D,OAAOD,GAAG,gBACRlB,MAAA,YAAAsB,aAAA,CAACnB,UAAA,WAAS;QAACqB,GAAG,EAAE,CAACjB,SAAS,EAAES,KAAK,CAAC,CAACS,IAAI,CAAC,GAAG,CAAE;QAACC,IAAI,EAAER;MAAI,gBACrDlB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGF,aAAa,EAAC,GAAG,CACZ,CAAC,gBAEZrB,MAAA,YAAAsB,aAAA,CAAAtB,MAAA,YAAAuB,QAAA,QAAGF,aAAa,EAAC,GAAG,CACrB;IACH,CAAC,CAAC;IAEF,OAAOR,YAAY,CAACJ,MAAM,GAAGI,YAAY,GAAG,IAAI;EAClD;EAEA,OAAOP,IAAI,gBAAGN,MAAA,YAAAsB,aAAA,CAACnB,UAAA,WAAS;IAACuB,IAAI,EAAEpB;EAAK,GAAED,KAAiB,CAAC,GAAGA,KAAK;AAClE,CAAC;AAAC,IAAAsB,QAAA,GAEavB,uBAAuB;AAAAwB,OAAA,cAAAD,QAAA"}
|
package/lib/helpers/index.js
CHANGED
|
@@ -41,6 +41,12 @@ 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
|
+
});
|
|
44
50
|
Object.defineProperty(exports, "buildRawQuery", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
get: function get() {
|
|
@@ -275,6 +281,12 @@ Object.defineProperty(exports, "parseTextBlock", {
|
|
|
275
281
|
return _parseTextBlock["default"];
|
|
276
282
|
}
|
|
277
283
|
});
|
|
284
|
+
Object.defineProperty(exports, "processDataSummaryValue", {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
get: function get() {
|
|
287
|
+
return _processDataSummaryValue["default"];
|
|
288
|
+
}
|
|
289
|
+
});
|
|
278
290
|
Object.defineProperty(exports, "removeExtraItems", {
|
|
279
291
|
enumerable: true,
|
|
280
292
|
get: function get() {
|
|
@@ -376,4 +388,6 @@ var _getParsedPropValues = _interopRequireDefault(require("./get-parsed-prop-val
|
|
|
376
388
|
var _getSanitizedPropValues = _interopRequireDefault(require("./get-sanitized-prop-values"));
|
|
377
389
|
var _appendImages = _interopRequireDefault(require("./append-images"));
|
|
378
390
|
var _parseTextBlock = _interopRequireDefault(require("./parse-TextBlock"));
|
|
391
|
+
var _processDataSummaryValue = _interopRequireDefault(require("./process-data-summary-value"));
|
|
392
|
+
var _buildQueryKey = _interopRequireDefault(require("./build-query-key"));
|
|
379
393
|
//# 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"],"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","_buildQueryKey"],"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';\nexport { default as buildQueryKey } from './build-query-key';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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lD,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;AACA,IAAAsD,cAAA,GAAAvD,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,OAA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E,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":";;;;;;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,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"}
|
|
@@ -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 } from './helpers';
|
|
16
|
+
import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn, getUpdatedSortProperties, getUpdatedItemsToDisplay } from './helpers';
|
|
17
17
|
const CardsContainer = dynamic(() => import('./CardsContainer'));
|
|
18
18
|
const CardsRender = _ref => {
|
|
19
19
|
let {
|
|
@@ -104,6 +104,12 @@ 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
|
+
});
|
|
107
113
|
const {
|
|
108
114
|
limit,
|
|
109
115
|
variables
|
|
@@ -115,10 +121,11 @@ const CardsRender = _ref => {
|
|
|
115
121
|
docType: docTypes,
|
|
116
122
|
filterOperator,
|
|
117
123
|
filterEntityRelations,
|
|
118
|
-
itemsToDisplay,
|
|
124
|
+
itemsToDisplay: updatedItemsToDisplay,
|
|
119
125
|
entitySameAsCurrentItemEntity,
|
|
120
126
|
useRandomSort
|
|
121
127
|
});
|
|
128
|
+
const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
|
|
122
129
|
const {
|
|
123
130
|
data: cardData,
|
|
124
131
|
error: cardsError,
|
|
@@ -126,9 +133,9 @@ const CardsRender = _ref => {
|
|
|
126
133
|
} = useQuery(action, {
|
|
127
134
|
variables,
|
|
128
135
|
fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
|
|
129
|
-
skip: shouldReturn(
|
|
136
|
+
skip: shouldReturn(hasNoFiltersOrItemsToDisplay, _loading, _load, schemaLoading, _error, _err, schemaError)
|
|
130
137
|
});
|
|
131
|
-
const imageIds =
|
|
138
|
+
const imageIds = updatedItemsToDisplay.map(({
|
|
132
139
|
imageId
|
|
133
140
|
}) => imageId).filter(Boolean);
|
|
134
141
|
const {
|
|
@@ -137,7 +144,7 @@ const CardsRender = _ref => {
|
|
|
137
144
|
} = useGetImages(imageIds, true);
|
|
138
145
|
const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
|
|
139
146
|
const hasError = shouldReturn(_error, _err, schemaError);
|
|
140
|
-
if (
|
|
147
|
+
if (hasNoFiltersOrItemsToDisplay) return null;
|
|
141
148
|
if (isLoading) return null;
|
|
142
149
|
if (hasError) return null;
|
|
143
150
|
if (cardsError) return cardsError.message;
|
|
@@ -147,14 +154,14 @@ const CardsRender = _ref => {
|
|
|
147
154
|
if (!cardDataResults || !cardDataResults.length) return null;
|
|
148
155
|
cardDataResults = entitySameAsCurrentItemEntity ? removeExtraItems(cardDataResults, limit, parentId) : cardDataResults;
|
|
149
156
|
if (!cardDataResults.length) return null;
|
|
150
|
-
const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults,
|
|
157
|
+
const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults, updatedItemsToDisplay);
|
|
151
158
|
const {
|
|
152
159
|
regularChildren,
|
|
153
160
|
gtmChildren
|
|
154
161
|
} = splitChildren(children, cardDataResults, graphqlEntityMap, {
|
|
155
162
|
name: variableProps.name
|
|
156
163
|
});
|
|
157
|
-
const updatedCards = appendImages(imagesData, orderedData,
|
|
164
|
+
const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);
|
|
158
165
|
return /*#__PURE__*/React.createElement(React.Fragment, null, gtmChildren && renderChildren(gtmChildren), /*#__PURE__*/React.createElement(CardsContainer, _extends({
|
|
159
166
|
cardData: updatedCards,
|
|
160
167
|
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","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,8BA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7G,WAAW,CAAC8G,YAAY,GAAG;EACzBvG,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","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,uBAA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M,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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const getUpdatedItemsToDisplay = ({
|
|
2
|
+
parentSchema,
|
|
3
|
+
parentEntityData,
|
|
4
|
+
itemsToDisplay = [],
|
|
5
|
+
inheritedFilters = []
|
|
6
|
+
}) => {
|
|
7
|
+
const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);
|
|
8
|
+
if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
|
|
9
|
+
const {
|
|
10
|
+
properties
|
|
11
|
+
} = parentSchema;
|
|
12
|
+
const [, entityKey] = idProp.split('/');
|
|
13
|
+
if (!properties || !entityKey) return itemsToDisplay;
|
|
14
|
+
const queryValue = Object.keys(properties).find(propKey => properties[propKey] && properties[propKey].relation && properties[propKey].relation.entityIdentifier === entityKey);
|
|
15
|
+
const parentValues = parentEntityData[queryValue];
|
|
16
|
+
if (!parentValues) return itemsToDisplay;
|
|
17
|
+
const updatedItemsToDisplay = [...itemsToDisplay];
|
|
18
|
+
if (Array.isArray(parentValues)) {
|
|
19
|
+
parentValues.forEach(value => {
|
|
20
|
+
updatedItemsToDisplay.push({
|
|
21
|
+
displayItems: [value]
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
updatedItemsToDisplay.push({
|
|
26
|
+
displayItems: [parentValues]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return updatedItemsToDisplay;
|
|
30
|
+
};
|
|
31
|
+
export default getUpdatedItemsToDisplay;
|
|
32
|
+
//# sourceMappingURL=get-updated-items-to-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","parentSchema","parentEntityData","itemsToDisplay","inheritedFilters","idProp","find","filter","indexOf","properties","entityKey","split","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","Array","isArray","forEach","value","push","displayItems"],"sources":["../../../../src/components/Card/helpers/get-updated-items-to-display.js"],"sourcesContent":["const getUpdatedItemsToDisplay = ({\n parentSchema,\n parentEntityData,\n itemsToDisplay = [],\n inheritedFilters = []\n}) => {\n const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);\n\n if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;\n const { properties } = parentSchema;\n const [, entityKey] = idProp.split('/');\n if (!properties || !entityKey) return itemsToDisplay;\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === entityKey\n );\n const parentValues = parentEntityData[queryValue];\n if (!parentValues) return itemsToDisplay;\n const updatedItemsToDisplay = [...itemsToDisplay];\n if (Array.isArray(parentValues)) {\n parentValues.forEach(value => {\n updatedItemsToDisplay.push({ displayItems: [value] });\n });\n } else {\n updatedItemsToDisplay.push({ displayItems: [parentValues] });\n }\n return updatedItemsToDisplay;\n};\n\nexport default getUpdatedItemsToDisplay;\n"],"mappings":"AAAA,MAAMA,wBAAwB,GAAGA,CAAC;EAChCC,YAAY;EACZC,gBAAgB;EAChBC,cAAc,GAAG,EAAE;EACnBC,gBAAgB,GAAG;AACrB,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGD,gBAAgB,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;EAE3E,IAAI,CAACH,MAAM,IAAI,CAACJ,YAAY,IAAI,CAACC,gBAAgB,EAAE,OAAOC,cAAc;EACxE,MAAM;IAAEM;EAAW,CAAC,GAAGR,YAAY;EACnC,MAAM,GAAGS,SAAS,CAAC,GAAGL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;EACvC,IAAI,CAACF,UAAU,IAAI,CAACC,SAAS,EAAE,OAAOP,cAAc;EACpD,MAAMS,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACL,UAAU,CAAC,CAACH,IAAI,CAC7CS,OAAO,IACLN,UAAU,CAACM,OAAO,CAAC,IACnBN,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,IAC5BP,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,CAACC,gBAAgB,KAAKP,SACtD,CAAC;EACD,MAAMQ,YAAY,GAAGhB,gBAAgB,CAACU,UAAU,CAAC;EACjD,IAAI,CAACM,YAAY,EAAE,OAAOf,cAAc;EACxC,MAAMgB,qBAAqB,GAAG,CAAC,GAAGhB,cAAc,CAAC;EACjD,IAAIiB,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACI,OAAO,CAACC,KAAK,IAAI;MAC5BJ,qBAAqB,CAACK,IAAI,CAAC;QAAEC,YAAY,EAAE,CAACF,KAAK;MAAE,CAAC,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,MAAM;IACLJ,qBAAqB,CAACK,IAAI,CAAC;MAAEC,YAAY,EAAE,CAACP,YAAY;IAAE,CAAC,CAAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAED,eAAenB,wBAAwB"}
|
|
@@ -6,4 +6,5 @@ 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';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties","getUpdatedItemsToDisplay"],"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';\nexport { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';\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;AACnF,SAASR,OAAO,IAAIS,wBAAwB,QAAQ,gCAAgC"}
|