@fluid-topics/ft-search-saved-searches 1.1.13 → 1.1.14
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/ft-search-saved-searches.css.d.ts +4 -0
- package/build/ft-search-saved-searches.css.js +65 -3
- package/build/ft-search-saved-searches.d.ts +14 -5
- package/build/ft-search-saved-searches.js +133 -43
- package/build/ft-search-saved-searches.light.js +307 -313
- package/build/ft-search-saved-searches.min.js +293 -298
- package/build/utils/SavedSearchesComponentMessages.d.ts +0 -2
- package/build/utils/SavedSearchesComponentMessages.js +0 -2
- package/package.json +4 -4
- package/build/ft-search-saved-search.d.ts +0 -27
- package/build/ft-search-saved-search.js +0 -196
|
@@ -7,10 +7,14 @@ export declare const FtSearchSavedSearchesCssVariables: {
|
|
|
7
7
|
activeSearchBorderWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
8
8
|
activeSearchBorderRadius: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
9
9
|
inactiveButtonTextColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
10
|
+
inactiveButtonBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
10
11
|
inactiveSearchBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
11
12
|
inactiveSearchBorderStyle: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
12
13
|
inactiveSearchBorderColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
13
14
|
inactiveSearchBorderWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
14
15
|
inactiveSearchBorderRadius: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
16
|
+
chipBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
17
|
+
cardTitleFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
18
|
+
cardTitleFontWeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
15
19
|
};
|
|
16
20
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -2,6 +2,10 @@ var _a, _b, _c, _d;
|
|
|
2
2
|
import { css } from "lit";
|
|
3
3
|
import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
4
4
|
import { FtCardCssVariables } from "@fluid-topics/ft-card";
|
|
5
|
+
import { FtRippleCssVariables } from "@fluid-topics/ft-ripple";
|
|
6
|
+
import { FtChipCssVariables } from "@fluid-topics/ft-chip";
|
|
7
|
+
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
8
|
+
import { FtTypographyTitleDenseCssVariables } from "@fluid-topics/ft-typography";
|
|
5
9
|
export const FtSearchSavedSearchesCssVariables = {
|
|
6
10
|
color: FtCssVariableFactory.extend("--ft-search-saved-searches-color", "", designSystemVariables.colorOnSurface),
|
|
7
11
|
activeButtonTextColor: FtCssVariableFactory.extend("--ft-search-saved-searches-active-button-text-color", "", designSystemVariables.colorPrimary),
|
|
@@ -11,21 +15,79 @@ export const FtSearchSavedSearchesCssVariables = {
|
|
|
11
15
|
activeSearchBorderWidth: FtCssVariableFactory.create("--ft-search-saved-searches-active-search-border-width", "", "SIZE", (_b = FtCardCssVariables.selectedOutlineWidth.lastResortDefaultValue()) !== null && _b !== void 0 ? _b : "2px"),
|
|
12
16
|
activeSearchBorderRadius: FtCssVariableFactory.extend("--ft-search-saved-searches-active-search-border-radius", "", designSystemVariables.borderRadiusM),
|
|
13
17
|
inactiveButtonTextColor: FtCssVariableFactory.extend("--ft-search-saved-searches-inactive-button-text-color", "", designSystemVariables.colorPrimary),
|
|
18
|
+
inactiveButtonBackgroundColor: FtCssVariableFactory.extend("--ft-search-saved-searches-inactive-button-background-color", "", designSystemVariables.colorSurface),
|
|
14
19
|
inactiveSearchBackgroundColor: FtCssVariableFactory.extend("--ft-search-saved-searches-inactive-search-background-color", "", designSystemVariables.colorContent),
|
|
15
20
|
inactiveSearchBorderStyle: FtCssVariableFactory.create("--ft-search-saved-searches-inactive-search-border-style", "", "BORDER-STYLE", (_c = FtCardCssVariables.outlineStyle.lastResortDefaultValue()) !== null && _c !== void 0 ? _c : "solid"),
|
|
16
21
|
inactiveSearchBorderColor: FtCssVariableFactory.extend("--ft-search-saved-searches-inactive-search-border-color", "", designSystemVariables.colorPrimary),
|
|
17
22
|
inactiveSearchBorderWidth: FtCssVariableFactory.create("--ft-search-saved-searches-inactive-search-border-width", "", "SIZE", (_d = FtCardCssVariables.outlineWidth.lastResortDefaultValue()) !== null && _d !== void 0 ? _d : "0"),
|
|
18
23
|
inactiveSearchBorderRadius: FtCssVariableFactory.extend("--ft-search-saved-searches-inactive-search-border-radius", "", designSystemVariables.borderRadiusM),
|
|
24
|
+
chipBackgroundColor: FtCssVariableFactory.extend("--ft-search-saved-searches-chip-background-color", "", designSystemVariables.colorSurface),
|
|
25
|
+
cardTitleFontSize: FtCssVariableFactory.create("--ft-search-saved-searches-card-title-font-size", "", "SIZE", "16px"),
|
|
26
|
+
cardTitleFontWeight: FtCssVariableFactory.create("--ft-search-saved-searches-card-title-font-weight", "", "SIZE", "600"),
|
|
19
27
|
};
|
|
20
28
|
// language=CSS
|
|
21
29
|
export const styles = css `
|
|
22
|
-
|
|
30
|
+
[part="container"] {
|
|
23
31
|
display: flex;
|
|
24
32
|
flex-direction: column;
|
|
25
|
-
gap:
|
|
33
|
+
gap: 12px;
|
|
26
34
|
margin: 3px;
|
|
27
|
-
|
|
28
35
|
${setVariable(FtCardCssVariables.colorOnSurfaceHigh, FtSearchSavedSearchesCssVariables.color)};
|
|
29
36
|
${setVariable(FtCardCssVariables.colorOnSurfaceMedium, FtSearchSavedSearchesCssVariables.color)};
|
|
30
37
|
}
|
|
38
|
+
|
|
39
|
+
[part="card"] {
|
|
40
|
+
${setVariable(FtCardCssVariables.outlineStyle, FtSearchSavedSearchesCssVariables.inactiveSearchBorderStyle)};
|
|
41
|
+
${setVariable(FtCardCssVariables.outlineWidth, FtSearchSavedSearchesCssVariables.inactiveSearchBorderWidth)};
|
|
42
|
+
${setVariable(FtCardCssVariables.outlineColor, FtSearchSavedSearchesCssVariables.inactiveSearchBorderColor)};
|
|
43
|
+
${setVariable(FtCardCssVariables.borderRadius, FtSearchSavedSearchesCssVariables.inactiveSearchBorderRadius)};
|
|
44
|
+
${setVariable(FtCardCssVariables.selectedOutlineStyle, FtSearchSavedSearchesCssVariables.activeSearchBorderStyle)};
|
|
45
|
+
${setVariable(FtCardCssVariables.selectedOutlineWidth, FtSearchSavedSearchesCssVariables.activeSearchBorderWidth)};
|
|
46
|
+
${setVariable(FtCardCssVariables.selectedOutlineColor, FtSearchSavedSearchesCssVariables.activeSearchBorderColor)};
|
|
47
|
+
${setVariable(FtCardCssVariables.selectedBorderRadius, FtSearchSavedSearchesCssVariables.activeSearchBorderRadius)};
|
|
48
|
+
${setVariable(FtRippleCssVariables.backgroundColor, FtSearchSavedSearchesCssVariables.inactiveSearchBackgroundColor)};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[part="card"][selected] {
|
|
52
|
+
${setVariable(FtRippleCssVariables.backgroundColor, FtSearchSavedSearchesCssVariables.activeSearchBackgroundColor)};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part="title"] {
|
|
56
|
+
${setVariable(FtTypographyTitleDenseCssVariables.fontSize, FtSearchSavedSearchesCssVariables.cardTitleFontSize)};
|
|
57
|
+
${setVariable(FtTypographyTitleDenseCssVariables.fontWeight, FtSearchSavedSearchesCssVariables.cardTitleFontWeight)};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[part="card-content"] {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[part="search-filters"] {
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: 4px;
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
[part="chip"] {
|
|
73
|
+
${setVariable(FtChipCssVariables.backgroundColor, FtSearchSavedSearchesCssVariables.chipBackgroundColor)};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part="search-button"] {
|
|
77
|
+
${setVariable(FtButtonCssVariables.color, FtSearchSavedSearchesCssVariables.inactiveButtonTextColor)};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[part="search-button"]:not([disabled]) {
|
|
81
|
+
${setVariable(FtButtonCssVariables.color, FtSearchSavedSearchesCssVariables.inactiveButtonTextColor)};
|
|
82
|
+
${setVariable(FtButtonCssVariables.backgroundColor, FtSearchSavedSearchesCssVariables.inactiveButtonBackgroundColor)};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[part="metadata-label"]:after {
|
|
86
|
+
content: ":";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
a, a:hover, a:focus, a:active {
|
|
90
|
+
text-decoration: none;
|
|
91
|
+
color: inherit;
|
|
92
|
+
}
|
|
31
93
|
`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { PropertyValues } from "lit";
|
|
1
|
+
import { nothing, PropertyValues } from "lit";
|
|
2
2
|
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtSearchSavedSearchesProperties } from "./ft-search-saved-searches.properties";
|
|
4
|
+
import { FtMySearch, FtSearchFilter } from "@fluid-topics/public-api";
|
|
4
5
|
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
5
6
|
declare const FtSearchSavedSearches_base: typeof FtSearchComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
6
7
|
export declare class FtSearchSavedSearches extends FtSearchSavedSearches_base implements FtSearchSavedSearchesProperties {
|
|
@@ -9,22 +10,30 @@ export declare class FtSearchSavedSearches extends FtSearchSavedSearches_base im
|
|
|
9
10
|
showSearchFilters: boolean;
|
|
10
11
|
showSearchButton: boolean;
|
|
11
12
|
showAlertStatus: boolean;
|
|
12
|
-
|
|
13
|
+
savedSearches?: Array<FtMySearch>;
|
|
13
14
|
private user?;
|
|
15
|
+
private baseUrl?;
|
|
14
16
|
private request?;
|
|
15
|
-
private editorMode;
|
|
16
17
|
private requiredRole;
|
|
17
18
|
static elementDefinitions: ElementDefinitionsMap;
|
|
18
19
|
constructor();
|
|
19
|
-
render(): import("lit").TemplateResult<1>;
|
|
20
|
+
render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
21
|
+
private renderDescription;
|
|
22
|
+
private renderSearchButton;
|
|
23
|
+
private renderAlertStatus;
|
|
24
|
+
private renderSearchFilters;
|
|
25
|
+
private renderMetadata;
|
|
26
|
+
private mapSortKey;
|
|
27
|
+
private mapPeriodFilter;
|
|
20
28
|
private get userHasRights();
|
|
21
29
|
private get isEmpty();
|
|
22
30
|
private isSelected;
|
|
31
|
+
areFtSearchFiltersEqual(arr1: FtSearchFilter[], arr2: FtSearchFilter[]): boolean;
|
|
23
32
|
private mapFtSearchSortCriterion;
|
|
24
33
|
private toFtSearchRequest;
|
|
25
34
|
private mapSearchFilter;
|
|
26
35
|
connectedCallback(): void;
|
|
27
|
-
private
|
|
36
|
+
private onLinkClick;
|
|
28
37
|
protected update(changedProperties: PropertyValues): void;
|
|
29
38
|
}
|
|
30
39
|
export {};
|
|
@@ -4,19 +4,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
|
-
import { deepEqual, redux } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { deepEqual, redux, serializeRequest } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-search-saved-searches.css";
|
|
11
11
|
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
12
|
-
import { FtSearchSavedSearch } from "./ft-search-saved-search";
|
|
13
12
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
14
13
|
import { repeat } from "lit/directives/repeat.js";
|
|
15
|
-
import { FtUserRole } from "@fluid-topics/public-api";
|
|
14
|
+
import { FtSearchScope, FtUserRole, FtVirtualField, userHasRole } from "@fluid-topics/public-api";
|
|
16
15
|
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
17
16
|
import { ftUserAssetsStore, userAssetsActions } from "@fluid-topics/ft-app-context/build/redux-stores/FtUserAssetsStore";
|
|
18
17
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
19
18
|
import { defaultSavedSearchesMessages, savedSearches } from "./utils/SavedSearchesComponentMessages";
|
|
19
|
+
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
20
|
+
import { FtCard } from "@fluid-topics/ft-card";
|
|
21
|
+
import { FtChip } from "@fluid-topics/ft-chip";
|
|
22
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
20
23
|
class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
21
24
|
constructor() {
|
|
22
25
|
super();
|
|
@@ -24,7 +27,6 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
24
27
|
this.showSearchFilters = false;
|
|
25
28
|
this.showSearchButton = false;
|
|
26
29
|
this.showAlertStatus = false;
|
|
27
|
-
this.editorMode = false;
|
|
28
30
|
this.requiredRole = FtUserRole.SAVED_SEARCH_USER;
|
|
29
31
|
this.addStore(ftAppInfoStore);
|
|
30
32
|
this.addStore(ftUserAssetsStore);
|
|
@@ -32,43 +34,111 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
32
34
|
}
|
|
33
35
|
render() {
|
|
34
36
|
var _a;
|
|
35
|
-
if (this.
|
|
37
|
+
if (this.userHasRights && !this.isEmpty) {
|
|
36
38
|
return html `
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
<div part="container">
|
|
40
|
+
${repeat((_a = this.savedSearches) !== null && _a !== void 0 ? _a : [], s => s.id, s => {
|
|
41
|
+
const ftSearchRequest = this.toFtSearchRequest(s.searchRequest);
|
|
42
|
+
if (ftSearchRequest === undefined)
|
|
43
|
+
return nothing;
|
|
44
|
+
const link = serializeRequest(this.baseUrl, ftSearchRequest);
|
|
45
|
+
return html `
|
|
46
|
+
<a href="${link}" @click="${(e) => this.onLinkClick(e, ftSearchRequest)}">
|
|
47
|
+
<ft-card clickable ?selected="${this.isSelected(s.searchRequest)}" part="card">
|
|
48
|
+
<div slot="header">
|
|
49
|
+
<ft-typography variant="title">${s.title}</ft-typography>
|
|
50
|
+
${this.renderAlertStatus(s.alert)}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div part="card-content">
|
|
54
|
+
${this.renderDescription(s.description)}
|
|
55
|
+
${this.renderSearchFilters(s.searchRequest)}
|
|
56
|
+
${this.renderSearchButton(this.isSelected(s.searchRequest))}
|
|
57
|
+
</div>
|
|
58
|
+
</ft-card>
|
|
59
|
+
</a>
|
|
60
|
+
`;
|
|
61
|
+
})}
|
|
56
62
|
</div>
|
|
57
63
|
`;
|
|
58
64
|
}
|
|
59
65
|
else {
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
return nothing;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
renderDescription(description) {
|
|
70
|
+
return this.showDescription && description
|
|
71
|
+
? html `<div part="description" class="content">${description}</div>`
|
|
72
|
+
: nothing;
|
|
73
|
+
}
|
|
74
|
+
renderSearchButton(isSelected) {
|
|
75
|
+
return this.showSearchButton
|
|
76
|
+
? html `<div part="search-button"><ft-button id="search" icon="search" ?disabled=${isSelected}>${savedSearches.messages.search()}</ft-button></div>`
|
|
77
|
+
: nothing;
|
|
78
|
+
}
|
|
79
|
+
renderAlertStatus(alert) {
|
|
80
|
+
return this.showAlertStatus && alert
|
|
81
|
+
? html `<ft-icon part="alert-status">alert</ft-icon>`
|
|
82
|
+
: nothing;
|
|
83
|
+
}
|
|
84
|
+
// See net.antidot.fluidtopics.client.application.mylibrary.shared.MyLibraryTagWidgetFactory.createMySearchTags
|
|
85
|
+
renderSearchFilters(searchRequest) {
|
|
86
|
+
var _a, _b, _c, _d, _e;
|
|
87
|
+
return this.showSearchFilters ? html `<div part="search-filters" class="content">
|
|
88
|
+
${((_a = searchRequest.query.length) !== null && _a !== void 0 ? _a : 0 > 0)
|
|
89
|
+
? this.renderMetadata(savedSearches.messages.keywords(), searchRequest.query)
|
|
90
|
+
: nothing}
|
|
91
|
+
${searchRequest.virtualField == FtVirtualField.TITLE_ONLY
|
|
92
|
+
? this.renderMetadata(savedSearches.messages.in(), savedSearches.messages.titles())
|
|
93
|
+
: nothing}
|
|
94
|
+
${searchRequest.scope == FtSearchScope.DOCUMENTS
|
|
95
|
+
? this.renderMetadata(savedSearches.messages.resultsType(), savedSearches.messages.documentsOnly())
|
|
96
|
+
: nothing}
|
|
97
|
+
${searchRequest.filters.map(f => this.renderMetadata(f.label, f.values))}
|
|
98
|
+
${((_c = (_b = searchRequest.contentLocale) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0 > 0)
|
|
99
|
+
? this.renderMetadata(savedSearches.messages.language(), searchRequest.contentLocale)
|
|
100
|
+
: nothing}
|
|
101
|
+
${((_e = (_d = searchRequest.sort[0]) === null || _d === void 0 ? void 0 : _d.key.length) !== null && _e !== void 0 ? _e : 0 > 0)
|
|
102
|
+
? this.renderMetadata(savedSearches.messages.sort(), this.mapSortKey(searchRequest.sort[0].key))
|
|
103
|
+
: nothing}
|
|
104
|
+
${searchRequest.periodFilter
|
|
105
|
+
? this.renderMetadata(savedSearches.messages.period(), this.mapPeriodFilter(searchRequest.periodFilter))
|
|
106
|
+
: nothing}
|
|
107
|
+
</div>` : nothing;
|
|
108
|
+
}
|
|
109
|
+
renderMetadata(key, values) {
|
|
110
|
+
return html `
|
|
111
|
+
<ft-chip dense part="chip">
|
|
112
|
+
<span part="metadata-label">${key}</span>
|
|
113
|
+
<span part="metadata-values">${Array.isArray(values) ? values.join(", ") : values}</span>
|
|
114
|
+
</ft-chip>`;
|
|
115
|
+
}
|
|
116
|
+
mapSortKey(key) {
|
|
117
|
+
switch (key) {
|
|
118
|
+
case "afs:relevance":
|
|
119
|
+
return savedSearches.messages.relevance();
|
|
120
|
+
case "ft:lastEdition":
|
|
121
|
+
return savedSearches.messages.lastUpdate();
|
|
122
|
+
default:
|
|
123
|
+
return key;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
mapPeriodFilter(periodFilter) {
|
|
127
|
+
switch (periodFilter.periodType) {
|
|
128
|
+
case "LAST_WEEK":
|
|
129
|
+
return savedSearches.messages.lastWeek();
|
|
130
|
+
case "LAST_MONTH":
|
|
131
|
+
return savedSearches.messages.lastMonth();
|
|
132
|
+
case "LAST_YEAR":
|
|
133
|
+
return savedSearches.messages.lastYear();
|
|
134
|
+
case "CUSTOM":
|
|
135
|
+
return savedSearches.messages.customPeriod();
|
|
136
|
+
default:
|
|
137
|
+
return "--";
|
|
67
138
|
}
|
|
68
139
|
}
|
|
69
140
|
get userHasRights() {
|
|
70
|
-
|
|
71
|
-
return !!((_a = this.user) === null || _a === void 0 ? void 0 : _a.roles.includes(this.requiredRole));
|
|
141
|
+
return userHasRole(this.user, this.requiredRole);
|
|
72
142
|
}
|
|
73
143
|
get isEmpty() {
|
|
74
144
|
var _a;
|
|
@@ -78,13 +148,28 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
78
148
|
var _a, _b, _c, _d;
|
|
79
149
|
return this.request != undefined
|
|
80
150
|
&& deepEqual(this.request.query, mySearchRequest.query)
|
|
81
|
-
&&
|
|
151
|
+
&& this.areFtSearchFiltersEqual([...this.request.filters], [...mySearchRequest.filters].map(this.mapSearchFilter))
|
|
82
152
|
&& deepEqual([...this.request.sort].map(this.mapFtSearchSortCriterion), [...mySearchRequest.sort].map(this.mapFtSearchSortCriterion))
|
|
83
153
|
&& deepEqual(this.request.contentLocale, mySearchRequest.contentLocale)
|
|
84
154
|
&& deepEqual(this.request.periodFilter, mySearchRequest.periodFilter)
|
|
85
155
|
&& deepEqual((_a = this.request.virtualField) !== null && _a !== void 0 ? _a : "EVERYWHERE", (_b = mySearchRequest.virtualField) !== null && _b !== void 0 ? _b : "EVERYWHERE")
|
|
86
156
|
&& deepEqual((_c = this.request.scope) !== null && _c !== void 0 ? _c : "DEFAULT", (_d = mySearchRequest.scope) !== null && _d !== void 0 ? _d : "DEFAULT");
|
|
87
157
|
}
|
|
158
|
+
areFtSearchFiltersEqual(arr1, arr2) {
|
|
159
|
+
if (!deepEqual(arr1.map(i => i.key).sort(), arr2.map(i => i.key).sort())) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
const compareObjects = (obj1, obj2) => {
|
|
163
|
+
return obj1.key === obj2.key && obj1.negative === obj2.negative && deepEqual(obj1.values.sort(), obj2.values.sort());
|
|
164
|
+
};
|
|
165
|
+
for (const obj1 of arr1) {
|
|
166
|
+
const matchingObject = arr2.find(obj2 => compareObjects(obj1, obj2));
|
|
167
|
+
if (!matchingObject) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
88
173
|
mapFtSearchSortCriterion(s) {
|
|
89
174
|
return { ...s };
|
|
90
175
|
}
|
|
@@ -111,11 +196,13 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
111
196
|
super.connectedCallback();
|
|
112
197
|
userAssetsActions.reloadMySearches();
|
|
113
198
|
}
|
|
114
|
-
|
|
199
|
+
onLinkClick(e, ftSearchRequest) {
|
|
115
200
|
var _a;
|
|
116
|
-
|
|
117
|
-
|
|
201
|
+
if (!e.ctrlKey && !e.metaKey) {
|
|
202
|
+
e.stopPropagation();
|
|
203
|
+
e.preventDefault();
|
|
118
204
|
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setRequest(ftSearchRequest);
|
|
205
|
+
this.click();
|
|
119
206
|
}
|
|
120
207
|
}
|
|
121
208
|
update(changedProperties) {
|
|
@@ -128,8 +215,11 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
128
215
|
}
|
|
129
216
|
FtSearchSavedSearches.styles = styles;
|
|
130
217
|
FtSearchSavedSearches.elementDefinitions = {
|
|
131
|
-
"ft-
|
|
132
|
-
"ft-
|
|
218
|
+
"ft-typography": FtTypography,
|
|
219
|
+
"ft-icon": FtIcon,
|
|
220
|
+
"ft-card": FtCard,
|
|
221
|
+
"ft-chip": FtChip,
|
|
222
|
+
"ft-button": FtButton
|
|
133
223
|
};
|
|
134
224
|
__decorate([
|
|
135
225
|
property({ type: Boolean })
|
|
@@ -149,10 +239,10 @@ __decorate([
|
|
|
149
239
|
__decorate([
|
|
150
240
|
redux({ store: ftAppInfoStore.name, selector: (s) => { var _a; return (_a = s.session) === null || _a === void 0 ? void 0 : _a.profile; } })
|
|
151
241
|
], FtSearchSavedSearches.prototype, "user", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
redux({ store: ftAppInfoStore.name })
|
|
244
|
+
], FtSearchSavedSearches.prototype, "baseUrl", void 0);
|
|
152
245
|
__decorate([
|
|
153
246
|
redux({ store: "search" })
|
|
154
247
|
], FtSearchSavedSearches.prototype, "request", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
redux({ store: ftAppInfoStore.name })
|
|
157
|
-
], FtSearchSavedSearches.prototype, "editorMode", void 0);
|
|
158
248
|
export { FtSearchSavedSearches };
|