@progress/kendo-angular-filter 0.1.6 → 1.0.0-next.202203251456
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/bundles/kendo-angular-filter.umd.js +5 -0
- package/package.json +41 -108
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/dist/cdn/js/kendo-angular-filter.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/aria-label.directive.js +0 -30
- package/dist/es/editors/boolean-editor.component.js +0 -61
- package/dist/es/editors/date-editor.component.js +0 -45
- package/dist/es/editors/numeric-editor.component.js +0 -45
- package/dist/es/editors/text-editor.component.js +0 -45
- package/dist/es/filter-expression-operators.component.js +0 -48
- package/dist/es/filter-expression.component.js +0 -136
- package/dist/es/filter-group.component.js +0 -84
- package/dist/es/filter.component.js +0 -184
- package/dist/es/filter.module.js +0 -91
- package/dist/es/filter.service.js +0 -45
- package/dist/es/index.js +0 -21
- package/dist/es/localization/custom-messages.component.js +0 -44
- package/dist/es/localization/localized-messages.directive.js +0 -35
- package/dist/es/localization/messages.js +0 -166
- package/dist/es/main.js +0 -6
- package/dist/es/model/filter-expression.js +0 -7
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/shared.module.js +0 -37
- package/dist/es/util.js +0 -136
- package/dist/es2015/aria-label.directive.d.ts +0 -15
- package/dist/es2015/aria-label.directive.js +0 -29
- package/dist/es2015/editors/boolean-editor.component.d.ts +0 -37
- package/dist/es2015/editors/boolean-editor.component.js +0 -72
- package/dist/es2015/editors/date-editor.component.d.ts +0 -20
- package/dist/es2015/editors/date-editor.component.js +0 -56
- package/dist/es2015/editors/numeric-editor.component.d.ts +0 -20
- package/dist/es2015/editors/numeric-editor.component.js +0 -56
- package/dist/es2015/editors/text-editor.component.d.ts +0 -20
- package/dist/es2015/editors/text-editor.component.js +0 -52
- package/dist/es2015/filter-expression-operators.component.d.ts +0 -24
- package/dist/es2015/filter-expression-operators.component.js +0 -59
- package/dist/es2015/filter-expression.component.d.ts +0 -43
- package/dist/es2015/filter-expression.component.js +0 -174
- package/dist/es2015/filter-group.component.d.ts +0 -36
- package/dist/es2015/filter-group.component.js +0 -145
- package/dist/es2015/filter.component.d.ts +0 -77
- package/dist/es2015/filter.component.js +0 -297
- package/dist/es2015/filter.module.d.ts +0 -37
- package/dist/es2015/filter.module.js +0 -88
- package/dist/es2015/filter.service.d.ts +0 -17
- package/dist/es2015/filter.service.js +0 -46
- package/dist/es2015/index.d.ts +0 -21
- package/dist/es2015/index.js +0 -21
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/localization/custom-messages.component.d.ts +0 -15
- package/dist/es2015/localization/custom-messages.component.js +0 -36
- package/dist/es2015/localization/localized-messages.directive.d.ts +0 -13
- package/dist/es2015/localization/localized-messages.directive.js +0 -31
- package/dist/es2015/localization/messages.d.ts +0 -158
- package/dist/es2015/localization/messages.js +0 -160
- package/dist/es2015/main.d.ts +0 -7
- package/dist/es2015/main.js +0 -6
- package/dist/es2015/model/filter-expression.d.ts +0 -60
- package/dist/es2015/model/filter-expression.js +0 -7
- package/dist/es2015/package-metadata.d.ts +0 -9
- package/dist/es2015/package-metadata.js +0 -15
- package/dist/es2015/shared.module.d.ts +0 -9
- package/dist/es2015/shared.module.js +0 -34
- package/dist/es2015/util.d.ts +0 -147
- package/dist/es2015/util.js +0 -136
- package/dist/fesm2015/index.js +0 -1316
- package/dist/fesm5/index.js +0 -1076
- package/dist/npm/aria-label.directive.js +0 -32
- package/dist/npm/editors/boolean-editor.component.js +0 -63
- package/dist/npm/editors/date-editor.component.js +0 -47
- package/dist/npm/editors/numeric-editor.component.js +0 -47
- package/dist/npm/editors/text-editor.component.js +0 -47
- package/dist/npm/filter-expression-operators.component.js +0 -50
- package/dist/npm/filter-expression.component.js +0 -138
- package/dist/npm/filter-group.component.js +0 -86
- package/dist/npm/filter.component.js +0 -186
- package/dist/npm/filter.module.js +0 -93
- package/dist/npm/filter.service.js +0 -47
- package/dist/npm/index.js +0 -37
- package/dist/npm/localization/custom-messages.component.js +0 -46
- package/dist/npm/localization/localized-messages.directive.js +0 -37
- package/dist/npm/localization/messages.js +0 -168
- package/dist/npm/main.js +0 -10
- package/dist/npm/model/filter-expression.js +0 -9
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/shared.module.js +0 -39
- package/dist/npm/util.js +0 -138
- package/dist/systemjs/kendo-angular-filter.js +0 -5
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
6
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import { FilterDescriptor } from '@progress/kendo-data-query';
|
|
8
|
-
import { FilterService } from './filter.service';
|
|
9
|
-
import { FilterEditor, FilterExpression, FilterOperator } from './model/filter-expression';
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare class FilterExpressionComponent implements OnInit, OnDestroy {
|
|
14
|
-
private filterService;
|
|
15
|
-
protected localization: LocalizationService;
|
|
16
|
-
private cdr;
|
|
17
|
-
index: number;
|
|
18
|
-
currentItem: FilterDescriptor;
|
|
19
|
-
valueChange: EventEmitter<void>;
|
|
20
|
-
operators: any[];
|
|
21
|
-
filters: FilterExpression[];
|
|
22
|
-
isBoolean: boolean;
|
|
23
|
-
isEditorDisabled: boolean;
|
|
24
|
-
editorType: FilterEditor;
|
|
25
|
-
private localizationSubscription;
|
|
26
|
-
constructor(filterService: FilterService, localization: LocalizationService, cdr: ChangeDetectorRef);
|
|
27
|
-
ngOnInit(): void;
|
|
28
|
-
ngOnDestroy(): void;
|
|
29
|
-
normalizeOperators(filterEditor: FilterEditor, operators: FilterOperator[]): {
|
|
30
|
-
text: string;
|
|
31
|
-
value: string;
|
|
32
|
-
}[];
|
|
33
|
-
messageFor(key: string): string;
|
|
34
|
-
getFilterExpressionByField(name: string): FilterExpression | null;
|
|
35
|
-
filterValueChange(value: string): void;
|
|
36
|
-
protected getDefaultOperators(operatorsType: FilterEditor): {
|
|
37
|
-
text: string;
|
|
38
|
-
value: string;
|
|
39
|
-
}[];
|
|
40
|
-
getEditorType(): FilterEditor;
|
|
41
|
-
removeFilterExpression(): void;
|
|
42
|
-
private setOperators;
|
|
43
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
|
-
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
|
7
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { FilterService } from './filter.service';
|
|
9
|
-
import { defaultDateOperators, defaultNumericOperators, defaultOperators, defaultStringOperators, getKeyByValue, isFilterEditor, localizeOperators } from './util';
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
let FilterExpressionComponent = class FilterExpressionComponent {
|
|
14
|
-
constructor(filterService, localization, cdr) {
|
|
15
|
-
this.filterService = filterService;
|
|
16
|
-
this.localization = localization;
|
|
17
|
-
this.cdr = cdr;
|
|
18
|
-
this.valueChange = new EventEmitter();
|
|
19
|
-
this.operators = [];
|
|
20
|
-
this.filters = [];
|
|
21
|
-
this.isBoolean = false;
|
|
22
|
-
this.isEditorDisabled = false;
|
|
23
|
-
}
|
|
24
|
-
ngOnInit() {
|
|
25
|
-
this.filters = this.filterService.filters;
|
|
26
|
-
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
27
|
-
if (this.currentItem.field) {
|
|
28
|
-
this.setOperators(foundFilter);
|
|
29
|
-
}
|
|
30
|
-
const defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
31
|
-
if (!this.currentItem.field) {
|
|
32
|
-
this.currentItem.field = this.filterService.filters[0].field;
|
|
33
|
-
this.setOperators(defaultFilter);
|
|
34
|
-
}
|
|
35
|
-
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
36
|
-
this.setOperators(foundFilter || defaultFilter);
|
|
37
|
-
this.cdr.detectChanges();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
ngOnDestroy() {
|
|
41
|
-
if (this.localizationSubscription) {
|
|
42
|
-
this.localizationSubscription.unsubscribe();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
normalizeOperators(filterEditor, operators) {
|
|
46
|
-
let result = [];
|
|
47
|
-
for (let j = 0; j < operators.length; j++) {
|
|
48
|
-
if (isFilterEditor(filterEditor)) {
|
|
49
|
-
result.push({
|
|
50
|
-
value: operators[j],
|
|
51
|
-
text: this.localization.get(getKeyByValue(defaultOperators[filterEditor], operators[j]))
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
messageFor(key) {
|
|
58
|
-
return this.localization.get(key);
|
|
59
|
-
}
|
|
60
|
-
getFilterExpressionByField(name) {
|
|
61
|
-
const foundFilter = this.filterService.filters.find(filter => filter.field === name);
|
|
62
|
-
if (foundFilter) {
|
|
63
|
-
return foundFilter;
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
filterValueChange(value) {
|
|
68
|
-
this.currentItem.value = null;
|
|
69
|
-
this.currentItem.field = value;
|
|
70
|
-
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
71
|
-
this.setOperators(foundFilter);
|
|
72
|
-
this.valueChange.emit();
|
|
73
|
-
}
|
|
74
|
-
getDefaultOperators(operatorsType) {
|
|
75
|
-
switch (operatorsType) {
|
|
76
|
-
case 'string':
|
|
77
|
-
return localizeOperators(defaultStringOperators)(this.localization);
|
|
78
|
-
case 'number':
|
|
79
|
-
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
80
|
-
case 'date':
|
|
81
|
-
return localizeOperators(defaultDateOperators)(this.localization);
|
|
82
|
-
default:
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
getEditorType() {
|
|
87
|
-
let item = this.filterService.filters.find((filterExpression) => filterExpression.field === this.currentItem.field);
|
|
88
|
-
return item.editor;
|
|
89
|
-
}
|
|
90
|
-
removeFilterExpression() {
|
|
91
|
-
this.filterService.remove(this.currentItem, this.index);
|
|
92
|
-
this.valueChange.emit();
|
|
93
|
-
}
|
|
94
|
-
setOperators(filter) {
|
|
95
|
-
this.isBoolean = filter.editor === 'boolean';
|
|
96
|
-
if (this.isBoolean) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (filter.operators) {
|
|
100
|
-
const localizedOperators = this.normalizeOperators(filter.editor, filter.operators);
|
|
101
|
-
this.operators = localizedOperators;
|
|
102
|
-
if (!this.currentItem.operator) {
|
|
103
|
-
this.currentItem.operator = localizedOperators[0].value;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
this.operators = this.getDefaultOperators(filter.editor);
|
|
108
|
-
if (!this.currentItem.operator) {
|
|
109
|
-
this.currentItem.operator = this.operators[0].value;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
tslib_1.__decorate([
|
|
115
|
-
Input(),
|
|
116
|
-
tslib_1.__metadata("design:type", Number)
|
|
117
|
-
], FilterExpressionComponent.prototype, "index", void 0);
|
|
118
|
-
tslib_1.__decorate([
|
|
119
|
-
Input(),
|
|
120
|
-
tslib_1.__metadata("design:type", Object)
|
|
121
|
-
], FilterExpressionComponent.prototype, "currentItem", void 0);
|
|
122
|
-
tslib_1.__decorate([
|
|
123
|
-
Output(),
|
|
124
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
125
|
-
], FilterExpressionComponent.prototype, "valueChange", void 0);
|
|
126
|
-
FilterExpressionComponent = tslib_1.__decorate([
|
|
127
|
-
Component({
|
|
128
|
-
selector: 'kendo-filter-expression',
|
|
129
|
-
template: `
|
|
130
|
-
<div class="k-filter-toolbar" role="group" [attr.aria-label]="messageFor('filterAriaLabel')">
|
|
131
|
-
<div class="k-toolbar">
|
|
132
|
-
<div class="k-filter-toolbar-item k-filter-field">
|
|
133
|
-
<kendo-dropdownlist
|
|
134
|
-
[kendoAriaLabelValue]="messageFor('filterFieldAriaLabel')"
|
|
135
|
-
[title]="messageFor('filterExpressionFilters')"
|
|
136
|
-
[data]="filters"
|
|
137
|
-
textField="title"
|
|
138
|
-
valueField="field"
|
|
139
|
-
[value]="currentItem.field"
|
|
140
|
-
[valuePrimitive]="true"
|
|
141
|
-
(valueChange)="filterValueChange($event)">
|
|
142
|
-
</kendo-dropdownlist>
|
|
143
|
-
</div>
|
|
144
|
-
<div *ngIf="!isBoolean" class="k-filter-toolbar-item k-filter-operator">
|
|
145
|
-
<kendo-filter-expression-operators
|
|
146
|
-
[currentItem]="currentItem"
|
|
147
|
-
[operators]="operators"
|
|
148
|
-
(valueChange)="valueChange.emit();">
|
|
149
|
-
</kendo-filter-expression-operators>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<ng-container [ngSwitch]="getEditorType()">
|
|
153
|
-
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
154
|
-
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
155
|
-
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
156
|
-
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
157
|
-
</ng-container>
|
|
158
|
-
|
|
159
|
-
<div class="k-filter-toolbar-item">
|
|
160
|
-
<button
|
|
161
|
-
kendoButton
|
|
162
|
-
icon="close"
|
|
163
|
-
fillMode="flat"
|
|
164
|
-
[title]="messageFor('remove')"
|
|
165
|
-
(click)="removeFilterExpression()">
|
|
166
|
-
</button>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
`
|
|
171
|
-
}),
|
|
172
|
-
tslib_1.__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
173
|
-
], FilterExpressionComponent);
|
|
174
|
-
export { FilterExpressionComponent };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
6
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import { CompositeFilterDescriptor } from '@progress/kendo-data-query';
|
|
8
|
-
import { FilterService } from './filter.service';
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export declare class FilterGroupComponent implements OnInit, OnDestroy {
|
|
13
|
-
private filterService;
|
|
14
|
-
localization: LocalizationService;
|
|
15
|
-
private cdr;
|
|
16
|
-
index: number;
|
|
17
|
-
currentItem: CompositeFilterDescriptor;
|
|
18
|
-
valueChange: EventEmitter<void>;
|
|
19
|
-
operators: {
|
|
20
|
-
text: string;
|
|
21
|
-
value: string;
|
|
22
|
-
}[];
|
|
23
|
-
private localizationSubscription;
|
|
24
|
-
constructor(filterService: FilterService, localization: LocalizationService, cdr: ChangeDetectorRef);
|
|
25
|
-
ngOnInit(): void;
|
|
26
|
-
ngOnDestroy(): void;
|
|
27
|
-
getLogicOperators(): {
|
|
28
|
-
text: string;
|
|
29
|
-
value: string;
|
|
30
|
-
}[];
|
|
31
|
-
messageFor(key: string): string;
|
|
32
|
-
selectedChange(logicOperator: 'or' | 'and'): void;
|
|
33
|
-
addFilterExpression(): void;
|
|
34
|
-
addFilterGroup(): void;
|
|
35
|
-
removeFilterGroup(): void;
|
|
36
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
|
-
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
|
7
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { FilterService } from './filter.service';
|
|
9
|
-
import { localizeOperators, logicOperators } from './util';
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
let FilterGroupComponent = class FilterGroupComponent {
|
|
14
|
-
constructor(filterService, localization, cdr) {
|
|
15
|
-
this.filterService = filterService;
|
|
16
|
-
this.localization = localization;
|
|
17
|
-
this.cdr = cdr;
|
|
18
|
-
this.index = 0;
|
|
19
|
-
this.currentItem = {
|
|
20
|
-
logic: 'or',
|
|
21
|
-
filters: []
|
|
22
|
-
};
|
|
23
|
-
this.valueChange = new EventEmitter();
|
|
24
|
-
this.operators = [];
|
|
25
|
-
}
|
|
26
|
-
ngOnInit() {
|
|
27
|
-
this.operators = this.getLogicOperators();
|
|
28
|
-
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
29
|
-
this.operators = this.getLogicOperators();
|
|
30
|
-
this.cdr.detectChanges();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
ngOnDestroy() {
|
|
34
|
-
if (this.localizationSubscription) {
|
|
35
|
-
this.localizationSubscription.unsubscribe();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
getLogicOperators() {
|
|
39
|
-
return localizeOperators(logicOperators)(this.localization);
|
|
40
|
-
}
|
|
41
|
-
messageFor(key) {
|
|
42
|
-
return this.localization.get(key);
|
|
43
|
-
}
|
|
44
|
-
selectedChange(logicOperator) {
|
|
45
|
-
if (this.currentItem.logic !== logicOperator) {
|
|
46
|
-
this.currentItem.logic = logicOperator;
|
|
47
|
-
this.valueChange.emit();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
addFilterExpression() {
|
|
51
|
-
this.filterService.addFilterExpression(this.currentItem);
|
|
52
|
-
this.valueChange.emit();
|
|
53
|
-
}
|
|
54
|
-
addFilterGroup() {
|
|
55
|
-
this.filterService.addFilterGroup(this.currentItem);
|
|
56
|
-
this.valueChange.emit();
|
|
57
|
-
}
|
|
58
|
-
removeFilterGroup() {
|
|
59
|
-
this.filterService.remove(this.currentItem, this.index);
|
|
60
|
-
this.valueChange.emit();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
tslib_1.__decorate([
|
|
64
|
-
Input(),
|
|
65
|
-
tslib_1.__metadata("design:type", Number)
|
|
66
|
-
], FilterGroupComponent.prototype, "index", void 0);
|
|
67
|
-
tslib_1.__decorate([
|
|
68
|
-
Input(),
|
|
69
|
-
tslib_1.__metadata("design:type", Object)
|
|
70
|
-
], FilterGroupComponent.prototype, "currentItem", void 0);
|
|
71
|
-
tslib_1.__decorate([
|
|
72
|
-
Output(),
|
|
73
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
74
|
-
], FilterGroupComponent.prototype, "valueChange", void 0);
|
|
75
|
-
FilterGroupComponent = tslib_1.__decorate([
|
|
76
|
-
Component({
|
|
77
|
-
selector: 'kendo-filter-group',
|
|
78
|
-
template: `
|
|
79
|
-
<div class="k-filter-toolbar" role="toolbar" [attr.aria-label]="messageFor('filterToolbarAriaLabel')">
|
|
80
|
-
<div class="k-toolbar">
|
|
81
|
-
<div class="k-filter-toolbar-item">
|
|
82
|
-
<div class="k-widget k-button-group" role="group">
|
|
83
|
-
<button
|
|
84
|
-
*ngFor="let operator of operators"
|
|
85
|
-
kendoButton
|
|
86
|
-
[ngClass]="{'k-group-start': operator.value === 'and', 'k-group-end': operator.value === 'or'}"
|
|
87
|
-
[selected]="currentItem.logic === operator.value"
|
|
88
|
-
[title]="operator.text"
|
|
89
|
-
(click)="selectedChange(operator.value)"
|
|
90
|
-
>
|
|
91
|
-
{{operator.text}}
|
|
92
|
-
</button>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
<div class="k-filter-toolbar-item">
|
|
96
|
-
<button
|
|
97
|
-
kendoButton
|
|
98
|
-
[title]="messageFor('addFilter')"
|
|
99
|
-
icon="filter-add-expression"
|
|
100
|
-
(click)="addFilterExpression()">
|
|
101
|
-
{{messageFor('addFilter')}}
|
|
102
|
-
</button>
|
|
103
|
-
</div>
|
|
104
|
-
<div class="k-filter-toolbar-item">
|
|
105
|
-
<button
|
|
106
|
-
kendoButton
|
|
107
|
-
[title]="messageFor('addGroup')"
|
|
108
|
-
icon="filter-add-group"
|
|
109
|
-
(click)="addFilterGroup()">
|
|
110
|
-
{{messageFor('addGroup')}}
|
|
111
|
-
</button>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="k-filter-toolbar-item">
|
|
114
|
-
<button
|
|
115
|
-
kendoButton
|
|
116
|
-
icon="close"
|
|
117
|
-
fillMode="flat"
|
|
118
|
-
[title]="messageFor('remove')"
|
|
119
|
-
(click)="removeFilterGroup()">
|
|
120
|
-
</button>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<ul class="k-filter-lines" *ngIf="currentItem.filters">
|
|
126
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
127
|
-
<li class="k-filter-item" *ngIf="!item.filters">
|
|
128
|
-
<kendo-filter-expression (valueChange)="valueChange.emit()" [currentItem]="item" [index]="i">
|
|
129
|
-
</kendo-filter-expression>
|
|
130
|
-
</li>
|
|
131
|
-
<li class="k-filter-item" *ngIf="item.filters" >
|
|
132
|
-
<kendo-filter-group
|
|
133
|
-
(valueChange)="valueChange.emit()"
|
|
134
|
-
[currentItem]="item"
|
|
135
|
-
[index]="i"
|
|
136
|
-
>
|
|
137
|
-
</kendo-filter-group>
|
|
138
|
-
</li>
|
|
139
|
-
</ng-container>
|
|
140
|
-
</ul>
|
|
141
|
-
`
|
|
142
|
-
}),
|
|
143
|
-
tslib_1.__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
144
|
-
], FilterGroupComponent);
|
|
145
|
-
export { FilterGroupComponent };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { OnInit, EventEmitter } from '@angular/core';
|
|
6
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import { FilterService } from './filter.service';
|
|
8
|
-
import { CompositeFilterDescriptor } from '@progress/kendo-data-query';
|
|
9
|
-
import { FilterExpression } from './model/filter-expression';
|
|
10
|
-
import { Direction } from './util';
|
|
11
|
-
import { ChangeDetectorRef } from '@angular/core';
|
|
12
|
-
import { OnDestroy } from '@angular/core';
|
|
13
|
-
/**
|
|
14
|
-
* Represents the [Kendo UI Filter component for Angular]({% slug overview_filter %}).
|
|
15
|
-
* The Filter component can be used to apply any user defined filter criteria.
|
|
16
|
-
* @example
|
|
17
|
-
* ```
|
|
18
|
-
* @Component({
|
|
19
|
-
* selector: 'my-app',
|
|
20
|
-
* template: `
|
|
21
|
-
* <kendo-filter [filters]="filters" (valueChange)="onValueChange($event)"></kendo-filter>
|
|
22
|
-
* `
|
|
23
|
-
* })
|
|
24
|
-
* export class AppComponent {
|
|
25
|
-
*
|
|
26
|
-
* public filters: FilterExpression[] = [
|
|
27
|
-
* {
|
|
28
|
-
* name: 'country',
|
|
29
|
-
* label: 'Country',
|
|
30
|
-
* filter: 'string',
|
|
31
|
-
* operators: ['eq', 'neq'],
|
|
32
|
-
* },
|
|
33
|
-
* {
|
|
34
|
-
* name: 'budget',
|
|
35
|
-
* filter: 'number'
|
|
36
|
-
* }
|
|
37
|
-
* ];
|
|
38
|
-
*
|
|
39
|
-
* onValueChange(e: CompositeFilterDescriptor){
|
|
40
|
-
* console.log(e)
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare class FilterComponent implements OnInit, OnDestroy {
|
|
46
|
-
private filterService;
|
|
47
|
-
private localization;
|
|
48
|
-
private cdr;
|
|
49
|
-
direction: Direction;
|
|
50
|
-
/**
|
|
51
|
-
* Specifies the available user-defined filters. At least one filter should be provided.
|
|
52
|
-
*/
|
|
53
|
-
filters: FilterExpression[];
|
|
54
|
-
/**
|
|
55
|
-
* Sets the initial `value` of the Filter component.
|
|
56
|
-
*/
|
|
57
|
-
value: CompositeFilterDescriptor;
|
|
58
|
-
/**
|
|
59
|
-
* Fires every time the Filter component value is updated.
|
|
60
|
-
* That is each time a Filter Group or Filter Expression is added, removed, or updated.
|
|
61
|
-
*/
|
|
62
|
-
valueChange: EventEmitter<CompositeFilterDescriptor>;
|
|
63
|
-
private localizationSubscription;
|
|
64
|
-
constructor(filterService: FilterService, localization: LocalizationService, cdr: ChangeDetectorRef);
|
|
65
|
-
ngOnInit(): void;
|
|
66
|
-
ngOnDestroy(): void;
|
|
67
|
-
/**
|
|
68
|
-
* @hidden
|
|
69
|
-
*/
|
|
70
|
-
getCurrentFilter(): CompositeFilterDescriptor;
|
|
71
|
-
/**
|
|
72
|
-
* @hidden
|
|
73
|
-
*/
|
|
74
|
-
onValueChange(): void;
|
|
75
|
-
private normalizeFilter;
|
|
76
|
-
private normalizeValue;
|
|
77
|
-
}
|