@sinequa/atomic-angular 1.7.0 → 1.7.1
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/fesm2022/sinequa-atomic-angular.mjs +30 -23
- package/fesm2022/sinequa-atomic-angular.mjs.map +1 -1
- package/index.d.ts +432 -255
- package/package.json +1 -1
|
@@ -1861,7 +1861,10 @@ function withQueryParamsFeatures() {
|
|
|
1861
1861
|
return { ...state, path, text, filters, id, page, sort, spellingCorrectionMode, tab, basket, name };
|
|
1862
1862
|
});
|
|
1863
1863
|
},
|
|
1864
|
-
_updateUrlQueryParams(state, audit) {
|
|
1864
|
+
_updateUrlQueryParams(state, audit, options) {
|
|
1865
|
+
// Opting out of URL sync keeps the store state authoritative without navigating.
|
|
1866
|
+
if (options?.syncUrl === false)
|
|
1867
|
+
return;
|
|
1865
1868
|
const { filters, page, sort, tab, text, basket, name } = state;
|
|
1866
1869
|
const queryParams = {
|
|
1867
1870
|
f: filters && filters.length > 0 ? JSON.stringify(filters) : undefined,
|
|
@@ -1893,8 +1896,8 @@ function withQueryParamsFeatures() {
|
|
|
1893
1896
|
*
|
|
1894
1897
|
* The function calls the `updateFilter` method to add the filter to the state.
|
|
1895
1898
|
*/
|
|
1896
|
-
addFilter(filter, audit) {
|
|
1897
|
-
this.updateFilter(filter, audit);
|
|
1899
|
+
addFilter(filter, audit, options) {
|
|
1900
|
+
this.updateFilter(filter, audit, options);
|
|
1898
1901
|
},
|
|
1899
1902
|
/**
|
|
1900
1903
|
* Updates the filter in the store's state.
|
|
@@ -1986,9 +1989,7 @@ function withQueryParamsFeatures() {
|
|
|
1986
1989
|
}
|
|
1987
1990
|
}
|
|
1988
1991
|
}
|
|
1989
|
-
|
|
1990
|
-
this._updateUrlQueryParams(newState || state, audit);
|
|
1991
|
-
}
|
|
1992
|
+
this._updateUrlQueryParams(newState || state, audit, options);
|
|
1992
1993
|
return newState || state;
|
|
1993
1994
|
});
|
|
1994
1995
|
},
|
|
@@ -2003,9 +2004,7 @@ function withQueryParamsFeatures() {
|
|
|
2003
2004
|
patchState(store, (state) => {
|
|
2004
2005
|
const filters = state.filters?.filter((f) => f.field !== field);
|
|
2005
2006
|
const newState = { ...state, filters };
|
|
2006
|
-
|
|
2007
|
-
this._updateUrlQueryParams(newState);
|
|
2008
|
-
}
|
|
2007
|
+
this._updateUrlQueryParams(newState, undefined, options);
|
|
2009
2008
|
return newState;
|
|
2010
2009
|
});
|
|
2011
2010
|
},
|
|
@@ -2025,9 +2024,7 @@ function withQueryParamsFeatures() {
|
|
|
2025
2024
|
patchState(store, (state) => {
|
|
2026
2025
|
const filters = state.filters?.filter((f) => f.name !== name);
|
|
2027
2026
|
const newState = { ...state, filters };
|
|
2028
|
-
|
|
2029
|
-
this._updateUrlQueryParams(newState);
|
|
2030
|
-
}
|
|
2027
|
+
this._updateUrlQueryParams(newState, undefined, options);
|
|
2031
2028
|
return newState;
|
|
2032
2029
|
});
|
|
2033
2030
|
},
|
|
@@ -2038,10 +2035,10 @@ function withQueryParamsFeatures() {
|
|
|
2038
2035
|
* along with the basket going undefined
|
|
2039
2036
|
* It uses the `patchState` function to apply the state change.
|
|
2040
2037
|
*/
|
|
2041
|
-
clearFilters() {
|
|
2038
|
+
clearFilters(options) {
|
|
2042
2039
|
patchState(store, (state) => {
|
|
2043
2040
|
const newState = { ...state, filters: [], basket: undefined };
|
|
2044
|
-
this._updateUrlQueryParams(newState);
|
|
2041
|
+
this._updateUrlQueryParams(newState, undefined, options);
|
|
2045
2042
|
return newState;
|
|
2046
2043
|
});
|
|
2047
2044
|
},
|
|
@@ -2051,10 +2048,10 @@ function withQueryParamsFeatures() {
|
|
|
2051
2048
|
* This method updates the state by setting the `basket` property to undefined.
|
|
2052
2049
|
* It uses the `patchState` function to apply the state change.
|
|
2053
2050
|
*/
|
|
2054
|
-
clearBasket() {
|
|
2051
|
+
clearBasket(options) {
|
|
2055
2052
|
patchState(store, (state) => {
|
|
2056
2053
|
const newState = { ...state, basket: undefined };
|
|
2057
|
-
this._updateUrlQueryParams(newState);
|
|
2054
|
+
this._updateUrlQueryParams(newState, undefined, options);
|
|
2058
2055
|
return newState;
|
|
2059
2056
|
});
|
|
2060
2057
|
},
|
|
@@ -2063,12 +2060,12 @@ function withQueryParamsFeatures() {
|
|
|
2063
2060
|
*
|
|
2064
2061
|
* @param params - A partial object containing the query parameters to be updated.
|
|
2065
2062
|
*/
|
|
2066
|
-
patch(params, audit) {
|
|
2063
|
+
patch(params, audit, options) {
|
|
2067
2064
|
patchState(store, (state) => {
|
|
2068
2065
|
// get the hash path without the query params and without the leading '#'
|
|
2069
2066
|
const path = window.location.hash.split("?")[0].replace(/^#/, "");
|
|
2070
2067
|
const newState = { ...state, ...params, path };
|
|
2071
|
-
this._updateUrlQueryParams(newState, audit);
|
|
2068
|
+
this._updateUrlQueryParams(newState, audit, options);
|
|
2072
2069
|
return newState;
|
|
2073
2070
|
});
|
|
2074
2071
|
},
|
|
@@ -2893,7 +2890,7 @@ function withSavedSearchesFeatures() {
|
|
|
2893
2890
|
return { ...state, savedSearches: [...savedSearches] };
|
|
2894
2891
|
});
|
|
2895
2892
|
},
|
|
2896
|
-
getSavedSearch(search) {
|
|
2893
|
+
getSavedSearch(search, tab) {
|
|
2897
2894
|
if (!search)
|
|
2898
2895
|
return undefined;
|
|
2899
2896
|
const savedSearches = store.savedSearches();
|
|
@@ -2902,7 +2899,15 @@ function withSavedSearchesFeatures() {
|
|
|
2902
2899
|
if (!queryParams)
|
|
2903
2900
|
return false;
|
|
2904
2901
|
const q = queryParams.split('&').find(qp => qp.startsWith('q='));
|
|
2905
|
-
|
|
2902
|
+
const qMatch = !!q && decodeURI(q.substring(2)) === search;
|
|
2903
|
+
if (!qMatch)
|
|
2904
|
+
return false;
|
|
2905
|
+
// If tab is provided, check it; otherwise accept any tab
|
|
2906
|
+
if (tab) {
|
|
2907
|
+
const t = queryParams.split('&').find(qp => qp.startsWith('t='));
|
|
2908
|
+
return !!t && decodeURI(t.substring(2)) === tab;
|
|
2909
|
+
}
|
|
2910
|
+
return true;
|
|
2906
2911
|
});
|
|
2907
2912
|
}
|
|
2908
2913
|
})));
|
|
@@ -4721,9 +4726,10 @@ class SavedSearchesService {
|
|
|
4721
4726
|
*
|
|
4722
4727
|
* @throws {Error} If saving an empty search is attempted.
|
|
4723
4728
|
*/
|
|
4724
|
-
saveSearch(saveName) {
|
|
4725
|
-
const { text } = getState(this.queryParamsStore);
|
|
4729
|
+
saveSearch(saveName, saveTab) {
|
|
4730
|
+
const { text, tab } = getState(this.queryParamsStore);
|
|
4726
4731
|
const display = saveName || text;
|
|
4732
|
+
const tabName = saveTab || tab;
|
|
4727
4733
|
if (!display) {
|
|
4728
4734
|
console.error("Saving empty search is not allowed");
|
|
4729
4735
|
return;
|
|
@@ -4731,6 +4737,7 @@ class SavedSearchesService {
|
|
|
4731
4737
|
const savedSearch = {
|
|
4732
4738
|
url: window.location.hash.substring(1),
|
|
4733
4739
|
date: new Date().toISOString(),
|
|
4740
|
+
tab: tabName,
|
|
4734
4741
|
display
|
|
4735
4742
|
};
|
|
4736
4743
|
const savedSearches = this.userSettingsStore.savedSearches();
|
|
@@ -16171,7 +16178,7 @@ class SavedSearchDialog {
|
|
|
16171
16178
|
this.dialog()?.showModal();
|
|
16172
16179
|
}
|
|
16173
16180
|
async confirm() {
|
|
16174
|
-
this.savedSearchesService.saveSearch(this.saveName());
|
|
16181
|
+
this.savedSearchesService.saveSearch(this.saveName(), this.queryParamsStore.tab?.());
|
|
16175
16182
|
notify.success(this.transloco.translate("searches.saved.saved"), { duration: 2000 });
|
|
16176
16183
|
// emit close output of the component
|
|
16177
16184
|
this.dialog()?.close("dialog-confirm");
|