@fluid-topics/ft-search-period-filter 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.
- package/README.md +24 -0
- package/build/SearchPeriodFilterMessages.d.ts +14 -0
- package/build/SearchPeriodFilterMessages.js +13 -0
- package/build/ft-search-period-filter.d.ts +18 -0
- package/build/ft-search-period-filter.js +66 -0
- package/build/ft-search-period-filter.light.js +1545 -0
- package/build/ft-search-period-filter.min.js +1713 -0
- package/build/ft-search-period-filter.properties.d.ts +2 -0
- package/build/ft-search-period-filter.properties.js +1 -0
- package/build/ft-search-period-filter.styles.d.ts +4 -0
- package/build/ft-search-period-filter.styles.js +46 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +7 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Search period filter for integrated fluid-topics search pages
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
npm install @fluid-topics/ft-search-period-filter
|
|
7
|
+
yarn add @fluid-topics/ft-search-period-filter
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { html } from "lit"
|
|
14
|
+
import "@fluid-topics/ft-search-context"
|
|
15
|
+
import "@fluid-topics/ft-search-period-filter"
|
|
16
|
+
|
|
17
|
+
function render() {
|
|
18
|
+
return html`
|
|
19
|
+
<ft-search-context>
|
|
20
|
+
<ft-search-period-filter></ft-search-period-filter>
|
|
21
|
+
</ft-search-context>
|
|
22
|
+
`
|
|
23
|
+
}
|
|
24
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n/build/generator/I18nMessageContext";
|
|
2
|
+
export interface SearchPeriodFilterMessages extends I18nMessages {
|
|
3
|
+
label(): string;
|
|
4
|
+
anyTime(): string;
|
|
5
|
+
LAST_WEEK(): string;
|
|
6
|
+
LAST_MONTH(): string;
|
|
7
|
+
LAST_QUARTER(): string;
|
|
8
|
+
LAST_YEAR(): string;
|
|
9
|
+
CUSTOM(): string;
|
|
10
|
+
customPeriod(from?: string, to?: string): string;
|
|
11
|
+
period(value: string): string;
|
|
12
|
+
}
|
|
13
|
+
export declare const periodFilterContext: I18nMessageContext<SearchPeriodFilterMessages>;
|
|
14
|
+
export declare const periodFilterDefaultMessages: DefaultI18nMessages<SearchPeriodFilterMessages>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { I18nMessageContext } from "@fluid-topics/ft-i18n/build/generator/I18nMessageContext";
|
|
2
|
+
export const periodFilterContext = I18nMessageContext.build("designedSearchPeriodFilter");
|
|
3
|
+
export const periodFilterDefaultMessages = {
|
|
4
|
+
label: "Last update",
|
|
5
|
+
anyTime: "Any time",
|
|
6
|
+
LAST_WEEK: "Less than a week",
|
|
7
|
+
LAST_MONTH: "Less than a month",
|
|
8
|
+
LAST_QUARTER: "Less than a quarter",
|
|
9
|
+
LAST_YEAR: "Less than a year",
|
|
10
|
+
CUSTOM: "Custom period",
|
|
11
|
+
customPeriod: "From {0} to {1}",
|
|
12
|
+
period: "Period: {0}"
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FtSearchPeriodFilterProperties } from "./ft-search-period-filter.properties";
|
|
2
|
+
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
3
|
+
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
4
|
+
import { FtPeriodFilter } from "@fluid-topics/public-api";
|
|
5
|
+
declare const FtSearchPeriodFilter_base: typeof FtSearchComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
6
|
+
export declare class FtSearchPeriodFilter extends FtSearchPeriodFilter_base implements FtSearchPeriodFilterProperties {
|
|
7
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
8
|
+
static styles: import("lit").CSSResult;
|
|
9
|
+
lessThanAWeek?: boolean;
|
|
10
|
+
lessThanAMonth?: boolean;
|
|
11
|
+
lessThanAQuarter?: boolean;
|
|
12
|
+
lessThanAYear?: boolean;
|
|
13
|
+
periodFilter?: FtPeriodFilter;
|
|
14
|
+
constructor();
|
|
15
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
16
|
+
private setPeriodFilter;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
|
+
import { styles } from "./ft-search-period-filter.styles";
|
|
9
|
+
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
10
|
+
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
11
|
+
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
12
|
+
import { periodFilterContext, periodFilterDefaultMessages } from "./SearchPeriodFilterMessages";
|
|
13
|
+
import { property } from "lit/decorators.js";
|
|
14
|
+
import { FtRadio, FtRadioGroup } from "@fluid-topics/ft-radio";
|
|
15
|
+
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
16
|
+
import { FtPeriodFilterType } from "@fluid-topics/public-api";
|
|
17
|
+
class FtSearchPeriodFilter extends withI18n(FtSearchComponent) {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.addI18nContext(periodFilterContext, periodFilterDefaultMessages);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
return html `<div part="container">
|
|
25
|
+
<div part="header">
|
|
26
|
+
<ft-typography variant="overline" part="label" id="label">
|
|
27
|
+
${periodFilterContext.messages.label()}
|
|
28
|
+
</ft-typography>
|
|
29
|
+
</div>
|
|
30
|
+
<ft-radio-group @change=${(e) => this.setPeriodFilter(e)} aria-labelledby="label">
|
|
31
|
+
<ft-radio value="anyTime" ?checked=${this.periodFilter === undefined || this.periodFilter.periodType === undefined}>${periodFilterContext.messages.anyTime()}</ft-radio>
|
|
32
|
+
${this.lessThanAWeek ? html `<ft-radio ?checked=${((_a = this.periodFilter) === null || _a === void 0 ? void 0 : _a.periodType) == "LAST_WEEK"} value="LAST_WEEK">${periodFilterContext.messages.LAST_WEEK()}</ft-radio>` : nothing}
|
|
33
|
+
${this.lessThanAMonth ? html `<ft-radio ?checked=${((_b = this.periodFilter) === null || _b === void 0 ? void 0 : _b.periodType) == "LAST_MONTH"} value="LAST_MONTH">${periodFilterContext.messages.LAST_MONTH()}</ft-radio>` : nothing}
|
|
34
|
+
${this.lessThanAQuarter ? html `<ft-radio ?checked=${((_c = this.periodFilter) === null || _c === void 0 ? void 0 : _c.periodType) == "LAST_QUARTER"} value="LAST_QUARTER">${periodFilterContext.messages.LAST_QUARTER()}</ft-radio>` : nothing}
|
|
35
|
+
${this.lessThanAYear ? html `<ft-radio ?checked=${((_d = this.periodFilter) === null || _d === void 0 ? void 0 : _d.periodType) == "LAST_YEAR"} value="LAST_YEAR">${periodFilterContext.messages.LAST_YEAR()}</ft-radio>` : nothing}
|
|
36
|
+
</ft-radio-group>
|
|
37
|
+
</div>`;
|
|
38
|
+
}
|
|
39
|
+
setPeriodFilter(e) {
|
|
40
|
+
var _a;
|
|
41
|
+
const periodType = FtPeriodFilterType[e.detail];
|
|
42
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setPeriodFilter(periodType === undefined ? undefined : { periodType: periodType });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
FtSearchPeriodFilter.elementDefinitions = {
|
|
46
|
+
"ft-radio-group": FtRadioGroup,
|
|
47
|
+
"ft-radio": FtRadio,
|
|
48
|
+
"ft-typography": FtTypography,
|
|
49
|
+
};
|
|
50
|
+
FtSearchPeriodFilter.styles = styles;
|
|
51
|
+
__decorate([
|
|
52
|
+
property({ type: Boolean })
|
|
53
|
+
], FtSearchPeriodFilter.prototype, "lessThanAWeek", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: Boolean })
|
|
56
|
+
], FtSearchPeriodFilter.prototype, "lessThanAMonth", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: Boolean })
|
|
59
|
+
], FtSearchPeriodFilter.prototype, "lessThanAQuarter", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: Boolean })
|
|
62
|
+
], FtSearchPeriodFilter.prototype, "lessThanAYear", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
redux({ store: "search", selector: (state) => state.request.periodFilter })
|
|
65
|
+
], FtSearchPeriodFilter.prototype, "periodFilter", void 0);
|
|
66
|
+
export { FtSearchPeriodFilter };
|