@fluid-topics/ft-search-saved-searches 1.1.113 → 1.1.115
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.
|
@@ -13,6 +13,7 @@ export declare class FtSearchSavedSearches extends FtSearchSavedSearches_base im
|
|
|
13
13
|
savedSearches?: Array<FtMySearch>;
|
|
14
14
|
private user?;
|
|
15
15
|
private baseUrl?;
|
|
16
|
+
private searchPlaceConverter?;
|
|
16
17
|
private request?;
|
|
17
18
|
private requiredRole;
|
|
18
19
|
static elementDefinitions: ElementDefinitionsMap;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
|
-
import { deepEqual, redux,
|
|
9
|
+
import { deepEqual, redux, SearchPlaceConverter } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-search-saved-searches.styles";
|
|
11
11
|
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
12
12
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
@@ -38,26 +38,27 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
38
38
|
return html `
|
|
39
39
|
<div part="container">
|
|
40
40
|
${repeat((_a = this.savedSearches) !== null && _a !== void 0 ? _a : [], s => s.id, s => {
|
|
41
|
+
var _a;
|
|
41
42
|
const ftSearchRequest = this.toFtSearchRequest(s.searchRequest);
|
|
42
|
-
if (ftSearchRequest === undefined)
|
|
43
|
+
if (ftSearchRequest === undefined) {
|
|
43
44
|
return nothing;
|
|
44
|
-
|
|
45
|
+
}
|
|
45
46
|
return html `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
<a href="${(_a = this.searchPlaceConverter) === null || _a === void 0 ? void 0 : _a.serialize(ftSearchRequest)}"
|
|
48
|
+
@click="${(e) => this.onLinkClick(e, ftSearchRequest)}">
|
|
49
|
+
<ft-card clickable ?selected="${this.isSelected(s.searchRequest)}" part="card">
|
|
50
|
+
<div slot="header">
|
|
51
|
+
<ft-typography variant="title">${s.title}</ft-typography>
|
|
52
|
+
${this.renderAlertStatus(s.alert)}
|
|
53
|
+
</div>
|
|
54
|
+
<div part="card-content">
|
|
55
|
+
${this.renderDescription(s.description)}
|
|
56
|
+
${this.renderSearchFilters(s.searchRequest)}
|
|
57
|
+
${this.renderSearchButton(this.isSelected(s.searchRequest))}
|
|
58
|
+
</div>
|
|
59
|
+
</ft-card>
|
|
60
|
+
</a>
|
|
61
|
+
`;
|
|
61
62
|
})}
|
|
62
63
|
</div>
|
|
63
64
|
`;
|
|
@@ -68,40 +69,46 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
68
69
|
}
|
|
69
70
|
renderDescription(description) {
|
|
70
71
|
return this.showDescription && description
|
|
71
|
-
? html
|
|
72
|
+
? html `
|
|
73
|
+
<div part="description" class="content">${description}</div>`
|
|
72
74
|
: nothing;
|
|
73
75
|
}
|
|
74
76
|
renderSearchButton(isSelected) {
|
|
75
77
|
return this.showSearchButton
|
|
76
|
-
? html
|
|
78
|
+
? html `
|
|
79
|
+
<div part="search-button">
|
|
80
|
+
<ft-button id="search" icon="search" ?disabled=${isSelected}>${savedSearches.messages.search()}</ft-button>
|
|
81
|
+
</div>`
|
|
77
82
|
: nothing;
|
|
78
83
|
}
|
|
79
84
|
renderAlertStatus(alert) {
|
|
80
85
|
return this.showAlertStatus && alert
|
|
81
|
-
? html
|
|
86
|
+
? html `
|
|
87
|
+
<ft-icon part="alert-status">alert</ft-icon>`
|
|
82
88
|
: nothing;
|
|
83
89
|
}
|
|
84
90
|
// See net.antidot.fluidtopics.client.application.mylibrary.shared.MyLibraryTagWidgetFactory.createMySearchTags
|
|
85
91
|
renderSearchFilters(searchRequest) {
|
|
86
92
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
87
|
-
return this.showSearchFilters ? html
|
|
88
|
-
|
|
93
|
+
return this.showSearchFilters ? html `
|
|
94
|
+
<div part="search-filters" class="content">
|
|
95
|
+
${((_a = searchRequest.query.length) !== null && _a !== void 0 ? _a : 0 > 0)
|
|
89
96
|
? this.renderMetadata(savedSearches.messages.keywords(), searchRequest.query)
|
|
90
97
|
: nothing}
|
|
91
|
-
|
|
98
|
+
${searchRequest.virtualField == FtVirtualField.TITLE_ONLY
|
|
92
99
|
? this.renderMetadata(savedSearches.messages.in(), savedSearches.messages.titles())
|
|
93
100
|
: nothing}
|
|
94
|
-
|
|
101
|
+
${searchRequest.scope == FtSearchScope.DOCUMENTS
|
|
95
102
|
? this.renderMetadata(savedSearches.messages.resultsType(), savedSearches.messages.documentsOnly())
|
|
96
103
|
: nothing}
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
${(_c = (_b = searchRequest.metadataFilters) === null || _b === void 0 ? void 0 : _b.map(f => this.renderUnknownFilter(f))) !== null && _c !== void 0 ? _c : nothing}
|
|
105
|
+
${((_e = (_d = searchRequest.contentLocale) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0 > 0)
|
|
99
106
|
? this.renderMetadata(savedSearches.messages.language(), searchRequest.contentLocale)
|
|
100
107
|
: nothing}
|
|
101
|
-
|
|
108
|
+
${((_g = (_f = searchRequest.sort[0]) === null || _f === void 0 ? void 0 : _f.key.length) !== null && _g !== void 0 ? _g : 0 > 0)
|
|
102
109
|
? this.renderMetadata(savedSearches.messages.sort(), this.mapSortKey(searchRequest.sort[0].key))
|
|
103
110
|
: nothing}
|
|
104
|
-
|
|
111
|
+
</div>` : nothing;
|
|
105
112
|
}
|
|
106
113
|
renderMetadata(key, values) {
|
|
107
114
|
return html `
|
|
@@ -251,6 +258,9 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
|
|
|
251
258
|
&& this.savedSearches == undefined) {
|
|
252
259
|
userAssetsActions.reloadMySearches();
|
|
253
260
|
}
|
|
261
|
+
if (changedProperties.has("baseUrl") && this.baseUrl) {
|
|
262
|
+
this.searchPlaceConverter = new SearchPlaceConverter(this.baseUrl, {});
|
|
263
|
+
}
|
|
254
264
|
}
|
|
255
265
|
}
|
|
256
266
|
FtSearchSavedSearches.styles = styles;
|