@progress/kendo-angular-filter 15.0.2-develop.8 → 15.1.0-develop.1
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/esm2020/base-filter-row.component.mjs +1 -0
- package/esm2020/filter-group.component.mjs +23 -4
- package/esm2020/filter.component.mjs +40 -4
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-filter.mjs +66 -10
- package/fesm2020/progress-kendo-angular-filter.mjs +66 -10
- package/filter-group.component.d.ts +8 -0
- package/filter.component.d.ts +10 -1
- package/package.json +11 -11
- package/schematics/ngAdd/index.js +3 -3
|
@@ -19,6 +19,7 @@ export class BaseFilterRowComponent {
|
|
|
19
19
|
this.localization = localization;
|
|
20
20
|
this.renderer = renderer;
|
|
21
21
|
this.valueChange = new EventEmitter();
|
|
22
|
+
this.itemNumber = 0;
|
|
22
23
|
}
|
|
23
24
|
get toolbarElement() {
|
|
24
25
|
return this.element.nativeElement.querySelector('.k-toolbar');
|
|
@@ -40,11 +40,30 @@ export class FilterGroupComponent extends BaseFilterRowComponent {
|
|
|
40
40
|
logic: 'or',
|
|
41
41
|
filters: []
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
this.trackByFunction = (index) => {
|
|
47
|
+
return index;
|
|
48
|
+
};
|
|
43
49
|
this.operators = [];
|
|
44
50
|
}
|
|
45
51
|
get filterItems() {
|
|
46
52
|
return this._filterItems.toArray();
|
|
47
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
*/
|
|
57
|
+
handleExpressionValueChange(isRemoveOperation) {
|
|
58
|
+
if (isRemoveOperation) {
|
|
59
|
+
// due to tracking by index, the filters should first be set to [] so that all rerender afterwards
|
|
60
|
+
const filtersCopy = this.currentItem.filters;
|
|
61
|
+
this.currentItem.filters = [];
|
|
62
|
+
this.cdr.detectChanges();
|
|
63
|
+
this.currentItem.filters = filtersCopy;
|
|
64
|
+
}
|
|
65
|
+
this.valueChange.emit(isRemoveOperation);
|
|
66
|
+
}
|
|
48
67
|
ngOnInit() {
|
|
49
68
|
this.operators = this.getLogicOperators();
|
|
50
69
|
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
@@ -159,9 +178,9 @@ FilterGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
159
178
|
</div>
|
|
160
179
|
|
|
161
180
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
162
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
181
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
163
182
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
164
|
-
<kendo-filter-expression (valueChange)="
|
|
183
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
165
184
|
</kendo-filter-expression>
|
|
166
185
|
</li>
|
|
167
186
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -238,9 +257,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
238
257
|
</div>
|
|
239
258
|
|
|
240
259
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
241
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
260
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
242
261
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
243
|
-
<kendo-filter-expression (valueChange)="
|
|
262
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
244
263
|
</kendo-filter-expression>
|
|
245
264
|
</li>
|
|
246
265
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -66,6 +66,7 @@ export class FilterComponent {
|
|
|
66
66
|
*/
|
|
67
67
|
this.valueChange = new EventEmitter();
|
|
68
68
|
this._value = { filters: [], logic: 'and' };
|
|
69
|
+
this._currentFilter = { logic: 'and', filters: [] };
|
|
69
70
|
validatePackage(packageMetadata);
|
|
70
71
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
71
72
|
}
|
|
@@ -117,6 +118,11 @@ export class FilterComponent {
|
|
|
117
118
|
*/
|
|
118
119
|
set value(value) {
|
|
119
120
|
const clonedValue = JSON.parse(JSON.stringify(value));
|
|
121
|
+
if (this.filtersTypeChanged(this.value, clonedValue)) {
|
|
122
|
+
// due to tracking group items by index, the filters should first be set to [] when the value is changed programmatically
|
|
123
|
+
this.currentFilter.filters = [];
|
|
124
|
+
this.cdr.detectChanges();
|
|
125
|
+
}
|
|
120
126
|
this._value = clonedValue;
|
|
121
127
|
if (this.filters.length > 0) {
|
|
122
128
|
this.setValue(this.value);
|
|
@@ -170,8 +176,14 @@ export class FilterComponent {
|
|
|
170
176
|
/**
|
|
171
177
|
* @hidden
|
|
172
178
|
*/
|
|
173
|
-
|
|
174
|
-
return this.
|
|
179
|
+
get currentFilter() {
|
|
180
|
+
return this._currentFilter;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* @hidden
|
|
184
|
+
*/
|
|
185
|
+
set currentFilter(value) {
|
|
186
|
+
this._currentFilter = value;
|
|
175
187
|
}
|
|
176
188
|
/**
|
|
177
189
|
* @hidden
|
|
@@ -224,6 +236,7 @@ export class FilterComponent {
|
|
|
224
236
|
setValue(items) {
|
|
225
237
|
this.normalizeValue(items);
|
|
226
238
|
this.filterService.normalizedValue = items;
|
|
239
|
+
this.currentFilter = items;
|
|
227
240
|
this.cdr.detectChanges();
|
|
228
241
|
this.navigationService.reset(this.filterItems);
|
|
229
242
|
}
|
|
@@ -246,6 +259,29 @@ export class FilterComponent {
|
|
|
246
259
|
messageFor(key) {
|
|
247
260
|
return this.localization.get(key);
|
|
248
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* @hidden
|
|
264
|
+
*/
|
|
265
|
+
filtersTypeChanged(previousValue, newValue) {
|
|
266
|
+
if (!(previousValue?.filters) && !(newValue?.filters)) {
|
|
267
|
+
return previousValue?.operator != newValue?.operator ||
|
|
268
|
+
previousValue?.field != newValue?.field;
|
|
269
|
+
}
|
|
270
|
+
if (!(previousValue?.filters) || !(newValue?.filters)) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
const previousFilters = previousValue.filters;
|
|
274
|
+
const newFilters = newValue.filters;
|
|
275
|
+
if (previousFilters.length !== newFilters.length) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
for (let i = 0; i < previousFilters.length; i++) {
|
|
279
|
+
if (this.filtersTypeChanged(previousFilters[i], newFilters[i])) {
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
249
285
|
}
|
|
250
286
|
FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FilterComponent, deps: [{ token: i1.FilterService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i3.NavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
251
287
|
FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FilterComponent, selector: "kendo-filter", inputs: { filters: "filters", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "focusout($event)", "keydown": "onKeydown($event)" }, properties: { "attr.dir": "this.direction" } }, providers: [
|
|
@@ -374,7 +410,7 @@ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
374
410
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
375
411
|
<li class='k-filter-group-main' role="treeitem">
|
|
376
412
|
<kendo-filter-group
|
|
377
|
-
[currentItem]="
|
|
413
|
+
[currentItem]="currentFilter"
|
|
378
414
|
(valueChange)="onValueChange($event)"
|
|
379
415
|
>
|
|
380
416
|
</kendo-filter-group>
|
|
@@ -513,7 +549,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
513
549
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
514
550
|
<li class='k-filter-group-main' role="treeitem">
|
|
515
551
|
<kendo-filter-group
|
|
516
|
-
[currentItem]="
|
|
552
|
+
[currentItem]="currentFilter"
|
|
517
553
|
(valueChange)="onValueChange($event)"
|
|
518
554
|
>
|
|
519
555
|
</kendo-filter-group>
|
|
@@ -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:
|
|
13
|
-
version: '15.0
|
|
12
|
+
publishDate: 1708505203,
|
|
13
|
+
version: '15.1.0-develop.1',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
15
15
|
};
|
|
@@ -235,8 +235,8 @@ const packageMetadata = {
|
|
|
235
235
|
name: '@progress/kendo-angular-filter',
|
|
236
236
|
productName: 'Kendo UI for Angular',
|
|
237
237
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
238
|
-
publishDate:
|
|
239
|
-
version: '15.0
|
|
238
|
+
publishDate: 1708505203,
|
|
239
|
+
version: '15.1.0-develop.1',
|
|
240
240
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
241
241
|
};
|
|
242
242
|
|
|
@@ -484,6 +484,7 @@ class BaseFilterRowComponent {
|
|
|
484
484
|
this.localization = localization;
|
|
485
485
|
this.renderer = renderer;
|
|
486
486
|
this.valueChange = new EventEmitter();
|
|
487
|
+
this.itemNumber = 0;
|
|
487
488
|
}
|
|
488
489
|
get toolbarElement() {
|
|
489
490
|
return this.element.nativeElement.querySelector('.k-toolbar');
|
|
@@ -1197,11 +1198,30 @@ class FilterGroupComponent extends BaseFilterRowComponent {
|
|
|
1197
1198
|
logic: 'or',
|
|
1198
1199
|
filters: []
|
|
1199
1200
|
};
|
|
1201
|
+
/**
|
|
1202
|
+
* @hidden
|
|
1203
|
+
*/
|
|
1204
|
+
this.trackByFunction = (index) => {
|
|
1205
|
+
return index;
|
|
1206
|
+
};
|
|
1200
1207
|
this.operators = [];
|
|
1201
1208
|
}
|
|
1202
1209
|
get filterItems() {
|
|
1203
1210
|
return this._filterItems.toArray();
|
|
1204
1211
|
}
|
|
1212
|
+
/**
|
|
1213
|
+
* @hidden
|
|
1214
|
+
*/
|
|
1215
|
+
handleExpressionValueChange(isRemoveOperation) {
|
|
1216
|
+
if (isRemoveOperation) {
|
|
1217
|
+
// due to tracking by index, the filters should first be set to [] so that all rerender afterwards
|
|
1218
|
+
const filtersCopy = this.currentItem.filters;
|
|
1219
|
+
this.currentItem.filters = [];
|
|
1220
|
+
this.cdr.detectChanges();
|
|
1221
|
+
this.currentItem.filters = filtersCopy;
|
|
1222
|
+
}
|
|
1223
|
+
this.valueChange.emit(isRemoveOperation);
|
|
1224
|
+
}
|
|
1205
1225
|
ngOnInit() {
|
|
1206
1226
|
this.operators = this.getLogicOperators();
|
|
1207
1227
|
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
@@ -1316,9 +1336,9 @@ FilterGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
1316
1336
|
</div>
|
|
1317
1337
|
|
|
1318
1338
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
1319
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
1339
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
1320
1340
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
1321
|
-
<kendo-filter-expression (valueChange)="
|
|
1341
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
1322
1342
|
</kendo-filter-expression>
|
|
1323
1343
|
</li>
|
|
1324
1344
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -1395,9 +1415,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
1395
1415
|
</div>
|
|
1396
1416
|
|
|
1397
1417
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
1398
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
1418
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
1399
1419
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
1400
|
-
<kendo-filter-expression (valueChange)="
|
|
1420
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
1401
1421
|
</kendo-filter-expression>
|
|
1402
1422
|
</li>
|
|
1403
1423
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -1582,6 +1602,7 @@ class FilterComponent {
|
|
|
1582
1602
|
*/
|
|
1583
1603
|
this.valueChange = new EventEmitter();
|
|
1584
1604
|
this._value = { filters: [], logic: 'and' };
|
|
1605
|
+
this._currentFilter = { logic: 'and', filters: [] };
|
|
1585
1606
|
validatePackage(packageMetadata);
|
|
1586
1607
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
1587
1608
|
}
|
|
@@ -1633,6 +1654,11 @@ class FilterComponent {
|
|
|
1633
1654
|
*/
|
|
1634
1655
|
set value(value) {
|
|
1635
1656
|
const clonedValue = JSON.parse(JSON.stringify(value));
|
|
1657
|
+
if (this.filtersTypeChanged(this.value, clonedValue)) {
|
|
1658
|
+
// due to tracking group items by index, the filters should first be set to [] when the value is changed programmatically
|
|
1659
|
+
this.currentFilter.filters = [];
|
|
1660
|
+
this.cdr.detectChanges();
|
|
1661
|
+
}
|
|
1636
1662
|
this._value = clonedValue;
|
|
1637
1663
|
if (this.filters.length > 0) {
|
|
1638
1664
|
this.setValue(this.value);
|
|
@@ -1685,8 +1711,14 @@ class FilterComponent {
|
|
|
1685
1711
|
/**
|
|
1686
1712
|
* @hidden
|
|
1687
1713
|
*/
|
|
1688
|
-
|
|
1689
|
-
return this.
|
|
1714
|
+
get currentFilter() {
|
|
1715
|
+
return this._currentFilter;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* @hidden
|
|
1719
|
+
*/
|
|
1720
|
+
set currentFilter(value) {
|
|
1721
|
+
this._currentFilter = value;
|
|
1690
1722
|
}
|
|
1691
1723
|
/**
|
|
1692
1724
|
* @hidden
|
|
@@ -1739,6 +1771,7 @@ class FilterComponent {
|
|
|
1739
1771
|
setValue(items) {
|
|
1740
1772
|
this.normalizeValue(items);
|
|
1741
1773
|
this.filterService.normalizedValue = items;
|
|
1774
|
+
this.currentFilter = items;
|
|
1742
1775
|
this.cdr.detectChanges();
|
|
1743
1776
|
this.navigationService.reset(this.filterItems);
|
|
1744
1777
|
}
|
|
@@ -1761,6 +1794,29 @@ class FilterComponent {
|
|
|
1761
1794
|
messageFor(key) {
|
|
1762
1795
|
return this.localization.get(key);
|
|
1763
1796
|
}
|
|
1797
|
+
/**
|
|
1798
|
+
* @hidden
|
|
1799
|
+
*/
|
|
1800
|
+
filtersTypeChanged(previousValue, newValue) {
|
|
1801
|
+
if (!(previousValue === null || previousValue === void 0 ? void 0 : previousValue.filters) && !(newValue === null || newValue === void 0 ? void 0 : newValue.filters)) {
|
|
1802
|
+
return (previousValue === null || previousValue === void 0 ? void 0 : previousValue.operator) != (newValue === null || newValue === void 0 ? void 0 : newValue.operator) ||
|
|
1803
|
+
(previousValue === null || previousValue === void 0 ? void 0 : previousValue.field) != (newValue === null || newValue === void 0 ? void 0 : newValue.field);
|
|
1804
|
+
}
|
|
1805
|
+
if (!(previousValue === null || previousValue === void 0 ? void 0 : previousValue.filters) || !(newValue === null || newValue === void 0 ? void 0 : newValue.filters)) {
|
|
1806
|
+
return true;
|
|
1807
|
+
}
|
|
1808
|
+
const previousFilters = previousValue.filters;
|
|
1809
|
+
const newFilters = newValue.filters;
|
|
1810
|
+
if (previousFilters.length !== newFilters.length) {
|
|
1811
|
+
return true;
|
|
1812
|
+
}
|
|
1813
|
+
for (let i = 0; i < previousFilters.length; i++) {
|
|
1814
|
+
if (this.filtersTypeChanged(previousFilters[i], newFilters[i])) {
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1764
1820
|
}
|
|
1765
1821
|
FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FilterComponent, deps: [{ token: FilterService }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
1766
1822
|
FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FilterComponent, selector: "kendo-filter", inputs: { filters: "filters", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "focusout($event)", "keydown": "onKeydown($event)" }, properties: { "attr.dir": "this.direction" } }, providers: [
|
|
@@ -1889,7 +1945,7 @@ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
1889
1945
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
1890
1946
|
<li class='k-filter-group-main' role="treeitem">
|
|
1891
1947
|
<kendo-filter-group
|
|
1892
|
-
[currentItem]="
|
|
1948
|
+
[currentItem]="currentFilter"
|
|
1893
1949
|
(valueChange)="onValueChange($event)"
|
|
1894
1950
|
>
|
|
1895
1951
|
</kendo-filter-group>
|
|
@@ -2028,7 +2084,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
2028
2084
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
2029
2085
|
<li class='k-filter-group-main' role="treeitem">
|
|
2030
2086
|
<kendo-filter-group
|
|
2031
|
-
[currentItem]="
|
|
2087
|
+
[currentItem]="currentFilter"
|
|
2032
2088
|
(valueChange)="onValueChange($event)"
|
|
2033
2089
|
>
|
|
2034
2090
|
</kendo-filter-group>
|
|
@@ -235,8 +235,8 @@ const packageMetadata = {
|
|
|
235
235
|
name: '@progress/kendo-angular-filter',
|
|
236
236
|
productName: 'Kendo UI for Angular',
|
|
237
237
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
238
|
-
publishDate:
|
|
239
|
-
version: '15.0
|
|
238
|
+
publishDate: 1708505203,
|
|
239
|
+
version: '15.1.0-develop.1',
|
|
240
240
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
241
241
|
};
|
|
242
242
|
|
|
@@ -483,6 +483,7 @@ class BaseFilterRowComponent {
|
|
|
483
483
|
this.localization = localization;
|
|
484
484
|
this.renderer = renderer;
|
|
485
485
|
this.valueChange = new EventEmitter();
|
|
486
|
+
this.itemNumber = 0;
|
|
486
487
|
}
|
|
487
488
|
get toolbarElement() {
|
|
488
489
|
return this.element.nativeElement.querySelector('.k-toolbar');
|
|
@@ -1196,11 +1197,30 @@ class FilterGroupComponent extends BaseFilterRowComponent {
|
|
|
1196
1197
|
logic: 'or',
|
|
1197
1198
|
filters: []
|
|
1198
1199
|
};
|
|
1200
|
+
/**
|
|
1201
|
+
* @hidden
|
|
1202
|
+
*/
|
|
1203
|
+
this.trackByFunction = (index) => {
|
|
1204
|
+
return index;
|
|
1205
|
+
};
|
|
1199
1206
|
this.operators = [];
|
|
1200
1207
|
}
|
|
1201
1208
|
get filterItems() {
|
|
1202
1209
|
return this._filterItems.toArray();
|
|
1203
1210
|
}
|
|
1211
|
+
/**
|
|
1212
|
+
* @hidden
|
|
1213
|
+
*/
|
|
1214
|
+
handleExpressionValueChange(isRemoveOperation) {
|
|
1215
|
+
if (isRemoveOperation) {
|
|
1216
|
+
// due to tracking by index, the filters should first be set to [] so that all rerender afterwards
|
|
1217
|
+
const filtersCopy = this.currentItem.filters;
|
|
1218
|
+
this.currentItem.filters = [];
|
|
1219
|
+
this.cdr.detectChanges();
|
|
1220
|
+
this.currentItem.filters = filtersCopy;
|
|
1221
|
+
}
|
|
1222
|
+
this.valueChange.emit(isRemoveOperation);
|
|
1223
|
+
}
|
|
1204
1224
|
ngOnInit() {
|
|
1205
1225
|
this.operators = this.getLogicOperators();
|
|
1206
1226
|
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
@@ -1315,9 +1335,9 @@ FilterGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
1315
1335
|
</div>
|
|
1316
1336
|
|
|
1317
1337
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
1318
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
1338
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
1319
1339
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
1320
|
-
<kendo-filter-expression (valueChange)="
|
|
1340
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
1321
1341
|
</kendo-filter-expression>
|
|
1322
1342
|
</li>
|
|
1323
1343
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -1394,9 +1414,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
1394
1414
|
</div>
|
|
1395
1415
|
|
|
1396
1416
|
<ul class="k-filter-lines" role="group" *ngIf="currentItem.filters">
|
|
1397
|
-
<ng-container *ngFor="let item of currentItem.filters; let i = index;">
|
|
1417
|
+
<ng-container *ngFor="let item of currentItem.filters; let i = index; trackBy: trackByFunction">
|
|
1398
1418
|
<li class="k-filter-item" role="treeitem" *ngIf="!item['filters']">
|
|
1399
|
-
<kendo-filter-expression (valueChange)="
|
|
1419
|
+
<kendo-filter-expression (valueChange)="handleExpressionValueChange($event)" [currentItem]="item" [index]="i">
|
|
1400
1420
|
</kendo-filter-expression>
|
|
1401
1421
|
</li>
|
|
1402
1422
|
<li class="k-filter-item" role="treeitem" *ngIf="item['filters']">
|
|
@@ -1581,6 +1601,7 @@ class FilterComponent {
|
|
|
1581
1601
|
*/
|
|
1582
1602
|
this.valueChange = new EventEmitter();
|
|
1583
1603
|
this._value = { filters: [], logic: 'and' };
|
|
1604
|
+
this._currentFilter = { logic: 'and', filters: [] };
|
|
1584
1605
|
validatePackage(packageMetadata);
|
|
1585
1606
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
1586
1607
|
}
|
|
@@ -1632,6 +1653,11 @@ class FilterComponent {
|
|
|
1632
1653
|
*/
|
|
1633
1654
|
set value(value) {
|
|
1634
1655
|
const clonedValue = JSON.parse(JSON.stringify(value));
|
|
1656
|
+
if (this.filtersTypeChanged(this.value, clonedValue)) {
|
|
1657
|
+
// due to tracking group items by index, the filters should first be set to [] when the value is changed programmatically
|
|
1658
|
+
this.currentFilter.filters = [];
|
|
1659
|
+
this.cdr.detectChanges();
|
|
1660
|
+
}
|
|
1635
1661
|
this._value = clonedValue;
|
|
1636
1662
|
if (this.filters.length > 0) {
|
|
1637
1663
|
this.setValue(this.value);
|
|
@@ -1685,8 +1711,14 @@ class FilterComponent {
|
|
|
1685
1711
|
/**
|
|
1686
1712
|
* @hidden
|
|
1687
1713
|
*/
|
|
1688
|
-
|
|
1689
|
-
return this.
|
|
1714
|
+
get currentFilter() {
|
|
1715
|
+
return this._currentFilter;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* @hidden
|
|
1719
|
+
*/
|
|
1720
|
+
set currentFilter(value) {
|
|
1721
|
+
this._currentFilter = value;
|
|
1690
1722
|
}
|
|
1691
1723
|
/**
|
|
1692
1724
|
* @hidden
|
|
@@ -1739,6 +1771,7 @@ class FilterComponent {
|
|
|
1739
1771
|
setValue(items) {
|
|
1740
1772
|
this.normalizeValue(items);
|
|
1741
1773
|
this.filterService.normalizedValue = items;
|
|
1774
|
+
this.currentFilter = items;
|
|
1742
1775
|
this.cdr.detectChanges();
|
|
1743
1776
|
this.navigationService.reset(this.filterItems);
|
|
1744
1777
|
}
|
|
@@ -1761,6 +1794,29 @@ class FilterComponent {
|
|
|
1761
1794
|
messageFor(key) {
|
|
1762
1795
|
return this.localization.get(key);
|
|
1763
1796
|
}
|
|
1797
|
+
/**
|
|
1798
|
+
* @hidden
|
|
1799
|
+
*/
|
|
1800
|
+
filtersTypeChanged(previousValue, newValue) {
|
|
1801
|
+
if (!(previousValue?.filters) && !(newValue?.filters)) {
|
|
1802
|
+
return previousValue?.operator != newValue?.operator ||
|
|
1803
|
+
previousValue?.field != newValue?.field;
|
|
1804
|
+
}
|
|
1805
|
+
if (!(previousValue?.filters) || !(newValue?.filters)) {
|
|
1806
|
+
return true;
|
|
1807
|
+
}
|
|
1808
|
+
const previousFilters = previousValue.filters;
|
|
1809
|
+
const newFilters = newValue.filters;
|
|
1810
|
+
if (previousFilters.length !== newFilters.length) {
|
|
1811
|
+
return true;
|
|
1812
|
+
}
|
|
1813
|
+
for (let i = 0; i < previousFilters.length; i++) {
|
|
1814
|
+
if (this.filtersTypeChanged(previousFilters[i], newFilters[i])) {
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1764
1820
|
}
|
|
1765
1821
|
FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FilterComponent, deps: [{ token: FilterService }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
1766
1822
|
FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FilterComponent, selector: "kendo-filter", inputs: { filters: "filters", value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "focusout($event)", "keydown": "onKeydown($event)" }, properties: { "attr.dir": "this.direction" } }, providers: [
|
|
@@ -1889,7 +1945,7 @@ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
1889
1945
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
1890
1946
|
<li class='k-filter-group-main' role="treeitem">
|
|
1891
1947
|
<kendo-filter-group
|
|
1892
|
-
[currentItem]="
|
|
1948
|
+
[currentItem]="currentFilter"
|
|
1893
1949
|
(valueChange)="onValueChange($event)"
|
|
1894
1950
|
>
|
|
1895
1951
|
</kendo-filter-group>
|
|
@@ -2028,7 +2084,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
2028
2084
|
<ul class='k-filter-container' role="tree" [attr.aria-label]="messageFor('filterComponentAriaLabel')">
|
|
2029
2085
|
<li class='k-filter-group-main' role="treeitem">
|
|
2030
2086
|
<kendo-filter-group
|
|
2031
|
-
[currentItem]="
|
|
2087
|
+
[currentItem]="currentFilter"
|
|
2032
2088
|
(valueChange)="onValueChange($event)"
|
|
2033
2089
|
>
|
|
2034
2090
|
</kendo-filter-group>
|
|
@@ -32,7 +32,15 @@ export declare class FilterGroupComponent extends BaseFilterRowComponent impleme
|
|
|
32
32
|
filterAddExpressionIcon: SVGIcon;
|
|
33
33
|
private _filterItems;
|
|
34
34
|
get filterItems(): FilterItem[];
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
handleExpressionValueChange(isRemoveOperation: any): void;
|
|
35
39
|
currentItem: CompositeFilterDescriptor;
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
trackByFunction: (index: any) => any;
|
|
36
44
|
operators: {
|
|
37
45
|
text: string;
|
|
38
46
|
value: 'and' | 'or';
|
package/filter.component.d.ts
CHANGED
|
@@ -88,10 +88,15 @@ export declare class FilterComponent implements OnInit, OnDestroy {
|
|
|
88
88
|
ngAfterViewInit(): void;
|
|
89
89
|
ngOnDestroy(): void;
|
|
90
90
|
private filterFieldsChanged;
|
|
91
|
+
private _currentFilter;
|
|
91
92
|
/**
|
|
92
93
|
* @hidden
|
|
93
94
|
*/
|
|
94
|
-
|
|
95
|
+
get currentFilter(): CompositeFilterDescriptor;
|
|
96
|
+
/**
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
set currentFilter(value: CompositeFilterDescriptor);
|
|
95
100
|
/**
|
|
96
101
|
* @hidden
|
|
97
102
|
*/
|
|
@@ -103,6 +108,10 @@ export declare class FilterComponent implements OnInit, OnDestroy {
|
|
|
103
108
|
* @hidden
|
|
104
109
|
*/
|
|
105
110
|
messageFor(key: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* @hidden
|
|
113
|
+
*/
|
|
114
|
+
private filtersTypeChanged;
|
|
106
115
|
static ɵfac: i0.ɵɵFactoryDeclaration<FilterComponent, never>;
|
|
107
116
|
static ɵcmp: i0.ɵɵComponentDeclaration<FilterComponent, "kendo-filter", never, { "filters": "filters"; "value": "value"; }, { "valueChange": "valueChange"; }, ["filterFields"], never>;
|
|
108
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-filter",
|
|
3
|
-
"version": "15.0
|
|
3
|
+
"version": "15.1.0-develop.1",
|
|
4
4
|
"description": "Kendo UI Angular Filter",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"@angular/platform-browser": "13 - 17",
|
|
23
23
|
"@progress/kendo-data-query": "^1.5.5",
|
|
24
24
|
"@progress/kendo-licensing": "^1.0.2",
|
|
25
|
-
"@progress/kendo-angular-buttons": "15.0
|
|
26
|
-
"@progress/kendo-angular-common": "15.0
|
|
27
|
-
"@progress/kendo-angular-dateinputs": "15.0
|
|
28
|
-
"@progress/kendo-angular-dropdowns": "15.0
|
|
29
|
-
"@progress/kendo-angular-inputs": "15.0
|
|
30
|
-
"@progress/kendo-angular-intl": "15.0
|
|
31
|
-
"@progress/kendo-angular-l10n": "15.0
|
|
32
|
-
"@progress/kendo-angular-icons": "15.0
|
|
33
|
-
"@progress/kendo-angular-label": "15.0
|
|
25
|
+
"@progress/kendo-angular-buttons": "15.1.0-develop.1",
|
|
26
|
+
"@progress/kendo-angular-common": "15.1.0-develop.1",
|
|
27
|
+
"@progress/kendo-angular-dateinputs": "15.1.0-develop.1",
|
|
28
|
+
"@progress/kendo-angular-dropdowns": "15.1.0-develop.1",
|
|
29
|
+
"@progress/kendo-angular-inputs": "15.1.0-develop.1",
|
|
30
|
+
"@progress/kendo-angular-intl": "15.1.0-develop.1",
|
|
31
|
+
"@progress/kendo-angular-l10n": "15.1.0-develop.1",
|
|
32
|
+
"@progress/kendo-angular-icons": "15.1.0-develop.1",
|
|
33
|
+
"@progress/kendo-angular-label": "15.1.0-develop.1",
|
|
34
34
|
"rxjs": "^6.5.3 || ^7.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"tslib": "^2.3.1",
|
|
38
|
-
"@progress/kendo-angular-schematics": "15.0
|
|
38
|
+
"@progress/kendo-angular-schematics": "15.1.0-develop.1"
|
|
39
39
|
},
|
|
40
40
|
"schematics": "./schematics/collection.json",
|
|
41
41
|
"module": "fesm2015/progress-kendo-angular-filter.mjs",
|
|
@@ -4,11 +4,11 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
4
4
|
function default_1(options) {
|
|
5
5
|
const finalOptions = Object.assign(Object.assign({}, options), { mainNgModule: 'FilterModule', package: 'filter', peerDependencies: {
|
|
6
6
|
// peer dep of the dropdowns
|
|
7
|
-
'@progress/kendo-angular-treeview': '15.0
|
|
8
|
-
'@progress/kendo-angular-popup': '15.0
|
|
7
|
+
'@progress/kendo-angular-treeview': '15.1.0-develop.1',
|
|
8
|
+
'@progress/kendo-angular-popup': '15.1.0-develop.1',
|
|
9
9
|
// peer dependency of kendo-angular-inputs
|
|
10
10
|
'@progress/kendo-drawing': '^1.16.0',
|
|
11
|
-
'@progress/kendo-angular-dialog': '15.0
|
|
11
|
+
'@progress/kendo-angular-dialog': '15.1.0-develop.1',
|
|
12
12
|
// Peer dependency of icons
|
|
13
13
|
'@progress/kendo-svg-icons': '^2.0.0'
|
|
14
14
|
} });
|