@fluid-topics/ft-search-facet 1.0.44 → 1.0.45

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.
@@ -12,9 +12,11 @@ export declare class FtSearchFacet extends FtSearchFacet_base implements FtSearc
12
12
  private request?;
13
13
  private facets?;
14
14
  private editorMode?;
15
+ private filter;
15
16
  setSearchStateManager(stateManager: FtSearchStateManager): void;
16
17
  protected render(): import("lit-html").TemplateResult<1> | typeof nothing;
17
18
  protected updated(props: PropertyValues): void;
18
19
  private onFacetValueSelected;
20
+ clearFacet(): void;
19
21
  }
20
22
  export {};
@@ -5,8 +5,8 @@ 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 } from "@fluid-topics/ft-wc-utils";
9
- import { property } from "lit/decorators.js";
8
+ import { redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
9
+ import { property, query } from "lit/decorators.js";
10
10
  import { styles } from "./ft-search-facet.css";
11
11
  import { FtFilter } from "@fluid-topics/ft-filter";
12
12
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
@@ -15,6 +15,7 @@ import { FtTypography } from "@fluid-topics/ft-typography";
15
15
  import { withI18n } from "@fluid-topics/ft-i18n";
16
16
  import { searchFacetContext } from "./SearchFacetMessages";
17
17
  import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
18
+ import { ClearAllFiltersEvent } from "@fluid-topics/ft-search-context";
18
19
  class FtSearchFacet extends withI18n(FtSearchComponent) {
19
20
  constructor() {
20
21
  super(...arguments);
@@ -36,19 +37,19 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
36
37
  if (facet) {
37
38
  return html `
38
39
  <ft-filter
39
- part="filter"
40
- label="${facet.label}"
41
- .exportpartsPrefixes=${["filter"]}
42
- id="${this.facetId}"
43
- ?multivalued=${facet.multiSelectionable}
44
- ?raiseSelectedOptions=${this.raiseSelectedOptions}
45
- .options=${convertFacetToFilterOptions(facet)}
46
- .displayedValuesLimit=${this.maxValues}
47
- filterPlaceHolder="${searchFacetContext.messages.filterInputPlaceHolder(facet.label)}"
48
- clearButtonLabel="${searchFacetContext.messages.clearFilterButton()}"
49
- moreValuesButtonLabel="${searchFacetContext.messages.displayMoreFilterValuesButton()}"
50
- noValuesLabel="${searchFacetContext.messages.noFilterValuesAvailable()}"
51
- @change=${this.onFacetValueSelected}
40
+ part="filter"
41
+ label="${facet.label}"
42
+ .exportpartsPrefixes=${["filter"]}
43
+ id="${this.facetId}"
44
+ ?multivalued=${facet.multiSelectionable}
45
+ ?raiseSelectedOptions=${this.raiseSelectedOptions}
46
+ .options=${convertFacetToFilterOptions(facet)}
47
+ .displayedValuesLimit=${this.maxValues}
48
+ filterPlaceHolder="${searchFacetContext.messages.filterInputPlaceHolder(facet.label)}"
49
+ clearButtonLabel="${searchFacetContext.messages.clearFilterButton()}"
50
+ moreValuesButtonLabel="${searchFacetContext.messages.displayMoreFilterValuesButton()}"
51
+ noValuesLabel="${searchFacetContext.messages.noFilterValuesAvailable()}"
52
+ @change=${this.onFacetValueSelected}
52
53
  ></ft-filter>
53
54
  `;
54
55
  }
@@ -73,6 +74,9 @@ class FtSearchFacet extends withI18n(FtSearchComponent) {
73
74
  var _a;
74
75
  (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setFilter(this.facetId, event.detail);
75
76
  }
77
+ clearFacet() {
78
+ this.filter.clear();
79
+ }
76
80
  }
77
81
  FtSearchFacet.elementDefinitions = {
78
82
  "ft-filter": FtFilter,
@@ -97,4 +101,10 @@ __decorate([
97
101
  __decorate([
98
102
  redux({ store: ftAppInfoStore.name })
99
103
  ], FtSearchFacet.prototype, "editorMode", void 0);
104
+ __decorate([
105
+ query("ft-filter")
106
+ ], FtSearchFacet.prototype, "filter", void 0);
107
+ __decorate([
108
+ reduxEventListener({ eventName: ClearAllFiltersEvent.eventName })
109
+ ], FtSearchFacet.prototype, "clearFacet", null);
100
110
  export { FtSearchFacet };