1 |
|
2 |
|
3 |
|
4 | import { Component } from "../widgets/component";
|
5 | import { IDoesFilterPassParams, IFilterComp, IFilterParams } from "../interfaces/iFilter";
|
6 | import { Context } from "../context/context";
|
7 | import { GridOptionsWrapper } from "../gridOptionsWrapper";
|
8 | import { FloatingFilterChange } from "./floatingFilter";
|
9 | import { INumberFilterParams, ITextFilterParams } from "./textFilter";
|
10 | export interface Comparator<T> {
|
11 | (left: T, right: T): number;
|
12 | }
|
13 | export declare enum FilterConditionType {
|
14 | MAIN = 0,
|
15 | CONDITION = 1,
|
16 | }
|
17 | export interface CombinedFilter<T> {
|
18 | operator: string;
|
19 | condition1: T;
|
20 | condition2: T;
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export declare abstract class BaseFilter<T, P extends IFilterParams, M> extends Component implements IFilterComp {
|
32 | static EQUALS: string;
|
33 | static NOT_EQUAL: string;
|
34 | static LESS_THAN: string;
|
35 | static LESS_THAN_OR_EQUAL: string;
|
36 | static GREATER_THAN: string;
|
37 | static GREATER_THAN_OR_EQUAL: string;
|
38 | static IN_RANGE: string;
|
39 | static CONTAINS: string;
|
40 | static NOT_CONTAINS: string;
|
41 | static STARTS_WITH: string;
|
42 | static ENDS_WITH: string;
|
43 | private newRowsActionKeep;
|
44 | filterParams: P;
|
45 | clearActive: boolean;
|
46 | applyActive: boolean;
|
47 | defaultFilter: string;
|
48 | filter: string;
|
49 | filterCondition: string;
|
50 | private eButtonsPanel;
|
51 | private eFilterBodyWrapper;
|
52 | private eApplyButton;
|
53 | private eClearButton;
|
54 | context: Context;
|
55 | private eConditionWrapper;
|
56 | conditionValue: string;
|
57 | gridOptionsWrapper: GridOptionsWrapper;
|
58 | init(params: P): void;
|
59 | onClearButton(): void;
|
60 | abstract customInit(): void;
|
61 | abstract isFilterActive(): boolean;
|
62 | abstract modelFromFloatingFilter(from: string): M;
|
63 | abstract doesFilterPass(params: IDoesFilterPassParams): boolean;
|
64 | abstract bodyTemplate(type: FilterConditionType): string;
|
65 | abstract resetState(): void;
|
66 | abstract serialize(type: FilterConditionType): M;
|
67 | abstract parse(toParse: M, type: FilterConditionType): void;
|
68 | abstract refreshFilterBodyUi(type: FilterConditionType): void;
|
69 | abstract initialiseFilterBodyUi(type: FilterConditionType): void;
|
70 | abstract isFilterConditionActive(type: FilterConditionType): boolean;
|
71 | floatingFilter(from: string): void;
|
72 | onNewRowsLoaded(): void;
|
73 | getModel(): M | CombinedFilter<M>;
|
74 | getNullableModel(): M | CombinedFilter<M>;
|
75 | setModel(model: M | CombinedFilter<M>): void;
|
76 | private doOnFilterChanged(applyNow?);
|
77 | onFilterChanged(applyNow?: boolean): void;
|
78 | private redrawCondition();
|
79 | private refreshOperatorUi();
|
80 | onFloatingFilterChanged(change: FloatingFilterChange): boolean;
|
81 | generateFilterHeader(type: FilterConditionType): string;
|
82 | private generateTemplate();
|
83 | acceptsBooleanLogic(): boolean;
|
84 | wrapCondition(mainCondition: string): string;
|
85 | private createConditionTemplate(type);
|
86 | private createConditionBody(type);
|
87 | translate(toTranslate: string): string;
|
88 | getDebounceMs(filterParams: ITextFilterParams | INumberFilterParams): number;
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 | export declare abstract class ComparableBaseFilter<T, P extends IComparableFilterParams, M> extends BaseFilter<T, P, M> {
|
94 | private eTypeSelector;
|
95 | private eTypeConditionSelector;
|
96 | private suppressAndOrCondition;
|
97 | abstract getApplicableFilterTypes(): string[];
|
98 | abstract filterValues(type: FilterConditionType): T | T[];
|
99 | abstract individualFilterPasses(params: IDoesFilterPassParams, type: FilterConditionType): boolean;
|
100 | doesFilterPass(params: IDoesFilterPassParams): boolean;
|
101 | init(params: P): void;
|
102 | customInit(): void;
|
103 | acceptsBooleanLogic(): boolean;
|
104 | generateFilterHeader(type: FilterConditionType): string;
|
105 | initialiseFilterBodyUi(type: FilterConditionType): void;
|
106 | abstract getDefaultType(): string;
|
107 | private onFilterTypeChanged(type);
|
108 | isFilterActive(): boolean;
|
109 | setFilterType(filterType: string, type: FilterConditionType): void;
|
110 | isFilterConditionActive(type: FilterConditionType): boolean;
|
111 | }
|
112 | export interface NullComparator {
|
113 | equals?: boolean;
|
114 | lessThan?: boolean;
|
115 | greaterThan?: boolean;
|
116 | }
|
117 | export interface IComparableFilterParams extends IFilterParams {
|
118 | suppressAndOrCondition: boolean;
|
119 | }
|
120 | export interface IScalarFilterParams extends IComparableFilterParams {
|
121 | inRangeInclusive?: boolean;
|
122 | nullComparator?: NullComparator;
|
123 | }
|
124 |
|
125 |
|
126 |
|
127 |
|
128 | export declare abstract class ScalarBaseFilter<T, P extends IScalarFilterParams, M> extends ComparableBaseFilter<T, P, M> {
|
129 | static readonly DEFAULT_NULL_COMPARATOR: NullComparator;
|
130 | abstract comparator(): Comparator<T>;
|
131 | private nullComparator(type);
|
132 | getDefaultType(): string;
|
133 | private translateNull(type);
|
134 | individualFilterPasses(params: IDoesFilterPassParams, type: FilterConditionType): boolean;
|
135 | private doIndividualFilterPasses(params, type, filter);
|
136 | }
|