@progress/kendo-angular-filter 2.0.1-dev.202205190755 → 2.1.0-dev.202206150812
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 +1 -1
- package/esm2015/editors/boolean-editor.component.js +0 -2
- package/esm2015/editors/date-editor.component.js +0 -2
- package/esm2015/editors/numeric-editor.component.js +0 -2
- package/esm2015/editors/text-editor.component.js +0 -2
- package/esm2015/filter-expression-operators.component.js +22 -4
- package/esm2015/filter-expression.component.js +37 -13
- package/esm2015/filter-field.component.js +68 -0
- package/esm2015/filter-group.component.js +6 -3
- package/esm2015/filter.component.js +33 -17
- package/esm2015/filter.module.js +14 -4
- package/esm2015/filter.service.js +2 -1
- package/esm2015/main.js +2 -0
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/templates/value-editor.template.js +19 -0
- package/fesm2015/kendo-angular-filter.js +185 -50
- package/filter-expression-operators.component.d.ts +6 -3
- package/filter-expression.component.d.ts +3 -1
- package/filter-field.component.d.ts +83 -0
- package/filter-group.component.d.ts +1 -0
- package/filter.component.d.ts +3 -1
- package/filter.module.d.ts +4 -2
- package/main.d.ts +2 -0
- package/model/filter-expression.d.ts +5 -0
- package/package.json +5 -5
- package/templates/value-editor.template.d.ts +12 -0
- package/util.d.ts +2 -4
|
@@ -42,6 +42,7 @@ export class FilterExpressionComponent {
|
|
|
42
42
|
this.currentItem.field = this.filterService.filters[0].field;
|
|
43
43
|
this.setOperators(defaultFilter);
|
|
44
44
|
}
|
|
45
|
+
this.setEditorTemplate();
|
|
45
46
|
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
46
47
|
this.setOperators(foundFilter || defaultFilter);
|
|
47
48
|
this.cdr.detectChanges();
|
|
@@ -77,6 +78,7 @@ export class FilterExpressionComponent {
|
|
|
77
78
|
filterValueChange(value) {
|
|
78
79
|
this.currentItem.value = null;
|
|
79
80
|
this.currentItem.field = value;
|
|
81
|
+
this.setEditorTemplate();
|
|
80
82
|
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
81
83
|
this.setOperators(foundFilter);
|
|
82
84
|
this.valueChange.emit();
|
|
@@ -130,6 +132,12 @@ export class FilterExpressionComponent {
|
|
|
130
132
|
this.isEditorDisabled = false;
|
|
131
133
|
}
|
|
132
134
|
}
|
|
135
|
+
setEditorTemplate() {
|
|
136
|
+
let filterExpression = this.filterService.filters.find((filter) => filter.field === this.currentItem.field);
|
|
137
|
+
if (filterExpression.editorTemplate) {
|
|
138
|
+
this.editorTemplate = filterExpression.editorTemplate;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
133
141
|
}
|
|
134
142
|
FilterExpressionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionComponent, deps: [{ token: i1.FilterService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
135
143
|
FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterExpressionComponent, selector: "kendo-filter-expression", inputs: { index: "index", currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
@@ -151,16 +159,24 @@ FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
151
159
|
<kendo-filter-expression-operators
|
|
152
160
|
[currentItem]="currentItem"
|
|
153
161
|
[operators]="operators"
|
|
162
|
+
[editorType]="getEditorType()"
|
|
154
163
|
(valueChange)="onOperatorChange($event);">
|
|
155
164
|
</kendo-filter-expression-operators>
|
|
156
165
|
</div>
|
|
157
166
|
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
<div class="k-filter-toolbar-item k-filter-value">
|
|
168
|
+
<ng-container *ngIf="!editorTemplate" [ngSwitch]="getEditorType()">
|
|
169
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
170
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
171
|
+
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
172
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
173
|
+
</ng-container>
|
|
174
|
+
<ng-container *ngIf="editorTemplate">
|
|
175
|
+
<ng-template
|
|
176
|
+
[templateContext]="{templateRef: editorTemplate, $implicit: currentItem}">
|
|
177
|
+
</ng-template>
|
|
178
|
+
</ng-container>
|
|
179
|
+
</div>
|
|
164
180
|
|
|
165
181
|
<div class="k-filter-toolbar-item">
|
|
166
182
|
<button
|
|
@@ -173,7 +189,7 @@ FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
173
189
|
</div>
|
|
174
190
|
</div>
|
|
175
191
|
</div>
|
|
176
|
-
`, isInline: true, components: [{ type: i3.DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["iconClass", "loading", "data", "value", "textField", "valueField", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }, { type: i4.FilterExpressionOperatorsComponent, selector: "kendo-filter-expression-operators", inputs: ["currentItem", "operators"], outputs: ["valueChange"] }, { type: i5.FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }, { type: i6.FilterNumericEditorComponent, selector: "kendo-filter-numeric-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }, { type: i7.FilterBooleanEditorComponent, selector: "kendo-filter-boolean-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i8.FilterDateEditorComponent, selector: "kendo-filter-date-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }], directives: [{ type: i9.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i10.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i11.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
192
|
+
`, isInline: true, components: [{ type: i3.DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["iconClass", "loading", "data", "value", "textField", "valueField", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }, { type: i4.FilterExpressionOperatorsComponent, selector: "kendo-filter-expression-operators", inputs: ["currentItem", "editorType", "operators"], outputs: ["valueChange"] }, { type: i5.FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }, { type: i6.FilterNumericEditorComponent, selector: "kendo-filter-numeric-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }, { type: i7.FilterBooleanEditorComponent, selector: "kendo-filter-boolean-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i8.FilterDateEditorComponent, selector: "kendo-filter-date-editor", inputs: ["currentItem", "isDisabled"], outputs: ["valueChange"] }], directives: [{ type: i9.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i10.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i11.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }, { type: i11.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
177
193
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionComponent, decorators: [{
|
|
178
194
|
type: Component,
|
|
179
195
|
args: [{
|
|
@@ -197,16 +213,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
197
213
|
<kendo-filter-expression-operators
|
|
198
214
|
[currentItem]="currentItem"
|
|
199
215
|
[operators]="operators"
|
|
216
|
+
[editorType]="getEditorType()"
|
|
200
217
|
(valueChange)="onOperatorChange($event);">
|
|
201
218
|
</kendo-filter-expression-operators>
|
|
202
219
|
</div>
|
|
203
220
|
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
221
|
+
<div class="k-filter-toolbar-item k-filter-value">
|
|
222
|
+
<ng-container *ngIf="!editorTemplate" [ngSwitch]="getEditorType()">
|
|
223
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
224
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
225
|
+
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
226
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
227
|
+
</ng-container>
|
|
228
|
+
<ng-container *ngIf="editorTemplate">
|
|
229
|
+
<ng-template
|
|
230
|
+
[templateContext]="{templateRef: editorTemplate, $implicit: currentItem}">
|
|
231
|
+
</ng-template>
|
|
232
|
+
</ng-container>
|
|
233
|
+
</div>
|
|
210
234
|
|
|
211
235
|
<div class="k-filter-toolbar-item">
|
|
212
236
|
<button
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { ContentChild } from '@angular/core';
|
|
6
|
+
import { Component, Input } from '@angular/core';
|
|
7
|
+
import { FilterValueEditorTemplateDirective } from './templates/value-editor.template';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* Represents the [Kendo UI Filter Field component for Angular]({% slug api_filter_filterfieldcomponent %}).
|
|
11
|
+
* The Filter Field component can be used to add Filter Expressions declaratively.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'my-app',
|
|
16
|
+
* template: `
|
|
17
|
+
* <kendo-filter (valueChange)="onValueChange($event)">
|
|
18
|
+
* <kendo-filter-field field="country" editor="string" [operators]="['neq', 'eq', 'contains']"></kendo-filter-field>
|
|
19
|
+
* <kendo-filter-field field="budget" editor="number"></kendo-filter-field>
|
|
20
|
+
* <kendo-filter-field field="discontinued" title="Discontinued" editor="boolean"></kendo-filter-field>
|
|
21
|
+
* <kendo-filter-field field="ordered on" title="Ordered on" editor="date"></kendo-filter-field>
|
|
22
|
+
* <kendo-filter>
|
|
23
|
+
* `
|
|
24
|
+
* })
|
|
25
|
+
* export class AppComponent {
|
|
26
|
+
* onValueChange(e: CompositeFilterDescriptor){
|
|
27
|
+
* console.log(e)
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class FilterFieldComponent {
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the `title` text that will be displayed by the user-defined filter.
|
|
35
|
+
* If the `title` isn't set, the value passed to `field` is used.
|
|
36
|
+
*/
|
|
37
|
+
set title(_title) {
|
|
38
|
+
if (_title) {
|
|
39
|
+
this._title = _title;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this._title = this.field;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
get title() {
|
|
46
|
+
return this._title;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
FilterFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
50
|
+
FilterFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterFieldComponent, selector: "kendo-filter-field", inputs: { field: "field", title: "title", editor: "editor", operators: "operators" }, queries: [{ propertyName: "editorTemplate", first: true, predicate: FilterValueEditorTemplateDirective, descendants: true }], ngImport: i0, template: ``, isInline: true });
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterFieldComponent, decorators: [{
|
|
52
|
+
type: Component,
|
|
53
|
+
args: [{
|
|
54
|
+
selector: 'kendo-filter-field',
|
|
55
|
+
template: ``
|
|
56
|
+
}]
|
|
57
|
+
}], propDecorators: { field: [{
|
|
58
|
+
type: Input
|
|
59
|
+
}], title: [{
|
|
60
|
+
type: Input
|
|
61
|
+
}], editor: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], operators: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], editorTemplate: [{
|
|
66
|
+
type: ContentChild,
|
|
67
|
+
args: [FilterValueEditorTemplateDirective]
|
|
68
|
+
}] } });
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
-
import { localizeOperators, logicOperators } from './util';
|
|
6
|
+
import { getKeyByValue, localizeOperators, logicOperators } from './util';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
import * as i1 from "./filter.service";
|
|
9
9
|
import * as i2 from "@progress/kendo-angular-l10n";
|
|
@@ -44,6 +44,9 @@ export class FilterGroupComponent {
|
|
|
44
44
|
messageFor(key) {
|
|
45
45
|
return this.localization.get(key);
|
|
46
46
|
}
|
|
47
|
+
getOperator(operatorValue) {
|
|
48
|
+
return this.messageFor(getKeyByValue(logicOperators, operatorValue));
|
|
49
|
+
}
|
|
47
50
|
selectedChange(logicOperator) {
|
|
48
51
|
if (this.currentItem.logic !== logicOperator) {
|
|
49
52
|
this.currentItem.logic = logicOperator;
|
|
@@ -77,7 +80,7 @@ FilterGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
77
80
|
[title]="operator.text"
|
|
78
81
|
(click)="selectedChange(operator.value)"
|
|
79
82
|
>
|
|
80
|
-
{{operator.
|
|
83
|
+
{{getOperator(operator.value)}}
|
|
81
84
|
</button>
|
|
82
85
|
</div>
|
|
83
86
|
</div>
|
|
@@ -145,7 +148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
145
148
|
[title]="operator.text"
|
|
146
149
|
(click)="selectedChange(operator.value)"
|
|
147
150
|
>
|
|
148
|
-
{{operator.
|
|
151
|
+
{{getOperator(operator.value)}}
|
|
149
152
|
</button>
|
|
150
153
|
</div>
|
|
151
154
|
</div>
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Component, Input, Output, EventEmitter, HostBinding, isDevMode } from '@angular/core';
|
|
5
|
+
import { Component, Input, Output, EventEmitter, HostBinding, isDevMode, ContentChildren } from '@angular/core';
|
|
6
6
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
7
|
import { FilterService } from './filter.service';
|
|
8
|
-
import {
|
|
8
|
+
import { nullOperators, isPresent } from './util';
|
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
10
|
import { packageMetadata } from './package-metadata';
|
|
11
|
+
import { FilterFieldComponent } from './filter-field.component';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
import * as i1 from "./filter.service";
|
|
13
14
|
import * as i2 from "@progress/kendo-angular-l10n";
|
|
@@ -63,17 +64,16 @@ export class FilterComponent {
|
|
|
63
64
|
* Specifies the available user-defined filters. At least one filter should be provided.
|
|
64
65
|
*/
|
|
65
66
|
set filters(_filters) {
|
|
66
|
-
if (
|
|
67
|
-
|
|
67
|
+
if (_filters.length > 0) {
|
|
68
|
+
this.filterService.filters = _filters.map(filterExpression => {
|
|
69
|
+
let clonedFilter = Object.assign({}, filterExpression);
|
|
70
|
+
if (!clonedFilter.title) {
|
|
71
|
+
clonedFilter.title = clonedFilter.field;
|
|
72
|
+
}
|
|
73
|
+
return clonedFilter;
|
|
74
|
+
});
|
|
75
|
+
this.setValue(this.value);
|
|
68
76
|
}
|
|
69
|
-
this.filterService.filters = _filters.map(filterExpression => {
|
|
70
|
-
let clonedFilter = Object.assign({}, filterExpression);
|
|
71
|
-
if (!clonedFilter.title) {
|
|
72
|
-
clonedFilter.title = clonedFilter.field;
|
|
73
|
-
}
|
|
74
|
-
return clonedFilter;
|
|
75
|
-
});
|
|
76
|
-
this.setValue(this.value);
|
|
77
77
|
}
|
|
78
78
|
get filters() {
|
|
79
79
|
return this.filterService.filters;
|
|
@@ -84,20 +84,30 @@ export class FilterComponent {
|
|
|
84
84
|
set value(value) {
|
|
85
85
|
const clonedValue = JSON.parse(JSON.stringify(value));
|
|
86
86
|
this._value = clonedValue;
|
|
87
|
-
|
|
87
|
+
if (this.filters.length > 0) {
|
|
88
|
+
this.setValue(this.value);
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
get value() {
|
|
90
92
|
return this._value;
|
|
91
93
|
}
|
|
92
94
|
ngOnInit() {
|
|
93
|
-
if (this.filters.length === 0) {
|
|
94
|
-
throw new Error(`Pass at least one user-defined filter through the [filters] input property. See http://www.telerik.com/kendo-angular-ui/components/filter/#data-binding`);
|
|
95
|
-
}
|
|
96
95
|
this.localizationSubscription = this.localization.changes.subscribe(({ rtl }) => {
|
|
97
96
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
98
97
|
this.cdr.detectChanges();
|
|
99
98
|
});
|
|
100
99
|
}
|
|
100
|
+
ngAfterViewChecked() {
|
|
101
|
+
if (this.filterFields && this.filterFields.length > 0) {
|
|
102
|
+
this.filters = this.filterFields.map((filterField) => {
|
|
103
|
+
var _a;
|
|
104
|
+
return (Object.assign(Object.assign({}, filterField), { editorTemplate: (_a = filterField.editorTemplate) === null || _a === void 0 ? void 0 : _a.templateRef }));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (this.filters.length === 0) {
|
|
108
|
+
throw new Error(`Pass at least one user-defined filter through the [filters] input property or nest kendo-filter-field components. See http://www.telerik.com/kendo-angular-ui/components/filter/#data-binding`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
101
111
|
ngOnDestroy() {
|
|
102
112
|
if (this.localizationSubscription) {
|
|
103
113
|
this.localizationSubscription.unsubscribe();
|
|
@@ -123,6 +133,9 @@ export class FilterComponent {
|
|
|
123
133
|
if (isDevMode() && foundFilter.editor === 'boolean' && (!filterDescriptor.value && filterDescriptor.value !== false)) {
|
|
124
134
|
console.warn(`Provide a value for the boolean '${filterDescriptor.field}' user-defined filter as the operator is always set to 'eq'.`);
|
|
125
135
|
}
|
|
136
|
+
if (isDevMode() && foundFilter.editor === 'boolean' && filterDescriptor.operator !== 'eq') {
|
|
137
|
+
console.warn(`The operator of the boolean '${filterDescriptor.field}' user-defined filter is always set to 'eq'.`);
|
|
138
|
+
}
|
|
126
139
|
if (filterDescriptor.operator && foundFilter.operators && !foundFilter.operators.some(operator => operator === filterDescriptor.operator)) {
|
|
127
140
|
throw new Error(`The user-defined filter with field '${filterDescriptor.field}' is missing the '${filterDescriptor.operator}' operator.`);
|
|
128
141
|
}
|
|
@@ -165,7 +178,7 @@ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
165
178
|
useValue: 'kendo.filter'
|
|
166
179
|
},
|
|
167
180
|
FilterService
|
|
168
|
-
], ngImport: i0, template: `
|
|
181
|
+
], queries: [{ propertyName: "filterFields", predicate: FilterFieldComponent }], ngImport: i0, template: `
|
|
169
182
|
<ng-container kendoFilterLocalizedMessages
|
|
170
183
|
i18n-editorDateTodayText="kendo.filter.editorDateTodayText|The text of the Today button of the Date editor"
|
|
171
184
|
editorDateTodayText="Today"
|
|
@@ -439,4 +452,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
439
452
|
type: Input
|
|
440
453
|
}], valueChange: [{
|
|
441
454
|
type: Output
|
|
455
|
+
}], filterFields: [{
|
|
456
|
+
type: ContentChildren,
|
|
457
|
+
args: [FilterFieldComponent]
|
|
442
458
|
}] } });
|
package/esm2015/filter.module.js
CHANGED
|
@@ -10,11 +10,13 @@ import { FilterNumericEditorComponent } from './editors/numeric-editor.component
|
|
|
10
10
|
import { FilterTextEditorComponent } from './editors/text-editor.component';
|
|
11
11
|
import { FilterExpressionOperatorsComponent } from './filter-expression-operators.component';
|
|
12
12
|
import { FilterExpressionComponent } from './filter-expression.component';
|
|
13
|
+
import { FilterFieldComponent } from './filter-field.component';
|
|
13
14
|
import { FilterGroupComponent } from './filter-group.component';
|
|
14
15
|
import { FilterComponent } from './filter.component';
|
|
15
16
|
import { CustomMessagesComponent } from './localization/custom-messages.component';
|
|
16
17
|
import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
|
17
18
|
import { SharedModule } from './shared.module';
|
|
19
|
+
import { FilterValueEditorTemplateDirective } from './templates/value-editor.template';
|
|
18
20
|
import * as i0 from "@angular/core";
|
|
19
21
|
/**
|
|
20
22
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
@@ -60,7 +62,9 @@ FilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
60
62
|
FilterDateEditorComponent,
|
|
61
63
|
LocalizedMessagesDirective,
|
|
62
64
|
CustomMessagesComponent,
|
|
63
|
-
AriaLabelValueDirective
|
|
65
|
+
AriaLabelValueDirective,
|
|
66
|
+
FilterFieldComponent,
|
|
67
|
+
FilterValueEditorTemplateDirective], imports: [SharedModule], exports: [FilterComponent,
|
|
64
68
|
FilterNumericEditorComponent,
|
|
65
69
|
FilterTextEditorComponent,
|
|
66
70
|
FilterExpressionComponent,
|
|
@@ -70,7 +74,9 @@ FilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
70
74
|
FilterDateEditorComponent,
|
|
71
75
|
LocalizedMessagesDirective,
|
|
72
76
|
CustomMessagesComponent,
|
|
73
|
-
AriaLabelValueDirective
|
|
77
|
+
AriaLabelValueDirective,
|
|
78
|
+
FilterFieldComponent,
|
|
79
|
+
FilterValueEditorTemplateDirective] });
|
|
74
80
|
FilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterModule, imports: [[SharedModule]] });
|
|
75
81
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterModule, decorators: [{
|
|
76
82
|
type: NgModule,
|
|
@@ -86,7 +92,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
86
92
|
FilterDateEditorComponent,
|
|
87
93
|
LocalizedMessagesDirective,
|
|
88
94
|
CustomMessagesComponent,
|
|
89
|
-
AriaLabelValueDirective
|
|
95
|
+
AriaLabelValueDirective,
|
|
96
|
+
FilterFieldComponent,
|
|
97
|
+
FilterValueEditorTemplateDirective
|
|
90
98
|
],
|
|
91
99
|
exports: [FilterComponent,
|
|
92
100
|
FilterNumericEditorComponent,
|
|
@@ -98,6 +106,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
98
106
|
FilterDateEditorComponent,
|
|
99
107
|
LocalizedMessagesDirective,
|
|
100
108
|
CustomMessagesComponent,
|
|
101
|
-
AriaLabelValueDirective
|
|
109
|
+
AriaLabelValueDirective,
|
|
110
|
+
FilterFieldComponent,
|
|
111
|
+
FilterValueEditorTemplateDirective]
|
|
102
112
|
}]
|
|
103
113
|
}] });
|
|
@@ -9,10 +9,11 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
*/
|
|
10
10
|
export class FilterService {
|
|
11
11
|
constructor() {
|
|
12
|
+
this.normalizedValue = { logic: 'and', filters: [] };
|
|
12
13
|
this.filters = [];
|
|
13
14
|
}
|
|
14
15
|
addFilterGroup(item) {
|
|
15
|
-
let filterGroup = { logic: '
|
|
16
|
+
let filterGroup = { logic: 'and', filters: [] };
|
|
16
17
|
item.filters.push(filterGroup);
|
|
17
18
|
}
|
|
18
19
|
addFilterExpression(item) {
|
package/esm2015/main.js
CHANGED
|
@@ -14,3 +14,5 @@ export { FilterExpressionOperatorsComponent } from './filter-expression-operator
|
|
|
14
14
|
export { FilterExpressionComponent } from './filter-expression.component';
|
|
15
15
|
export { CustomMessagesComponent } from './localization/custom-messages.component';
|
|
16
16
|
export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
|
17
|
+
export { FilterFieldComponent } from './filter-field.component';
|
|
18
|
+
export { FilterValueEditorTemplateDirective } from './templates/value-editor.template';
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-filter',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1655280742,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { Directive } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export class FilterValueEditorTemplateDirective {
|
|
8
|
+
constructor(templateRef) {
|
|
9
|
+
this.templateRef = templateRef;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
FilterValueEditorTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterValueEditorTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
13
|
+
FilterValueEditorTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FilterValueEditorTemplateDirective, selector: "[kendoFilterValueEditorTemplate]", ngImport: i0 });
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterValueEditorTemplateDirective, decorators: [{
|
|
15
|
+
type: Directive,
|
|
16
|
+
args: [{
|
|
17
|
+
selector: '[kendoFilterValueEditorTemplate]'
|
|
18
|
+
}]
|
|
19
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|