@progress/kendo-angular-filter 2.0.1-dev.202205130803 → 2.0.1-dev.202205190755
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/editors/date-editor.component.d.ts +3 -5
- package/editors/numeric-editor.component.d.ts +3 -5
- package/editors/text-editor.component.d.ts +3 -5
- package/esm2015/editors/date-editor.component.js +11 -18
- package/esm2015/editors/numeric-editor.component.js +11 -18
- package/esm2015/editors/text-editor.component.js +11 -18
- package/esm2015/filter-expression-operators.component.js +15 -19
- package/esm2015/filter-expression.component.js +21 -10
- package/esm2015/filter.component.js +23 -11
- package/esm2015/filter.service.js +1 -3
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/util.js +4 -0
- package/fesm2015/kendo-angular-filter.js +91 -86
- package/filter-expression-operators.component.d.ts +2 -4
- package/filter-expression.component.d.ts +2 -1
- package/filter.component.d.ts +2 -0
- package/filter.service.d.ts +1 -2
- package/package.json +1 -1
- package/util.d.ts +4 -0
|
@@ -5,39 +5,30 @@
|
|
|
5
5
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
import * as i1 from "@progress/kendo-angular-l10n";
|
|
8
|
-
import * as i2 from "
|
|
9
|
-
import * as i3 from "
|
|
10
|
-
import * as i4 from "../aria-label.directive";
|
|
8
|
+
import * as i2 from "@progress/kendo-angular-inputs";
|
|
9
|
+
import * as i3 from "../aria-label.directive";
|
|
11
10
|
/**
|
|
12
11
|
* @hidden
|
|
13
12
|
*/
|
|
14
13
|
export class FilterTextEditorComponent {
|
|
15
|
-
constructor(localization
|
|
14
|
+
constructor(localization) {
|
|
16
15
|
this.localization = localization;
|
|
17
|
-
this.filterService = filterService;
|
|
18
16
|
this.valueChange = new EventEmitter();
|
|
19
17
|
}
|
|
20
|
-
isDisabled() {
|
|
21
|
-
const isDisabled = this.filterService.isEditorDisabled;
|
|
22
|
-
if (isDisabled) {
|
|
23
|
-
this.currentItem.value = null;
|
|
24
|
-
}
|
|
25
|
-
return isDisabled;
|
|
26
|
-
}
|
|
27
18
|
messageFor(key) {
|
|
28
19
|
return this.localization.get(key);
|
|
29
20
|
}
|
|
30
21
|
}
|
|
31
|
-
FilterTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterTextEditorComponent, deps: [{ token: i1.LocalizationService }
|
|
32
|
-
FilterTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: { currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
22
|
+
FilterTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterTextEditorComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
FilterTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: { currentItem: "currentItem", isDisabled: "isDisabled" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
33
24
|
<kendo-textbox
|
|
34
25
|
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
35
26
|
class="k-filter-toolbar-item k-filter-value"
|
|
36
27
|
[(value)]="currentItem.value"
|
|
37
28
|
(valueChange)="valueChange.emit()"
|
|
38
|
-
[disabled]="isDisabled
|
|
29
|
+
[disabled]="isDisabled">
|
|
39
30
|
</kendo-textbox>
|
|
40
|
-
`, isInline: true, components: [{ type:
|
|
31
|
+
`, isInline: true, components: [{ type: i2.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "errorIcon", "clearButtonIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }], directives: [{ type: i3.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
41
32
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterTextEditorComponent, decorators: [{
|
|
42
33
|
type: Component,
|
|
43
34
|
args: [{
|
|
@@ -48,11 +39,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
48
39
|
class="k-filter-toolbar-item k-filter-value"
|
|
49
40
|
[(value)]="currentItem.value"
|
|
50
41
|
(valueChange)="valueChange.emit()"
|
|
51
|
-
[disabled]="isDisabled
|
|
42
|
+
[disabled]="isDisabled">
|
|
52
43
|
</kendo-textbox>
|
|
53
44
|
`
|
|
54
45
|
}]
|
|
55
|
-
}], ctorParameters: function () { return [{ type: i1.LocalizationService }
|
|
46
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { currentItem: [{
|
|
47
|
+
type: Input
|
|
48
|
+
}], isDisabled: [{
|
|
56
49
|
type: Input
|
|
57
50
|
}], valueChange: [{
|
|
58
51
|
type: Output
|
|
@@ -3,31 +3,27 @@
|
|
|
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 { nullOperators } from './util';
|
|
7
6
|
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "
|
|
9
|
-
import * as i2 from "@progress/kendo-angular-
|
|
10
|
-
import * as i3 from "
|
|
11
|
-
import * as i4 from "./aria-label.directive";
|
|
7
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
8
|
+
import * as i2 from "@progress/kendo-angular-dropdowns";
|
|
9
|
+
import * as i3 from "./aria-label.directive";
|
|
12
10
|
/**
|
|
13
11
|
* @hidden
|
|
14
12
|
*/
|
|
15
13
|
export class FilterExpressionOperatorsComponent {
|
|
16
|
-
constructor(
|
|
17
|
-
this.filterService = filterService;
|
|
14
|
+
constructor(localization) {
|
|
18
15
|
this.localization = localization;
|
|
19
|
-
this.valueChange = new EventEmitter();
|
|
20
16
|
this.operators = [];
|
|
17
|
+
this.valueChange = new EventEmitter();
|
|
21
18
|
}
|
|
22
19
|
messageFor(key) {
|
|
23
20
|
return this.localization.get(key);
|
|
24
21
|
}
|
|
25
22
|
operatorValueChange(value) {
|
|
26
|
-
this.valueChange.emit();
|
|
27
|
-
this.filterService.isEditorDisabled = nullOperators.indexOf(value) >= 0;
|
|
23
|
+
this.valueChange.emit(value);
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
FilterExpressionOperatorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionOperatorsComponent, deps: [{ token: i1.
|
|
26
|
+
FilterExpressionOperatorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionOperatorsComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
31
27
|
FilterExpressionOperatorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterExpressionOperatorsComponent, selector: "kendo-filter-expression-operators", inputs: { currentItem: "currentItem", operators: "operators" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
32
28
|
<kendo-dropdownlist
|
|
33
29
|
[kendoAriaLabelValue]="messageFor('filterOperatorAriaLabel')"
|
|
@@ -38,13 +34,13 @@ FilterExpressionOperatorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersio
|
|
|
38
34
|
[valuePrimitive]="true"
|
|
39
35
|
textField="text"
|
|
40
36
|
valueField="value"
|
|
41
|
-
|
|
37
|
+
>
|
|
42
38
|
</kendo-dropdownlist>
|
|
43
|
-
|
|
39
|
+
`, isInline: true, components: [{ type: i2.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"] }], directives: [{ type: i3.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
44
40
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionOperatorsComponent, decorators: [{
|
|
45
41
|
type: Component,
|
|
46
42
|
args: [{
|
|
47
|
-
selector:
|
|
43
|
+
selector: "kendo-filter-expression-operators",
|
|
48
44
|
template: `
|
|
49
45
|
<kendo-dropdownlist
|
|
50
46
|
[kendoAriaLabelValue]="messageFor('filterOperatorAriaLabel')"
|
|
@@ -55,14 +51,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
55
51
|
[valuePrimitive]="true"
|
|
56
52
|
textField="text"
|
|
57
53
|
valueField="value"
|
|
58
|
-
|
|
54
|
+
>
|
|
59
55
|
</kendo-dropdownlist>
|
|
60
|
-
|
|
56
|
+
`
|
|
61
57
|
}]
|
|
62
|
-
}], ctorParameters: function () { return [{ type: i1.
|
|
58
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { currentItem: [{
|
|
63
59
|
type: Input
|
|
64
|
-
}], valueChange: [{
|
|
65
|
-
type: Output
|
|
66
60
|
}], operators: [{
|
|
67
61
|
type: Input
|
|
62
|
+
}], valueChange: [{
|
|
63
|
+
type: Output
|
|
68
64
|
}] } });
|
|
@@ -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 { defaultDateOperators, defaultNumericOperators, defaultOperators, defaultStringOperators, getKeyByValue, isFilterEditor, localizeOperators } from './util';
|
|
6
|
+
import { defaultDateOperators, defaultNumericOperators, defaultOperators, defaultStringOperators, getKeyByValue, isFilterEditor, localizeOperators, nullOperators } 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";
|
|
@@ -31,6 +31,7 @@ export class FilterExpressionComponent {
|
|
|
31
31
|
this.isEditorDisabled = false;
|
|
32
32
|
}
|
|
33
33
|
ngOnInit() {
|
|
34
|
+
this.isEditorDisabled = nullOperators.indexOf(this.currentItem.operator) >= 0;
|
|
34
35
|
this.filters = this.filterService.filters;
|
|
35
36
|
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
36
37
|
if (this.currentItem.field) {
|
|
@@ -119,6 +120,16 @@ export class FilterExpressionComponent {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
}
|
|
123
|
+
onOperatorChange(value) {
|
|
124
|
+
this.valueChange.emit();
|
|
125
|
+
if (nullOperators.indexOf(value) >= 0) {
|
|
126
|
+
this.currentItem.value = null;
|
|
127
|
+
this.isEditorDisabled = true;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.isEditorDisabled = false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
122
133
|
}
|
|
123
134
|
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 });
|
|
124
135
|
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: `
|
|
@@ -140,15 +151,15 @@ FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
140
151
|
<kendo-filter-expression-operators
|
|
141
152
|
[currentItem]="currentItem"
|
|
142
153
|
[operators]="operators"
|
|
143
|
-
(valueChange)="
|
|
154
|
+
(valueChange)="onOperatorChange($event);">
|
|
144
155
|
</kendo-filter-expression-operators>
|
|
145
156
|
</div>
|
|
146
157
|
|
|
147
158
|
<ng-container [ngSwitch]="getEditorType()">
|
|
148
|
-
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
149
|
-
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
159
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
160
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
150
161
|
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
151
|
-
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
162
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
152
163
|
</ng-container>
|
|
153
164
|
|
|
154
165
|
<div class="k-filter-toolbar-item">
|
|
@@ -162,7 +173,7 @@ FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
162
173
|
</div>
|
|
163
174
|
</div>
|
|
164
175
|
</div>
|
|
165
|
-
`, 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"], outputs: ["valueChange"] }, { type: i6.FilterNumericEditorComponent, selector: "kendo-filter-numeric-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i7.FilterBooleanEditorComponent, selector: "kendo-filter-boolean-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i8.FilterDateEditorComponent, selector: "kendo-filter-date-editor", inputs: ["currentItem"], 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"] }] });
|
|
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"] }] });
|
|
166
177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionComponent, decorators: [{
|
|
167
178
|
type: Component,
|
|
168
179
|
args: [{
|
|
@@ -186,15 +197,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
186
197
|
<kendo-filter-expression-operators
|
|
187
198
|
[currentItem]="currentItem"
|
|
188
199
|
[operators]="operators"
|
|
189
|
-
(valueChange)="
|
|
200
|
+
(valueChange)="onOperatorChange($event);">
|
|
190
201
|
</kendo-filter-expression-operators>
|
|
191
202
|
</div>
|
|
192
203
|
|
|
193
204
|
<ng-container [ngSwitch]="getEditorType()">
|
|
194
|
-
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
195
|
-
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
205
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
206
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
196
207
|
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
197
|
-
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
208
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" [isDisabled]="isEditorDisabled" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
198
209
|
</ng-container>
|
|
199
210
|
|
|
200
211
|
<div class="k-filter-toolbar-item">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Component, Input, Output, EventEmitter, HostBinding, isDevMode } from '@angular/core';
|
|
6
6
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
7
|
import { FilterService } from './filter.service';
|
|
8
|
-
import { isArray } from './util';
|
|
8
|
+
import { isArray, nullOperators, isPresent } from './util';
|
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
10
|
import { packageMetadata } from './package-metadata';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
@@ -55,6 +55,7 @@ export class FilterComponent {
|
|
|
55
55
|
* That is each time a Filter Group or Filter Expression is added, removed, or updated.
|
|
56
56
|
*/
|
|
57
57
|
this.valueChange = new EventEmitter();
|
|
58
|
+
this._value = { filters: [], logic: 'and' };
|
|
58
59
|
validatePackage(packageMetadata);
|
|
59
60
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
60
61
|
}
|
|
@@ -72,6 +73,7 @@ export class FilterComponent {
|
|
|
72
73
|
}
|
|
73
74
|
return clonedFilter;
|
|
74
75
|
});
|
|
76
|
+
this.setValue(this.value);
|
|
75
77
|
}
|
|
76
78
|
get filters() {
|
|
77
79
|
return this.filterService.filters;
|
|
@@ -81,11 +83,11 @@ export class FilterComponent {
|
|
|
81
83
|
*/
|
|
82
84
|
set value(value) {
|
|
83
85
|
const clonedValue = JSON.parse(JSON.stringify(value));
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
+
this._value = clonedValue;
|
|
87
|
+
this.setValue(this.value);
|
|
86
88
|
}
|
|
87
89
|
get value() {
|
|
88
|
-
return this.
|
|
90
|
+
return this._value;
|
|
89
91
|
}
|
|
90
92
|
ngOnInit() {
|
|
91
93
|
if (this.filters.length === 0) {
|
|
@@ -105,13 +107,13 @@ export class FilterComponent {
|
|
|
105
107
|
* @hidden
|
|
106
108
|
*/
|
|
107
109
|
getCurrentFilter() {
|
|
108
|
-
return this.
|
|
110
|
+
return this.filterService.normalizedValue;
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
113
|
* @hidden
|
|
112
114
|
*/
|
|
113
115
|
onValueChange() {
|
|
114
|
-
this.valueChange.emit(this.filterService.
|
|
116
|
+
this.valueChange.emit(this.filterService.normalizedValue);
|
|
115
117
|
}
|
|
116
118
|
normalizeFilter(filterDescriptor) {
|
|
117
119
|
const foundFilter = this.filterService.filters.find((filter) => filter.field === filterDescriptor.field);
|
|
@@ -130,12 +132,22 @@ export class FilterComponent {
|
|
|
130
132
|
if (foundFilter.editor === 'date' && filterDescriptor.value) {
|
|
131
133
|
filterDescriptor.value = new Date(filterDescriptor.value);
|
|
132
134
|
}
|
|
133
|
-
if (!filterDescriptor.value
|
|
135
|
+
if (!isPresent(filterDescriptor.value)) {
|
|
136
|
+
filterDescriptor.value = null;
|
|
137
|
+
}
|
|
138
|
+
if (nullOperators.indexOf(filterDescriptor.operator) >= 0) {
|
|
134
139
|
filterDescriptor.value = null;
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
setValue(items) {
|
|
143
|
+
this.normalizeValue(items);
|
|
144
|
+
this.filterService.normalizedValue = items;
|
|
145
|
+
}
|
|
146
|
+
normalizeValue(items) {
|
|
147
|
+
if (!this.filterService.filters.length) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
items.filters.forEach((item) => {
|
|
139
151
|
if (item.filters) {
|
|
140
152
|
this.normalizeValue(item);
|
|
141
153
|
}
|
|
@@ -278,7 +290,7 @@ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
278
290
|
</li>
|
|
279
291
|
</ul>
|
|
280
292
|
</div>
|
|
281
|
-
`, isInline: true, components: [{ type: i3.FilterGroupComponent, selector: "kendo-filter-group", inputs: ["index", "currentItem"], outputs: ["valueChange"] }], directives: [{ type: i4.LocalizedMessagesDirective, selector: "[kendoFilterLocalizedMessages]" }] });
|
|
293
|
+
`, isInline: true, components: [{ type: i3.FilterGroupComponent, selector: "kendo-filter-group", inputs: ["index", "currentItem"], outputs: ["valueChange"] }], directives: [{ type: i4.LocalizedMessagesDirective, selector: "[kendoFilterLocalizedMessages]" }] });
|
|
282
294
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterComponent, decorators: [{
|
|
283
295
|
type: Component,
|
|
284
296
|
args: [{
|
|
@@ -416,7 +428,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
416
428
|
</li>
|
|
417
429
|
</ul>
|
|
418
430
|
</div>
|
|
419
|
-
`
|
|
431
|
+
`
|
|
420
432
|
}]
|
|
421
433
|
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { direction: [{
|
|
422
434
|
type: HostBinding,
|
|
@@ -9,9 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
*/
|
|
10
10
|
export class FilterService {
|
|
11
11
|
constructor() {
|
|
12
|
-
this.value = { filters: [], logic: 'or' };
|
|
13
12
|
this.filters = [];
|
|
14
|
-
this.isEditorDisabled = false;
|
|
15
13
|
}
|
|
16
14
|
addFilterGroup(item) {
|
|
17
15
|
let filterGroup = { logic: 'or', filters: [] };
|
|
@@ -23,7 +21,7 @@ export class FilterService {
|
|
|
23
21
|
}
|
|
24
22
|
remove(item, positionIndex, parentItem) {
|
|
25
23
|
if (!parentItem) {
|
|
26
|
-
parentItem = this.
|
|
24
|
+
parentItem = this.normalizedValue;
|
|
27
25
|
}
|
|
28
26
|
if (item === parentItem) {
|
|
29
27
|
parentItem.filters = [];
|
|
@@ -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: 1652946928,
|
|
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
|
};
|
package/esm2015/util.js
CHANGED