@progress/kendo-angular-filter 0.1.0

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 (94) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +654 -0
  3. package/README.md +31 -0
  4. package/dist/cdn/js/kendo-angular-filter.js +150 -0
  5. package/dist/cdn/main.js +5 -0
  6. package/dist/es/aria-label.directive.js +30 -0
  7. package/dist/es/editors/boolean-editor.component.js +41 -0
  8. package/dist/es/editors/date-editor.component.js +45 -0
  9. package/dist/es/editors/numeric-editor.component.js +45 -0
  10. package/dist/es/editors/text-editor.component.js +45 -0
  11. package/dist/es/filter-expression-operators.component.js +48 -0
  12. package/dist/es/filter-expression.component.js +121 -0
  13. package/dist/es/filter-group.component.js +69 -0
  14. package/dist/es/filter.component.js +185 -0
  15. package/dist/es/filter.module.js +91 -0
  16. package/dist/es/filter.service.js +84 -0
  17. package/dist/es/index.js +21 -0
  18. package/dist/es/localization/custom-messages.component.js +44 -0
  19. package/dist/es/localization/localized-messages.directive.js +35 -0
  20. package/dist/es/localization/messages.js +166 -0
  21. package/dist/es/main.js +6 -0
  22. package/dist/es/model/filter-expression.js +7 -0
  23. package/dist/es/package-metadata.js +15 -0
  24. package/dist/es/shared.module.js +37 -0
  25. package/dist/es/util.js +129 -0
  26. package/dist/es2015/aria-label.directive.d.ts +15 -0
  27. package/dist/es2015/aria-label.directive.js +29 -0
  28. package/dist/es2015/editors/boolean-editor.component.d.ts +25 -0
  29. package/dist/es2015/editors/boolean-editor.component.js +53 -0
  30. package/dist/es2015/editors/date-editor.component.d.ts +20 -0
  31. package/dist/es2015/editors/date-editor.component.js +56 -0
  32. package/dist/es2015/editors/numeric-editor.component.d.ts +20 -0
  33. package/dist/es2015/editors/numeric-editor.component.js +56 -0
  34. package/dist/es2015/editors/text-editor.component.d.ts +20 -0
  35. package/dist/es2015/editors/text-editor.component.js +52 -0
  36. package/dist/es2015/filter-expression-operators.component.d.ts +24 -0
  37. package/dist/es2015/filter-expression-operators.component.js +59 -0
  38. package/dist/es2015/filter-expression.component.d.ts +40 -0
  39. package/dist/es2015/filter-expression.component.js +160 -0
  40. package/dist/es2015/filter-group.component.d.ts +29 -0
  41. package/dist/es2015/filter-group.component.js +131 -0
  42. package/dist/es2015/filter.component.d.ts +80 -0
  43. package/dist/es2015/filter.component.js +298 -0
  44. package/dist/es2015/filter.module.d.ts +37 -0
  45. package/dist/es2015/filter.module.js +88 -0
  46. package/dist/es2015/filter.service.d.ts +43 -0
  47. package/dist/es2015/filter.service.js +66 -0
  48. package/dist/es2015/index.d.ts +21 -0
  49. package/dist/es2015/index.js +21 -0
  50. package/dist/es2015/index.metadata.json +1 -0
  51. package/dist/es2015/localization/custom-messages.component.d.ts +15 -0
  52. package/dist/es2015/localization/custom-messages.component.js +36 -0
  53. package/dist/es2015/localization/localized-messages.directive.d.ts +13 -0
  54. package/dist/es2015/localization/localized-messages.directive.js +31 -0
  55. package/dist/es2015/localization/messages.d.ts +158 -0
  56. package/dist/es2015/localization/messages.js +160 -0
  57. package/dist/es2015/main.d.ts +7 -0
  58. package/dist/es2015/main.js +6 -0
  59. package/dist/es2015/model/filter-expression.d.ts +60 -0
  60. package/dist/es2015/model/filter-expression.js +7 -0
  61. package/dist/es2015/package-metadata.d.ts +9 -0
  62. package/dist/es2015/package-metadata.js +15 -0
  63. package/dist/es2015/shared.module.d.ts +9 -0
  64. package/dist/es2015/shared.module.js +34 -0
  65. package/dist/es2015/util.d.ts +140 -0
  66. package/dist/es2015/util.js +129 -0
  67. package/dist/fesm2015/index.js +1282 -0
  68. package/dist/fesm5/index.js +1058 -0
  69. package/dist/npm/aria-label.directive.js +32 -0
  70. package/dist/npm/editors/boolean-editor.component.js +43 -0
  71. package/dist/npm/editors/date-editor.component.js +47 -0
  72. package/dist/npm/editors/numeric-editor.component.js +47 -0
  73. package/dist/npm/editors/text-editor.component.js +47 -0
  74. package/dist/npm/filter-expression-operators.component.js +50 -0
  75. package/dist/npm/filter-expression.component.js +123 -0
  76. package/dist/npm/filter-group.component.js +71 -0
  77. package/dist/npm/filter.component.js +187 -0
  78. package/dist/npm/filter.module.js +93 -0
  79. package/dist/npm/filter.service.js +86 -0
  80. package/dist/npm/index.js +37 -0
  81. package/dist/npm/localization/custom-messages.component.js +46 -0
  82. package/dist/npm/localization/localized-messages.directive.js +37 -0
  83. package/dist/npm/localization/messages.js +168 -0
  84. package/dist/npm/main.js +10 -0
  85. package/dist/npm/model/filter-expression.js +9 -0
  86. package/dist/npm/package-metadata.js +17 -0
  87. package/dist/npm/shared.module.js +39 -0
  88. package/dist/npm/util.js +131 -0
  89. package/dist/systemjs/kendo-angular-filter.js +5 -0
  90. package/package.json +158 -0
  91. package/schematics/collection.json +12 -0
  92. package/schematics/ngAdd/index.js +12 -0
  93. package/schematics/ngAdd/index.js.map +1 -0
  94. package/schematics/ngAdd/schema.json +28 -0
