@fluid-topics/ft-search-saved-searches 1.2.56 → 1.2.58

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.
@@ -1,4 +1,4 @@
1
- import { nothing, PropertyValues } from "lit";
1
+ import { PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtSearchSavedSearchesProperties } from "./ft-search-saved-searches.properties";
4
4
  import { FtMetadataFilter, FtMySearch } from "@fluid-topics/public-api";
@@ -16,7 +16,7 @@ export declare class FtSearchSavedSearches extends FtSearchSavedSearches_base im
16
16
  private requiredRole;
17
17
  static elementDefinitions: ElementDefinitionsMap;
18
18
  constructor();
19
- render(): typeof nothing | import("lit-html").TemplateResult<1>;
19
+ render(): import("lit-html").TemplateResult<1> | undefined;
20
20
  private renderDescription;
21
21
  private renderSearchButton;
22
22
  private renderAlertStatus;
@@ -6,6 +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 { when } from "lit/directives/when.js";
9
10
  import { deepEqual, redux } from "@fluid-topics/ft-wc-utils";
10
11
  import { styles } from "./ft-search-saved-searches.styles";
11
12
  import { ftAppInfoStore, SearchPlaceConverterProvider } from "@fluid-topics/ft-app-context";
@@ -33,11 +34,11 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
33
34
  this.addI18nContext(savedSearches, defaultSavedSearchesMessages);
34
35
  }
35
36
  render() {
36
- var _a;
37
37
  const searchPlaceConverter = SearchPlaceConverterProvider.get();
38
- if (this.userHasRights && !this.isEmpty) {
38
+ return when(this.userHasRights && !this.isEmpty, () => {
39
+ var _a;
39
40
  return html `
40
- <div part="container">
41
+ <div part="container" role="group" aria-label="${savedSearches.messages.groupLabel()}">
41
42
  ${repeat((_a = this.savedSearches) !== null && _a !== void 0 ? _a : [], s => s.id, s => {
42
43
  const ftSearchRequest = this.toFtSearchRequest(s.searchRequest);
43
44
  if (ftSearchRequest === undefined) {
@@ -62,53 +63,36 @@ class FtSearchSavedSearches extends withI18n(FtSearchComponent) {
62
63
  })}
63
64
  </div>
64
65
  `;
65
- }
66
- else {
67
- return nothing;
68
- }
66
+ });
69
67
  }
70
68
  renderDescription(description) {
71
- return this.showDescription && description
72
- ? html `
73
- <div part="description" class="content">${description}</div>`
74
- : nothing;
69
+ return when(this.showDescription && description, () => html `
70
+ <div part="description" class="content">${description}</div>`);
75
71
  }
76
72
  renderSearchButton(isSelected) {
77
- return this.showSearchButton
78
- ? html `
79
- <div part="search-button">
80
- <ft-button id="search" icon="search" ?disabled=${isSelected}>${savedSearches.messages.search()}</ft-button>
81
- </div>`
82
- : nothing;
73
+ return when(this.showSearchButton, () => html `
74
+ <div part="search-button">
75
+ <ft-button id="search" tabindex="-1" icon="search" ?disabled=${isSelected}>${savedSearches.messages.search()}</ft-button>
76
+ </div>`);
83
77
  }
84
78
  renderAlertStatus(alert) {
85
- return this.showAlertStatus && alert
86
- ? html `
87
- <ft-icon part="alert-status">alert</ft-icon>`
88
- : nothing;
79
+ return when(this.showAlertStatus && alert, () => html `
80
+ <ft-icon part="alert-status">alert</ft-icon>`);
89
81
  }
90
82
  // See net.antidot.fluidtopics.client.application.mylibrary.shared.MyLibraryTagWidgetFactory.createMySearchTags
91
83
  renderSearchFilters(searchRequest) {
92
- var _a, _b, _c, _d, _e, _f, _g;
93
- return this.showSearchFilters ? html `
84
+ return when(this.showSearchFilters, () => {
85
+ var _a, _b, _c, _d, _e, _f, _g;
86
+ return html `
94
87
  <div part="search-filters" class="content">
95
- ${((_a = searchRequest.query.length) !== null && _a !== void 0 ? _a : 0 > 0)
96
- ? this.renderMetadata(savedSearches.messages.keywords(), searchRequest.query)
97
- : nothing}
98
- ${searchRequest.virtualField == FtVirtualField.TITLE_ONLY
99
- ? this.renderMetadata(savedSearches.messages.in(), savedSearches.messages.titles())
100
- : nothing}
101
- ${searchRequest.scope == FtSearchScope.DOCUMENTS
102
- ? this.renderMetadata(savedSearches.messages.resultsType(), savedSearches.messages.documentsOnly())
103
- : nothing}
88
+ ${when((_a = searchRequest.query.length) !== null && _a !== void 0 ? _a : 0 > 0, () => this.renderMetadata(savedSearches.messages.keywords(), searchRequest.query))}
89
+ ${when(searchRequest.virtualField == FtVirtualField.TITLE_ONLY, () => this.renderMetadata(savedSearches.messages.in(), savedSearches.messages.titles()))}
90
+ ${when(searchRequest.scope == FtSearchScope.DOCUMENTS, () => this.renderMetadata(savedSearches.messages.resultsType(), savedSearches.messages.documentsOnly()))}
104
91
  ${(_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)
106
- ? this.renderMetadata(savedSearches.messages.language(), searchRequest.contentLocale)
107
- : nothing}
108
- ${((_g = (_f = searchRequest.sort[0]) === null || _f === void 0 ? void 0 : _f.key.length) !== null && _g !== void 0 ? _g : 0 > 0)
109
- ? this.renderMetadata(savedSearches.messages.sort(), this.mapSortKey(searchRequest.sort[0].key))
110
- : nothing}
111
- </div>` : nothing;
92
+ ${when((_e = (_d = searchRequest.contentLocale) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0 > 0, () => this.renderMetadata(savedSearches.messages.language(), searchRequest.contentLocale))}
93
+ ${when((_g = (_f = searchRequest.sort[0]) === null || _f === void 0 ? void 0 : _f.key.length) !== null && _g !== void 0 ? _g : 0 > 0, () => this.renderMetadata(savedSearches.messages.sort(), this.mapSortKey(searchRequest.sort[0].key)))}
94
+ </div>`;
95
+ });
112
96
  }
113
97
  renderMetadata(key, values) {
114
98
  return html `