@fluid-topics/ft-search-period-filter 1.1.90 → 1.1.92

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.
@@ -6,13 +6,16 @@ declare const FtSearchPeriodFilter_base: typeof FtSearchComponent & import("@flu
6
6
  export declare class FtSearchPeriodFilter extends FtSearchPeriodFilter_base implements FtSearchPeriodFilterProperties {
7
7
  static elementDefinitions: ElementDefinitionsMap;
8
8
  static styles: import("lit").CSSResult;
9
+ key: string;
9
10
  lessThanAWeek?: boolean;
10
11
  lessThanAMonth?: boolean;
11
12
  lessThanAQuarter?: boolean;
12
13
  lessThanAYear?: boolean;
13
14
  periodFilter?: FtPeriodFilter;
15
+ private metadataDescriptors;
14
16
  constructor();
15
17
  protected render(): import("lit").TemplateResult<1>;
16
18
  private setPeriodFilter;
19
+ private header;
17
20
  }
18
21
  export {};
@@ -14,17 +14,21 @@ import { property } from "lit/decorators.js";
14
14
  import { FtRadio, FtRadioGroup } from "@fluid-topics/ft-radio";
15
15
  import { FtTypography } from "@fluid-topics/ft-typography";
16
16
  import { FtPeriodFilterType } from "@fluid-topics/public-api";
17
+ import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
17
18
  class FtSearchPeriodFilter extends withI18n(FtSearchComponent) {
18
19
  constructor() {
19
20
  super();
21
+ this.key = "ft:lastEdition";
22
+ this.metadataDescriptors = [];
20
23
  this.addI18nContext(periodFilterContext, periodFilterDefaultMessages);
24
+ this.addStore(ftAppInfoStore);
21
25
  }
22
26
  render() {
23
27
  var _a, _b, _c, _d;
24
28
  return html `<div part="container">
25
29
  <div part="header">
26
30
  <ft-typography variant="overline" part="label" id="label">
27
- ${periodFilterContext.messages.label()}
31
+ ${this.header()}
28
32
  </ft-typography>
29
33
  </div>
30
34
  <ft-radio-group @change=${(e) => this.setPeriodFilter(e)} aria-labelledby="label">
@@ -39,7 +43,17 @@ class FtSearchPeriodFilter extends withI18n(FtSearchComponent) {
39
43
  setPeriodFilter(e) {
40
44
  var _a;
41
45
  const periodType = FtPeriodFilterType[e.detail];
42
- (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setPeriodFilter(periodType === undefined ? undefined : { periodType: periodType });
46
+ (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setPeriodFilter(periodType === undefined ? undefined : {
47
+ key: this.key,
48
+ periodType: periodType
49
+ });
50
+ }
51
+ header() {
52
+ var _a, _b, _c;
53
+ if (this.key === "ft:lastEdition") {
54
+ return periodFilterContext.messages.label();
55
+ }
56
+ return (_c = (_b = (_a = this.metadataDescriptors) === null || _a === void 0 ? void 0 : _a.find(d => d.key == this.key)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : this.key;
43
57
  }
44
58
  }
45
59
  FtSearchPeriodFilter.elementDefinitions = {
@@ -48,6 +62,9 @@ FtSearchPeriodFilter.elementDefinitions = {
48
62
  "ft-typography": FtTypography,
49
63
  };
50
64
  FtSearchPeriodFilter.styles = styles;
65
+ __decorate([
66
+ property({ type: String })
67
+ ], FtSearchPeriodFilter.prototype, "key", void 0);
51
68
  __decorate([
52
69
  property({ type: Boolean })
53
70
  ], FtSearchPeriodFilter.prototype, "lessThanAWeek", void 0);
@@ -63,4 +80,7 @@ __decorate([
63
80
  __decorate([
64
81
  redux({ store: "search", selector: (state) => state.request.periodFilter })
65
82
  ], FtSearchPeriodFilter.prototype, "periodFilter", void 0);
83
+ __decorate([
84
+ redux({ store: ftAppInfoStore.name, selector: (s) => { var _a, _b; return (_b = (_a = s.metadataConfiguration) === null || _a === void 0 ? void 0 : _a.descriptors) !== null && _b !== void 0 ? _b : []; } })
85
+ ], FtSearchPeriodFilter.prototype, "metadataDescriptors", void 0);
66
86
  export { FtSearchPeriodFilter };