@progress/kendo-angular-filter 1.0.0-next.202203251456 → 1.0.0-next.202204011458
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/aria-label.directive.d.ts +18 -0
- package/bundles/kendo-angular-filter.umd.js +1 -1
- package/editors/boolean-editor.component.d.ts +40 -0
- package/editors/date-editor.component.d.ts +23 -0
- package/editors/numeric-editor.component.d.ts +23 -0
- package/editors/text-editor.component.d.ts +23 -0
- package/esm2015/aria-label.directive.js +28 -0
- package/esm2015/editors/boolean-editor.component.js +84 -0
- package/esm2015/editors/date-editor.component.js +67 -0
- package/esm2015/editors/numeric-editor.component.js +67 -0
- package/esm2015/editors/text-editor.component.js +59 -0
- package/esm2015/filter-expression-operators.component.js +68 -0
- package/esm2015/filter-expression.component.js +219 -0
- package/esm2015/filter-group.component.js +206 -0
- package/esm2015/filter.component.js +415 -0
- package/esm2015/filter.module.js +117 -0
- package/esm2015/filter.service.js +44 -0
- package/esm2015/kendo-angular-filter.js +8 -0
- package/esm2015/localization/custom-messages.component.js +41 -0
- package/esm2015/localization/localized-messages.directive.js +36 -0
- package/esm2015/localization/messages.js +95 -0
- package/esm2015/main.js +16 -0
- package/esm2015/model/filter-expression.js +8 -0
- package/esm2015/package-metadata.js +15 -0
- package/esm2015/shared.module.js +50 -0
- package/esm2015/util.js +136 -0
- package/fesm2015/kendo-angular-filter.js +1622 -0
- package/filter-expression-operators.component.d.ts +27 -0
- package/filter-expression.component.d.ts +48 -0
- package/filter-group.component.d.ts +41 -0
- package/filter.component.d.ts +82 -0
- package/filter.module.d.ts +53 -0
- package/filter.service.d.ts +20 -0
- package/kendo-angular-filter.d.ts +9 -0
- package/localization/custom-messages.component.d.ts +18 -0
- package/localization/localized-messages.directive.d.ts +16 -0
- package/localization/messages.d.ts +161 -0
- package/main.d.ts +17 -0
- package/model/filter-expression.d.ts +60 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +2 -6
- package/shared.module.d.ts +19 -0
- package/util.d.ts +147 -0
|
@@ -0,0 +1,67 @@
|
|
|
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 { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
8
|
+
import * as i2 from "../filter.service";
|
|
9
|
+
import * as i3 from "@progress/kendo-angular-dateinputs";
|
|
10
|
+
import * as i4 from "../aria-label.directive";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class FilterDateEditorComponent {
|
|
15
|
+
constructor(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
messageFor(key) {
|
|
21
|
+
return this.localization.get(key);
|
|
22
|
+
}
|
|
23
|
+
isDisabled() {
|
|
24
|
+
const isDisabled = this.filterService.isEditorDisabled;
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
this.currentItem.value = null;
|
|
27
|
+
}
|
|
28
|
+
return isDisabled;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
FilterDateEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDateEditorComponent, deps: [{ token: i1.LocalizationService }, { token: i2.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
+
FilterDateEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterDateEditorComponent, selector: "kendo-filter-date-editor", inputs: { currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
33
|
+
<kendo-datepicker
|
|
34
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
35
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
36
|
+
[(value)]="currentItem.value"
|
|
37
|
+
(valueChange)="valueChange.emit()"
|
|
38
|
+
[disabled]="isDisabled()">
|
|
39
|
+
<kendo-datepicker-messages
|
|
40
|
+
[toggle]="messageFor('editorDateToggleText')"
|
|
41
|
+
[today]="messageFor('editorDateTodayText')">
|
|
42
|
+
</kendo-datepicker-messages>
|
|
43
|
+
</kendo-datepicker>
|
|
44
|
+
`, isInline: true, components: [{ type: i3.DatePickerComponent, selector: "kendo-datepicker", inputs: ["cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate", "navigationItemTemplate", "focusableId", "activeView", "bottomView", "topView", "calendarType", "animateCalendarNavigation", "disabled", "readonly", "readOnlyInput", "popupSettings", "navigation", "min", "max", "incompleteDateValidation", "focusedDate", "value", "format", "twoDigitYearMax", "formatPlaceholder", "placeholder", "tabindex", "tabIndex", "disabledDates", "title", "rangeValidation", "disabledDatesValidation", "weekNumber", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur", "open", "close"], exportAs: ["kendo-datepicker"] }, { type: i3.DatePickerCustomMessagesComponent, selector: "kendo-datepicker-messages" }], directives: [{ type: i4.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDateEditorComponent, decorators: [{
|
|
46
|
+
type: Component,
|
|
47
|
+
args: [{
|
|
48
|
+
selector: 'kendo-filter-date-editor',
|
|
49
|
+
template: `
|
|
50
|
+
<kendo-datepicker
|
|
51
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
52
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
53
|
+
[(value)]="currentItem.value"
|
|
54
|
+
(valueChange)="valueChange.emit()"
|
|
55
|
+
[disabled]="isDisabled()">
|
|
56
|
+
<kendo-datepicker-messages
|
|
57
|
+
[toggle]="messageFor('editorDateToggleText')"
|
|
58
|
+
[today]="messageFor('editorDateTodayText')">
|
|
59
|
+
</kendo-datepicker-messages>
|
|
60
|
+
</kendo-datepicker>
|
|
61
|
+
`
|
|
62
|
+
}]
|
|
63
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.FilterService }]; }, propDecorators: { currentItem: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], valueChange: [{
|
|
66
|
+
type: Output
|
|
67
|
+
}] } });
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
8
|
+
import * as i2 from "../filter.service";
|
|
9
|
+
import * as i3 from "@progress/kendo-angular-inputs";
|
|
10
|
+
import * as i4 from "../aria-label.directive";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class FilterNumericEditorComponent {
|
|
15
|
+
constructor(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
messageFor(key) {
|
|
21
|
+
return this.localization.get(key);
|
|
22
|
+
}
|
|
23
|
+
isDisabled() {
|
|
24
|
+
const isDisabled = this.filterService.isEditorDisabled;
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
this.currentItem.value = null;
|
|
27
|
+
}
|
|
28
|
+
return isDisabled;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
FilterNumericEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterNumericEditorComponent, deps: [{ token: i1.LocalizationService }, { token: i2.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
+
FilterNumericEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterNumericEditorComponent, selector: "kendo-filter-numeric-editor", inputs: { currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
33
|
+
<kendo-numerictextbox
|
|
34
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
35
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
36
|
+
[(value)]="currentItem.value"
|
|
37
|
+
(valueChange)="valueChange.emit()"
|
|
38
|
+
[disabled]="isDisabled()">
|
|
39
|
+
<kendo-numerictextbox-messages
|
|
40
|
+
[increment]="messageFor('editorNumericIncrement')"
|
|
41
|
+
[decrement]="messageFor('editorNumericDecrement')">
|
|
42
|
+
</kendo-numerictextbox-messages>
|
|
43
|
+
</kendo-numerictextbox>
|
|
44
|
+
`, isInline: true, components: [{ type: i3.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur"], exportAs: ["kendoNumericTextBox"] }, { type: i3.NumericTextBoxCustomMessagesComponent, selector: "kendo-numerictextbox-messages" }], directives: [{ type: i4.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterNumericEditorComponent, decorators: [{
|
|
46
|
+
type: Component,
|
|
47
|
+
args: [{
|
|
48
|
+
selector: 'kendo-filter-numeric-editor',
|
|
49
|
+
template: `
|
|
50
|
+
<kendo-numerictextbox
|
|
51
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
52
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
53
|
+
[(value)]="currentItem.value"
|
|
54
|
+
(valueChange)="valueChange.emit()"
|
|
55
|
+
[disabled]="isDisabled()">
|
|
56
|
+
<kendo-numerictextbox-messages
|
|
57
|
+
[increment]="messageFor('editorNumericIncrement')"
|
|
58
|
+
[decrement]="messageFor('editorNumericDecrement')">
|
|
59
|
+
</kendo-numerictextbox-messages>
|
|
60
|
+
</kendo-numerictextbox>
|
|
61
|
+
`
|
|
62
|
+
}]
|
|
63
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.FilterService }]; }, propDecorators: { currentItem: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], valueChange: [{
|
|
66
|
+
type: Output
|
|
67
|
+
}] } });
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
8
|
+
import * as i2 from "../filter.service";
|
|
9
|
+
import * as i3 from "@progress/kendo-angular-inputs";
|
|
10
|
+
import * as i4 from "../aria-label.directive";
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export class FilterTextEditorComponent {
|
|
15
|
+
constructor(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
isDisabled() {
|
|
21
|
+
const isDisabled = this.filterService.isEditorDisabled;
|
|
22
|
+
if (isDisabled) {
|
|
23
|
+
this.currentItem.value = null;
|
|
24
|
+
}
|
|
25
|
+
return isDisabled;
|
|
26
|
+
}
|
|
27
|
+
messageFor(key) {
|
|
28
|
+
return this.localization.get(key);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
FilterTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterTextEditorComponent, deps: [{ token: i1.LocalizationService }, { token: i2.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
+
FilterTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: { currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
33
|
+
<kendo-textbox
|
|
34
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
35
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
36
|
+
[(value)]="currentItem.value"
|
|
37
|
+
(valueChange)="valueChange.emit()"
|
|
38
|
+
[disabled]="isDisabled()">
|
|
39
|
+
</kendo-textbox>
|
|
40
|
+
`, isInline: true, components: [{ type: i3.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "errorIcon", "clearButtonIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }], directives: [{ type: i4.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterTextEditorComponent, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: 'kendo-filter-text-editor',
|
|
45
|
+
template: `
|
|
46
|
+
<kendo-textbox
|
|
47
|
+
[kendoAriaLabelValue]="messageFor('filterValueAriaLabel')"
|
|
48
|
+
class="k-filter-toolbar-item k-filter-value"
|
|
49
|
+
[(value)]="currentItem.value"
|
|
50
|
+
(valueChange)="valueChange.emit()"
|
|
51
|
+
[disabled]="isDisabled()">
|
|
52
|
+
</kendo-textbox>
|
|
53
|
+
`
|
|
54
|
+
}]
|
|
55
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.FilterService }]; }, propDecorators: { currentItem: [{
|
|
56
|
+
type: Input
|
|
57
|
+
}], valueChange: [{
|
|
58
|
+
type: Output
|
|
59
|
+
}] } });
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import { nullOperators } from './util';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "./filter.service";
|
|
9
|
+
import * as i2 from "@progress/kendo-angular-l10n";
|
|
10
|
+
import * as i3 from "@progress/kendo-angular-dropdowns";
|
|
11
|
+
import * as i4 from "./aria-label.directive";
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export class FilterExpressionOperatorsComponent {
|
|
16
|
+
constructor(filterService, localization) {
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.localization = localization;
|
|
19
|
+
this.valueChange = new EventEmitter();
|
|
20
|
+
this.operators = [];
|
|
21
|
+
}
|
|
22
|
+
messageFor(key) {
|
|
23
|
+
return this.localization.get(key);
|
|
24
|
+
}
|
|
25
|
+
operatorValueChange(value) {
|
|
26
|
+
this.valueChange.emit();
|
|
27
|
+
this.filterService.isEditorDisabled = nullOperators.indexOf(value) >= 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
FilterExpressionOperatorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionOperatorsComponent, deps: [{ token: i1.FilterService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
FilterExpressionOperatorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterExpressionOperatorsComponent, selector: "kendo-filter-expression-operators", inputs: { currentItem: "currentItem", operators: "operators" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
32
|
+
<kendo-dropdownlist
|
|
33
|
+
[kendoAriaLabelValue]="messageFor('filterOperatorAriaLabel')"
|
|
34
|
+
[data]="operators"
|
|
35
|
+
[title]="messageFor('filterExpressionOperators')"
|
|
36
|
+
[(value)]="currentItem.operator"
|
|
37
|
+
(valueChange)="operatorValueChange($event)"
|
|
38
|
+
[valuePrimitive]="true"
|
|
39
|
+
textField="text"
|
|
40
|
+
valueField="value"
|
|
41
|
+
>
|
|
42
|
+
</kendo-dropdownlist>
|
|
43
|
+
`, isInline: true, components: [{ type: i3.DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["iconClass", "loading", "data", "value", "textField", "valueField", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }], directives: [{ type: i4.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }] });
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionOperatorsComponent, decorators: [{
|
|
45
|
+
type: Component,
|
|
46
|
+
args: [{
|
|
47
|
+
selector: 'kendo-filter-expression-operators',
|
|
48
|
+
template: `
|
|
49
|
+
<kendo-dropdownlist
|
|
50
|
+
[kendoAriaLabelValue]="messageFor('filterOperatorAriaLabel')"
|
|
51
|
+
[data]="operators"
|
|
52
|
+
[title]="messageFor('filterExpressionOperators')"
|
|
53
|
+
[(value)]="currentItem.operator"
|
|
54
|
+
(valueChange)="operatorValueChange($event)"
|
|
55
|
+
[valuePrimitive]="true"
|
|
56
|
+
textField="text"
|
|
57
|
+
valueField="value"
|
|
58
|
+
>
|
|
59
|
+
</kendo-dropdownlist>
|
|
60
|
+
`
|
|
61
|
+
}]
|
|
62
|
+
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.LocalizationService }]; }, propDecorators: { currentItem: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], valueChange: [{
|
|
65
|
+
type: Output
|
|
66
|
+
}], operators: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}] } });
|
|
@@ -0,0 +1,219 @@
|
|
|
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 { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import { defaultDateOperators, defaultNumericOperators, defaultOperators, defaultStringOperators, getKeyByValue, isFilterEditor, localizeOperators } from './util';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "./filter.service";
|
|
9
|
+
import * as i2 from "@progress/kendo-angular-l10n";
|
|
10
|
+
import * as i3 from "@progress/kendo-angular-dropdowns";
|
|
11
|
+
import * as i4 from "./filter-expression-operators.component";
|
|
12
|
+
import * as i5 from "./editors/text-editor.component";
|
|
13
|
+
import * as i6 from "./editors/numeric-editor.component";
|
|
14
|
+
import * as i7 from "./editors/boolean-editor.component";
|
|
15
|
+
import * as i8 from "./editors/date-editor.component";
|
|
16
|
+
import * as i9 from "./aria-label.directive";
|
|
17
|
+
import * as i10 from "@angular/common";
|
|
18
|
+
import * as i11 from "@progress/kendo-angular-buttons";
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export class FilterExpressionComponent {
|
|
23
|
+
constructor(filterService, localization, cdr) {
|
|
24
|
+
this.filterService = filterService;
|
|
25
|
+
this.localization = localization;
|
|
26
|
+
this.cdr = cdr;
|
|
27
|
+
this.valueChange = new EventEmitter();
|
|
28
|
+
this.operators = [];
|
|
29
|
+
this.filters = [];
|
|
30
|
+
this.isBoolean = false;
|
|
31
|
+
this.isEditorDisabled = false;
|
|
32
|
+
}
|
|
33
|
+
ngOnInit() {
|
|
34
|
+
this.filters = this.filterService.filters;
|
|
35
|
+
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
36
|
+
if (this.currentItem.field) {
|
|
37
|
+
this.setOperators(foundFilter);
|
|
38
|
+
}
|
|
39
|
+
const defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
40
|
+
if (!this.currentItem.field) {
|
|
41
|
+
this.currentItem.field = this.filterService.filters[0].field;
|
|
42
|
+
this.setOperators(defaultFilter);
|
|
43
|
+
}
|
|
44
|
+
this.localizationSubscription = this.localization.changes.subscribe(() => {
|
|
45
|
+
this.setOperators(foundFilter || defaultFilter);
|
|
46
|
+
this.cdr.detectChanges();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
ngOnDestroy() {
|
|
50
|
+
if (this.localizationSubscription) {
|
|
51
|
+
this.localizationSubscription.unsubscribe();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
normalizeOperators(filterEditor, operators) {
|
|
55
|
+
let result = [];
|
|
56
|
+
for (let j = 0; j < operators.length; j++) {
|
|
57
|
+
if (isFilterEditor(filterEditor)) {
|
|
58
|
+
result.push({
|
|
59
|
+
value: operators[j],
|
|
60
|
+
text: this.localization.get(getKeyByValue(defaultOperators[filterEditor], operators[j]))
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
messageFor(key) {
|
|
67
|
+
return this.localization.get(key);
|
|
68
|
+
}
|
|
69
|
+
getFilterExpressionByField(name) {
|
|
70
|
+
const foundFilter = this.filterService.filters.find(filter => filter.field === name);
|
|
71
|
+
if (foundFilter) {
|
|
72
|
+
return foundFilter;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
filterValueChange(value) {
|
|
77
|
+
this.currentItem.value = null;
|
|
78
|
+
this.currentItem.field = value;
|
|
79
|
+
const foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
80
|
+
this.setOperators(foundFilter);
|
|
81
|
+
this.valueChange.emit();
|
|
82
|
+
}
|
|
83
|
+
getDefaultOperators(operatorsType) {
|
|
84
|
+
switch (operatorsType) {
|
|
85
|
+
case 'string':
|
|
86
|
+
return localizeOperators(defaultStringOperators)(this.localization);
|
|
87
|
+
case 'number':
|
|
88
|
+
return localizeOperators(defaultNumericOperators)(this.localization);
|
|
89
|
+
case 'date':
|
|
90
|
+
return localizeOperators(defaultDateOperators)(this.localization);
|
|
91
|
+
default:
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
getEditorType() {
|
|
96
|
+
let item = this.filterService.filters.find((filterExpression) => filterExpression.field === this.currentItem.field);
|
|
97
|
+
return item.editor;
|
|
98
|
+
}
|
|
99
|
+
removeFilterExpression() {
|
|
100
|
+
this.filterService.remove(this.currentItem, this.index);
|
|
101
|
+
this.valueChange.emit();
|
|
102
|
+
}
|
|
103
|
+
setOperators(filter) {
|
|
104
|
+
this.isBoolean = filter.editor === 'boolean';
|
|
105
|
+
if (this.isBoolean) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (filter.operators) {
|
|
109
|
+
const localizedOperators = this.normalizeOperators(filter.editor, filter.operators);
|
|
110
|
+
this.operators = localizedOperators;
|
|
111
|
+
if (!this.currentItem.operator) {
|
|
112
|
+
this.currentItem.operator = localizedOperators[0].value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.operators = this.getDefaultOperators(filter.editor);
|
|
117
|
+
if (!this.currentItem.operator) {
|
|
118
|
+
this.currentItem.operator = this.operators[0].value;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
FilterExpressionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionComponent, deps: [{ token: i1.FilterService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
124
|
+
FilterExpressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FilterExpressionComponent, selector: "kendo-filter-expression", inputs: { index: "index", currentItem: "currentItem" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
|
|
125
|
+
<div class="k-filter-toolbar" role="group" [attr.aria-label]="messageFor('filterAriaLabel')">
|
|
126
|
+
<div class="k-toolbar">
|
|
127
|
+
<div class="k-filter-toolbar-item k-filter-field">
|
|
128
|
+
<kendo-dropdownlist
|
|
129
|
+
[kendoAriaLabelValue]="messageFor('filterFieldAriaLabel')"
|
|
130
|
+
[title]="messageFor('filterExpressionFilters')"
|
|
131
|
+
[data]="filters"
|
|
132
|
+
textField="title"
|
|
133
|
+
valueField="field"
|
|
134
|
+
[value]="currentItem.field"
|
|
135
|
+
[valuePrimitive]="true"
|
|
136
|
+
(valueChange)="filterValueChange($event)">
|
|
137
|
+
</kendo-dropdownlist>
|
|
138
|
+
</div>
|
|
139
|
+
<div *ngIf="!isBoolean" class="k-filter-toolbar-item k-filter-operator">
|
|
140
|
+
<kendo-filter-expression-operators
|
|
141
|
+
[currentItem]="currentItem"
|
|
142
|
+
[operators]="operators"
|
|
143
|
+
(valueChange)="valueChange.emit();">
|
|
144
|
+
</kendo-filter-expression-operators>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<ng-container [ngSwitch]="getEditorType()">
|
|
148
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
149
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
150
|
+
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
151
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
152
|
+
</ng-container>
|
|
153
|
+
|
|
154
|
+
<div class="k-filter-toolbar-item">
|
|
155
|
+
<button
|
|
156
|
+
kendoButton
|
|
157
|
+
icon="close"
|
|
158
|
+
fillMode="flat"
|
|
159
|
+
[title]="messageFor('remove')"
|
|
160
|
+
(click)="removeFilterExpression()">
|
|
161
|
+
</button>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
`, isInline: true, components: [{ type: i3.DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["iconClass", "loading", "data", "value", "textField", "valueField", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }, { type: i4.FilterExpressionOperatorsComponent, selector: "kendo-filter-expression-operators", inputs: ["currentItem", "operators"], outputs: ["valueChange"] }, { type: i5.FilterTextEditorComponent, selector: "kendo-filter-text-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i6.FilterNumericEditorComponent, selector: "kendo-filter-numeric-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i7.FilterBooleanEditorComponent, selector: "kendo-filter-boolean-editor", inputs: ["currentItem"], outputs: ["valueChange"] }, { type: i8.FilterDateEditorComponent, selector: "kendo-filter-date-editor", inputs: ["currentItem"], outputs: ["valueChange"] }], directives: [{ type: i9.AriaLabelValueDirective, selector: "[kendoAriaLabelValue]", inputs: ["kendoAriaLabelValue"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i10.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i11.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "shape", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterExpressionComponent, decorators: [{
|
|
167
|
+
type: Component,
|
|
168
|
+
args: [{
|
|
169
|
+
selector: 'kendo-filter-expression',
|
|
170
|
+
template: `
|
|
171
|
+
<div class="k-filter-toolbar" role="group" [attr.aria-label]="messageFor('filterAriaLabel')">
|
|
172
|
+
<div class="k-toolbar">
|
|
173
|
+
<div class="k-filter-toolbar-item k-filter-field">
|
|
174
|
+
<kendo-dropdownlist
|
|
175
|
+
[kendoAriaLabelValue]="messageFor('filterFieldAriaLabel')"
|
|
176
|
+
[title]="messageFor('filterExpressionFilters')"
|
|
177
|
+
[data]="filters"
|
|
178
|
+
textField="title"
|
|
179
|
+
valueField="field"
|
|
180
|
+
[value]="currentItem.field"
|
|
181
|
+
[valuePrimitive]="true"
|
|
182
|
+
(valueChange)="filterValueChange($event)">
|
|
183
|
+
</kendo-dropdownlist>
|
|
184
|
+
</div>
|
|
185
|
+
<div *ngIf="!isBoolean" class="k-filter-toolbar-item k-filter-operator">
|
|
186
|
+
<kendo-filter-expression-operators
|
|
187
|
+
[currentItem]="currentItem"
|
|
188
|
+
[operators]="operators"
|
|
189
|
+
(valueChange)="valueChange.emit();">
|
|
190
|
+
</kendo-filter-expression-operators>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<ng-container [ngSwitch]="getEditorType()">
|
|
194
|
+
<kendo-filter-text-editor *ngSwitchCase="'string'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-text-editor>
|
|
195
|
+
<kendo-filter-numeric-editor *ngSwitchCase="'number'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-numeric-editor>
|
|
196
|
+
<kendo-filter-boolean-editor *ngSwitchCase="'boolean'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-boolean-editor>
|
|
197
|
+
<kendo-filter-date-editor *ngSwitchCase="'date'" [currentItem]="currentItem" (valueChange)="valueChange.emit()"></kendo-filter-date-editor>
|
|
198
|
+
</ng-container>
|
|
199
|
+
|
|
200
|
+
<div class="k-filter-toolbar-item">
|
|
201
|
+
<button
|
|
202
|
+
kendoButton
|
|
203
|
+
icon="close"
|
|
204
|
+
fillMode="flat"
|
|
205
|
+
[title]="messageFor('remove')"
|
|
206
|
+
(click)="removeFilterExpression()">
|
|
207
|
+
</button>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
`
|
|
212
|
+
}]
|
|
213
|
+
}], ctorParameters: function () { return [{ type: i1.FilterService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { index: [{
|
|
214
|
+
type: Input
|
|
215
|
+
}], currentItem: [{
|
|
216
|
+
type: Input
|
|
217
|
+
}], valueChange: [{
|
|
218
|
+
type: Output
|
|
219
|
+
}] } });
|