@fluid-topics/ft-search-selected-facets 1.1.63 → 1.1.64
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,14 +2,15 @@ import { nothing } from "lit";
|
|
|
2
2
|
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
|
-
import { FtSearchFacet } from "@fluid-topics/public-api";
|
|
5
|
+
import { FtPeriodFilter, FtSearchFacet } from "@fluid-topics/public-api";
|
|
6
6
|
declare const FtSearchSelectedFacets_base: typeof FtSearchComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
7
7
|
export declare class FtSearchSelectedFacets extends FtSearchSelectedFacets_base implements FtSearchSelectedFacetsProperties {
|
|
8
8
|
static elementDefinitions: ElementDefinitionsMap;
|
|
9
9
|
static styles: import("lit").CSSResult;
|
|
10
10
|
facets?: Array<FtSearchFacet>;
|
|
11
11
|
searchInDocumentTitlesOnly?: boolean;
|
|
12
|
-
|
|
12
|
+
periodFilter?: FtPeriodFilter;
|
|
13
|
+
get hasSomethingToDisplay(): true | "LAST_WEEK" | "LAST_MONTH" | "LAST_QUARTER" | "LAST_YEAR" | "CUSTOM" | undefined;
|
|
13
14
|
constructor();
|
|
14
15
|
protected render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
15
16
|
private renderFacet;
|
|
@@ -18,5 +19,6 @@ export declare class FtSearchSelectedFacets extends FtSearchSelectedFacets_base
|
|
|
18
19
|
private getBreadcrumbFromValue;
|
|
19
20
|
private unquote;
|
|
20
21
|
private renderSearchInDocumentTitlesOnly;
|
|
22
|
+
private renderPeriodFilter;
|
|
21
23
|
}
|
|
22
24
|
export {};
|
|
@@ -14,14 +14,16 @@ import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
|
14
14
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
15
15
|
import { searchInDocumentTitlesOnlySelector } from "@fluid-topics/ft-search-context";
|
|
16
16
|
import { searchTypeContext, searchTypeDefaultMessages } from "@fluid-topics/ft-search-type";
|
|
17
|
+
import { periodFilterContext, periodFilterDefaultMessages } from "@fluid-topics/ft-search-period-filter";
|
|
17
18
|
class FtSearchSelectedFacets extends withI18n(FtSearchComponent) {
|
|
18
19
|
get hasSomethingToDisplay() {
|
|
19
20
|
var _a;
|
|
20
|
-
return this.searchInDocumentTitlesOnly || ((_a = this.facets) === null || _a === void 0 ? void 0 : _a.some(facet => this.getSelectedValues(facet).length > 0));
|
|
21
|
+
return this.searchInDocumentTitlesOnly || ((_a = this.facets) === null || _a === void 0 ? void 0 : _a.some(facet => this.getSelectedValues(facet).length > 0)) || (this.periodFilter && this.periodFilter.periodType);
|
|
21
22
|
}
|
|
22
23
|
constructor() {
|
|
23
24
|
super();
|
|
24
25
|
this.addI18nContext(searchTypeContext, searchTypeDefaultMessages);
|
|
26
|
+
this.addI18nContext(periodFilterContext, periodFilterDefaultMessages);
|
|
25
27
|
}
|
|
26
28
|
render() {
|
|
27
29
|
if (!this.hasSomethingToDisplay) {
|
|
@@ -34,6 +36,7 @@ class FtSearchSelectedFacets extends withI18n(FtSearchComponent) {
|
|
|
34
36
|
return repeat(values, value => facet.key + "-" + value, value => this.renderFacet(facet.key, facet.label, values, value));
|
|
35
37
|
})}
|
|
36
38
|
${this.renderSearchInDocumentTitlesOnly()}
|
|
39
|
+
${this.renderPeriodFilter()}
|
|
37
40
|
</div>
|
|
38
41
|
`;
|
|
39
42
|
}
|
|
@@ -85,6 +88,22 @@ class FtSearchSelectedFacets extends withI18n(FtSearchComponent) {
|
|
|
85
88
|
</ft-tooltip>
|
|
86
89
|
` : nothing;
|
|
87
90
|
}
|
|
91
|
+
renderPeriodFilter() {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
return (this.periodFilter && this.periodFilter.periodType) ? html `
|
|
94
|
+
<ft-tooltip inline text="${periodFilterContext.messages.period(this.periodFilter.periodType === "CUSTOM" ?
|
|
95
|
+
periodFilterContext.messages.customPeriod((_a = this.periodFilter.period) === null || _a === void 0 ? void 0 : _a.from, (_b = this.periodFilter.period) === null || _b === void 0 ? void 0 : _b.to) :
|
|
96
|
+
periodFilterContext.messages[this.periodFilter.periodType]())}"
|
|
97
|
+
part=" tooltips tooltip-search-period-filter">
|
|
98
|
+
<ft-chip
|
|
99
|
+
part="ft-search-selected-facets ft-search-selected-facet-period-filter"
|
|
100
|
+
removable
|
|
101
|
+
@icon-click=${() => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setPeriodFilter(undefined); }}>
|
|
102
|
+
${periodFilterContext.messages[this.periodFilter.periodType]()}
|
|
103
|
+
</ft-chip>
|
|
104
|
+
</ft-tooltip>
|
|
105
|
+
` : nothing;
|
|
106
|
+
}
|
|
88
107
|
}
|
|
89
108
|
FtSearchSelectedFacets.elementDefinitions = {
|
|
90
109
|
"ft-chip": FtChip,
|
|
@@ -97,4 +116,7 @@ __decorate([
|
|
|
97
116
|
__decorate([
|
|
98
117
|
redux({ store: "search", selector: searchInDocumentTitlesOnlySelector })
|
|
99
118
|
], FtSearchSelectedFacets.prototype, "searchInDocumentTitlesOnly", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
redux({ store: "search", selector: (state) => state.request.periodFilter })
|
|
121
|
+
], FtSearchSelectedFacets.prototype, "periodFilter", void 0);
|
|
100
122
|
export { FtSearchSelectedFacets };
|