@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.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +654 -0
- package/README.md +31 -0
- package/dist/cdn/js/kendo-angular-filter.js +150 -0
- package/dist/cdn/main.js +5 -0
- package/dist/es/aria-label.directive.js +30 -0
- package/dist/es/editors/boolean-editor.component.js +41 -0
- package/dist/es/editors/date-editor.component.js +45 -0
- package/dist/es/editors/numeric-editor.component.js +45 -0
- package/dist/es/editors/text-editor.component.js +45 -0
- package/dist/es/filter-expression-operators.component.js +48 -0
- package/dist/es/filter-expression.component.js +121 -0
- package/dist/es/filter-group.component.js +69 -0
- package/dist/es/filter.component.js +185 -0
- package/dist/es/filter.module.js +91 -0
- package/dist/es/filter.service.js +84 -0
- package/dist/es/index.js +21 -0
- package/dist/es/localization/custom-messages.component.js +44 -0
- package/dist/es/localization/localized-messages.directive.js +35 -0
- package/dist/es/localization/messages.js +166 -0
- package/dist/es/main.js +6 -0
- package/dist/es/model/filter-expression.js +7 -0
- package/dist/es/package-metadata.js +15 -0
- package/dist/es/shared.module.js +37 -0
- package/dist/es/util.js +129 -0
- package/dist/es2015/aria-label.directive.d.ts +15 -0
- package/dist/es2015/aria-label.directive.js +29 -0
- package/dist/es2015/editors/boolean-editor.component.d.ts +25 -0
- package/dist/es2015/editors/boolean-editor.component.js +53 -0
- package/dist/es2015/editors/date-editor.component.d.ts +20 -0
- package/dist/es2015/editors/date-editor.component.js +56 -0
- package/dist/es2015/editors/numeric-editor.component.d.ts +20 -0
- package/dist/es2015/editors/numeric-editor.component.js +56 -0
- package/dist/es2015/editors/text-editor.component.d.ts +20 -0
- package/dist/es2015/editors/text-editor.component.js +52 -0
- package/dist/es2015/filter-expression-operators.component.d.ts +24 -0
- package/dist/es2015/filter-expression-operators.component.js +59 -0
- package/dist/es2015/filter-expression.component.d.ts +40 -0
- package/dist/es2015/filter-expression.component.js +160 -0
- package/dist/es2015/filter-group.component.d.ts +29 -0
- package/dist/es2015/filter-group.component.js +131 -0
- package/dist/es2015/filter.component.d.ts +80 -0
- package/dist/es2015/filter.component.js +298 -0
- package/dist/es2015/filter.module.d.ts +37 -0
- package/dist/es2015/filter.module.js +88 -0
- package/dist/es2015/filter.service.d.ts +43 -0
- package/dist/es2015/filter.service.js +66 -0
- package/dist/es2015/index.d.ts +21 -0
- package/dist/es2015/index.js +21 -0
- package/dist/es2015/index.metadata.json +1 -0
- package/dist/es2015/localization/custom-messages.component.d.ts +15 -0
- package/dist/es2015/localization/custom-messages.component.js +36 -0
- package/dist/es2015/localization/localized-messages.directive.d.ts +13 -0
- package/dist/es2015/localization/localized-messages.directive.js +31 -0
- package/dist/es2015/localization/messages.d.ts +158 -0
- package/dist/es2015/localization/messages.js +160 -0
- package/dist/es2015/main.d.ts +7 -0
- package/dist/es2015/main.js +6 -0
- package/dist/es2015/model/filter-expression.d.ts +60 -0
- package/dist/es2015/model/filter-expression.js +7 -0
- package/dist/es2015/package-metadata.d.ts +9 -0
- package/dist/es2015/package-metadata.js +15 -0
- package/dist/es2015/shared.module.d.ts +9 -0
- package/dist/es2015/shared.module.js +34 -0
- package/dist/es2015/util.d.ts +140 -0
- package/dist/es2015/util.js +129 -0
- package/dist/fesm2015/index.js +1282 -0
- package/dist/fesm5/index.js +1058 -0
- package/dist/npm/aria-label.directive.js +32 -0
- package/dist/npm/editors/boolean-editor.component.js +43 -0
- package/dist/npm/editors/date-editor.component.js +47 -0
- package/dist/npm/editors/numeric-editor.component.js +47 -0
- package/dist/npm/editors/text-editor.component.js +47 -0
- package/dist/npm/filter-expression-operators.component.js +50 -0
- package/dist/npm/filter-expression.component.js +123 -0
- package/dist/npm/filter-group.component.js +71 -0
- package/dist/npm/filter.component.js +187 -0
- package/dist/npm/filter.module.js +93 -0
- package/dist/npm/filter.service.js +86 -0
- package/dist/npm/index.js +37 -0
- package/dist/npm/localization/custom-messages.component.js +46 -0
- package/dist/npm/localization/localized-messages.directive.js +37 -0
- package/dist/npm/localization/messages.js +168 -0
- package/dist/npm/main.js +10 -0
- package/dist/npm/model/filter-expression.js +9 -0
- package/dist/npm/package-metadata.js +17 -0
- package/dist/npm/shared.module.js +39 -0
- package/dist/npm/util.js +131 -0
- package/dist/systemjs/kendo-angular-filter.js +5 -0
- package/package.json +158 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +12 -0
- package/schematics/ngAdd/index.js.map +1 -0
- package/schematics/ngAdd/schema.json +28 -0
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
var AriaLabelValueDirective = /** @class */ (function () {
|
|
13
|
+
function AriaLabelValueDirective(hostElement, renderer) {
|
|
14
|
+
this.hostElement = hostElement;
|
|
15
|
+
this.renderer = renderer;
|
|
16
|
+
}
|
|
17
|
+
AriaLabelValueDirective.prototype.ngOnChanges = function () {
|
|
18
|
+
var target = this.hostElement.nativeElement.querySelector('input') || this.hostElement.nativeElement;
|
|
19
|
+
this.renderer.setAttribute(target, 'aria-label', this.ariaLabel);
|
|
20
|
+
};
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
core_1.Input('kendoAriaLabelValue'),
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
24
|
+
], AriaLabelValueDirective.prototype, "ariaLabel", void 0);
|
|
25
|
+
AriaLabelValueDirective = tslib_1.__decorate([
|
|
26
|
+
core_1.Directive({ selector: '[kendoAriaLabelValue]' }),
|
|
27
|
+
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
28
|
+
core_1.Renderer2])
|
|
29
|
+
], AriaLabelValueDirective);
|
|
30
|
+
return AriaLabelValueDirective;
|
|
31
|
+
}());
|
|
32
|
+
exports.AriaLabelValueDirective = AriaLabelValueDirective;
|
|
@@ -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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
var FilterBooleanEditorComponent = /** @class */ (function () {
|
|
14
|
+
function FilterBooleanEditorComponent(localization) {
|
|
15
|
+
this.localization = localization;
|
|
16
|
+
this.valueChange = new core_1.EventEmitter();
|
|
17
|
+
this.items = [
|
|
18
|
+
{ text: this.localization.get("filterIsTrue"), value: true },
|
|
19
|
+
{ text: this.localization.get("filterIsFalse"), value: false }
|
|
20
|
+
];
|
|
21
|
+
this.defaultItem = { text: this.localization.get("filterBooleanAll"), value: null };
|
|
22
|
+
}
|
|
23
|
+
FilterBooleanEditorComponent.prototype.messageFor = function (key) {
|
|
24
|
+
return this.localization.get(key);
|
|
25
|
+
};
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
core_1.Input(),
|
|
28
|
+
tslib_1.__metadata("design:type", Object)
|
|
29
|
+
], FilterBooleanEditorComponent.prototype, "currentItem", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
core_1.Output(),
|
|
32
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
33
|
+
], FilterBooleanEditorComponent.prototype, "valueChange", void 0);
|
|
34
|
+
FilterBooleanEditorComponent = tslib_1.__decorate([
|
|
35
|
+
core_1.Component({
|
|
36
|
+
selector: 'kendo-filter-boolean-editor',
|
|
37
|
+
template: "\n <kendo-dropdownlist\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [data]=\"items\"\n [defaultItem]=\"defaultItem\"\n [valuePrimitive]=\"true\"\n textField=\"text\"\n valueField=\"value\"\n >\n </kendo-dropdownlist>\n "
|
|
38
|
+
}),
|
|
39
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService])
|
|
40
|
+
], FilterBooleanEditorComponent);
|
|
41
|
+
return FilterBooleanEditorComponent;
|
|
42
|
+
}());
|
|
43
|
+
exports.FilterBooleanEditorComponent = FilterBooleanEditorComponent;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("../filter.service");
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
var FilterDateEditorComponent = /** @class */ (function () {
|
|
15
|
+
function FilterDateEditorComponent(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new core_1.EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
FilterDateEditorComponent.prototype.messageFor = function (key) {
|
|
21
|
+
return this.localization.get(key);
|
|
22
|
+
};
|
|
23
|
+
FilterDateEditorComponent.prototype.isDisabled = function () {
|
|
24
|
+
var isDisabled = this.filterService.isEditorDisabled;
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
this.currentItem.value = null;
|
|
27
|
+
}
|
|
28
|
+
return isDisabled;
|
|
29
|
+
};
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
core_1.Input(),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], FilterDateEditorComponent.prototype, "currentItem", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
core_1.Output(),
|
|
36
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
37
|
+
], FilterDateEditorComponent.prototype, "valueChange", void 0);
|
|
38
|
+
FilterDateEditorComponent = tslib_1.__decorate([
|
|
39
|
+
core_1.Component({
|
|
40
|
+
selector: 'kendo-filter-date-editor',
|
|
41
|
+
template: "\n <kendo-datepicker\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [disabled]=\"isDisabled()\">\n <kendo-datepicker-messages\n [toggle]=\"messageFor('editorDateToggleText')\"\n [today]=\"messageFor('editorDateTodayText')\">\n </kendo-datepicker-messages>\n </kendo-datepicker>\n "
|
|
42
|
+
}),
|
|
43
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService, filter_service_1.FilterService])
|
|
44
|
+
], FilterDateEditorComponent);
|
|
45
|
+
return FilterDateEditorComponent;
|
|
46
|
+
}());
|
|
47
|
+
exports.FilterDateEditorComponent = FilterDateEditorComponent;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("../filter.service");
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
var FilterNumericEditorComponent = /** @class */ (function () {
|
|
15
|
+
function FilterNumericEditorComponent(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new core_1.EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
FilterNumericEditorComponent.prototype.messageFor = function (key) {
|
|
21
|
+
return this.localization.get(key);
|
|
22
|
+
};
|
|
23
|
+
FilterNumericEditorComponent.prototype.isDisabled = function () {
|
|
24
|
+
var isDisabled = this.filterService.isEditorDisabled;
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
this.currentItem.value = null;
|
|
27
|
+
}
|
|
28
|
+
return isDisabled;
|
|
29
|
+
};
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
core_1.Input(),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], FilterNumericEditorComponent.prototype, "currentItem", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
core_1.Output(),
|
|
36
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
37
|
+
], FilterNumericEditorComponent.prototype, "valueChange", void 0);
|
|
38
|
+
FilterNumericEditorComponent = tslib_1.__decorate([
|
|
39
|
+
core_1.Component({
|
|
40
|
+
selector: 'kendo-filter-numeric-editor',
|
|
41
|
+
template: "\n <kendo-numerictextbox\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [disabled]=\"isDisabled()\">\n <kendo-numerictextbox-messages\n [increment]=\"messageFor('editorNumericIncrement')\"\n [decrement]=\"messageFor('editorNumericDecrement')\">\n </kendo-numerictextbox-messages>\n </kendo-numerictextbox>\n "
|
|
42
|
+
}),
|
|
43
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService, filter_service_1.FilterService])
|
|
44
|
+
], FilterNumericEditorComponent);
|
|
45
|
+
return FilterNumericEditorComponent;
|
|
46
|
+
}());
|
|
47
|
+
exports.FilterNumericEditorComponent = FilterNumericEditorComponent;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("../filter.service");
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
var FilterTextEditorComponent = /** @class */ (function () {
|
|
15
|
+
function FilterTextEditorComponent(localization, filterService) {
|
|
16
|
+
this.localization = localization;
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.valueChange = new core_1.EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
FilterTextEditorComponent.prototype.isDisabled = function () {
|
|
21
|
+
var isDisabled = this.filterService.isEditorDisabled;
|
|
22
|
+
if (isDisabled) {
|
|
23
|
+
this.currentItem.value = null;
|
|
24
|
+
}
|
|
25
|
+
return isDisabled;
|
|
26
|
+
};
|
|
27
|
+
FilterTextEditorComponent.prototype.messageFor = function (key) {
|
|
28
|
+
return this.localization.get(key);
|
|
29
|
+
};
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
core_1.Input(),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], FilterTextEditorComponent.prototype, "currentItem", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
core_1.Output(),
|
|
36
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
37
|
+
], FilterTextEditorComponent.prototype, "valueChange", void 0);
|
|
38
|
+
FilterTextEditorComponent = tslib_1.__decorate([
|
|
39
|
+
core_1.Component({
|
|
40
|
+
selector: 'kendo-filter-text-editor',
|
|
41
|
+
template: "\n <kendo-textbox\n [kendoAriaLabelValue]=\"messageFor('filterValueAriaLabel')\"\n class=\"k-filter-toolbar-item k-filter-value\"\n [(value)]=\"currentItem.value\"\n (valueChange)=\"valueChange.emit()\"\n [disabled]=\"isDisabled()\">\n </kendo-textbox>\n "
|
|
42
|
+
}),
|
|
43
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService, filter_service_1.FilterService])
|
|
44
|
+
], FilterTextEditorComponent);
|
|
45
|
+
return FilterTextEditorComponent;
|
|
46
|
+
}());
|
|
47
|
+
exports.FilterTextEditorComponent = FilterTextEditorComponent;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("./filter.service");
|
|
11
|
+
var util_1 = require("./util");
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
var FilterExpressionOperatorsComponent = /** @class */ (function () {
|
|
16
|
+
function FilterExpressionOperatorsComponent(filterService, localization) {
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.localization = localization;
|
|
19
|
+
this.valueChange = new core_1.EventEmitter();
|
|
20
|
+
this.operators = [];
|
|
21
|
+
}
|
|
22
|
+
FilterExpressionOperatorsComponent.prototype.messageFor = function (key) {
|
|
23
|
+
return this.localization.get(key);
|
|
24
|
+
};
|
|
25
|
+
FilterExpressionOperatorsComponent.prototype.operatorValueChange = function (value) {
|
|
26
|
+
this.valueChange.emit();
|
|
27
|
+
this.filterService.isEditorDisabled = util_1.nullOperators.indexOf(value) >= 0;
|
|
28
|
+
};
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
core_1.Input(),
|
|
31
|
+
tslib_1.__metadata("design:type", Object)
|
|
32
|
+
], FilterExpressionOperatorsComponent.prototype, "currentItem", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
core_1.Output(),
|
|
35
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
36
|
+
], FilterExpressionOperatorsComponent.prototype, "valueChange", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
core_1.Input(),
|
|
39
|
+
tslib_1.__metadata("design:type", Array)
|
|
40
|
+
], FilterExpressionOperatorsComponent.prototype, "operators", void 0);
|
|
41
|
+
FilterExpressionOperatorsComponent = tslib_1.__decorate([
|
|
42
|
+
core_1.Component({
|
|
43
|
+
selector: 'kendo-filter-expression-operators',
|
|
44
|
+
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 "
|
|
45
|
+
}),
|
|
46
|
+
tslib_1.__metadata("design:paramtypes", [filter_service_1.FilterService, kendo_angular_l10n_1.LocalizationService])
|
|
47
|
+
], FilterExpressionOperatorsComponent);
|
|
48
|
+
return FilterExpressionOperatorsComponent;
|
|
49
|
+
}());
|
|
50
|
+
exports.FilterExpressionOperatorsComponent = FilterExpressionOperatorsComponent;
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("./filter.service");
|
|
11
|
+
var util_1 = require("./util");
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
var FilterExpressionComponent = /** @class */ (function () {
|
|
16
|
+
function FilterExpressionComponent(filterService, localization) {
|
|
17
|
+
this.filterService = filterService;
|
|
18
|
+
this.localization = localization;
|
|
19
|
+
this.valueChange = new core_1.EventEmitter();
|
|
20
|
+
this.operators = [];
|
|
21
|
+
this.filters = [];
|
|
22
|
+
this.isBoolean = false;
|
|
23
|
+
this.isEditorDisabled = false;
|
|
24
|
+
}
|
|
25
|
+
FilterExpressionComponent.prototype.ngOnInit = function () {
|
|
26
|
+
this.filters = this.filterService.filters;
|
|
27
|
+
if (this.currentItem.field) {
|
|
28
|
+
var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
29
|
+
this.setOperators(foundFilter);
|
|
30
|
+
}
|
|
31
|
+
if (!this.currentItem.field) {
|
|
32
|
+
this.currentItem.field = this.filterService.filters[0].field;
|
|
33
|
+
var defaultFilter = this.getFilterExpressionByField(this.filterService.filters[0].field);
|
|
34
|
+
this.setOperators(defaultFilter);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
FilterExpressionComponent.prototype.normalizeOperators = function (filterEditor, operators) {
|
|
38
|
+
var result = [];
|
|
39
|
+
for (var j = 0; j < operators.length; j++) {
|
|
40
|
+
if (util_1.isFilterEditor(filterEditor)) {
|
|
41
|
+
result.push({
|
|
42
|
+
value: operators[j],
|
|
43
|
+
text: this.localization.get(util_1.getKeyByValue(util_1.defaultOperators[filterEditor], operators[j]))
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
FilterExpressionComponent.prototype.messageFor = function (key) {
|
|
50
|
+
return this.localization.get(key);
|
|
51
|
+
};
|
|
52
|
+
FilterExpressionComponent.prototype.getFilterExpressionByField = function (name) {
|
|
53
|
+
var foundFilter = this.filterService.filters.find(function (filter) { return filter.field === name; });
|
|
54
|
+
if (foundFilter) {
|
|
55
|
+
return foundFilter;
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
FilterExpressionComponent.prototype.filterValueChange = function (value) {
|
|
60
|
+
this.currentItem.value = null;
|
|
61
|
+
this.currentItem.field = value;
|
|
62
|
+
var foundFilter = this.getFilterExpressionByField(this.currentItem.field);
|
|
63
|
+
this.setOperators(foundFilter);
|
|
64
|
+
this.valueChange.emit();
|
|
65
|
+
};
|
|
66
|
+
FilterExpressionComponent.prototype.getDefaultOperators = function (operatorsType) {
|
|
67
|
+
switch (operatorsType) {
|
|
68
|
+
case 'string':
|
|
69
|
+
return this.filterService.defaultStringOperators;
|
|
70
|
+
case 'number':
|
|
71
|
+
return this.filterService.defaultNumericOperators;
|
|
72
|
+
case 'date':
|
|
73
|
+
return this.filterService.defaultDateOperators;
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
FilterExpressionComponent.prototype.getEditorType = function () {
|
|
79
|
+
var _this = this;
|
|
80
|
+
var item = this.filterService.filters.find(function (filterExpression) { return filterExpression.field === _this.currentItem.field; });
|
|
81
|
+
return item.editor;
|
|
82
|
+
};
|
|
83
|
+
FilterExpressionComponent.prototype.removeFilterExpression = function () {
|
|
84
|
+
this.filterService.remove(this.currentItem, this.index);
|
|
85
|
+
this.valueChange.emit();
|
|
86
|
+
};
|
|
87
|
+
FilterExpressionComponent.prototype.setOperators = function (filter) {
|
|
88
|
+
this.isBoolean = filter.editor === 'boolean';
|
|
89
|
+
if (this.isBoolean) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (filter.operators) {
|
|
93
|
+
var localizedOperators = this.normalizeOperators(filter.editor, filter.operators);
|
|
94
|
+
this.operators = localizedOperators;
|
|
95
|
+
this.currentItem.operator = localizedOperators[0].value;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
this.operators = this.getDefaultOperators(filter.editor);
|
|
99
|
+
this.currentItem.operator = this.operators[0].value;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
core_1.Input(),
|
|
104
|
+
tslib_1.__metadata("design:type", Number)
|
|
105
|
+
], FilterExpressionComponent.prototype, "index", void 0);
|
|
106
|
+
tslib_1.__decorate([
|
|
107
|
+
core_1.Input(),
|
|
108
|
+
tslib_1.__metadata("design:type", Object)
|
|
109
|
+
], FilterExpressionComponent.prototype, "currentItem", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
core_1.Output(),
|
|
112
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
113
|
+
], FilterExpressionComponent.prototype, "valueChange", void 0);
|
|
114
|
+
FilterExpressionComponent = tslib_1.__decorate([
|
|
115
|
+
core_1.Component({
|
|
116
|
+
selector: 'kendo-filter-expression',
|
|
117
|
+
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 look=\"flat\"\n [title]=\"messageFor('remove')\"\n (click)=\"removeFilterExpression()\">\n </button>\n </div>\n </div>\n </div>\n "
|
|
118
|
+
}),
|
|
119
|
+
tslib_1.__metadata("design:paramtypes", [filter_service_1.FilterService, kendo_angular_l10n_1.LocalizationService])
|
|
120
|
+
], FilterExpressionComponent);
|
|
121
|
+
return FilterExpressionComponent;
|
|
122
|
+
}());
|
|
123
|
+
exports.FilterExpressionComponent = FilterExpressionComponent;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var tslib_1 = require("tslib");
|
|
8
|
+
var core_1 = require("@angular/core");
|
|
9
|
+
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
|
+
var filter_service_1 = require("./filter.service");
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
var FilterGroupComponent = /** @class */ (function () {
|
|
15
|
+
function FilterGroupComponent(filterService, localization) {
|
|
16
|
+
this.filterService = filterService;
|
|
17
|
+
this.localization = localization;
|
|
18
|
+
this.index = 0;
|
|
19
|
+
this.currentItem = {
|
|
20
|
+
logic: 'or',
|
|
21
|
+
filters: []
|
|
22
|
+
};
|
|
23
|
+
this.valueChange = new core_1.EventEmitter();
|
|
24
|
+
this.logicOperators = [];
|
|
25
|
+
}
|
|
26
|
+
FilterGroupComponent.prototype.ngOnInit = function () {
|
|
27
|
+
this.logicOperators = this.filterService.logicOperators;
|
|
28
|
+
};
|
|
29
|
+
FilterGroupComponent.prototype.messageFor = function (key) {
|
|
30
|
+
return this.localization.get(key);
|
|
31
|
+
};
|
|
32
|
+
FilterGroupComponent.prototype.selectedChange = function (logicOperator) {
|
|
33
|
+
if (this.currentItem.logic !== logicOperator) {
|
|
34
|
+
this.currentItem.logic = logicOperator;
|
|
35
|
+
this.valueChange.emit();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
FilterGroupComponent.prototype.addFilterExpression = function () {
|
|
39
|
+
this.filterService.addFilterExpression(this.currentItem);
|
|
40
|
+
this.valueChange.emit();
|
|
41
|
+
};
|
|
42
|
+
FilterGroupComponent.prototype.addFilterGroup = function () {
|
|
43
|
+
this.filterService.addFilterGroup(this.currentItem);
|
|
44
|
+
this.valueChange.emit();
|
|
45
|
+
};
|
|
46
|
+
FilterGroupComponent.prototype.removeFilterGroup = function () {
|
|
47
|
+
this.filterService.remove(this.currentItem, this.index);
|
|
48
|
+
this.valueChange.emit();
|
|
49
|
+
};
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
core_1.Input(),
|
|
52
|
+
tslib_1.__metadata("design:type", Number)
|
|
53
|
+
], FilterGroupComponent.prototype, "index", void 0);
|
|
54
|
+
tslib_1.__decorate([
|
|
55
|
+
core_1.Input(),
|
|
56
|
+
tslib_1.__metadata("design:type", Object)
|
|
57
|
+
], FilterGroupComponent.prototype, "currentItem", void 0);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
core_1.Output(),
|
|
60
|
+
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
61
|
+
], FilterGroupComponent.prototype, "valueChange", void 0);
|
|
62
|
+
FilterGroupComponent = tslib_1.__decorate([
|
|
63
|
+
core_1.Component({
|
|
64
|
+
selector: 'kendo-filter-group',
|
|
65
|
+
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 logicOperators\"\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('addExpression')\"\n icon=\"filter-add-expression\"\n (click)=\"addFilterExpression()\">\n {{messageFor('addExpression')}}\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 look=\"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 "
|
|
66
|
+
}),
|
|
67
|
+
tslib_1.__metadata("design:paramtypes", [filter_service_1.FilterService, kendo_angular_l10n_1.LocalizationService])
|
|
68
|
+
], FilterGroupComponent);
|
|
69
|
+
return FilterGroupComponent;
|
|
70
|
+
}());
|
|
71
|
+
exports.FilterGroupComponent = FilterGroupComponent;
|