@@ -0,0 +1,298 @@
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
+ let FilterComponent = class FilterComponent {
46
+ constructor(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
+ /**
59
+ * Specifies the available user-defined filters. At least one filter should be provided.
60
+ */
61
+ set filters(_filters) {
62
+ if (isDevMode() && (!isArray(_filters) || _filters.length === 0)) {
63
+ 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`);
64
+ }
65
+ this.filterService.filters = _filters.map(filterExpression => {
66
+ let clonedFilter = Object.assign({}, filterExpression);
67
+ if (!clonedFilter.title) {
68
+ clonedFilter.title = clonedFilter.field;
69
+ }
70
+ return clonedFilter;
71
+ });
72
+ }
73
+ get filters() {
74
+ return this.filterService.filters;
75
+ }
76
+ /**
77
+ * Sets the initial `value` of the Filter component.
78
+ */
79
+ set value(value) {
80
+ const clonedValue = JSON.parse(JSON.stringify(value));
81
+ this.normalizeValue(clonedValue);
82
+ this.filterService.value = clonedValue;
83
+ }
84
+ get value() {
85
+ return this.filterService.value;
86
+ }
87
+ ngOnInit() {
88
+ if (this.filters.length === 0) {
89
+ 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`);
90
+ }
91
+ this.localization.changes.subscribe(({ rtl }) => {
92
+ this.direction = rtl ? 'rtl' : 'ltr';
93
+ this.cdr.detectChanges();
94
+ });
95
+ }
96
+ ngOnDestroy() {
97
+ this.localization.changes.unsubscribe();
98
+ }
99
+ /**
100
+ * @hidden
101
+ */
102
+ getCurrentFilter() {
103
+ return this.value;
104
+ }
105
+ /**
106
+ * @hidden
107
+ */
108
+ getCurrentFilterChildren() {
109
+ return this.value.filters;
110
+ }
111
+ /**
112
+ * @hidden
113
+ */
114
+ onValueChange() {
115
+ this.valueChange.emit(this.filterService.value);
116
+ }
117
+ normalizeFilter(filterDescriptor) {
118
+ const foundFilter = this.filterService.filters.find((filter) => filter.field === filterDescriptor.field);
119
+ if (isDevMode() && !foundFilter) {
120
+ throw new Error(`There is no user-defined filter with '${filterDescriptor.field}' field provided through the [filters] input property.`);
121
+ }
122
+ if (isDevMode() && foundFilter.editor === 'boolean' && (!filterDescriptor.value && filterDescriptor.value !== false)) {
123
+ console.warn(`Provide a value for the boolean '${filterDescriptor.field}' user-defined filter as the operator is always set to 'eq'.`);
124
+ }
125
+ if (foundFilter.editor === 'boolean') {
126
+ filterDescriptor.operator = 'eq';
127
+ }
128
+ if (foundFilter.editor === 'date' && filterDescriptor.value) {
129
+ filterDescriptor.value = new Date(filterDescriptor.value);
130
+ }
131
+ if (!filterDescriptor.value && filterDescriptor.value !== false) {
132
+ filterDescriptor.value = null;
133
+ }
134
+ }
135
+ normalizeValue(item) {
136
+ item.filters.forEach((item) => {
137
+ if (item.filters) {
138
+ this.normalizeValue(item);
139
+ }
140
+ else {
141
+ this.normalizeFilter(item);
142
+ }
143
+ });
144
+ }
145
+ };
146
+ tslib_1.__decorate([
147
+ HostBinding('attr.dir'),
148
+ tslib_1.__metadata("design:type", String)
149
+ ], FilterComponent.prototype, "direction", void 0);
150
+ tslib_1.__decorate([
151
+ Input(),
152
+ tslib_1.__metadata("design:type", Array),
153
+ tslib_1.__metadata("design:paramtypes", [Array])
154
+ ], FilterComponent.prototype, "filters", null);
155
+ tslib_1.__decorate([
156
+ Input(),
157
+ tslib_1.__metadata("design:type", Object),
158
+ tslib_1.__metadata("design:paramtypes", [Object])
159
+ ], FilterComponent.prototype, "value", null);
160
+ tslib_1.__decorate([
161
+ Output(),
162
+ tslib_1.__metadata("design:type", EventEmitter)
163
+ ], FilterComponent.prototype, "valueChange", void 0);
164
+ FilterComponent = tslib_1.__decorate([
165
+ Component({
166
+ selector: 'kendo-filter',
167
+ template: `
168
+ <ng-container kendoFilterLocalizedMessages
169
+ i18n-editorDateTodayText="kendo.filter.editorDateTodayText|The text of the Today button of the Date editor"
170
+ editorDateTodayText="Today"
171
+
172
+ i18n-editorDateToggleText="kendo.filter.editorDateToggleText|The title of the Toggle button of the Date editor."
173
+ editorDateToggleText="Toggle calendar"
174
+
175
+ i18n-editorNumericDecrement="kendo.filter.editorNumericDecrement|The title of the Decrement button of the Numeric editor"
176
+ editorNumericDecrement="Decrement"
177
+
178
+ i18n-editorNumericIncrement="kendo.filter.editorNumericIncrement|The title of the Increment button of the Numeric editor"
179
+ editorNumericIncrement="Increment"
180
+
181
+ i18n-filterExpressionOperators="kendo.filter.filterExpressionOperators|The text of the Filter Expression Operators drop down"
182
+ filterExpressionOperators="Operators"
183
+
184
+ i18n-filterExpressionFilters="kendo.filter.filterExpressionFilters|The text of the Filter Expression filters drop down"
185
+ filterExpressionFilters="Fields"
186
+
187
+ i18n-remove="kendo.filter.remove|The text of the Remove button"
188
+ remove="Remove"
189
+
190
+ i18n-addExpression="kendo.filter.addExpression|The text of the Add Expression button"
191
+ addExpression="Add Expression"
192
+
193
+ i18n-addGroup="kendo.filter.addGroup|The text of the Add Group button"
194
+ addGroup="Add Group"
195
+
196
+ i18n-filterAndLogic="kendo.filter.filterAndLogic|The text of the And filter logic"
197
+ filterAndLogic="And"
198
+
199
+ i18n-filterOrLogic="kendo.filter.filterOrLogic|The text of the Or filter logic"
200
+ filterOrLogic="Or"
201
+
202
+ i18n-filterEqOperator="kendo.filter.filterEqOperator|The text of the equal filter operator"
203
+ filterEqOperator="Is equal to"
204
+
205
+ i18n-filterNotEqOperator="kendo.filter.filterNotEqOperator|The text of the not equal filter operator"
206
+ filterNotEqOperator="Is not equal to"
207
+
208
+ i18n-filterIsNullOperator="kendo.filter.filterIsNullOperator|The text of the is null filter operator"
209
+ filterIsNullOperator="Is null"
210
+
211
+ i18n-filterIsNotNullOperator="kendo.filter.filterIsNotNullOperator|The text of the is not null filter operator"
212
+ filterIsNotNullOperator="Is not null"
213
+
214
+ i18n-filterIsEmptyOperator="kendo.filter.filterIsEmptyOperator|The text of the is empty filter operator"
215
+ filterIsEmptyOperator="Is empty"
216
+
217
+ i18n-filterIsNotEmptyOperator="kendo.filter.filterIsNotEmptyOperator|The text of the is not empty filter operator"
218
+ filterIsNotEmptyOperator="Is not empty"
219
+
220
+ i18n-filterStartsWithOperator="kendo.filter.filterStartsWithOperator|The text of the starts with filter operator"
221
+ filterStartsWithOperator="Starts with"
222
+
223
+ i18n-filterContainsOperator="kendo.filter.filterContainsOperator|The text of the contains filter operator"
224
+ filterContainsOperator="Contains"
225
+
226
+ i18n-filterNotContainsOperator="kendo.filter.filterNotContainsOperator|The text of the does not contain filter operator"
227
+ filterNotContainsOperator="Does not contain"
228
+
229
+ i18n-filterEndsWithOperator="kendo.filter.filterEndsWithOperator|The text of the ends with filter operator"
230
+ filterEndsWithOperator="Ends with"
231
+
232
+ i18n-filterGteOperator="kendo.filter.filterGteOperator|The text of the greater than or equal filter operator"
233
+ filterGteOperator="Is greater than or equal to"
234
+
235
+ i18n-filterGtOperator="kendo.filter.filterGtOperator|The text of the greater than filter operator"
236
+ filterGtOperator="Is greater than"
237
+
238
+ i18n-filterLteOperator="kendo.filter.filterLteOperator|The text of the less than or equal filter operator"
239
+ filterLteOperator="Is less than or equal to"
240
+
241
+ i18n-filterLtOperator="kendo.filter.filterLtOperator|The text of the less than filter operator"
242
+ filterLtOperator="Is less than"
243
+
244
+ i18n-filterIsTrue="kendo.filter.filterIsTrue|The text of the IsTrue boolean filter option"
245
+ filterIsTrue="Is True"
246
+
247
+ i18n-filterIsFalse="kendo.filter.filterIsFalse|The text of the IsFalse boolean filter option"
248
+ filterIsFalse="Is False"
249
+
250
+ i18n-filterBooleanAll="kendo.filter.filterBooleanAll|The text of the (All) boolean filter option"
251
+ filterBooleanAll="(All)"
252
+
253
+ i18n-filterAfterOrEqualOperator="kendo.filter.filterAfterOrEqualOperator|The text of the after or equal date filter operator"
254
+ filterAfterOrEqualOperator="Is after or equal to"
255
+
256
+ i18n-filterAfterOperator="kendo.filter.filterAfterOperator|The text of the after date filter operator"
257
+ filterAfterOperator="Is after"
258
+
259
+ i18n-filterBeforeOperator="kendo.filter.filterBeforeOperator|The text of the before date filter operator"
260
+ filterBeforeOperator="Is before"
261
+
262
+ i18n-filterBeforeOrEqualOperator="kendo.filter.filterBeforeOrEqualOperator|The text of the before or equal date filter operator"
263
+ filterBeforeOrEqualOperator="Is before or equal to"
264
+
265
+ i18n-filterFieldAriaLabel="kendo.filter.filterFieldAriaLabel|The text of the filter field aria label"
266
+ filterFieldAriaLabel="field"
267
+
268
+ i18n-filterOperatorAriaLabel="kendo.filter.filterOperatorAriaLabel|The text of the filter operator aria label"
269
+ filterOperatorAriaLabel="operator"
270
+
271
+ i18n-filterValueAriaLabel="kendo.filter.filterValueAriaLabel|The text of the filter value aria label"
272
+ filterValueAriaLabel="value"
273
+
274
+ i18n-filterAriaLabel="kendo.filter.filterAriaLabel|The text of the filter row aria label"
275
+ filterAriaLabel="filter"
276
+
277
+ i18n-filterToolbarAriaLabel="kendo.filter.filterToolbarAriaLabel|The text of the filter toolbar aria label"
278
+ filterToolbarAriaLabel="filter settings"
279
+ >
280
+ </ng-container>
281
+ <div class="k-widget k-filter" [attr.dir]="direction">
282
+ <ul class='k-filter-container'>
283
+ <li class='k-filter-group-main'>
284
+ <kendo-filter-group
285
+ [currentItem]="getCurrentFilter()"
286
+ (valueChange)="onValueChange()"
287
+ >
288
+ </kendo-filter-group>
289
+ </li>
290
+ </ul>
291
+ </div>
292
+ `
293
+ }),
294
+ tslib_1.__metadata("design:paramtypes", [FilterService,
295
+ LocalizationService,
296
+ ChangeDetectorRef])
297
+ ], FilterComponent);
298
+ export { FilterComponent };
@@ -0,0 +1,37 @@
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
+ /**
6
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
7
+ * definition for the Filter component.
8
+ *
9
+ * @example
10
+ *
11
+ * ```
12
+ * // Import the Filter module
13
+ * import { FilterModule } from '@progress/kendo-angular-filter';
14
+ *
15
+ * // The browser platform with a compiler
16
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
17
+ *
18
+ * import { NgModule } from '@angular/core';
19
+ *
20
+ * // Import the app component
21
+ * import { AppComponent } from './app.component';
22
+ *
23
+ * // Define the app module
24
+ * _@NgModule({
25
+ * declarations: [AppComponent], // declare app component
26
+ * imports: [BrowserModule, FilterModule], // import Filter module
27
+ * bootstrap: [AppComponent]
28
+ * })
29
+ * export class AppModule { }
30
+ *
31
+ * // Compile and launch the module
32
+ * platformBrowserDynamic().bootstrapModule(AppModule);
33
+ *
34
+ * ```
35
+ */
36
+ export declare class FilterModule {
37
+ }
@@ -0,0 +1,88 @@
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
+ let FilterModule = class FilterModule {
52
+ };
53
+ FilterModule = tslib_1.__decorate([
54
+ NgModule({
55
+ imports: [SharedModule],
56
+ declarations: [FilterComponent,
57
+ FilterNumericEditorComponent,
58
+ FilterTextEditorComponent,
59
+ FilterExpressionComponent,
60
+ FilterGroupComponent,
61
+ FilterExpressionOperatorsComponent,
62
+ FilterBooleanEditorComponent,
63
+ FilterDateEditorComponent,
64
+ LocalizedMessagesDirective,
65
+ CustomMessagesComponent,
66
+ AriaLabelValueDirective
67
+ ],
68
+ exports: [FilterComponent,
69
+ FilterNumericEditorComponent,
70
+ FilterTextEditorComponent,
71
+ FilterExpressionComponent,
72
+ FilterGroupComponent,
73
+ FilterExpressionOperatorsComponent,
74
+ FilterBooleanEditorComponent,
75
+ FilterDateEditorComponent,
76
+ LocalizedMessagesDirective,
77
+ CustomMessagesComponent,
78
+ AriaLabelValueDirective],
79
+ providers: [
80
+ LocalizationService,
81
+ {
82
+ provide: L10N_PREFIX,
83
+ useValue: 'kendo.filter'
84
+ }
85
+ ]
86
+ })
87
+ ], FilterModule);
88
+ export { FilterModule };
@@ -0,0 +1,43 @@
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 { LocalizationService } from '@progress/kendo-angular-l10n';
6
+ import { CompositeFilterDescriptor, FilterDescriptor } from '@progress/kendo-data-query';
7
+ import { FilterExpression } from './model/filter-expression';
8
+ /**
9
+ * @hidden
10
+ */
11
+ export declare const localizeOperators: (operators: any) => (localization: any) => {
12
+ text: any;
13
+ value: any;
14
+ }[];
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare class FilterService {
19
+ private localization;
20
+ value: CompositeFilterDescriptor;
21
+ filters: FilterExpression[];
22
+ isEditorDisabled: boolean;
23
+ constructor(localization: LocalizationService);
24
+ readonly defaultNumericOperators: {
25
+ text: string;
26
+ value: string;
27
+ }[];
28
+ readonly defaultStringOperators: {
29
+ text: string;
30
+ value: string;
31
+ }[];
32
+ readonly defaultDateOperators: {
33
+ text: string;
34
+ value: string;
35
+ }[];
36
+ readonly logicOperators: {
37
+ text: string;
38
+ value: string;
39
+ }[];
40
+ addFilterGroup(item: CompositeFilterDescriptor): void;
41
+ addFilterExpression(item: CompositeFilterDescriptor): void;
42
+ remove(item: CompositeFilterDescriptor | FilterDescriptor, positionIndex: number, parentItem?: CompositeFilterDescriptor): void;
43
+ }
@@ -0,0 +1,66 @@
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
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
8
+ import { defaultDateOperators, defaultNumericOperators, defaultStringOperators, logicOperators } from './util';
9
+ /**
10
+ * @hidden
11
+ */
12
+ export const localizeOperators = operators => localization => Object.keys(operators).map(key => ({
13
+ text: localization.get(key),
14
+ value: operators[key]
15
+ }));
16
+ /**
17
+ * @hidden
18
+ */
19
+ let FilterService = class FilterService {
20
+ constructor(localization) {
21
+ this.localization = localization;
22
+ this.value = { filters: [], logic: 'or' };
23
+ this.filters = [];
24
+ this.isEditorDisabled = false;
25
+ }
26
+ get defaultNumericOperators() {
27
+ return localizeOperators(defaultNumericOperators)(this.localization);
28
+ }
29
+ get defaultStringOperators() {
30
+ return localizeOperators(defaultStringOperators)(this.localization);
31
+ }
32
+ get defaultDateOperators() {
33
+ return localizeOperators(defaultDateOperators)(this.localization);
34
+ }
35
+ get logicOperators() {
36
+ return localizeOperators(logicOperators)(this.localization);
37
+ }
38
+ addFilterGroup(item) {
39
+ let filterGroup = { logic: 'or', filters: [] };
40
+ item.filters.push(filterGroup);
41
+ }
42
+ addFilterExpression(item) {
43
+ let filterExpression = { operator: 'eq', value: null, field: null };
44
+ item.filters.push(filterExpression);
45
+ }
46
+ remove(item, positionIndex, parentItem) {
47
+ if (!parentItem) {
48
+ parentItem = this.value;
49
+ }
50
+ if (item === parentItem) {
51
+ parentItem.filters = [];
52
+ return;
53
+ }
54
+ let index = parentItem.filters.indexOf(item);
55
+ if (index >= 0 && index === positionIndex) {
56
+ parentItem.filters = parentItem.filters.filter((i) => i !== item);
57
+ return;
58
+ }
59
+ parentItem.filters.forEach((filter) => filter.filters && this.remove(item, positionIndex, filter));
60
+ }
61
+ };
62
+ FilterService = tslib_1.__decorate([
63
+ Injectable(),
64
+ tslib_1.__metadata("design:paramtypes", [LocalizationService])
65
+ ], FilterService);
66
+ export { FilterService };
@@ -0,0 +1,21 @@
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
+ /**
6
+ * Generated bundle index. Do not edit.
7
+ */
8
+ export * from './main';
9
+ export { AriaLabelValueDirective } from './aria-label.directive';
10
+ export { FilterBooleanEditorComponent } from './editors/boolean-editor.component';
11
+ export { FilterDateEditorComponent } from './editors/date-editor.component';
12
+ export { FilterNumericEditorComponent } from './editors/numeric-editor.component';
13
+ export { FilterTextEditorComponent } from './editors/text-editor.component';
14
+ export { FilterExpressionOperatorsComponent } from './filter-expression-operators.component';
15
+ export { FilterExpressionComponent } from './filter-expression.component';
16
+ export { FilterGroupComponent } from './filter-group.component';
17
+ export { FilterService } from './filter.service';
18
+ export { CustomMessagesComponent } from './localization/custom-messages.component';
19
+ export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
20
+ export { Messages } from './localization/messages';
21
+ export { SharedModule } from './shared.module';
@@ -0,0 +1,21 @@
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
+ /**
6
+ * Generated bundle index. Do not edit.
7
+ */
8
+ export * from './main';
9
+ export { AriaLabelValueDirective } from './aria-label.directive';
10
+ export { FilterBooleanEditorComponent } from './editors/boolean-editor.component';
11
+ export { FilterDateEditorComponent } from './editors/date-editor.component';
12
+ export { FilterNumericEditorComponent } from './editors/numeric-editor.component';
13
+ export { FilterTextEditorComponent } from './editors/text-editor.component';
14
+ export { FilterExpressionOperatorsComponent } from './filter-expression-operators.component';
15
+ export { FilterExpressionComponent } from './filter-expression.component';
16
+ export { FilterGroupComponent } from './filter-group.component';
17
+ export { FilterService } from './filter.service';
18
+ export { CustomMessagesComponent } from './localization/custom-messages.component';
19
+ export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
20
+ export { Messages } from './localization/messages';
21
+ export { SharedModule } from './shared.module';