@progress/kendo-angular-filter 0.1.7 → 1.0.0-next.202204010908

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.
Files changed (106) hide show
  1. package/{dist/es2015/aria-label.directive.d.ts → aria-label.directive.d.ts} +3 -0
  2. package/bundles/kendo-angular-filter.umd.js +5 -0
  3. package/{dist/es2015/editors → editors}/boolean-editor.component.d.ts +3 -0
  4. package/{dist/es2015/editors → editors}/date-editor.component.d.ts +3 -0
  5. package/{dist/es2015/editors → editors}/numeric-editor.component.d.ts +3 -0
  6. package/{dist/es2015/editors → editors}/text-editor.component.d.ts +3 -0
  7. package/esm2015/aria-label.directive.js +28 -0
  8. package/esm2015/editors/boolean-editor.component.js +84 -0
  9. package/esm2015/editors/date-editor.component.js +67 -0
  10. package/esm2015/editors/numeric-editor.component.js +67 -0
  11. package/esm2015/editors/text-editor.component.js +59 -0
  12. package/esm2015/filter-expression-operators.component.js +68 -0
  13. package/{dist/es2015 → esm2015}/filter-expression.component.js +71 -26
  14. package/esm2015/filter-group.component.js +206 -0
  15. package/{dist/es2015 → esm2015}/filter.component.js +151 -34
  16. package/esm2015/filter.module.js +117 -0
  17. package/{dist/es2015 → esm2015}/filter.service.js +8 -10
  18. package/{dist/es2015/shared.module.d.ts → esm2015/kendo-angular-filter.js} +2 -3
  19. package/esm2015/localization/custom-messages.component.js +41 -0
  20. package/esm2015/localization/localized-messages.directive.js +36 -0
  21. package/esm2015/localization/messages.js +95 -0
  22. package/{dist/es/index.js → esm2015/main.js} +3 -8
  23. package/{dist/es → esm2015}/model/filter-expression.js +1 -0
  24. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  25. package/esm2015/shared.module.js +50 -0
  26. package/{dist/es2015 → esm2015}/util.js +3 -3
  27. package/fesm2015/kendo-angular-filter.js +1622 -0
  28. package/{dist/es2015/filter-expression-operators.component.d.ts → filter-expression-operators.component.d.ts} +3 -0
  29. package/{dist/es2015/filter-expression.component.d.ts → filter-expression.component.d.ts} +5 -0
  30. package/{dist/es2015/filter-group.component.d.ts → filter-group.component.d.ts} +7 -2
  31. package/{dist/es2015/filter.component.d.ts → filter.component.d.ts} +7 -2
  32. package/filter.module.d.ts +53 -0
  33. package/{dist/es2015/filter.service.d.ts → filter.service.d.ts} +3 -0
  34. package/{dist/npm/model/filter-expression.js → kendo-angular-filter.d.ts} +3 -3
  35. package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
  36. package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
  37. package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
  38. package/{dist/es2015/index.d.ts → main.d.ts} +4 -8
  39. package/{dist/es2015/model → model}/filter-expression.d.ts +0 -0
  40. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  41. package/package.json +38 -109
  42. package/schematics/ngAdd/index.js +5 -2
  43. package/schematics/ngAdd/index.js.map +1 -1
  44. package/shared.module.d.ts +19 -0
  45. package/util.d.ts +147 -0
  46. package/dist/cdn/js/kendo-angular-filter.js +0 -20
  47. package/dist/cdn/main.js +0 -5
  48. package/dist/es/aria-label.directive.js +0 -30
  49. package/dist/es/editors/boolean-editor.component.js +0 -61
  50. package/dist/es/editors/date-editor.component.js +0 -45
  51. package/dist/es/editors/numeric-editor.component.js +0 -45
  52. package/dist/es/editors/text-editor.component.js +0 -45
  53. package/dist/es/filter-expression-operators.component.js +0 -48
  54. package/dist/es/filter-expression.component.js +0 -136
  55. package/dist/es/filter-group.component.js +0 -84
  56. package/dist/es/filter.component.js +0 -185
  57. package/dist/es/filter.module.js +0 -91
  58. package/dist/es/filter.service.js +0 -45
  59. package/dist/es/localization/custom-messages.component.js +0 -44
  60. package/dist/es/localization/localized-messages.directive.js +0 -35
  61. package/dist/es/localization/messages.js +0 -166
  62. package/dist/es/main.js +0 -6
  63. package/dist/es/package-metadata.js +0 -15
  64. package/dist/es/shared.module.js +0 -35
  65. package/dist/es/util.js +0 -136
  66. package/dist/es2015/aria-label.directive.js +0 -29
  67. package/dist/es2015/editors/boolean-editor.component.js +0 -72
  68. package/dist/es2015/editors/date-editor.component.js +0 -56
  69. package/dist/es2015/editors/numeric-editor.component.js +0 -56
  70. package/dist/es2015/editors/text-editor.component.js +0 -52
  71. package/dist/es2015/filter-expression-operators.component.js +0 -59
  72. package/dist/es2015/filter-group.component.js +0 -145
  73. package/dist/es2015/filter.module.d.ts +0 -37
  74. package/dist/es2015/filter.module.js +0 -88
  75. package/dist/es2015/index.js +0 -21
  76. package/dist/es2015/index.metadata.json +0 -1
  77. package/dist/es2015/localization/custom-messages.component.js +0 -36
  78. package/dist/es2015/localization/localized-messages.directive.js +0 -31
  79. package/dist/es2015/localization/messages.js +0 -160
  80. package/dist/es2015/main.d.ts +0 -7
  81. package/dist/es2015/main.js +0 -6
  82. package/dist/es2015/model/filter-expression.js +0 -7
  83. package/dist/es2015/shared.module.js +0 -32
  84. package/dist/es2015/util.d.ts +0 -147
  85. package/dist/fesm2015/index.js +0 -1316
  86. package/dist/fesm5/index.js +0 -1076
  87. package/dist/npm/aria-label.directive.js +0 -32
  88. package/dist/npm/editors/boolean-editor.component.js +0 -63
  89. package/dist/npm/editors/date-editor.component.js +0 -47
  90. package/dist/npm/editors/numeric-editor.component.js +0 -47
  91. package/dist/npm/editors/text-editor.component.js +0 -47
  92. package/dist/npm/filter-expression-operators.component.js +0 -50
  93. package/dist/npm/filter-expression.component.js +0 -138
  94. package/dist/npm/filter-group.component.js +0 -86
  95. package/dist/npm/filter.component.js +0 -187
  96. package/dist/npm/filter.module.js +0 -93
  97. package/dist/npm/filter.service.js +0 -47
  98. package/dist/npm/index.js +0 -37
  99. package/dist/npm/localization/custom-messages.component.js +0 -46
  100. package/dist/npm/localization/localized-messages.directive.js +0 -37
  101. package/dist/npm/localization/messages.js +0 -168
  102. package/dist/npm/main.js +0 -10
  103. package/dist/npm/package-metadata.js +0 -17
  104. package/dist/npm/shared.module.js +0 -37
  105. package/dist/npm/util.js +0 -138
  106. package/dist/systemjs/kendo-angular-filter.js +0 -5
