@zengenti/contensis-react-base 4.0.0-beta.52 → 4.0.0-beta.54
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/cjs/{App-MBfJ2LEB.js → App-C5GI_YFh.js} +2 -2
- package/cjs/{App-MBfJ2LEB.js.map → App-C5GI_YFh.js.map} +1 -1
- package/cjs/client.js +2 -2
- package/cjs/contensis-react-base.js +2 -2
- package/cjs/{sagas-DetYc0Sb.js → sagas-CYcqkymm.js} +22 -9
- package/cjs/sagas-CYcqkymm.js.map +1 -0
- package/cjs/search.js +1 -1
- package/esm/{App-CGJd1xEp.js → App-DBr80OSz.js} +2 -2
- package/esm/{App-CGJd1xEp.js.map → App-DBr80OSz.js.map} +1 -1
- package/esm/client.js +3 -3
- package/esm/contensis-react-base.js +3 -3
- package/esm/{sagas-tSMLm-l5.js → sagas-Dl7xqU8K.js} +22 -9
- package/esm/sagas-Dl7xqU8K.js.map +1 -0
- package/esm/search.js +2 -2
- package/models/search/models/Queries.d.ts +1 -1
- package/models/search/models/Search.d.ts +2 -0
- package/models/search/models/SearchActions.d.ts +1 -0
- package/models/search/models/SearchState.d.ts +1 -0
- package/package.json +1 -1
- package/cjs/sagas-DetYc0Sb.js.map +0 -1
- package/esm/sagas-tSMLm-l5.js.map +0 -1
|
@@ -1331,10 +1331,10 @@ var expressions = /*#__PURE__*/Object.freeze({
|
|
|
1331
1331
|
termExpressions: termExpressions
|
|
1332
1332
|
});
|
|
1333
1333
|
|
|
1334
|
-
const filterQuery = (contentTypeIds, languages, versionStatus, customWhere) => {
|
|
1334
|
+
const filterQuery = (contentTypeIds, languages, versionStatus, customWhere, pageSize = 100) => {
|
|
1335
1335
|
const query = new contensisCoreApi.Query(...[...contentTypeIdExpression(contentTypeIds), ...languagesExpression(languages), ...defaultExpressions(versionStatus), ...customWhereExpressions(customWhere)]);
|
|
1336
1336
|
query.orderBy = contensisCoreApi.OrderBy.asc(Fields.entryTitle);
|
|
1337
|
-
query.pageSize =
|
|
1337
|
+
query.pageSize = pageSize;
|
|
1338
1338
|
return query;
|
|
1339
1339
|
};
|
|
1340
1340
|
const searchQuery = ({
|
|
@@ -5116,6 +5116,9 @@ const facetTemplate = {
|
|
|
5116
5116
|
}
|
|
5117
5117
|
|
|
5118
5118
|
// Update aggregation counts on existing filter items
|
|
5119
|
+
// In the context of a pre-loaded facet, the filter items will
|
|
5120
|
+
// not have been loaded yet, so we need to check again when
|
|
5121
|
+
// the filter items load and populate the aggregate counts then as well
|
|
5119
5122
|
for (const filterItem of filter.items || []) {
|
|
5120
5123
|
if (!aggregation) delete filterItem.aggregate;else {
|
|
5121
5124
|
const aggregate = aggregation[filterItem.key.toLowerCase()];
|
|
@@ -5216,7 +5219,7 @@ const filterTemplate = {
|
|
|
5216
5219
|
selectedKeys,
|
|
5217
5220
|
mapper,
|
|
5218
5221
|
facet,
|
|
5219
|
-
|
|
5222
|
+
filter
|
|
5220
5223
|
}) => {
|
|
5221
5224
|
// Handle taxonomy filter items
|
|
5222
5225
|
if (payload && 'children' in payload) {
|
|
@@ -5229,10 +5232,18 @@ const filterTemplate = {
|
|
|
5229
5232
|
}
|
|
5230
5233
|
|
|
5231
5234
|
// Handle entries-based filter items
|
|
5232
|
-
if (payload && 'items' in payload) {
|
|
5233
|
-
var _facet$
|
|
5235
|
+
if (payload && 'items' in payload && filter.fieldId) {
|
|
5236
|
+
var _facet$aggregations2;
|
|
5234
5237
|
// Handle aggregations from SSR where the results containing the aggregations have loaded before the filter items
|
|
5235
|
-
const aggregation = (
|
|
5238
|
+
const aggregation = Array.isArray(filter.fieldId) ? filter.fieldId.reduce((agg, fieldId) => {
|
|
5239
|
+
var _facet$aggregations;
|
|
5240
|
+
const fieldAggregations = ((_facet$aggregations = facet.aggregations) === null || _facet$aggregations === void 0 ? void 0 : _facet$aggregations[util.convertKeyForAggregation(fieldId)]) || {};
|
|
5241
|
+
// Accumulate numeric values for matching keys from previous counted fields
|
|
5242
|
+
for (const [key, value] of Object.entries(fieldAggregations)) {
|
|
5243
|
+
agg[key] = (agg[key] || 0) + value;
|
|
5244
|
+
}
|
|
5245
|
+
return agg;
|
|
5246
|
+
}, {}) : (_facet$aggregations2 = facet.aggregations) === null || _facet$aggregations2 === void 0 ? void 0 : _facet$aggregations2[util.convertKeyForAggregation(filter.fieldId)];
|
|
5236
5247
|
const items = payload.items.map(item => {
|
|
5237
5248
|
var _item$sys, _item$sys2;
|
|
5238
5249
|
item.isSelected = selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.includes(item === null || item === void 0 || (_item$sys = item.sys) === null || _item$sys === void 0 ? void 0 : _item$sys.id);
|
|
@@ -5240,7 +5251,7 @@ const filterTemplate = {
|
|
|
5240
5251
|
if (typeof aggregate === 'number') item.aggregate = aggregate;
|
|
5241
5252
|
return item;
|
|
5242
5253
|
});
|
|
5243
|
-
return mapper === null || mapper === void 0 ? void 0 : mapper(items);
|
|
5254
|
+
return (mapper === null || mapper === void 0 ? void 0 : mapper(items)) || [];
|
|
5244
5255
|
}
|
|
5245
5256
|
return [];
|
|
5246
5257
|
}
|
|
@@ -5805,6 +5816,7 @@ function* loadFilter(action) {
|
|
|
5805
5816
|
const {
|
|
5806
5817
|
contentTypeId,
|
|
5807
5818
|
customWhere,
|
|
5819
|
+
pageSize,
|
|
5808
5820
|
path
|
|
5809
5821
|
} = filter;
|
|
5810
5822
|
const createStateFrom = {
|
|
@@ -5812,6 +5824,7 @@ function* loadFilter(action) {
|
|
|
5812
5824
|
context,
|
|
5813
5825
|
error: undefined,
|
|
5814
5826
|
facetKey,
|
|
5827
|
+
filter,
|
|
5815
5828
|
filterKey,
|
|
5816
5829
|
payload: {},
|
|
5817
5830
|
selectedKeys,
|
|
@@ -5820,7 +5833,7 @@ function* loadFilter(action) {
|
|
|
5820
5833
|
try {
|
|
5821
5834
|
if (contentTypeId) {
|
|
5822
5835
|
const versionStatus = yield effects.select(version.selectVersionStatus);
|
|
5823
|
-
const query = filterQuery(Array.isArray(contentTypeId) ? contentTypeId : [contentTypeId], languages, versionStatus, customWhere);
|
|
5836
|
+
const query = filterQuery(Array.isArray(contentTypeId) ? contentTypeId : [contentTypeId], languages, versionStatus, customWhere, pageSize);
|
|
5824
5837
|
const payload = yield api.search(query, 0, projectId);
|
|
5825
5838
|
if (!payload) throw new Error('No payload returned by search');
|
|
5826
5839
|
if (payload.type === 'error') throw payload;
|
|
@@ -6147,4 +6160,4 @@ exports.updateSortOrder = updateSortOrder$1;
|
|
|
6147
6160
|
exports.useFacets = useFacets;
|
|
6148
6161
|
exports.useListing = useListing;
|
|
6149
6162
|
exports.withMappers = withMappers;
|
|
6150
|
-
//# sourceMappingURL=sagas-
|
|
6163
|
+
//# sourceMappingURL=sagas-CYcqkymm.js.map
|