@progress/kendo-angular-filter 0.1.3 → 0.1.5
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/dist/cdn/js/kendo-angular-filter.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/editors/boolean-editor.component.js +26 -6
- package/dist/es/filter-expression.component.js +20 -9
- package/dist/es/filter-group.component.js +21 -6
- package/dist/es/filter.service.js +2 -41
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.js +7 -0
- package/dist/es2015/editors/boolean-editor.component.d.ts +14 -2
- package/dist/es2015/editors/boolean-editor.component.js +24 -5
- package/dist/es2015/filter-expression.component.d.ts +6 -3
- package/dist/es2015/filter-expression.component.js +19 -9
- package/dist/es2015/filter-group.component.d.ts +11 -4
- package/dist/es2015/filter-group.component.js +20 -6
- package/dist/es2015/filter.service.d.ts +0 -26
- package/dist/es2015/filter.service.js +5 -25
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/util.d.ts +7 -0
- package/dist/es2015/util.js +7 -0
- package/dist/fesm2015/index.js +99 -68
- package/dist/fesm5/index.js +102 -87
- package/dist/npm/editors/boolean-editor.component.js +25 -5
- package/dist/npm/filter-expression.component.js +18 -7
- package/dist/npm/filter-group.component.js +20 -5
- package/dist/npm/filter.service.js +2 -41
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/util.js +7 -0
- package/dist/systemjs/kendo-angular-filter.js +1 -1
- package/package.json +2 -1
package/dist/fesm2015/index.js
CHANGED
|
@@ -13,6 +13,46 @@ import { LabelModule } from '@progress/kendo-angular-label';
|
|
|
13
13
|
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
14
14
|
import { DateInputsModule } from '@progress/kendo-angular-dateinputs';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
let FilterService = class FilterService {
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
constructor() {
|
|
24
|
+
this.value = { filters: [], logic: 'or' };
|
|
25
|
+
this.filters = [];
|
|
26
|
+
this.isEditorDisabled = false;
|
|
27
|
+
}
|
|
28
|
+
addFilterGroup(item) {
|
|
29
|
+
let filterGroup = { logic: 'or', filters: [] };
|
|
30
|
+
item.filters.push(filterGroup);
|
|
31
|
+
}
|
|
32
|
+
addFilterExpression(item) {
|
|
33
|
+
let filterExpression = { operator: 'eq', value: null, field: null };
|
|
34
|
+
item.filters.push(filterExpression);
|
|
35
|
+
}
|
|
36
|
+
remove(item, positionIndex, parentItem) {
|
|
37
|
+
if (!parentItem) {
|
|
38
|
+
parentItem = this.value;
|
|
39
|
+
}
|
|
40
|
+
if (item === parentItem) {
|
|
41
|
+
parentItem.filters = [];
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let index = parentItem.filters.indexOf(item);
|
|
45
|
+
if (index >= 0 && index === positionIndex) {
|
|
46
|
+
parentItem.filters = parentItem.filters.filter((i) => i !== item);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
parentItem.filters.forEach((filter) => filter.filters && this.remove(item, positionIndex, filter));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
FilterService = __decorate([
|
|
53
|
+
Injectable()
|
|
54
|
+
], FilterService);
|
|
55
|
+
|
|
16
56
|
/**
|
|
17
57
|
* @hidden
|
|
18
58
|
*/
|
|
@@ -90,7 +130,6 @@ const isFilterEditor = (editorType) => {
|
|
|
90
130
|
const supportedEditorTypes = ['string', 'number', 'boolean', 'date'];
|
|
91
131
|
return supportedEditorTypes.indexOf(editorType) >= 0;
|
|
92
132
|
};
|
|
93
|
-
|
|
94
133
|
/**
|
|
95
134
|
* @hidden
|
|
96
135
|
*/
|
|
@@ -98,56 +137,6 @@ const localizeOperators = operators => localization => Object.keys(operators).ma
|
|
|
98
137
|
text: localization.get(key),
|
|
99
138
|
value: operators[key]
|
|
100
139
|
}));
|
|
101
|
-
/**
|
|
102
|
-
* @hidden
|
|
103
|
-
*/
|
|
104
|
-
let FilterService = class FilterService {
|
|
105
|
-
constructor(localization) {
|
|
106
|
-
this.localization = localization;
|
|
107
|
-
this.value = { filters: [], logic: 'or' };
|
|
108
|
-
this.filters = [];
|
|
109
|
-
this.isEditorDisabled = false;
|
|
110
|
-
}
|
|
111
|
-
get defaultNumericOperators() {
|
|
112
|
-
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
113
|
-
}
|
|
114
|
-
get defaultStringOperators() {
|
|
115
|
-
return localizeOperators(defaultStringOperators)(this.localization);
|
|
116
|
-
}
|
|
117
|
-
get defaultDateOperators() {
|
|
118
|
-
return localizeOperators(defaultDateOperators)(this.localization);
|
|
119
|
-
}
|
|
120
|
-
get logicOperators() {
|
|
121
|
-
return localizeOperators(logicOperators)(this.localization);
|
|
122
|
-
}
|
|
123
|
-
addFilterGroup(item) {
|
|
124
|
-
let filterGroup = { logic: 'or', filters: [] };
|
|
125
|
-
item.filters.push(filterGroup);
|
|
126
|
-
}
|
|
127
|
-
addFilterExpression(item) {
|
|
128
|
-
let filterExpression = { operator: 'eq', value: null, field: null };
|
|
129
|
-
item.filters.push(filterExpression);
|
|
130
|
-
}
|
|
131
|
-
remove(item, positionIndex, parentItem) {
|
|
132
|
-
if (!parentItem) {
|
|
133
|
-
parentItem = this.value;
|
|
134
|
-
}
|
|
135
|
-
if (item === parentItem) {
|
|
136
|
-
parentItem.filters = [];
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
let index = parentItem.filters.indexOf(item);
|
|
140
|
-
if (index >= 0 && index === positionIndex) {
|
|
141
|
-
parentItem.filters = parentItem.filters.filter((i) => i !== item);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
parentItem.filters.forEach((filter) => filter.filters && this.remove(item, positionIndex, filter));
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
FilterService = __decorate([
|
|
148
|
-
Injectable(),
|
|
149
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
150
|
-
], FilterService);
|
|
151
140
|
|
|
152
141
|
/**
|
|
153
142
|
* @hidden
|
|
@@ -156,7 +145,7 @@ const packageMetadata = {
|
|
|
156
145
|
name: '@progress/kendo-angular-filter',
|
|
157
146
|
productName: 'Kendo UI for Angular',
|
|
158
147
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
159
|
-
publishDate:
|
|
148
|
+
publishDate: 1645017362,
|
|
160
149
|
version: '',
|
|
161
150
|
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'
|
|
162
151
|
};
|
|
@@ -476,14 +465,33 @@ AriaLabelValueDirective = __decorate([
|
|
|
476
465
|
* @hidden
|
|
477
466
|
*/
|
|
478
467
|
let FilterBooleanEditorComponent = class FilterBooleanEditorComponent {
|
|
479
|
-
constructor(localization) {
|
|
468
|
+
constructor(localization, cdr) {
|
|
480
469
|
this.localization = localization;
|
|
470
|
+
this.cdr = cdr;
|
|
481
471
|
this.valueChange = new EventEmitter();
|
|
482
|
-
this.items =
|
|
472
|
+
this.items = this.getValueItems();
|
|
473
|
+
this.defaultItem = this.getDefaultItem();
|
|
474
|
+
}
|
|
475
|
+
ngOnInit() {
|
|
476
|
+
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
477
|
+
this.defaultItem = this.getDefaultItem();
|
|
478
|
+
this.items = this.getValueItems();
|
|
479
|
+
this.cdr.detectChanges();
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
getDefaultItem() {
|
|
483
|
+
return { text: this.localization.get("filterBooleanAll"), value: null };
|
|
484
|
+
}
|
|
485
|
+
getValueItems() {
|
|
486
|
+
return [
|
|
483
487
|
{ text: this.localization.get("filterIsTrue"), value: true },
|
|
484
488
|
{ text: this.localization.get("filterIsFalse"), value: false }
|
|
485
489
|
];
|
|
486
|
-
|
|
490
|
+
}
|
|
491
|
+
ngOnDestroy() {
|
|
492
|
+
if (this.localizationSubscription) {
|
|
493
|
+
this.localizationSubscription.unsubscribe();
|
|
494
|
+
}
|
|
487
495
|
}
|
|
488
496
|
messageFor(key) {
|
|
489
497
|
return this.localization.get(key);
|
|
@@ -515,7 +523,7 @@ FilterBooleanEditorComponent = __decorate([
|
|
|
515
523
|
</kendo-dropdownlist>
|
|
516
524
|
`
|
|
517
525
|
}),
|
|
518
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
526
|
+
__metadata("design:paramtypes", [LocalizationService, ChangeDetectorRef])
|
|
519
527
|
], FilterBooleanEditorComponent);
|
|
520
528
|
|
|
521
529
|
/**
|
|
@@ -712,9 +720,10 @@ FilterExpressionOperatorsComponent = __decorate([
|
|
|
712
720
|
* @hidden
|
|
713
721
|
*/
|
|
714
722
|
let FilterExpressionComponent = class FilterExpressionComponent {
|
|
715
|
-
constructor(filterService, localization) {
|
|
723
|
+
constructor(filterService, localization, cdr) {
|
|
716
724
|
this.filterService = filterService;
|
|
717
725
|
this.localization = localization;
|
|
726
|
+
this.cdr = cdr;
|
|
718
727
|
this.valueChange = new EventEmitter();
|
|
719
728
|
this.operators = [];
|
|
720
729
|
this.filters = [];
|
|
@@ -723,15 +732,24 @@ let FilterExpressionComponent = class FilterExpressionComponent {
|
|
|
723
732
|
}
|
|
724
733
|
ngOnInit() {
|
|
725
734
|
this.filters = this.filterService.filters;
|
|
735
|
+
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
726
736
|
if (this.currentItem.field) {
|
|
727
|
-
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
728
737
|
this.setOperators(foundFilter);
|
|
729
738
|
}
|
|
739
|
+
const defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
730
740
|
if (!this.currentItem.field) {
|
|
731
741
|
this.currentItem.field = this.filterService.filters[0].field;
|
|
732
|
-
const defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
733
742
|
this.setOperators(defaultFilter);
|
|
734
743
|
}
|
|
744
|
+
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
745
|
+
this.setOperators(foundFilter || defaultFilter);
|
|
746
|
+
this.cdr.detectChanges();
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
ngOnDestroy() {
|
|
750
|
+
if (this.localizationSubscription) {
|
|
751
|
+
this.localizationSubscription.unsubscribe();
|
|
752
|
+
}
|
|
735
753
|
}
|
|
736
754
|
normalizeOperators(filterEditor, operators) {
|
|
737
755
|
let result = [];
|
|
@@ -765,11 +783,11 @@ let FilterExpressionComponent = class FilterExpressionComponent {
|
|
|
765
783
|
getDefaultOperators(operatorsType) {
|
|
766
784
|
switch (operatorsType) {
|
|
767
785
|
case 'string':
|
|
768
|
-
return this.
|
|
786
|
+
return localizeOperators(defaultStringOperators)(this.localization);
|
|
769
787
|
case 'number':
|
|
770
|
-
return this.
|
|
788
|
+
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
771
789
|
case 'date':
|
|
772
|
-
return this.
|
|
790
|
+
return localizeOperators(defaultDateOperators)(this.localization);
|
|
773
791
|
default:
|
|
774
792
|
break;
|
|
775
793
|
}
|
|
@@ -856,26 +874,39 @@ FilterExpressionComponent = __decorate([
|
|
|
856
874
|
</div>
|
|
857
875
|
`
|
|
858
876
|
}),
|
|
859
|
-
__metadata("design:paramtypes", [FilterService, LocalizationService])
|
|
877
|
+
__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
860
878
|
], FilterExpressionComponent);
|
|
861
879
|
|
|
862
880
|
/**
|
|
863
881
|
* @hidden
|
|
864
882
|
*/
|
|
865
883
|
let FilterGroupComponent = class FilterGroupComponent {
|
|
866
|
-
constructor(filterService, localization) {
|
|
884
|
+
constructor(filterService, localization, cdr) {
|
|
867
885
|
this.filterService = filterService;
|
|
868
886
|
this.localization = localization;
|
|
887
|
+
this.cdr = cdr;
|
|
869
888
|
this.index = 0;
|
|
870
889
|
this.currentItem = {
|
|
871
890
|
logic: 'or',
|
|
872
891
|
filters: []
|
|
873
892
|
};
|
|
874
893
|
this.valueChange = new EventEmitter();
|
|
875
|
-
this.
|
|
894
|
+
this.operators = [];
|
|
876
895
|
}
|
|
877
896
|
ngOnInit() {
|
|
878
|
-
this.
|
|
897
|
+
this.operators = this.getLogicOperators();
|
|
898
|
+
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
899
|
+
this.operators = this.getLogicOperators();
|
|
900
|
+
this.cdr.detectChanges();
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
ngOnDestroy() {
|
|
904
|
+
if (this.localizationSubscription) {
|
|
905
|
+
this.localizationSubscription.unsubscribe();
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
getLogicOperators() {
|
|
909
|
+
return localizeOperators(logicOperators)(this.localization);
|
|
879
910
|
}
|
|
880
911
|
messageFor(key) {
|
|
881
912
|
return this.localization.get(key);
|
|
@@ -920,7 +951,7 @@ FilterGroupComponent = __decorate([
|
|
|
920
951
|
<div class="k-filter-toolbar-item">
|
|
921
952
|
<div class="k-widget k-button-group" role="group">
|
|
922
953
|
<button
|
|
923
|
-
*ngFor="let operator of
|
|
954
|
+
*ngFor="let operator of operators"
|
|
924
955
|
kendoButton
|
|
925
956
|
[ngClass]="{'k-group-start': operator.value === 'and', 'k-group-end': operator.value === 'or'}"
|
|
926
957
|
[selected]="currentItem.logic === operator.value"
|
|
@@ -979,7 +1010,7 @@ FilterGroupComponent = __decorate([
|
|
|
979
1010
|
</ul>
|
|
980
1011
|
`
|
|
981
1012
|
}),
|
|
982
|
-
__metadata("design:paramtypes", [FilterService, LocalizationService])
|
|
1013
|
+
__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
983
1014
|
], FilterGroupComponent);
|
|
984
1015
|
|
|
985
1016
|
/**
|
package/dist/fesm5/index.js
CHANGED
|
@@ -13,6 +13,45 @@ import { LabelModule } from '@progress/kendo-angular-label';
|
|
|
13
13
|
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
14
14
|
import { DateInputsModule } from '@progress/kendo-angular-dateinputs';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
var FilterService = /** @class */ (function () {
|
|
20
|
+
function FilterService() {
|
|
21
|
+
this.value = { filters: [], logic: 'or' };
|
|
22
|
+
this.filters = [];
|
|
23
|
+
this.isEditorDisabled = false;
|
|
24
|
+
}
|
|
25
|
+
FilterService.prototype.addFilterGroup = function (item) {
|
|
26
|
+
var filterGroup = { logic: 'or', filters: [] };
|
|
27
|
+
item.filters.push(filterGroup);
|
|
28
|
+
};
|
|
29
|
+
FilterService.prototype.addFilterExpression = function (item) {
|
|
30
|
+
var filterExpression = { operator: 'eq', value: null, field: null };
|
|
31
|
+
item.filters.push(filterExpression);
|
|
32
|
+
};
|
|
33
|
+
FilterService.prototype.remove = function (item, positionIndex, parentItem) {
|
|
34
|
+
var _this = this;
|
|
35
|
+
if (!parentItem) {
|
|
36
|
+
parentItem = this.value;
|
|
37
|
+
}
|
|
38
|
+
if (item === parentItem) {
|
|
39
|
+
parentItem.filters = [];
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var index = parentItem.filters.indexOf(item);
|
|
43
|
+
if (index >= 0 && index === positionIndex) {
|
|
44
|
+
parentItem.filters = parentItem.filters.filter(function (i) { return i !== item; });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
parentItem.filters.forEach(function (filter) { return filter.filters && _this.remove(item, positionIndex, filter); });
|
|
48
|
+
};
|
|
49
|
+
FilterService = __decorate([
|
|
50
|
+
Injectable()
|
|
51
|
+
], FilterService);
|
|
52
|
+
return FilterService;
|
|
53
|
+
}());
|
|
54
|
+
|
|
16
55
|
/**
|
|
17
56
|
* @hidden
|
|
18
57
|
*/
|
|
@@ -90,7 +129,6 @@ var isFilterEditor = function (editorType) {
|
|
|
90
129
|
var supportedEditorTypes = ['string', 'number', 'boolean', 'date'];
|
|
91
130
|
return supportedEditorTypes.indexOf(editorType) >= 0;
|
|
92
131
|
};
|
|
93
|
-
|
|
94
132
|
/**
|
|
95
133
|
* @hidden
|
|
96
134
|
*/
|
|
@@ -98,74 +136,6 @@ var localizeOperators = function (operators) { return function (localization) {
|
|
|
98
136
|
text: localization.get(key),
|
|
99
137
|
value: operators[key]
|
|
100
138
|
}); }); }; };
|
|
101
|
-
/**
|
|
102
|
-
* @hidden
|
|
103
|
-
*/
|
|
104
|
-
var FilterService = /** @class */ (function () {
|
|
105
|
-
function FilterService(localization) {
|
|
106
|
-
this.localization = localization;
|
|
107
|
-
this.value = { filters: [], logic: 'or' };
|
|
108
|
-
this.filters = [];
|
|
109
|
-
this.isEditorDisabled = false;
|
|
110
|
-
}
|
|
111
|
-
Object.defineProperty(FilterService.prototype, "defaultNumericOperators", {
|
|
112
|
-
get: function () {
|
|
113
|
-
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
114
|
-
},
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true
|
|
117
|
-
});
|
|
118
|
-
Object.defineProperty(FilterService.prototype, "defaultStringOperators", {
|
|
119
|
-
get: function () {
|
|
120
|
-
return localizeOperators(defaultStringOperators)(this.localization);
|
|
121
|
-
},
|
|
122
|
-
enumerable: true,
|
|
123
|
-
configurable: true
|
|
124
|
-
});
|
|
125
|
-
Object.defineProperty(FilterService.prototype, "defaultDateOperators", {
|
|
126
|
-
get: function () {
|
|
127
|
-
return localizeOperators(defaultDateOperators)(this.localization);
|
|
128
|
-
},
|
|
129
|
-
enumerable: true,
|
|
130
|
-
configurable: true
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(FilterService.prototype, "logicOperators", {
|
|
133
|
-
get: function () {
|
|
134
|
-
return localizeOperators(logicOperators)(this.localization);
|
|
135
|
-
},
|
|
136
|
-
enumerable: true,
|
|
137
|
-
configurable: true
|
|
138
|
-
});
|
|
139
|
-
FilterService.prototype.addFilterGroup = function (item) {
|
|
140
|
-
var filterGroup = { logic: 'or', filters: [] };
|
|
141
|
-
item.filters.push(filterGroup);
|
|
142
|
-
};
|
|
143
|
-
FilterService.prototype.addFilterExpression = function (item) {
|
|
144
|
-
var filterExpression = { operator: 'eq', value: null, field: null };
|
|
145
|
-
item.filters.push(filterExpression);
|
|
146
|
-
};
|
|
147
|
-
FilterService.prototype.remove = function (item, positionIndex, parentItem) {
|
|
148
|
-
var _this = this;
|
|
149
|
-
if (!parentItem) {
|
|
150
|
-
parentItem = this.value;
|
|
151
|
-
}
|
|
152
|
-
if (item === parentItem) {
|
|
153
|
-
parentItem.filters = [];
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
var index = parentItem.filters.indexOf(item);
|
|
157
|
-
if (index >= 0 && index === positionIndex) {
|
|
158
|
-
parentItem.filters = parentItem.filters.filter(function (i) { return i !== item; });
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
parentItem.filters.forEach(function (filter) { return filter.filters && _this.remove(item, positionIndex, filter); });
|
|
162
|
-
};
|
|
163
|
-
FilterService = __decorate([
|
|
164
|
-
Injectable(),
|
|
165
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
166
|
-
], FilterService);
|
|
167
|
-
return FilterService;
|
|
168
|
-
}());
|
|
169
139
|
|
|
170
140
|
/**
|
|
171
141
|
* @hidden
|
|
@@ -174,7 +144,7 @@ var packageMetadata = {
|
|
|
174
144
|
name: '@progress/kendo-angular-filter',
|
|
175
145
|
productName: 'Kendo UI for Angular',
|
|
176
146
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
177
|
-
publishDate:
|
|
147
|
+
publishDate: 1645017362,
|
|
178
148
|
version: '',
|
|
179
149
|
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'
|
|
180
150
|
};
|
|
@@ -382,15 +352,35 @@ var AriaLabelValueDirective = /** @class */ (function () {
|
|
|
382
352
|
* @hidden
|
|
383
353
|
*/
|
|
384
354
|
var FilterBooleanEditorComponent = /** @class */ (function () {
|
|
385
|
-
function FilterBooleanEditorComponent(localization) {
|
|
355
|
+
function FilterBooleanEditorComponent(localization, cdr) {
|
|
386
356
|
this.localization = localization;
|
|
357
|
+
this.cdr = cdr;
|
|
387
358
|
this.valueChange = new EventEmitter();
|
|
388
|
-
this.items =
|
|
359
|
+
this.items = this.getValueItems();
|
|
360
|
+
this.defaultItem = this.getDefaultItem();
|
|
361
|
+
}
|
|
362
|
+
FilterBooleanEditorComponent.prototype.ngOnInit = function () {
|
|
363
|
+
var _this = this;
|
|
364
|
+
this.localizationSubscription = this.localization.changes.subscribe(function () {
|
|
365
|
+
_this.defaultItem = _this.getDefaultItem();
|
|
366
|
+
_this.items = _this.getValueItems();
|
|
367
|
+
_this.cdr.detectChanges();
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
FilterBooleanEditorComponent.prototype.getDefaultItem = function () {
|
|
371
|
+
return { text: this.localization.get("filterBooleanAll"), value: null };
|
|
372
|
+
};
|
|
373
|
+
FilterBooleanEditorComponent.prototype.getValueItems = function () {
|
|
374
|
+
return [
|
|
389
375
|
{ text: this.localization.get("filterIsTrue"), value: true },
|
|
390
376
|
{ text: this.localization.get("filterIsFalse"), value: false }
|
|
391
377
|
];
|
|
392
|
-
|
|
393
|
-
|
|
378
|
+
};
|
|
379
|
+
FilterBooleanEditorComponent.prototype.ngOnDestroy = function () {
|
|
380
|
+
if (this.localizationSubscription) {
|
|
381
|
+
this.localizationSubscription.unsubscribe();
|
|
382
|
+
}
|
|
383
|
+
};
|
|
394
384
|
FilterBooleanEditorComponent.prototype.messageFor = function (key) {
|
|
395
385
|
return this.localization.get(key);
|
|
396
386
|
};
|
|
@@ -407,7 +397,7 @@ var FilterBooleanEditorComponent = /** @class */ (function () {
|
|
|
407
397
|
selector: 'kendo-filter-boolean-editor',
|
|
408
398
|
template: "\n <kendo-dropdownlist\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [data]=\"items\"\n [defaultItem]=\"defaultItem\"\n [valuePrimitive]=\"true\"\n textField=\"text\"\n valueField=\"value\"\n >\n </kendo-dropdownlist>\n "
|
|
409
399
|
}),
|
|
410
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
400
|
+
__metadata("design:paramtypes", [LocalizationService, ChangeDetectorRef])
|
|
411
401
|
], FilterBooleanEditorComponent);
|
|
412
402
|
return FilterBooleanEditorComponent;
|
|
413
403
|
}());
|
|
@@ -566,9 +556,10 @@ var FilterExpressionOperatorsComponent = /** @class */ (function () {
|
|
|
566
556
|
* @hidden
|
|
567
557
|
*/
|
|
568
558
|
var FilterExpressionComponent = /** @class */ (function () {
|
|
569
|
-
function FilterExpressionComponent(filterService, localization) {
|
|
559
|
+
function FilterExpressionComponent(filterService, localization, cdr) {
|
|
570
560
|
this.filterService = filterService;
|
|
571
561
|
this.localization = localization;
|
|
562
|
+
this.cdr = cdr;
|
|
572
563
|
this.valueChange = new EventEmitter();
|
|
573
564
|
this.operators = [];
|
|
574
565
|
this.filters = [];
|
|
@@ -576,16 +567,26 @@ var FilterExpressionComponent = /** @class */ (function () {
|
|
|
576
567
|
this.isEditorDisabled = false;
|
|
577
568
|
}
|
|
578
569
|
FilterExpressionComponent.prototype.ngOnInit = function () {
|
|
570
|
+
var _this = this;
|
|
579
571
|
this.filters = this.filterService.filters;
|
|
572
|
+
var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
580
573
|
if (this.currentItem.field) {
|
|
581
|
-
var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
582
574
|
this.setOperators(foundFilter);
|
|
583
575
|
}
|
|
576
|
+
var defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
584
577
|
if (!this.currentItem.field) {
|
|
585
578
|
this.currentItem.field = this.filterService.filters[0].field;
|
|
586
|
-
var defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
587
579
|
this.setOperators(defaultFilter);
|
|
588
580
|
}
|
|
581
|
+
this.localizationSubscription = this.localization.changes.subscribe(function () {
|
|
582
|
+
_this.setOperators(foundFilter || defaultFilter);
|
|
583
|
+
_this.cdr.detectChanges();
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
FilterExpressionComponent.prototype.ngOnDestroy = function () {
|
|
587
|
+
if (this.localizationSubscription) {
|
|
588
|
+
this.localizationSubscription.unsubscribe();
|
|
589
|
+
}
|
|
589
590
|
};
|
|
590
591
|
FilterExpressionComponent.prototype.normalizeOperators = function (filterEditor, operators) {
|
|
591
592
|
var result = [];
|
|
@@ -619,11 +620,11 @@ var FilterExpressionComponent = /** @class */ (function () {
|
|
|
619
620
|
FilterExpressionComponent.prototype.getDefaultOperators = function (operatorsType) {
|
|
620
621
|
switch (operatorsType) {
|
|
621
622
|
case 'string':
|
|
622
|
-
return this.
|
|
623
|
+
return localizeOperators(defaultStringOperators)(this.localization);
|
|
623
624
|
case 'number':
|
|
624
|
-
return this.
|
|
625
|
+
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
625
626
|
case 'date':
|
|
626
|
-
return this.
|
|
627
|
+
return localizeOperators(defaultDateOperators)(this.localization);
|
|
627
628
|
default:
|
|
628
629
|
break;
|
|
629
630
|
}
|
|
@@ -669,7 +670,7 @@ var FilterExpressionComponent = /** @class */ (function () {
|
|
|
669
670
|
selector: 'kendo-filter-expression',
|
|
670
671
|
template: "\n <div class=\"k-filter-toolbar\" role=\"group\" [attr.aria-label]=\"messageFor('filterAriaLabel')\">\n <div class=\"k-toolbar\">\n <div class=\"k-filter-toolbar-item k-filter-field\">\n <kendo-dropdownlist\n [kendoAriaLabelValue]=\"messageFor('filterFieldAriaLabel')\"\n [title]=\"messageFor('filterExpressionFilters')\"\n [data]=\"filters\"\n textField=\"title\"\n valueField=\"field\"\n [value]=\"currentItem.field\"\n [valuePrimitive]=\"true\"\n (valueChange)=\"filterValueChange($event)\">\n </kendo-dropdownlist>\n </div>\n <div *ngIf=\"!isBoolean\" class=\"k-filter-toolbar-item k-filter-operator\">\n <kendo-filter-expression-operators\n [currentItem]=\"currentItem\"\n [operators]=\"operators\"\n (valueChange)=\"valueChange.emit();\">\n </kendo-filter-expression-operators>\n </div>\n\n <ng-container [ngSwitch]=\"getEditorType()\">\n <kendo-filter-text-editor *ngSwitchCase=\"'string'\" [currentItem]=\"currentItem\" (valueChange)=\"valueChange.emit()\"></kendo-filter-text-editor>\n <kendo-filter-numeric-editor *ngSwitchCase=\"'number'\" [currentItem]=\"currentItem\" (valueChange)=\"valueChange.emit()\"></kendo-filter-numeric-editor>\n <kendo-filter-boolean-editor *ngSwitchCase=\"'boolean'\" [currentItem]=\"currentItem\" (valueChange)=\"valueChange.emit()\"></kendo-filter-boolean-editor>\n <kendo-filter-date-editor *ngSwitchCase=\"'date'\" [currentItem]=\"currentItem\" (valueChange)=\"valueChange.emit()\"></kendo-filter-date-editor>\n </ng-container>\n\n <div class=\"k-filter-toolbar-item\">\n <button\n kendoButton\n icon=\"close\"\n fillMode=\"flat\"\n [title]=\"messageFor('remove')\"\n (click)=\"removeFilterExpression()\">\n </button>\n </div>\n </div>\n </div>\n "
|
|
671
672
|
}),
|
|
672
|
-
__metadata("design:paramtypes", [FilterService, LocalizationService])
|
|
673
|
+
__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
673
674
|
], FilterExpressionComponent);
|
|
674
675
|
return FilterExpressionComponent;
|
|
675
676
|
}());
|
|
@@ -678,19 +679,33 @@ var FilterExpressionComponent = /** @class */ (function () {
|
|
|
678
679
|
* @hidden
|
|
679
680
|
*/
|
|
680
681
|
var FilterGroupComponent = /** @class */ (function () {
|
|
681
|
-
function FilterGroupComponent(filterService, localization) {
|
|
682
|
+
function FilterGroupComponent(filterService, localization, cdr) {
|
|
682
683
|
this.filterService = filterService;
|
|
683
684
|
this.localization = localization;
|
|
685
|
+
this.cdr = cdr;
|
|
684
686
|
this.index = 0;
|
|
685
687
|
this.currentItem = {
|
|
686
688
|
logic: 'or',
|
|
687
689
|
filters: []
|
|
688
690
|
};
|
|
689
691
|
this.valueChange = new EventEmitter();
|
|
690
|
-
this.
|
|
692
|
+
this.operators = [];
|
|
691
693
|
}
|
|
692
694
|
FilterGroupComponent.prototype.ngOnInit = function () {
|
|
693
|
-
|
|
695
|
+
var _this = this;
|
|
696
|
+
this.operators = this.getLogicOperators();
|
|
697
|
+
this.localizationSubscription = this.localization.changes.subscribe(function () {
|
|
698
|
+
_this.operators = _this.getLogicOperators();
|
|
699
|
+
_this.cdr.detectChanges();
|
|
700
|
+
});
|
|
701
|
+
};
|
|
702
|
+
FilterGroupComponent.prototype.ngOnDestroy = function () {
|
|
703
|
+
if (this.localizationSubscription) {
|
|
704
|
+
this.localizationSubscription.unsubscribe();
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
FilterGroupComponent.prototype.getLogicOperators = function () {
|
|
708
|
+
return localizeOperators(logicOperators)(this.localization);
|
|
694
709
|
};
|
|
695
710
|
FilterGroupComponent.prototype.messageFor = function (key) {
|
|
696
711
|
return this.localization.get(key);
|
|
@@ -728,9 +743,9 @@ var FilterGroupComponent = /** @class */ (function () {
|
|
|
728
743
|
FilterGroupComponent = __decorate([
|
|
729
744
|
Component({
|
|
730
745
|
selector: 'kendo-filter-group',
|
|
731
|
-
template: "\n <div class=\"k-filter-toolbar\" role=\"toolbar\" [attr.aria-label]=\"messageFor('filterToolbarAriaLabel')\">\n <div class=\"k-toolbar\">\n <div class=\"k-filter-toolbar-item\">\n <div class=\"k-widget k-button-group\" role=\"group\">\n <button\n *ngFor=\"let operator of
|
|
746
|
+
template: "\n <div class=\"k-filter-toolbar\" role=\"toolbar\" [attr.aria-label]=\"messageFor('filterToolbarAriaLabel')\">\n <div class=\"k-toolbar\">\n <div class=\"k-filter-toolbar-item\">\n <div class=\"k-widget k-button-group\" role=\"group\">\n <button\n *ngFor=\"let operator of operators\"\n kendoButton\n [ngClass]=\"{'k-group-start': operator.value === 'and', 'k-group-end': operator.value === 'or'}\"\n [selected]=\"currentItem.logic === operator.value\"\n [title]=\"operator.text\"\n (click)=\"selectedChange(operator.value)\"\n >\n {{operator.text}}\n </button>\n </div>\n </div>\n <div class=\"k-filter-toolbar-item\">\n <button\n kendoButton\n [title]=\"messageFor('addFilter')\"\n icon=\"filter-add-expression\"\n (click)=\"addFilterExpression()\">\n {{messageFor('addFilter')}}\n </button>\n </div>\n <div class=\"k-filter-toolbar-item\">\n <button\n kendoButton\n [title]=\"messageFor('addGroup')\"\n icon=\"filter-add-group\"\n (click)=\"addFilterGroup()\">\n {{messageFor('addGroup')}}\n </button>\n </div>\n <div class=\"k-filter-toolbar-item\">\n <button\n kendoButton\n icon=\"close\"\n fillMode=\"flat\"\n [title]=\"messageFor('remove')\"\n (click)=\"removeFilterGroup()\">\n </button>\n </div>\n </div>\n </div>\n\n <ul class=\"k-filter-lines\" *ngIf=\"currentItem.filters\">\n <ng-container *ngFor=\"let item of currentItem.filters; let i = index;\">\n <li class=\"k-filter-item\" *ngIf=\"!item.filters\">\n <kendo-filter-expression (valueChange)=\"valueChange.emit()\" [currentItem]=\"item\" [index]=\"i\">\n </kendo-filter-expression>\n </li>\n <li class=\"k-filter-item\" *ngIf=\"item.filters\" >\n <kendo-filter-group\n (valueChange)=\"valueChange.emit()\"\n [currentItem]=\"item\"\n [index]=\"i\"\n >\n </kendo-filter-group>\n </li>\n </ng-container>\n </ul>\n "
|
|
732
747
|
}),
|
|
733
|
-
__metadata("design:paramtypes", [FilterService, LocalizationService])
|
|
748
|
+
__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
|
|
734
749
|
], FilterGroupComponent);
|
|
735
750
|
return FilterGroupComponent;
|
|
736
751
|
}());
|
|
@@ -11,15 +11,35 @@ var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
|
11
11
|
* @hidden
|
|
12
12
|
*/
|
|
13
13
|
var FilterBooleanEditorComponent = /** @class */ (function () {
|
|
14
|
-
function FilterBooleanEditorComponent(localization) {
|
|
14
|
+
function FilterBooleanEditorComponent(localization, cdr) {
|
|
15
15
|
this.localization = localization;
|
|
16
|
+
this.cdr = cdr;
|
|
16
17
|
this.valueChange = new core_1.EventEmitter();
|
|
17
|
-
this.items =
|
|
18
|
+
this.items = this.getValueItems();
|
|
19
|
+
this.defaultItem = this.getDefaultItem();
|
|
20
|
+
}
|
|
21
|
+
FilterBooleanEditorComponent.prototype.ngOnInit = function () {
|
|
22
|
+
var _this = this;
|
|
23
|
+
this.localizationSubscription = this.localization.changes.subscribe(function () {
|
|
24
|
+
_this.defaultItem = _this.getDefaultItem();
|
|
25
|
+
_this.items = _this.getValueItems();
|
|
26
|
+
_this.cdr.detectChanges();
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
FilterBooleanEditorComponent.prototype.getDefaultItem = function () {
|
|
30
|
+
return { text: this.localization.get("filterBooleanAll"), value: null };
|
|
31
|
+
};
|
|
32
|
+
FilterBooleanEditorComponent.prototype.getValueItems = function () {
|
|
33
|
+
return [
|
|
18
34
|
{ text: this.localization.get("filterIsTrue"), value: true },
|
|
19
35
|
{ text: this.localization.get("filterIsFalse"), value: false }
|
|
20
36
|
];
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
};
|
|
38
|
+
FilterBooleanEditorComponent.prototype.ngOnDestroy = function () {
|
|
39
|
+
if (this.localizationSubscription) {
|
|
40
|
+
this.localizationSubscription.unsubscribe();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
23
43
|
FilterBooleanEditorComponent.prototype.messageFor = function (key) {
|
|
24
44
|
return this.localization.get(key);
|
|
25
45
|
};
|
|
@@ -36,7 +56,7 @@ var FilterBooleanEditorComponent = /** @class */ (function () {
|
|
|
36
56
|
selector: 'kendo-filter-boolean-editor',
|
|
37
57
|
template: "\n <kendo-dropdownlist\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [data]=\"items\"\n [defaultItem]=\"defaultItem\"\n [valuePrimitive]=\"true\"\n textField=\"text\"\n valueField=\"value\"\n >\n </kendo-dropdownlist>\n "
|
|
38
58
|
}),
|
|
39
|
-
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService])
|
|
59
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService, core_1.ChangeDetectorRef])
|
|
40
60
|
], FilterBooleanEditorComponent);
|
|
41
61
|
return FilterBooleanEditorComponent;
|
|
42
62
|
}());
|