@fluid-topics/ft-search-selected-facets 1.0.60 → 1.0.61

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.
@@ -3,10 +3,12 @@ import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtSearchSelectedFacetsProperties } from "./ft-search-selected-facets.properties";
4
4
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
5
5
  import { FtSearchFacet } from "@fluid-topics/public-api";
6
- export declare class FtSearchSelectedFacets extends FtSearchComponent implements FtSearchSelectedFacetsProperties {
6
+ declare const FtSearchSelectedFacets_base: typeof FtSearchComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
7
+ export declare class FtSearchSelectedFacets extends FtSearchSelectedFacets_base implements FtSearchSelectedFacetsProperties {
7
8
  static elementDefinitions: ElementDefinitionsMap;
8
9
  static styles: import("lit").CSSResult;
9
10
  facets?: Array<FtSearchFacet>;
11
+ searchInDocumentTitlesOnly?: boolean;
10
12
  editorMode: boolean;
11
13
  constructor();
12
14
  protected render(): import("lit-html").TemplateResult<1> | typeof nothing;
@@ -17,4 +19,6 @@ export declare class FtSearchSelectedFacets extends FtSearchComponent implements
17
19
  private getBreadcrumbFromValue;
18
20
  private quote;
19
21
  private unquote;
22
+ private renderSearchInDocumentTitlesOnly;
20
23
  }
24
+ export {};
@@ -12,26 +12,31 @@ import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registr
12
12
  import { FtChip } from "@fluid-topics/ft-chip";
13
13
  import { FtTooltip } from "@fluid-topics/ft-tooltip";
14
14
  import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
15
- class FtSearchSelectedFacets extends FtSearchComponent {
15
+ import { withI18n } from "@fluid-topics/ft-i18n";
16
+ import { searchInDocumentTitlesOnlySelector } from "@fluid-topics/ft-search-context";
17
+ import { searchTypeContext, searchTypeDefaultMessages } from "@fluid-topics/ft-search-type";
18
+ class FtSearchSelectedFacets extends withI18n(FtSearchComponent) {
16
19
  constructor() {
17
20
  super();
18
21
  this.editorMode = false;
19
22
  this.addStore(ftAppInfoStore);
23
+ this.addI18nContext(searchTypeContext, searchTypeDefaultMessages);
20
24
  }
21
25
  render() {
22
26
  if (this.editorMode) {
23
27
  return this.renderDummyFacet();
24
28
  }
25
- if (this.facets == null || this.facets.length === 0) {
29
+ if ((this.facets == null || this.facets.length === 0) && !this.searchInDocumentTitlesOnly) {
26
30
  return nothing;
27
31
  }
28
32
  return html `
29
33
 
30
34
  <div class="ft-search-selected-facets--container">
31
- ${repeat(this.facets, facet => facet.key, facet => {
35
+ ${repeat(this.facets || [], facet => facet.key, facet => {
32
36
  const values = this.getSelectedValues(facet);
33
37
  return repeat(values, value => facet.key + "-" + value, value => this.renderFacet(facet.key, facet.label, values, value));
34
38
  })}
39
+ ${this.renderSearchInDocumentTitlesOnly()}
35
40
  </div>
36
41
  `;
37
42
  }
@@ -84,6 +89,19 @@ class FtSearchSelectedFacets extends FtSearchComponent {
84
89
  }
85
90
  return value;
86
91
  }
92
+ renderSearchInDocumentTitlesOnly() {
93
+ return this.searchInDocumentTitlesOnly ? html `
94
+ <ft-tooltip inline text="${searchTypeContext.messages.documentTitlesOnly()}"
95
+ part="tooltips tooltip-search-in-document-titles-only">
96
+ <ft-chip
97
+ part="ft-search-selected-facets ft-search-selected-facet-search-in-document-titles-only"
98
+ removable
99
+ @icon-click=${() => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setSearchInDocumentTitlesOnly(false); }}>
100
+ ${searchTypeContext.messages.documentTitlesOnly()}
101
+ </ft-chip>
102
+ </ft-tooltip>
103
+ ` : nothing;
104
+ }
87
105
  }
88
106
  FtSearchSelectedFacets.elementDefinitions = {
89
107
  "ft-chip": FtChip,
@@ -93,6 +111,9 @@ FtSearchSelectedFacets.styles = styles;
93
111
  __decorate([
94
112
  redux({ store: "search" })
95
113
  ], FtSearchSelectedFacets.prototype, "facets", void 0);
114
+ __decorate([
115
+ redux({ store: "search", selector: searchInDocumentTitlesOnlySelector })
116
+ ], FtSearchSelectedFacets.prototype, "searchInDocumentTitlesOnly", void 0);
96
117
  __decorate([
97
118
  redux({ store: ftAppInfoStore.name })
98
119
  ], FtSearchSelectedFacets.prototype, "editorMode", void 0);