@@ -1,48 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, EventEmitter, Input, Output } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { FilterService } from './filter.service';
9
- import { nullOperators } from './util';
10
- /**
11
- * @hidden
12
- */
13
- var FilterExpressionOperatorsComponent = /** @class */ (function () {
14
- function FilterExpressionOperatorsComponent(filterService, localization) {
15
- this.filterService = filterService;
16
- this.localization = localization;
17
- this.valueChange = new EventEmitter();
18
- this.operators = [];
19
- }
20
- FilterExpressionOperatorsComponent.prototype.messageFor = function (key) {
21
- return this.localization.get(key);
22
- };
23
- FilterExpressionOperatorsComponent.prototype.operatorValueChange = function (value) {
24
- this.valueChange.emit();
25
- this.filterService.isEditorDisabled = nullOperators.indexOf(value) >= 0;
26
- };
27
- tslib_1.__decorate([
28
- Input(),
29
- tslib_1.__metadata("design:type", Object)
30
- ], FilterExpressionOperatorsComponent.prototype, "currentItem", void 0);
31
- tslib_1.__decorate([
32
- Output(),
33
- tslib_1.__metadata("design:type", EventEmitter)
34
- ], FilterExpressionOperatorsComponent.prototype, "valueChange", void 0);
35
- tslib_1.__decorate([
36
- Input(),
37
- tslib_1.__metadata("design:type", Array)
38
- ], FilterExpressionOperatorsComponent.prototype, "operators", void 0);
39
- FilterExpressionOperatorsComponent = tslib_1.__decorate([
40
- Component({
41
- selector: 'kendo-filter-expression-operators',
42
- template: "\n <kendo-dropdownlist\n [kendoAriaLabelValue]=\"messageFor('filterOperatorAriaLabel')\"\n [data]=\"operators\"\n [title]=\"messageFor('filterExpressionOperators')\"\n [(value)]=\"currentItem.operator\"\n (valueChange)=\"operatorValueChange($event)\"\n [valuePrimitive]=\"true\"\n textField=\"text\"\n valueField=\"value\"\n >\n </kendo-dropdownlist>\n "
43
- }),
44
- tslib_1.__metadata("design:paramtypes", [FilterService, LocalizationService])
45
- ], FilterExpressionOperatorsComponent);
46
- return FilterExpressionOperatorsComponent;
47
- }());
48
- export { FilterExpressionOperatorsComponent };
@@ -1,136 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { FilterService } from './filter.service';
9
- import { defaultDateOperators, defaultNumericOperators, defaultOperators, defaultStringOperators, getKeyByValue, isFilterEditor, localizeOperators } from './util';
10
- /**
11
- * @hidden
12
- */
13
- var FilterExpressionComponent = /** @class */ (function () {
14
- function FilterExpressionComponent(filterService, localization, cdr) {
15
- this.filterService = filterService;
16
- this.localization = localization;
17
- this.cdr = cdr;
18
- this.valueChange = new EventEmitter();
19
- this.operators = [];
20
- this.filters = [];
21
- this.isBoolean = false;
22
- this.isEditorDisabled = false;
23
- }
24
- FilterExpressionComponent.prototype.ngOnInit = function () {
25
- var _this = this;
26
- this.filters = this.filterService.filters;
27
- var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
28
- if (this.currentItem.field) {
29
- this.setOperators(foundFilter);
30
- }
31
- var defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
32
- if (!this.currentItem.field) {
33
- this.currentItem.field = this.filterService.filters[0].field;
34
- this.setOperators(defaultFilter);
35
- }
36
- this.localizationSubscription = this.localization.changes.subscribe(function () {
37
- _this.setOperators(foundFilter || defaultFilter);
38
- _this.cdr.detectChanges();
39
- });
40
- };
41
- FilterExpressionComponent.prototype.ngOnDestroy = function () {
42
- if (this.localizationSubscription) {
43
- this.localizationSubscription.unsubscribe();
44
- }
45
- };
46
- FilterExpressionComponent.prototype.normalizeOperators = function (filterEditor, operators) {
47
- var result = [];
48
- for (var j = 0; j < operators.length; j++) {
49
- if (isFilterEditor(filterEditor)) {
50
- result.push({
51
- value: operators[j],
52
- text: this.localization.get(getKeyByValue(defaultOperators[filterEditor], operators[j]))
53
- });
54
- }
55
- }
56
- return result;
57
- };
58
- FilterExpressionComponent.prototype.messageFor = function (key) {
59
- return this.localization.get(key);
60
- };
61
- FilterExpressionComponent.prototype.getFilterExpressionByField = function (name) {
62
- var foundFilter = this.filterService.filters.find(function (filter) { return filter.field === name; });
63
- if (foundFilter) {
64
- return foundFilter;
65
- }
66
- return null;
67
- };
68
- FilterExpressionComponent.prototype.filterValueChange = function (value) {
69
- this.currentItem.value = null;
70
- this.currentItem.field = value;
71
- var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
72
- this.setOperators(foundFilter);
73
- this.valueChange.emit();
74
- };
75
- FilterExpressionComponent.prototype.getDefaultOperators = function (operatorsType) {
76
- switch (operatorsType) {
77
- case 'string':
78
- return localizeOperators(defaultStringOperators)(this.localization);
79
- case 'number':
80
- return localizeOperators(defaultNumericOperators)(this.localization);
81
- case 'date':
82
- return localizeOperators(defaultDateOperators)(this.localization);
83
- default:
84
- break;
85
- }
86
- };
87
- FilterExpressionComponent.prototype.getEditorType = function () {
88
- var _this = this;
89
- var item = this.filterService.filters.find(function (filterExpression) { return filterExpression.field === _this.currentItem.field; });
90
- return item.editor;
91
- };
92
- FilterExpressionComponent.prototype.removeFilterExpression = function () {
93
- this.filterService.remove(this.currentItem, this.index);
94
- this.valueChange.emit();
95
- };
96
- FilterExpressionComponent.prototype.setOperators = function (filter) {
97
- this.isBoolean = filter.editor === 'boolean';
98
- if (this.isBoolean) {
99
- return;
100
- }
101
- if (filter.operators) {
102
- var localizedOperators = this.normalizeOperators(filter.editor, filter.operators);
103
- this.operators = localizedOperators;
104
- if (!this.currentItem.operator) {
105
- this.currentItem.operator = localizedOperators[0].value;
106
- }
107
- }
108
- else {
109
- this.operators = this.getDefaultOperators(filter.editor);
110
- if (!this.currentItem.operator) {
111
- this.currentItem.operator = this.operators[0].value;
112
- }
113
- }
114
- };
115
- tslib_1.__decorate([
116
- Input(),
117
- tslib_1.__metadata("design:type", Number)
118
- ], FilterExpressionComponent.prototype, "index", void 0);
119
- tslib_1.__decorate([
120
- Input(),
121
- tslib_1.__metadata("design:type", Object)
122
- ], FilterExpressionComponent.prototype, "currentItem", void 0);
123
- tslib_1.__decorate([
124
- Output(),
125
- tslib_1.__metadata("design:type", EventEmitter)
126
- ], FilterExpressionComponent.prototype, "valueChange", void 0);
127
- FilterExpressionComponent = tslib_1.__decorate([
128
- Component({
129
- selector: 'kendo-filter-expression',
130
- 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 "
131
- }),
132
- tslib_1.__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
133
- ], FilterExpressionComponent);
134
- return FilterExpressionComponent;
135
- }());
136
- export { FilterExpressionComponent };
@@ -1,84 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { FilterService } from './filter.service';
9
- import { localizeOperators, logicOperators } from './util';
10
- /**
11
- * @hidden
12
- */
13
- var FilterGroupComponent = /** @class */ (function () {
14
- function FilterGroupComponent(filterService, localization, cdr) {
15
- this.filterService = filterService;
16
- this.localization = localization;
17
- this.cdr = cdr;
18
- this.index = 0;
19
- this.currentItem = {
20
- logic: 'or',
21
- filters: []
22
- };
23
- this.valueChange = new EventEmitter();
24
- this.operators = [];
25
- }
26
- FilterGroupComponent.prototype.ngOnInit = function () {
27
- var _this = this;
28
- this.operators = this.getLogicOperators();
29
- this.localizationSubscription = this.localization.changes.subscribe(function () {
30
- _this.operators = _this.getLogicOperators();
31
- _this.cdr.detectChanges();
32
- });
33
- };
34
- FilterGroupComponent.prototype.ngOnDestroy = function () {
35
- if (this.localizationSubscription) {
36
- this.localizationSubscription.unsubscribe();
37
- }
38
- };
39
- FilterGroupComponent.prototype.getLogicOperators = function () {
40
- return localizeOperators(logicOperators)(this.localization);
41
- };
42
- FilterGroupComponent.prototype.messageFor = function (key) {
43
- return this.localization.get(key);
44
- };
45
- FilterGroupComponent.prototype.selectedChange = function (logicOperator) {
46
- if (this.currentItem.logic !== logicOperator) {
47
- this.currentItem.logic = logicOperator;
48
- this.valueChange.emit();
49
- }
50
- };
51
- FilterGroupComponent.prototype.addFilterExpression = function () {
52
- this.filterService.addFilterExpression(this.currentItem);
53
- this.valueChange.emit();
54
- };
55
- FilterGroupComponent.prototype.addFilterGroup = function () {
56
- this.filterService.addFilterGroup(this.currentItem);
57
- this.valueChange.emit();
58
- };
59
- FilterGroupComponent.prototype.removeFilterGroup = function () {
60
- this.filterService.remove(this.currentItem, this.index);
61
- this.valueChange.emit();
62
- };
63
- tslib_1.__decorate([
64
- Input(),
65
- tslib_1.__metadata("design:type", Number)
66
- ], FilterGroupComponent.prototype, "index", void 0);
67
- tslib_1.__decorate([
68
- Input(),
69
- tslib_1.__metadata("design:type", Object)
70
- ], FilterGroupComponent.prototype, "currentItem", void 0);
71
- tslib_1.__decorate([
72
- Output(),
73
- tslib_1.__metadata("design:type", EventEmitter)
74
- ], FilterGroupComponent.prototype, "valueChange", void 0);
75
- FilterGroupComponent = tslib_1.__decorate([
76
- Component({
77
- selector: 'kendo-filter-group',
78
- template: "\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 "
79
- }),
80
- tslib_1.__metadata("design:paramtypes", [FilterService, LocalizationService, ChangeDetectorRef])
81
- ], FilterGroupComponent);
82
- return FilterGroupComponent;
83
- }());
84
- export { FilterGroupComponent };
@@ -1,185 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, Input, Output, EventEmitter, HostBinding, isDevMode } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { FilterService } from './filter.service';
9
- import { isArray } from './util';
10
- import { ChangeDetectorRef } from '@angular/core';
11
- import { validatePackage } from '@progress/kendo-licensing';
12
- import { packageMetadata } from './package-metadata';
13
- /**
14
- * Represents the [Kendo UI Filter component for Angular]({% slug overview_filter %}).
15
- * The Filter component can be used to apply any user defined filter criteria.
16
- * @example
17
- * ```
18
- * @Component({
19
- * selector: 'my-app',
20
- * template: `
21
- * <kendo-filter [filters]="filters" (valueChange)="onValueChange($event)"></kendo-filter>
22
- * `
23
- * })
24
- * export class AppComponent {
25
- *
26
- * public filters: FilterExpression[] = [
27
- * {
28
- * name: 'country',
29
- * label: 'Country',
30
- * filter: 'string',
31
- * operators: ['eq', 'neq'],
32
- * },
33
- * {
34
- * name: 'budget',
35
- * filter: 'number'
36
- * }
37
- * ];
38
- *
39
- * onValueChange(e: CompositeFilterDescriptor){
40
- * console.log(e)
41
- * }
42
- * }
43
- * ```
44
- */
45
- var FilterComponent = /** @class */ (function () {
46
- function FilterComponent(filterService, localization, cdr) {
47
- this.filterService = filterService;
48
- this.localization = localization;
49
- this.cdr = cdr;
50
- /**
51
- * Fires every time the Filter component value is updated.
52
- * That is each time a Filter Group or Filter Expression is added, removed, or updated.
53
- */
54
- this.valueChange = new EventEmitter();
55
- validatePackage(packageMetadata);
56
- this.direction = localization.rtl ? 'rtl' : 'ltr';
57
- }
58
- Object.defineProperty(FilterComponent.prototype, "filters", {
59
- get: function () {
60
- return this.filterService.filters;
61
- },
62
- /**
63
- * Specifies the available user-defined filters. At least one filter should be provided.
64
- */
65
- set: function (_filters) {
66
- if (isDevMode() && (!isArray(_filters) || _filters.length === 0)) {
67
- 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");
68
- }
69
- this.filterService.filters = _filters.map(function (filterExpression) {
70
- var clonedFilter = Object.assign({}, filterExpression);
71
- if (!clonedFilter.title) {
72
- clonedFilter.title = clonedFilter.field;
73
- }
74
- return clonedFilter;
75
- });
76
- },
77
- enumerable: true,
78
- configurable: true
79
- });
80
- Object.defineProperty(FilterComponent.prototype, "value", {
81
- get: function () {
82
- return this.filterService.value;
83
- },
84
- /**
85
- * Sets the initial `value` of the Filter component.
86
- */
87
- set: function (value) {
88
- var clonedValue = JSON.parse(JSON.stringify(value));
89
- this.normalizeValue(clonedValue);
90
- this.filterService.value = clonedValue;
91
- },
92
- enumerable: true,
93
- configurable: true
94
- });
95
- FilterComponent.prototype.ngOnInit = function () {
96
- var _this = this;
97
- if (this.filters.length === 0) {
98
- 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");
99
- }
100
- this.localizationSubscription = this.localization.changes.subscribe(function (_a) {
101
- var rtl = _a.rtl;
102
- _this.direction = rtl ? 'rtl' : 'ltr';
103
- _this.cdr.detectChanges();
104
- });
105
- };
106
- FilterComponent.prototype.ngOnDestroy = function () {
107
- if (this.localizationSubscription) {
108
- this.localizationSubscription.unsubscribe();
109
- }
110
- };
111
- /**
112
- * @hidden
113
- */
114
- FilterComponent.prototype.getCurrentFilter = function () {
115
- return this.value;
116
- };
117
- /**
118
- * @hidden
119
- */
120
- FilterComponent.prototype.onValueChange = function () {
121
- this.valueChange.emit(this.filterService.value);
122
- };
123
- FilterComponent.prototype.normalizeFilter = function (filterDescriptor) {
124
- var foundFilter = this.filterService.filters.find(function (filter) { return filter.field === filterDescriptor.field; });
125
- if (isDevMode() && !foundFilter) {
126
- throw new Error("There is no user-defined filter with '" + filterDescriptor.field + "' field provided through the [filters] input property.");
127
- }
128
- if (isDevMode() && foundFilter.editor === 'boolean' && (!filterDescriptor.value && filterDescriptor.value !== false)) {
129
- console.warn("Provide a value for the boolean '" + filterDescriptor.field + "' user-defined filter as the operator is always set to 'eq'.");
130
- }
131
- if (filterDescriptor.operator && foundFilter.operators && !foundFilter.operators.some(function (operator) { return operator === filterDescriptor.operator; })) {
132
- throw new Error("The user-defined filter with field '" + filterDescriptor.field + "' is missing the '" + filterDescriptor.operator + "' operator.");
133
- }
134
- if (foundFilter.editor === 'boolean') {
135
- filterDescriptor.operator = 'eq';
136
- }
137
- if (foundFilter.editor === 'date' && filterDescriptor.value) {
138
- filterDescriptor.value = new Date(filterDescriptor.value);
139
- }
140
- if (!filterDescriptor.value && filterDescriptor.value !== false) {
141
- filterDescriptor.value = null;
142
- }
143
- };
144
- FilterComponent.prototype.normalizeValue = function (item) {
145
- var _this = this;
146
- item.filters.forEach(function (item) {
147
- if (item.filters) {
148
- _this.normalizeValue(item);
149
- }
150
- else {
151
- _this.normalizeFilter(item);
152
- }
153
- });
154
- };
155
- tslib_1.__decorate([
156
- HostBinding('attr.dir'),
157
- tslib_1.__metadata("design:type", String)
158
- ], FilterComponent.prototype, "direction", void 0);
159
- tslib_1.__decorate([
160
- Input(),
161
- tslib_1.__metadata("design:type", Array),
162
- tslib_1.__metadata("design:paramtypes", [Array])
163
- ], FilterComponent.prototype, "filters", null);
164
- tslib_1.__decorate([
165
- Input(),
166
- tslib_1.__metadata("design:type", Object),
167
- tslib_1.__metadata("design:paramtypes", [Object])
168
- ], FilterComponent.prototype, "value", null);
169
- tslib_1.__decorate([
170
- Output(),
171
- tslib_1.__metadata("design:type", EventEmitter)
172
- ], FilterComponent.prototype, "valueChange", void 0);
173
- FilterComponent = tslib_1.__decorate([
174
- Component({
175
- selector: 'kendo-filter',
176
- template: "\n <ng-container kendoFilterLocalizedMessages\n i18n-editorDateTodayText=\"kendo.filter.editorDateTodayText|The text of the Today button of the Date editor\"\n editorDateTodayText=\"Today\"\n\n i18n-editorDateToggleText=\"kendo.filter.editorDateToggleText|The title of the Toggle button of the Date editor.\"\n editorDateToggleText=\"Toggle calendar\"\n\n i18n-editorNumericDecrement=\"kendo.filter.editorNumericDecrement|The title of the Decrement button of the Numeric editor\"\n editorNumericDecrement=\"Decrement\"\n\n i18n-editorNumericIncrement=\"kendo.filter.editorNumericIncrement|The title of the Increment button of the Numeric editor\"\n editorNumericIncrement=\"Increment\"\n\n i18n-filterExpressionOperators=\"kendo.filter.filterExpressionOperators|The text of the Filter Expression Operators drop down\"\n filterExpressionOperators=\"Operators\"\n\n i18n-filterExpressionFilters=\"kendo.filter.filterExpressionFilters|The text of the Filter Expression filters drop down\"\n filterExpressionFilters=\"Fields\"\n\n i18n-remove=\"kendo.filter.remove|The text of the Remove button\"\n remove=\"Remove\"\n\n i18n-addFilter=\"kendo.filter.addFilter|The text of the Add Filter button\"\n addFilter=\"Add Filter\"\n\n i18n-addGroup=\"kendo.filter.addGroup|The text of the Add Group button\"\n addGroup=\"Add Group\"\n\n i18n-filterAndLogic=\"kendo.filter.filterAndLogic|The text of the And filter logic\"\n filterAndLogic=\"And\"\n\n i18n-filterOrLogic=\"kendo.filter.filterOrLogic|The text of the Or filter logic\"\n filterOrLogic=\"Or\"\n\n i18n-filterEqOperator=\"kendo.filter.filterEqOperator|The text of the equal filter operator\"\n filterEqOperator=\"Is equal to\"\n\n i18n-filterNotEqOperator=\"kendo.filter.filterNotEqOperator|The text of the not equal filter operator\"\n filterNotEqOperator=\"Is not equal to\"\n\n i18n-filterIsNullOperator=\"kendo.filter.filterIsNullOperator|The text of the is null filter operator\"\n filterIsNullOperator=\"Is null\"\n\n i18n-filterIsNotNullOperator=\"kendo.filter.filterIsNotNullOperator|The text of the is not null filter operator\"\n filterIsNotNullOperator=\"Is not null\"\n\n i18n-filterIsEmptyOperator=\"kendo.filter.filterIsEmptyOperator|The text of the is empty filter operator\"\n filterIsEmptyOperator=\"Is empty\"\n\n i18n-filterIsNotEmptyOperator=\"kendo.filter.filterIsNotEmptyOperator|The text of the is not empty filter operator\"\n filterIsNotEmptyOperator=\"Is not empty\"\n\n i18n-filterStartsWithOperator=\"kendo.filter.filterStartsWithOperator|The text of the starts with filter operator\"\n filterStartsWithOperator=\"Starts with\"\n\n i18n-filterContainsOperator=\"kendo.filter.filterContainsOperator|The text of the contains filter operator\"\n filterContainsOperator=\"Contains\"\n\n i18n-filterNotContainsOperator=\"kendo.filter.filterNotContainsOperator|The text of the does not contain filter operator\"\n filterNotContainsOperator=\"Does not contain\"\n\n i18n-filterEndsWithOperator=\"kendo.filter.filterEndsWithOperator|The text of the ends with filter operator\"\n filterEndsWithOperator=\"Ends with\"\n\n i18n-filterGteOperator=\"kendo.filter.filterGteOperator|The text of the greater than or equal filter operator\"\n filterGteOperator=\"Is greater than or equal to\"\n\n i18n-filterGtOperator=\"kendo.filter.filterGtOperator|The text of the greater than filter operator\"\n filterGtOperator=\"Is greater than\"\n\n i18n-filterLteOperator=\"kendo.filter.filterLteOperator|The text of the less than or equal filter operator\"\n filterLteOperator=\"Is less than or equal to\"\n\n i18n-filterLtOperator=\"kendo.filter.filterLtOperator|The text of the less than filter operator\"\n filterLtOperator=\"Is less than\"\n\n i18n-filterIsTrue=\"kendo.filter.filterIsTrue|The text of the IsTrue boolean filter option\"\n filterIsTrue=\"Is True\"\n\n i18n-filterIsFalse=\"kendo.filter.filterIsFalse|The text of the IsFalse boolean filter option\"\n filterIsFalse=\"Is False\"\n\n i18n-filterBooleanAll=\"kendo.filter.filterBooleanAll|The text of the (All) boolean filter option\"\n filterBooleanAll=\"(All)\"\n\n i18n-filterAfterOrEqualOperator=\"kendo.filter.filterAfterOrEqualOperator|The text of the after or equal date filter operator\"\n filterAfterOrEqualOperator=\"Is after or equal to\"\n\n i18n-filterAfterOperator=\"kendo.filter.filterAfterOperator|The text of the after date filter operator\"\n filterAfterOperator=\"Is after\"\n\n i18n-filterBeforeOperator=\"kendo.filter.filterBeforeOperator|The text of the before date filter operator\"\n filterBeforeOperator=\"Is before\"\n\n i18n-filterBeforeOrEqualOperator=\"kendo.filter.filterBeforeOrEqualOperator|The text of the before or equal date filter operator\"\n filterBeforeOrEqualOperator=\"Is before or equal to\"\n\n i18n-filterFieldAriaLabel=\"kendo.filter.filterFieldAriaLabel|The text of the filter field aria label\"\n filterFieldAriaLabel=\"field\"\n\n i18n-filterOperatorAriaLabel=\"kendo.filter.filterOperatorAriaLabel|The text of the filter operator aria label\"\n filterOperatorAriaLabel=\"operator\"\n\n i18n-filterValueAriaLabel=\"kendo.filter.filterValueAriaLabel|The text of the filter value aria label\"\n filterValueAriaLabel=\"value\"\n\n i18n-filterAriaLabel=\"kendo.filter.filterAriaLabel|The text of the filter row aria label\"\n filterAriaLabel=\"filter\"\n\n i18n-filterToolbarAriaLabel=\"kendo.filter.filterToolbarAriaLabel|The text of the filter toolbar aria label\"\n filterToolbarAriaLabel=\"filter settings\"\n >\n </ng-container>\n <div class=\"k-widget k-filter\" [attr.dir]=\"direction\">\n <ul class='k-filter-container'>\n <li class='k-filter-group-main'>\n <kendo-filter-group\n [currentItem]=\"getCurrentFilter()\"\n (valueChange)=\"onValueChange()\"\n >\n </kendo-filter-group>\n </li>\n </ul>\n </div>\n",
177
- providers: [FilterService]
178
- }),
179
- tslib_1.__metadata("design:paramtypes", [FilterService,
180
- LocalizationService,
181
- ChangeDetectorRef])
182
- ], FilterComponent);
183
- return FilterComponent;
184
- }());
185
- export { FilterComponent };
@@ -1,91 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { NgModule } from '@angular/core';
7
- import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { AriaLabelValueDirective } from './aria-label.directive';
9
- import { FilterBooleanEditorComponent } from './editors/boolean-editor.component';
10
- import { FilterDateEditorComponent } from './editors/date-editor.component';
11
- import { FilterNumericEditorComponent } from './editors/numeric-editor.component';
12
- import { FilterTextEditorComponent } from './editors/text-editor.component';
13
- import { FilterExpressionOperatorsComponent } from './filter-expression-operators.component';
14
- import { FilterExpressionComponent } from './filter-expression.component';
15
- import { FilterGroupComponent } from './filter-group.component';
16
- import { FilterComponent } from './filter.component';
17
- import { CustomMessagesComponent } from './localization/custom-messages.component';
18
- import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
19
- import { SharedModule } from './shared.module';
20
- /**
21
- * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
22
- * definition for the Filter component.
23
- *
24
- * @example
25
- *
26
- * ```
27
- * // Import the Filter module
28
- * import { FilterModule } from '@progress/kendo-angular-filter';
29
- *
30
- * // The browser platform with a compiler
31
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
32
- *
33
- * import { NgModule } from '@angular/core';
34
- *
35
- * // Import the app component
36
- * import { AppComponent } from './app.component';
37
- *
38
- * // Define the app module
39
- * _@NgModule({
40
- * declarations: [AppComponent], // declare app component
41
- * imports: [BrowserModule, FilterModule], // import Filter module
42
- * bootstrap: [AppComponent]
43
- * })
44
- * export class AppModule { }
45
- *
46
- * // Compile and launch the module
47
- * platformBrowserDynamic().bootstrapModule(AppModule);
48
- *
49
- * ```
50
- */
51
- var FilterModule = /** @class */ (function () {
52
- function FilterModule() {
53
- }
54
- FilterModule = tslib_1.__decorate([
55
- NgModule({
56
- imports: [SharedModule],
57
- declarations: [FilterComponent,
58
- FilterNumericEditorComponent,
59
- FilterTextEditorComponent,
60
- FilterExpressionComponent,
61
- FilterGroupComponent,
62
- FilterExpressionOperatorsComponent,
63
- FilterBooleanEditorComponent,
64
- FilterDateEditorComponent,
65
- LocalizedMessagesDirective,
66
- CustomMessagesComponent,
67
- AriaLabelValueDirective
68
- ],
69
- exports: [FilterComponent,
70
- FilterNumericEditorComponent,
71
- FilterTextEditorComponent,
72
- FilterExpressionComponent,
73
- FilterGroupComponent,
74
- FilterExpressionOperatorsComponent,
75
- FilterBooleanEditorComponent,
76
- FilterDateEditorComponent,
77
- LocalizedMessagesDirective,
78
- CustomMessagesComponent,
79
- AriaLabelValueDirective],
80
- providers: [
81
- LocalizationService,
82
- {
83
- provide: L10N_PREFIX,
84
- useValue: 'kendo.filter'
85
- }
86
- ]
87
- })
88
- ], FilterModule);
89
- return FilterModule;
90
- }());
91
- export { FilterModule };
@@ -1,45 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Injectable } from '@angular/core';
7
- /**
8
- * @hidden
9
- */
10
- var FilterService = /** @class */ (function () {
11
- function FilterService() {
12
- this.value = { filters: [], logic: 'or' };
13
- this.filters = [];
14
- this.isEditorDisabled = false;
15
- }
16
- FilterService.prototype.addFilterGroup = function (item) {
17
- var filterGroup = { logic: 'or', filters: [] };
18
- item.filters.push(filterGroup);
19
- };
20
- FilterService.prototype.addFilterExpression = function (item) {
21
- var filterExpression = { operator: 'eq', value: null, field: null };
22
- item.filters.push(filterExpression);
23
- };
24
- FilterService.prototype.remove = function (item, positionIndex, parentItem) {
25
- var _this = this;
26
- if (!parentItem) {
27
- parentItem = this.value;
28
- }
29
- if (item === parentItem) {
30
- parentItem.filters = [];
31
- return;
32
- }
33
- var index = parentItem.filters.indexOf(item);
34
- if (index >= 0 && index === positionIndex) {
35
- parentItem.filters = parentItem.filters.filter(function (i) { return i !== item; });
36
- return;
37
- }
38
- parentItem.filters.forEach(function (filter) { return filter.filters && _this.remove(item, positionIndex, filter); });
39
- };
40
- FilterService = tslib_1.__decorate([
41
- Injectable()
42
- ], FilterService);
43
- return FilterService;
44
- }());
45
- export { FilterService };
@@ -1,44 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as tslib_1 from "tslib";
6
- import { Component, forwardRef } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { Messages } from './messages';
9
- /**
10
- * Custom component messages override default component messages
11
- * ([see example]({% slug globalization_filter %}#toc-localization)).
12
- */
13
- var CustomMessagesComponent = /** @class */ (function (_super) {
14
- tslib_1.__extends(CustomMessagesComponent, _super);
15
- function CustomMessagesComponent(service) {
16
- var _this = _super.call(this) || this;
17
- _this.service = service;
18
- return _this;
19
- }
20
- CustomMessagesComponent_1 = CustomMessagesComponent;
21
- Object.defineProperty(CustomMessagesComponent.prototype, "override", {
22
- get: function () {
23
- return true;
24
- },
25
- enumerable: true,
26
- configurable: true
27
- });
28
- var CustomMessagesComponent_1;
29
- CustomMessagesComponent = CustomMessagesComponent_1 = tslib_1.__decorate([
30
- Component({
31
- providers: [
32
- {
33
- provide: Messages,
34
- useExisting: forwardRef(function () { return CustomMessagesComponent_1; })
35
- }
36
- ],
37
- selector: 'kendo-filter-messages',
38
- template: ""
39
- }),
40
- tslib_1.__metadata("design:paramtypes", [LocalizationService])
41
- ], CustomMessagesComponent);
42
- return CustomMessagesComponent;
43
- }(Messages));
44
- export { CustomMessagesComponent };