@fluid-topics/ft-search-facet 1.3.28 → 1.3.30

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.
@@ -2,6 +2,7 @@ import { nothing, PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtSearchFacetProperties } from "./ft-search-facet.properties";
4
4
  import { FtSearchComponent, FtSearchStateManager } from "@fluid-topics/ft-search-context/build/registration";
5
+ import { I18nAttributeValue } from "@fluid-topics/ft-i18n/build/decorators/i18nAttribute";
5
6
  declare const FtSearchFacet_base: typeof FtSearchComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
6
7
  export declare class FtSearchFacet extends FtSearchFacet_base implements FtSearchFacetProperties {
7
8
  static elementDefinitions: ElementDefinitionsMap;
@@ -11,6 +12,7 @@ export declare class FtSearchFacet extends FtSearchFacet_base implements FtSearc
11
12
  raiseSelectedOptions: boolean;
12
13
  displayTotalResultsCount: boolean;
13
14
  displayMode: "cascade" | "hierarchical";
15
+ filteredOptionsNumberAriaNotification: I18nAttributeValue;
14
16
  private facets?;
15
17
  private editorMode?;
16
18
  private filter?;
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { html, nothing } from "lit";
8
- import { redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
8
+ import { jsonProperty, numberProperty, redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
9
9
  import { property, query, state } from "lit/decorators.js";
10
10
  import { styles } from "./ft-search-facet.styles";
11
11
  import { FtFilter } from "@fluid-topics/ft-filter";
@@ -27,6 +27,11 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
27
27
  this.raiseSelectedOptions = false;
28
28
  this.displayTotalResultsCount = false;
29
29
  this.displayMode = "cascade";
30
+ this.filteredOptionsNumberAriaNotification = {
31
+ context: "officialContext",
32
+ key: "searchFacetsFilteredOptionsNumberAriaNotification",
33
+ message: "",
34
+ };
30
35
  this.facetHelper = new FacetHelper();
31
36
  }
32
37
  setSearchStateManager(stateManager) {
@@ -40,7 +45,7 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
40
45
  render() {
41
46
  if (this.facet) {
42
47
  // We want to keep cascade for no hierarchical meta
43
- let effectivelyDisplayMode = this.facet.hierarchical ? this.displayMode : "cascade";
48
+ const effectivelyDisplayMode = this.facet.hierarchical ? this.displayMode : "cascade";
44
49
  return effectivelyDisplayMode == "cascade" ? this.renderCascadeFilter(this.facet) : this.renderHierarchicalFilter(this.facet);
45
50
  }
46
51
  if (this.editorMode) {
@@ -60,7 +65,7 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
60
65
  (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.replaceFacet(props.get("facetId"), this.facetId);
61
66
  }
62
67
  if (props.has("facetId") || props.has("facets")) {
63
- this.facet = (_b = this.facets) === null || _b === void 0 ? void 0 : _b.find(f => f.key == this.facetId);
68
+ this.facet = (_b = this.facets) === null || _b === void 0 ? void 0 : _b.find((f) => f.key == this.facetId);
64
69
  }
65
70
  }
66
71
  onFacetValueSelected(event) {
@@ -83,32 +88,33 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
83
88
  clearButtonLabel="${searchFacetContext.messages.clearFilterButton()}"
84
89
  moreValuesButtonLabel="${searchFacetContext.messages.displayMoreFilterValuesButton()}"
85
90
  noValuesLabel="${searchFacetContext.messages.noFilterValuesAvailable()}"
91
+ .filteredOptionsNumberAriaNotification=${this.filteredOptionsNumberAriaNotification}
86
92
  @change=${this.onFacetValueSelected}
87
93
  ></ft-filter>
88
94
  `;
89
95
  }
90
96
  renderHierarchicalFilter(facet) {
91
- let tree = this.convertFacetToTree(facet);
97
+ const tree = this.convertFacetToTree(facet);
92
98
  return html `
93
99
  <ft-tree-selector
94
100
  part="tree-selector"
95
101
  .exportpartsPrefixes=${["filter"]}
96
- data=${tree}
97
- label=${facet.label}
102
+ data="${tree}"
103
+ label="${facet.label}"
98
104
  expandLabel="${searchFacetContext.messages.expandLabel()}"
99
105
  collapseLabel="${searchFacetContext.messages.collapseLabel()}"
100
106
  expandParametrizedLabel="${searchFacetContext.rawMessages.expandParametrizedLabel}"
101
107
  collapseParametrizedLabel="${searchFacetContext.rawMessages.collapseParametrizedLabel}"
102
108
  expandAllLabel="${searchFacetContext.messages.expandAllLabel()}"
103
109
  collapseAllLabel="${searchFacetContext.messages.collapseAllLabel()}"
104
- @treenode-change="${(e) => this.onTreeValueChange(facet, e.detail)}"
105
- @treenode-clear-all="${() => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setValueFilter(this.facetId, []); }}"
110
+ @treenode-change=${(e) => this.onTreeValueChange(facet, e.detail)}
111
+ @treenode-clear-all=${() => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setValueFilter(this.facetId, []); }}
106
112
  ></ft-tree-selector>
107
113
  `;
108
114
  }
109
115
  convertFacetToTree(facet) {
110
116
  return {
111
- rootNodes: facet.rootNodes.map(entry => this.convertEntryToTreeNode(entry))
117
+ rootNodes: facet.rootNodes.map((entry) => this.convertEntryToTreeNode(entry)),
112
118
  };
113
119
  }
114
120
  convertEntryToTreeNode(entry) {
@@ -117,8 +123,8 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
117
123
  label: entry.label + (this.displayTotalResultsCount ? ` (${entry.totalResultsCount})` : ""),
118
124
  selected: entry.selected,
119
125
  expanded: this.isEntryExpanded(entry),
120
- indeterminate: entry.descendantSelected ? entry.childNodes.some(e => !e.selected) : false,
121
- children: entry.childNodes.map(e => this.convertEntryToTreeNode(e))
126
+ indeterminate: entry.descendantSelected ? entry.childNodes.some((e) => !e.selected) : false,
127
+ children: entry.childNodes.map((e) => this.convertEntryToTreeNode(e)),
122
128
  };
123
129
  }
124
130
  isEntryExpanded(entry) {
@@ -138,14 +144,14 @@ FtSearchFacet.elementDefinitions = {
138
144
  "ft-filter": FtFilter,
139
145
  "ft-tree-selector": FtTreeSelector,
140
146
  "ft-typography": FtTypography,
141
- "ft-button": FtButton
147
+ "ft-button": FtButton,
142
148
  };
143
149
  FtSearchFacet.styles = styles;
144
150
  __decorate([
145
151
  property()
146
152
  ], FtSearchFacet.prototype, "facetId", void 0);
147
153
  __decorate([
148
- property({ type: Number })
154
+ numberProperty()
149
155
  ], FtSearchFacet.prototype, "maxValues", void 0);
150
156
  __decorate([
151
157
  property({ type: Boolean })
@@ -156,6 +162,9 @@ __decorate([
156
162
  __decorate([
157
163
  property()
158
164
  ], FtSearchFacet.prototype, "displayMode", void 0);
165
+ __decorate([
166
+ jsonProperty({ context: "officialContext", key: "searchFacetsFilteredOptionsNumberAriaNotification" })
167
+ ], FtSearchFacet.prototype, "filteredOptionsNumberAriaNotification", void 0);
159
168
  __decorate([
160
169
  redux({ store: "search" })
161
170
  ], FtSearchFacet.prototype, "facets", void 0);