@fluid-topics/ft-search-context 2.2.18 → 2.2.20
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/build/registration.js
CHANGED
|
@@ -27,11 +27,12 @@ export const toFtSearchComponent = applyMixinOnce(Symbol("toFtSearchComponent"),
|
|
|
27
27
|
this.neededSearchRequests = [];
|
|
28
28
|
}
|
|
29
29
|
willUpdate(props) {
|
|
30
|
-
var _a, _b
|
|
30
|
+
var _a, _b;
|
|
31
|
+
var _c;
|
|
31
32
|
super.willUpdate(props);
|
|
32
33
|
if (props.has("neededSearchRequests")) {
|
|
33
|
-
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.unregisterComponent(this, (
|
|
34
|
-
(
|
|
34
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.unregisterComponent(this, (_c = props.get("neededSearchRequests")) !== null && _c !== void 0 ? _c : []);
|
|
35
|
+
(_b = this.stateManager) === null || _b === void 0 ? void 0 : _b.registerComponent(this, this.neededSearchRequests);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
setSearchStateManager(stateManager) {
|
|
@@ -58,16 +58,17 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
58
58
|
return this.suggestDebouncer.run(() => this.fetchSuggestData(request !== null && request !== void 0 ? request : this.buildSuggestRequest()));
|
|
59
59
|
};
|
|
60
60
|
this.buildSuggestRequest = (searchState = this.store.getState()) => {
|
|
61
|
-
var _a
|
|
61
|
+
var _a;
|
|
62
|
+
var _b;
|
|
62
63
|
return {
|
|
63
64
|
input: searchState.liveQuery,
|
|
64
65
|
metadataFilters: searchState.request.metadataFilters,
|
|
65
|
-
sort: (
|
|
66
|
+
sort: (_b = searchState.request.sort) !== null && _b !== void 0 ? _b : [],
|
|
66
67
|
sortId: searchState.request.sortId,
|
|
67
68
|
contentLocale: searchState.request.contentLocale,
|
|
68
69
|
scope: searchState.request.scope,
|
|
69
70
|
keywordMatch: searchState.request.keywordMatch,
|
|
70
|
-
stickyFiltersId: this.applyStickyFilters ? (
|
|
71
|
+
stickyFiltersId: this.applyStickyFilters ? (_a = ftAppInfoStore.getState().stickyFilters) === null || _a === void 0 ? void 0 : _a.id : undefined,
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
74
|
this.service = service !== null && service !== void 0 ? service : new FtSearchService();
|
|
@@ -130,8 +131,9 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
130
131
|
this.setLiveQuery(query);
|
|
131
132
|
}
|
|
132
133
|
setContentLocale(contentLocale) {
|
|
133
|
-
var _a
|
|
134
|
-
|
|
134
|
+
var _a;
|
|
135
|
+
var _b;
|
|
136
|
+
const locales = (_b = this.store.getState().locales) !== null && _b !== void 0 ? _b : [];
|
|
135
137
|
const previousContentLocale = this.store.getState().request.contentLocale;
|
|
136
138
|
if (contentLocale != previousContentLocale) {
|
|
137
139
|
if (locales.length > 0) {
|
|
@@ -141,7 +143,7 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
this.updateSearchRequest({ contentLocale, metadataFilters: [] }, true);
|
|
144
|
-
if (this.canUpdateUiLocale && ((
|
|
146
|
+
if (this.canUpdateUiLocale && ((_a = ftAppStateManager.store.getState().localesConfiguration) === null || _a === void 0 ? void 0 : _a.searchLanguageSetsUiLanguage) && contentLocale) {
|
|
145
147
|
ftAppStateManager.requestUiLocaleUpdate(contentLocale, contentLocale);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
@@ -169,7 +171,8 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
169
171
|
});
|
|
170
172
|
}
|
|
171
173
|
get sortOptions() {
|
|
172
|
-
var _a
|
|
174
|
+
var _a;
|
|
175
|
+
var _b;
|
|
173
176
|
return (_b = (_a = this.store.getState().configuration) === null || _a === void 0 ? void 0 : _a.sortOptions) !== null && _b !== void 0 ? _b : [];
|
|
174
177
|
}
|
|
175
178
|
setSort(sort) {
|
|
@@ -355,7 +358,8 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
355
358
|
return this.localesDebouncer.run(async () => this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales));
|
|
356
359
|
}
|
|
357
360
|
async fetchSearchData(request) {
|
|
358
|
-
var _a, _b, _c
|
|
361
|
+
var _a, _b, _c;
|
|
362
|
+
var _d, _e;
|
|
359
363
|
(_a = this.cancelableSearch) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
360
364
|
if (!this.isRequestNeeded(FtSearchStateResourceRequest.CLUSTERED_SEARCH)) {
|
|
361
365
|
return;
|
|
@@ -385,11 +389,11 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
385
389
|
this.store.actions.spellcheck(results.spellcheck);
|
|
386
390
|
}
|
|
387
391
|
else {
|
|
388
|
-
const newResults = ((
|
|
392
|
+
const newResults = ((_d = this.store.getState().results) !== null && _d !== void 0 ? _d : []).concat(results.results);
|
|
389
393
|
this.store.actions.results(newResults);
|
|
390
394
|
// Focus on first new result
|
|
391
395
|
this.store.commands.clear(/^focus-result-/);
|
|
392
|
-
this.store.commands.add({ type: `focus-result-${(results.paging.currentPage - 1) * ((
|
|
396
|
+
this.store.commands.add({ type: `focus-result-${(results.paging.currentPage - 1) * ((_e = request.paging.perPage) !== null && _e !== void 0 ? _e : 20) + 1}` });
|
|
393
397
|
}
|
|
394
398
|
this.store.actions.paging(results.paging);
|
|
395
399
|
}
|
|
@@ -397,7 +401,7 @@ export class FtSearchStateManager extends FtStateManager {
|
|
|
397
401
|
catch (e) {
|
|
398
402
|
if (!(e instanceof CanceledPromiseError)) {
|
|
399
403
|
console.error(e);
|
|
400
|
-
(
|
|
404
|
+
(_c = this.errorHandler) === null || _c === void 0 ? void 0 : _c.call(this, e);
|
|
401
405
|
}
|
|
402
406
|
}
|
|
403
407
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-context",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.20",
|
|
4
4
|
"description": "Context block for integrated search components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "2.2.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "2.2.
|
|
22
|
+
"@fluid-topics/ft-app-context": "2.2.20",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "2.2.20",
|
|
24
24
|
"lit": "3.3.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@fluid-topics/public-api": "1.0.143"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1edf5039fd9e6f390f81d9f7f3bbb8b1e3e6d2db"
|
|
30
30
|
}
|