@progress/kendo-angular-dropdowns 5.4.0-dev.202107201315 → 5.5.0-dev.202110291622
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/dist/cdn/js/kendo-angular-dropdowns.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/common/filtering/filter.directive.js +1 -0
- package/dist/es/common/localization/messages.js +4 -0
- package/dist/es/common/shared.module.js +3 -1
- package/dist/es/dropdowntrees/checked-state/base-check.directive.js +54 -0
- package/dist/es/dropdowntrees/checked-state/check-all.directive.js +181 -0
- package/dist/es/dropdowntrees/checked-state/check.directive.js +15 -36
- package/dist/es/dropdowntrees/dropdowntree.component.js +1 -2
- package/dist/es/dropdowntrees/multiselecttree.component.js +58 -13
- package/dist/es/index.js +2 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/common/filtering/filter.directive.d.ts +1 -0
- package/dist/es2015/common/filtering/filter.directive.js +1 -0
- package/dist/es2015/common/localization/messages.d.ts +4 -0
- package/dist/es2015/common/localization/messages.js +4 -0
- package/dist/es2015/common/shared.module.js +3 -1
- package/dist/es2015/dropdowntrees/checked-state/base-check.directive.d.ts +32 -0
- package/dist/es2015/dropdowntrees/checked-state/base-check.directive.js +48 -0
- package/dist/es2015/dropdowntrees/checked-state/check-all.directive.d.ts +53 -0
- package/dist/es2015/dropdowntrees/checked-state/check-all.directive.js +161 -0
- package/dist/es2015/dropdowntrees/checked-state/check.directive.d.ts +3 -5
- package/dist/es2015/dropdowntrees/checked-state/check.directive.js +5 -26
- package/dist/es2015/dropdowntrees/dropdowntree.component.js +1 -2
- package/dist/es2015/dropdowntrees/multiselecttree.component.d.ts +14 -0
- package/dist/es2015/dropdowntrees/multiselecttree.component.js +82 -15
- package/dist/es2015/index.d.ts +2 -0
- package/dist/es2015/index.js +2 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +289 -45
- package/dist/fesm5/index.js +300 -53
- package/dist/npm/common/filtering/filter.directive.js +1 -0
- package/dist/npm/common/localization/messages.js +4 -0
- package/dist/npm/common/shared.module.js +3 -1
- package/dist/npm/dropdowntrees/checked-state/base-check.directive.js +56 -0
- package/dist/npm/dropdowntrees/checked-state/check-all.directive.js +183 -0
- package/dist/npm/dropdowntrees/checked-state/check.directive.js +14 -35
- package/dist/npm/dropdowntrees/dropdowntree.component.js +1 -2
- package/dist/npm/dropdowntrees/multiselecttree.component.js +58 -13
- package/dist/npm/index.js +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-dropdowns.js +1 -1
- package/package.json +5 -5
package/dist/fesm5/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var packageMetadata = {
|
|
|
23
23
|
name: '@progress/kendo-angular-dropdowns',
|
|
24
24
|
productName: 'Kendo UI for Angular',
|
|
25
25
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
26
|
-
publishDate:
|
|
26
|
+
publishDate: 1635524416,
|
|
27
27
|
version: '',
|
|
28
28
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
29
29
|
};
|
|
@@ -8460,8 +8460,8 @@ var DropDownTreeComponent = /** @class */ (function () {
|
|
|
8460
8460
|
dataItem;
|
|
8461
8461
|
var shouldUpdateValue = newValue !== this.value;
|
|
8462
8462
|
if (shouldUpdateValue) {
|
|
8463
|
-
this.dataItem = dataItem;
|
|
8464
8463
|
this.value = newValue;
|
|
8464
|
+
this.dataItem = dataItem;
|
|
8465
8465
|
this.emitValueChange(this.value);
|
|
8466
8466
|
}
|
|
8467
8467
|
this.togglePopup(false);
|
|
@@ -8668,7 +8668,6 @@ var DropDownTreeComponent = /** @class */ (function () {
|
|
|
8668
8668
|
};
|
|
8669
8669
|
DropDownTreeComponent.prototype.clearState = function () {
|
|
8670
8670
|
this.text = undefined;
|
|
8671
|
-
this.valueDepth = undefined;
|
|
8672
8671
|
this.selectedKeys = [];
|
|
8673
8672
|
};
|
|
8674
8673
|
DropDownTreeComponent.prototype.subscribeEvents = function () {
|
|
@@ -9049,6 +9048,12 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9049
9048
|
* @default false
|
|
9050
9049
|
*/
|
|
9051
9050
|
this.filterable = false;
|
|
9051
|
+
/**
|
|
9052
|
+
* If `checkАll` is set to `true` and the checkboxes are enabled, a tri-state checkbox appears above the embedded treeview.
|
|
9053
|
+
* Clicking the checkbox checks or unchecks all enabled items of the treeview that are loaded.
|
|
9054
|
+
* @default false
|
|
9055
|
+
*/
|
|
9056
|
+
this.checkAll = false;
|
|
9052
9057
|
/**
|
|
9053
9058
|
* A function which determines if a specific node has child nodes.
|
|
9054
9059
|
*/
|
|
@@ -9152,6 +9157,7 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9152
9157
|
this._checkableSettings = DEFAULT_CHECKABLE_SETTINGS;
|
|
9153
9158
|
this._isFocused = false;
|
|
9154
9159
|
this.subscriptions = [];
|
|
9160
|
+
this.lastAction = 'check';
|
|
9155
9161
|
this.onTouchedCallback = noop;
|
|
9156
9162
|
this.onChangeCallback = noop;
|
|
9157
9163
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
@@ -9167,7 +9173,7 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9167
9173
|
this._treeview = treeview;
|
|
9168
9174
|
if (treeview) {
|
|
9169
9175
|
// If filtering is enabled, focus the TreeView on mobile devices instead of the filter input
|
|
9170
|
-
if (this.isFocused && !this.filterable || this.touchEnabled) {
|
|
9176
|
+
if (this.isFocused && !this.filterable && !this.checkAll || this.touchEnabled) {
|
|
9171
9177
|
treeview.focus();
|
|
9172
9178
|
}
|
|
9173
9179
|
/**
|
|
@@ -9488,6 +9494,20 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9488
9494
|
enumerable: true,
|
|
9489
9495
|
configurable: true
|
|
9490
9496
|
});
|
|
9497
|
+
Object.defineProperty(MultiSelectTreeComponent.prototype, "isFilterActive", {
|
|
9498
|
+
get: function () {
|
|
9499
|
+
return this.filterInput && document.activeElement === this.filterInput.nativeElement;
|
|
9500
|
+
},
|
|
9501
|
+
enumerable: true,
|
|
9502
|
+
configurable: true
|
|
9503
|
+
});
|
|
9504
|
+
Object.defineProperty(MultiSelectTreeComponent.prototype, "isCheckAllActive", {
|
|
9505
|
+
get: function () {
|
|
9506
|
+
return this.checkAllInput && document.activeElement === this.checkAllInput.nativeElement;
|
|
9507
|
+
},
|
|
9508
|
+
enumerable: true,
|
|
9509
|
+
configurable: true
|
|
9510
|
+
});
|
|
9491
9511
|
MultiSelectTreeComponent.prototype.ngOnInit = function () {
|
|
9492
9512
|
var _this = this;
|
|
9493
9513
|
this.renderer.removeAttribute(this.hostElement.nativeElement, 'tabindex');
|
|
@@ -9711,6 +9731,7 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9711
9731
|
*/
|
|
9712
9732
|
MultiSelectTreeComponent.prototype.handleCheckedItemsChange = function (items) {
|
|
9713
9733
|
this.valueDepth = items.map(function (item) { return item.level; });
|
|
9734
|
+
this.lastAction = items.length > this.dataItems.length ? 'check' : 'uncheck';
|
|
9714
9735
|
this.dataItems = items.slice();
|
|
9715
9736
|
this.updateValue(this.dataItems);
|
|
9716
9737
|
};
|
|
@@ -9803,6 +9824,13 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9803
9824
|
this.filterChange.next(term);
|
|
9804
9825
|
this.allNodesHidden = this.nodes.every(function (node, index) { return !_this.isVisible(node, String(index)); });
|
|
9805
9826
|
};
|
|
9827
|
+
/**
|
|
9828
|
+
* @hidden
|
|
9829
|
+
*/
|
|
9830
|
+
MultiSelectTreeComponent.prototype.toggleCheckAll = function () {
|
|
9831
|
+
this.checkAllInput.nativeElement.focus();
|
|
9832
|
+
this.checkAllInput.nativeElement.click();
|
|
9833
|
+
};
|
|
9806
9834
|
MultiSelectTreeComponent.prototype.verifySettings = function () {
|
|
9807
9835
|
if (!isDevMode()) {
|
|
9808
9836
|
return;
|
|
@@ -9928,17 +9956,20 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9928
9956
|
return;
|
|
9929
9957
|
}
|
|
9930
9958
|
var isFirstNodeActive = this.treeview['navigationService']['activeIndex'] === '0';
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
if (isFilterActive) {
|
|
9934
|
-
this.focus();
|
|
9935
|
-
}
|
|
9936
|
-
else if (!isFilterActive && isFirstNodeActive) {
|
|
9937
|
-
this.filterInput.nativeElement.focus();
|
|
9938
|
-
}
|
|
9939
|
-
}
|
|
9940
|
-
if (!this.filterable && isFirstNodeActive) {
|
|
9959
|
+
// Current focus is on the filter input => should focus the wrapper
|
|
9960
|
+
if (this.filterable && this.isFilterActive) {
|
|
9941
9961
|
this.focus();
|
|
9962
|
+
// Current focus is on the treeview first node => should focus the check all checkbox if enabled
|
|
9963
|
+
}
|
|
9964
|
+
else if (this.checkAll && !this.isCheckAllActive && isFirstNodeActive) {
|
|
9965
|
+
this.checkAllInput.nativeElement.focus();
|
|
9966
|
+
// Current focus is either on the check all checkbox or the treeview's first node
|
|
9967
|
+
// => should focus either the filter input (if enabled) or the wrapper
|
|
9968
|
+
}
|
|
9969
|
+
else if (this.isCheckAllActive || isFirstNodeActive) {
|
|
9970
|
+
this.filterable ?
|
|
9971
|
+
this.filterInput.nativeElement.focus() :
|
|
9972
|
+
this.focus();
|
|
9942
9973
|
}
|
|
9943
9974
|
};
|
|
9944
9975
|
MultiSelectTreeComponent.prototype.handleDownKey = function (event) {
|
|
@@ -9946,9 +9977,14 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
9946
9977
|
return;
|
|
9947
9978
|
}
|
|
9948
9979
|
event.originalEvent.preventDefault();
|
|
9949
|
-
//
|
|
9980
|
+
// Current focus is on the wrapper => should focus the filter input
|
|
9950
9981
|
if (this.filterable && this.isWrapperActive) {
|
|
9951
9982
|
this.filterInput.nativeElement.focus();
|
|
9983
|
+
// Current focus is on the wrapper/filter input => should focus check all checkbox if enabled
|
|
9984
|
+
}
|
|
9985
|
+
else if (this.checkAll && (this.isWrapperActive || this.isFilterActive)) {
|
|
9986
|
+
this.checkAllInput.nativeElement.focus();
|
|
9987
|
+
// Should focus the treeview if filterable and check all are disabled
|
|
9952
9988
|
}
|
|
9953
9989
|
else if (!this.treeview.isActive) {
|
|
9954
9990
|
this.treeview.focus();
|
|
@@ -10109,6 +10145,10 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
10109
10145
|
ViewChild('filterInput', { static: false }),
|
|
10110
10146
|
__metadata("design:type", ElementRef)
|
|
10111
10147
|
], MultiSelectTreeComponent.prototype, "filterInput", void 0);
|
|
10148
|
+
__decorate([
|
|
10149
|
+
ViewChild('checkAllInput', { static: false }),
|
|
10150
|
+
__metadata("design:type", ElementRef)
|
|
10151
|
+
], MultiSelectTreeComponent.prototype, "checkAllInput", void 0);
|
|
10112
10152
|
__decorate([
|
|
10113
10153
|
Input(),
|
|
10114
10154
|
__metadata("design:type", Number),
|
|
@@ -10191,6 +10231,10 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
10191
10231
|
Input(),
|
|
10192
10232
|
__metadata("design:type", Boolean)
|
|
10193
10233
|
], MultiSelectTreeComponent.prototype, "filterable", void 0);
|
|
10234
|
+
__decorate([
|
|
10235
|
+
Input(),
|
|
10236
|
+
__metadata("design:type", Boolean)
|
|
10237
|
+
], MultiSelectTreeComponent.prototype, "checkAll", void 0);
|
|
10194
10238
|
__decorate([
|
|
10195
10239
|
Input(),
|
|
10196
10240
|
__metadata("design:type", Function)
|
|
@@ -10291,7 +10335,7 @@ var MultiSelectTreeComponent = /** @class */ (function () {
|
|
|
10291
10335
|
}
|
|
10292
10336
|
],
|
|
10293
10337
|
selector: 'kendo-multiselecttree',
|
|
10294
|
-
template: "\n <ng-container kendoMultiSelectTreeLocalizedMessages\n i18n-noDataText=\"kendo.multiselecttree.noDataText|The text displayed in the popup when there are no items\"\n noDataText=\"NO DATA FOUND\"\n\n i18n-clearTitle=\"kendo.multiselecttree.clearTitle|The title of the clear button\"\n clearTitle=\"clear\"\n >\n </ng-container>\n <div #wrapper\n [ngClass]=\"{\n 'k-multiselect-wrap': true,\n 'k-floatwrap': true,\n 'k-state-disabled': this.disabled\n }\"\n role=\"listbox\"\n aria-haspopup=\"tree\"\n [attr.aria-describedby]=\"tagListId\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-activedescendant]=\"focusedTagId\"\n [attr.tabindex]=\"tabindex\"\n [attr.id]=\"focusableId\"\n [attr.dir]=\"direction\"\n (click)=\"handleClick()\"\n (keydown)=\"handleKeydown($event)\"\n [kendoEventsOutsideAngular]=\"{\n focus: handleFocus,\n blur: handleBlur\n }\"\n [scope]=\"this\"\n >\n <kendo-taglist\n [id]=\"tagListId\"\n [tags]=\"tags\"\n [focused]=\"focusedTagIndex\"\n [textField]=\"textField\"\n [valueField]=\"valueField\"\n [valueDepth]=\"valueDepth\"\n [disabled]=\"disabled\"\n [tagPrefix]=\"tagPrefix\"\n [template]=\"tagTemplate\"\n [groupTemplate]=\"groupTagTemplate\"\n [disabledIndices]=\"disabledIndices\"\n (removeTag)=\"handleRemoveTag($event)\"\n >\n </kendo-taglist>\n <span *ngIf=\"!tags || !tags.length\"\n class=\"k-input k-readonly\"\n >\n {{ placeholder }}\n </span>\n <span\n *ngIf=\"!disabled && !loading && !readonly && clearButton && tags?.length\"\n class=\"k-icon k-clear-value k-i-close\"\n [attr.title]=\"messageFor('clearTitle')\"\n role=\"button\"\n tabindex=\"-1\"\n (click)=\"clearAll($event)\"\n >\n </span>\n <span\n *ngIf=\"loading\"\n class=\"k-icon k-i-loading\"\n >\n </span>\n </div>\n <ng-template #popupTemplate>\n <span\n *ngIf=\"filterable\"\n class=\"k-list-filter\"\n >\n <input\n #filterInput\n (input)=\"handleFilterInputChange($event.target.value)\"\n [filterInput]=\"filterable && !touchEnabled\"\n (keydown
|
|
10338
|
+
template: "\n <ng-container kendoMultiSelectTreeLocalizedMessages\n i18n-noDataText=\"kendo.multiselecttree.noDataText|The text displayed in the popup when there are no items\"\n noDataText=\"NO DATA FOUND\"\n\n i18n-clearTitle=\"kendo.multiselecttree.clearTitle|The title of the clear button\"\n clearTitle=\"clear\"\n\n i18n-checkAllText=\"kendo.multiselecttree.checkAllText|The text displayed for the check-all checkbox\"\n checkAllText=\"Check all\"\n >\n </ng-container>\n <div #wrapper\n [ngClass]=\"{\n 'k-multiselect-wrap': true,\n 'k-floatwrap': true,\n 'k-state-disabled': this.disabled\n }\"\n role=\"listbox\"\n aria-haspopup=\"tree\"\n [attr.aria-describedby]=\"tagListId\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-activedescendant]=\"focusedTagId\"\n [attr.tabindex]=\"tabindex\"\n [attr.id]=\"focusableId\"\n [attr.dir]=\"direction\"\n (click)=\"handleClick()\"\n (keydown)=\"handleKeydown($event)\"\n [kendoEventsOutsideAngular]=\"{\n focus: handleFocus,\n blur: handleBlur\n }\"\n [scope]=\"this\"\n >\n <kendo-taglist\n [id]=\"tagListId\"\n [tags]=\"tags\"\n [focused]=\"focusedTagIndex\"\n [textField]=\"textField\"\n [valueField]=\"valueField\"\n [valueDepth]=\"valueDepth\"\n [disabled]=\"disabled\"\n [tagPrefix]=\"tagPrefix\"\n [template]=\"tagTemplate\"\n [groupTemplate]=\"groupTagTemplate\"\n [disabledIndices]=\"disabledIndices\"\n (removeTag)=\"handleRemoveTag($event)\"\n >\n </kendo-taglist>\n <span *ngIf=\"!tags || !tags.length\"\n class=\"k-input k-readonly\"\n >\n {{ placeholder }}\n </span>\n <span\n *ngIf=\"!disabled && !loading && !readonly && clearButton && tags?.length\"\n class=\"k-icon k-clear-value k-i-close\"\n [attr.title]=\"messageFor('clearTitle')\"\n role=\"button\"\n tabindex=\"-1\"\n (click)=\"clearAll($event)\"\n >\n </span>\n <span\n *ngIf=\"loading\"\n class=\"k-icon k-i-loading\"\n >\n </span>\n </div>\n <ng-template #popupTemplate>\n <span\n *ngIf=\"filterable\"\n class=\"k-list-filter\"\n >\n <input\n #filterInput\n (input)=\"handleFilterInputChange($event.target.value)\"\n [filterInput]=\"filterable && !touchEnabled\"\n (keydown)=\"handleKeydown($event)\"\n [(ngModel)]=\"filter\"\n class=\"k-textbox\"\n role=\"textbox\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n tabindex=\"0\"\n aria-disabled=\"false\"\n aria-readonly=\"false\"\n [kendoEventsOutsideAngular]=\"{\n blur: handleBlur\n }\"\n [scope]=\"this\"\n >\n <span class=\"k-icon k-i-zoom\"></span>\n </span>\n <!--header template-->\n <ng-template\n *ngIf=\"headerTemplate\"\n [templateContext]=\"{\n templateRef: headerTemplate?.templateRef\n }\">\n </ng-template>\n <div *ngIf=\"checkAll\" class=\"k-check-all\">\n <input\n #checkAllInput\n [checkAll]=\"!filterable && !touchEnabled\"\n type=\"checkbox\"\n class=\"k-checkbox\"\n role=\"checkbox\"\n tabindex=\"0\"\n aria-disabled=\"false\"\n aria-readonly=\"false\"\n [treeview]=\"treeview\"\n [checkedItems]=\"checkedItems\"\n [valueField]=\"valueField\"\n [lastAction]=\"lastAction\"\n (checkedItemsChange)=\"handleCheckedItemsChange($event)\"\n (keydown)=\"handleKeydown($event)\"\n [kendoEventsOutsideAngular]=\"{\n blur: handleBlur\n }\"\n [scope]=\"this\"\n >\n <span\n class=\"k-checkbox-label\"\n (click)=\"toggleCheckAll()\"\n (mousedown)=\"$event.preventDefault()\"\n >\n {{ messageFor('checkAllText') }}\n </span>\n </div>\n <kendo-treeview\n #treeview\n [nodes]=\"data\"\n [style.maxHeight.px]=\"listHeight\"\n [animate]=\"false\"\n kendoMultiSelectTreeCheckable\n [checkable]=\"checkableSettings\"\n [checkedItems]=\"checkedItems\"\n [valueField]=\"valueField\"\n [textField]=\"textField\"\n [children]=\"children\"\n [hasChildren]=\"hasChildren\"\n [isExpanded]=\"isNodeExpanded\"\n [isDisabled]=\"itemDisabled\"\n [nodeTemplate]=\"nodeTemplate\"\n [loadOnDemand]=\"loadOnDemand\"\n [filter]=\"filter\"\n [isVisible]=\"isNodeVisible\"\n (keydown)=\"handleKeydown($event)\"\n (nodeClick)=\"handleNodeClick($event)\"\n (expand)=\"nodeExpand.emit($event)\"\n (collapse)=\"nodeCollapse.emit($event)\"\n (checkedItemsChange)=\"handleCheckedItemsChange($event)\"\n [kendoEventsOutsideAngular]=\"{\n focusout: handleBlur\n }\"\n [scope]=\"this\"\n >\n </kendo-treeview>\n <!--footer template-->\n <ng-template\n *ngIf=\"footerTemplate\"\n [templateContext]=\"{\n templateRef: footerTemplate?.templateRef\n }\">\n </ng-template>\n <!--no-data template-->\n <div class=\"k-nodata\" *ngIf=\"data?.length === 0 || allNodesHidden\">\n <ng-template [ngIf]=\"noDataTemplate\"\n [templateContext]=\"{\n templateRef: noDataTemplate?.templateRef\n }\">\n </ng-template>\n <ng-template [ngIf]=\"!noDataTemplate\">\n <div>{{ messageFor('noDataText') }}</div>\n </ng-template>\n </div>\n </ng-template>\n <ng-container #container></ng-container>\n "
|
|
10295
10339
|
}),
|
|
10296
10340
|
__param(7, Optional()), __param(7, Inject(TOUCH_ENABLED)),
|
|
10297
10341
|
__metadata("design:paramtypes", [PopupService,
|
|
@@ -10579,6 +10623,10 @@ var Messages = /** @class */ (function (_super) {
|
|
|
10579
10623
|
Input(),
|
|
10580
10624
|
__metadata("design:type", String)
|
|
10581
10625
|
], Messages.prototype, "clearTitle", void 0);
|
|
10626
|
+
__decorate([
|
|
10627
|
+
Input(),
|
|
10628
|
+
__metadata("design:type", String)
|
|
10629
|
+
], Messages.prototype, "checkAllText", void 0);
|
|
10582
10630
|
return Messages;
|
|
10583
10631
|
}(ComponentMessages));
|
|
10584
10632
|
|
|
@@ -10670,6 +10718,7 @@ var DEFAULT_FILTER_SETTINGS = {
|
|
|
10670
10718
|
* public data: Array<string> = ["Albania", "Andorra", "Armenia", "Austria", "Azerbaijan"];
|
|
10671
10719
|
* }
|
|
10672
10720
|
* ```
|
|
10721
|
+
* > Currently, the built-in filtering does not work with [grouped data]({% slug api_kendo-data-query_groupby %}).
|
|
10673
10722
|
*/
|
|
10674
10723
|
var FilterDirective = /** @class */ (function () {
|
|
10675
10724
|
function FilterDirective(component) {
|
|
@@ -10974,33 +11023,81 @@ var TemplateContextDirective = /** @class */ (function () {
|
|
|
10974
11023
|
*
|
|
10975
11024
|
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
10976
11025
|
*/
|
|
10977
|
-
var
|
|
11026
|
+
var BaseCheckDirective = /** @class */ (function () {
|
|
11027
|
+
function BaseCheckDirective() {
|
|
11028
|
+
}
|
|
11029
|
+
BaseCheckDirective.prototype.addItem = function (item) {
|
|
11030
|
+
if (this.isItemChecked(item)) {
|
|
11031
|
+
return;
|
|
11032
|
+
}
|
|
11033
|
+
var level = getHierarchicalItemLevel(item.index);
|
|
11034
|
+
var candidate = __assign({}, item, { level: level });
|
|
11035
|
+
this.checkedItems.push(candidate);
|
|
11036
|
+
this.checkedKeys.add(valueFrom(candidate, this.valueField));
|
|
11037
|
+
};
|
|
11038
|
+
BaseCheckDirective.prototype.removeItem = function (item) {
|
|
11039
|
+
var _this = this;
|
|
11040
|
+
if (!this.isItemChecked(item)) {
|
|
11041
|
+
return;
|
|
11042
|
+
}
|
|
11043
|
+
var level = getHierarchicalItemLevel(item.index);
|
|
11044
|
+
var candidate = __assign({}, item, { level: level });
|
|
11045
|
+
this.checkedItems = this.checkedItems
|
|
11046
|
+
.filter(function (item) { return valueFrom(item, _this.valueField) !== valueFrom(candidate, _this.valueField); });
|
|
11047
|
+
this.checkedKeys.delete(valueFrom(candidate, this.valueField));
|
|
11048
|
+
};
|
|
11049
|
+
BaseCheckDirective.prototype.isItemChecked = function (item) {
|
|
11050
|
+
return this.checkedKeys.has(valueFrom(item, this.valueField));
|
|
11051
|
+
};
|
|
11052
|
+
BaseCheckDirective.prototype.updateItems = function () {
|
|
11053
|
+
var _this = this;
|
|
11054
|
+
this.checkedItems = this.checkedItems || [];
|
|
11055
|
+
this.checkedKeys = new Set(this.checkedItems.map(function (item) { return valueFrom(item, _this.valueField); }));
|
|
11056
|
+
};
|
|
11057
|
+
__decorate([
|
|
11058
|
+
Input(),
|
|
11059
|
+
__metadata("design:type", Object)
|
|
11060
|
+
], BaseCheckDirective.prototype, "valueField", void 0);
|
|
11061
|
+
__decorate([
|
|
11062
|
+
Input(),
|
|
11063
|
+
__metadata("design:type", Array)
|
|
11064
|
+
], BaseCheckDirective.prototype, "checkedItems", void 0);
|
|
11065
|
+
return BaseCheckDirective;
|
|
11066
|
+
}());
|
|
11067
|
+
|
|
11068
|
+
/**
|
|
11069
|
+
* @hidden
|
|
11070
|
+
*
|
|
11071
|
+
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
11072
|
+
*/
|
|
11073
|
+
var CheckDirective = /** @class */ (function (_super) {
|
|
11074
|
+
__extends(CheckDirective, _super);
|
|
10978
11075
|
function CheckDirective(treeView) {
|
|
10979
|
-
|
|
11076
|
+
var _this = _super.call(this) || this;
|
|
11077
|
+
_this.treeView = treeView;
|
|
10980
11078
|
/**
|
|
10981
11079
|
* Fires when the `checkedItems` collection was updated.
|
|
10982
11080
|
*/
|
|
10983
|
-
|
|
11081
|
+
_this.checkedItemsChange = new EventEmitter();
|
|
10984
11082
|
/**
|
|
10985
11083
|
* Holds a Set with just the checked item keys.
|
|
10986
11084
|
*
|
|
10987
11085
|
* Should be updated each time the `checkedItems` value or content is changed.
|
|
10988
11086
|
* Can be used for efficient look-up of whether an item is checked or not (O(1) access time).
|
|
10989
11087
|
*/
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
.subscribe(
|
|
10994
|
-
|
|
11088
|
+
_this.checkedKeys = new Set();
|
|
11089
|
+
_this.subscriptions = new Subscription();
|
|
11090
|
+
_this.subscriptions.add(_this.treeView.checkedChange
|
|
11091
|
+
.subscribe(_this.handleCheckedChange.bind(_this)));
|
|
11092
|
+
_this.treeView.isChecked = _this.getCheckedState.bind(_this);
|
|
11093
|
+
return _this;
|
|
10995
11094
|
}
|
|
10996
11095
|
CheckDirective.prototype.ngOnChanges = function (changes) {
|
|
10997
|
-
var _this = this;
|
|
10998
11096
|
if (isPresent(changes.checkable)) {
|
|
10999
11097
|
this.toggleCheckOnClick();
|
|
11000
11098
|
}
|
|
11001
11099
|
if (isPresent(changes.checkedItems)) {
|
|
11002
|
-
this.
|
|
11003
|
-
this.checkedKeys = new Set(this.checkedItems.map(function (item) { return valueFrom(item, _this.valueField); }));
|
|
11100
|
+
this.updateItems();
|
|
11004
11101
|
}
|
|
11005
11102
|
};
|
|
11006
11103
|
CheckDirective.prototype.ngOnDestroy = function () {
|
|
@@ -11085,29 +11182,6 @@ var CheckDirective = /** @class */ (function () {
|
|
|
11085
11182
|
currentParent = currentParent.parent;
|
|
11086
11183
|
}
|
|
11087
11184
|
};
|
|
11088
|
-
CheckDirective.prototype.addItem = function (item) {
|
|
11089
|
-
if (this.isItemChecked(item)) {
|
|
11090
|
-
return;
|
|
11091
|
-
}
|
|
11092
|
-
var level = getHierarchicalItemLevel(item.index);
|
|
11093
|
-
var candidate = __assign({}, item, { level: level });
|
|
11094
|
-
this.checkedItems.push(candidate);
|
|
11095
|
-
this.checkedKeys.add(valueFrom(candidate, this.valueField));
|
|
11096
|
-
};
|
|
11097
|
-
CheckDirective.prototype.removeItem = function (item) {
|
|
11098
|
-
var _this = this;
|
|
11099
|
-
if (!this.isItemChecked(item)) {
|
|
11100
|
-
return;
|
|
11101
|
-
}
|
|
11102
|
-
var level = getHierarchicalItemLevel(item.index);
|
|
11103
|
-
var candidate = __assign({}, item, { level: level });
|
|
11104
|
-
this.checkedItems = this.checkedItems
|
|
11105
|
-
.filter(function (item) { return valueFrom(item, _this.valueField) !== valueFrom(candidate, _this.valueField); });
|
|
11106
|
-
this.checkedKeys.delete(valueFrom(candidate, this.valueField));
|
|
11107
|
-
};
|
|
11108
|
-
CheckDirective.prototype.isItemChecked = function (item) {
|
|
11109
|
-
return this.checkedKeys.has(valueFrom(item, this.valueField));
|
|
11110
|
-
};
|
|
11111
11185
|
CheckDirective.prototype.isItemIndeterminate = function (lookup) {
|
|
11112
11186
|
var children = lookup.children;
|
|
11113
11187
|
if (!Array.isArray(children) || children.length === 0) {
|
|
@@ -11147,7 +11221,179 @@ var CheckDirective = /** @class */ (function () {
|
|
|
11147
11221
|
__metadata("design:paramtypes", [TreeViewComponent])
|
|
11148
11222
|
], CheckDirective);
|
|
11149
11223
|
return CheckDirective;
|
|
11150
|
-
}());
|
|
11224
|
+
}(BaseCheckDirective));
|
|
11225
|
+
|
|
11226
|
+
/**
|
|
11227
|
+
* @hidden
|
|
11228
|
+
*
|
|
11229
|
+
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
11230
|
+
*/
|
|
11231
|
+
var CheckAllDirective = /** @class */ (function (_super) {
|
|
11232
|
+
__extends(CheckAllDirective, _super);
|
|
11233
|
+
function CheckAllDirective(element, zone, cdr, renderer) {
|
|
11234
|
+
var _this = _super.call(this) || this;
|
|
11235
|
+
_this.element = element;
|
|
11236
|
+
_this.zone = zone;
|
|
11237
|
+
_this.cdr = cdr;
|
|
11238
|
+
_this.renderer = renderer;
|
|
11239
|
+
/**
|
|
11240
|
+
* Fires when the `checkedItems` collection was updated.
|
|
11241
|
+
*/
|
|
11242
|
+
_this.checkedItemsChange = new EventEmitter();
|
|
11243
|
+
/**
|
|
11244
|
+
* Holds a Set with just the checked item keys.
|
|
11245
|
+
*
|
|
11246
|
+
* Should be updated each time the `checkedItems` value or content is changed.
|
|
11247
|
+
* Can be used for efficient look-up of whether an item is checked or not (O(1) access time).
|
|
11248
|
+
*/
|
|
11249
|
+
_this.checkedKeys = new Set();
|
|
11250
|
+
return _this;
|
|
11251
|
+
}
|
|
11252
|
+
CheckAllDirective.prototype.handleChange = function (event) {
|
|
11253
|
+
var _this = this;
|
|
11254
|
+
// Need to store the current checkbox state at the moment of click
|
|
11255
|
+
this.currentCheckedState = event.checked;
|
|
11256
|
+
this.currentIndeterminateState = this.isIndeterminate;
|
|
11257
|
+
this.treeview.nodes.map(function (_value, index) {
|
|
11258
|
+
var itemIndex = String(index);
|
|
11259
|
+
var itemLookup = _this.treeview.itemLookup(itemIndex);
|
|
11260
|
+
_this.checkNode(itemLookup);
|
|
11261
|
+
});
|
|
11262
|
+
this.checkedItemsChange.emit(this.checkedItems.slice());
|
|
11263
|
+
};
|
|
11264
|
+
Object.defineProperty(CheckAllDirective.prototype, "isIndeterminate", {
|
|
11265
|
+
get: function () {
|
|
11266
|
+
var _this = this;
|
|
11267
|
+
var isIndeterminate = this.treeview.nodes.some(function (_node, index) {
|
|
11268
|
+
var itemIndex = String(index);
|
|
11269
|
+
var itemLookup = _this.treeview.itemLookup(itemIndex);
|
|
11270
|
+
return _this.someChecked(itemLookup);
|
|
11271
|
+
});
|
|
11272
|
+
return this.isChecked ? false : isIndeterminate;
|
|
11273
|
+
},
|
|
11274
|
+
enumerable: true,
|
|
11275
|
+
configurable: true
|
|
11276
|
+
});
|
|
11277
|
+
Object.defineProperty(CheckAllDirective.prototype, "isChecked", {
|
|
11278
|
+
get: function () {
|
|
11279
|
+
var _this = this;
|
|
11280
|
+
var isChecked = this.treeview.nodes.every(function (_node, index) {
|
|
11281
|
+
var itemIndex = String(index);
|
|
11282
|
+
var itemLookup = _this.treeview.itemLookup(itemIndex);
|
|
11283
|
+
return _this.allChecked(itemLookup);
|
|
11284
|
+
});
|
|
11285
|
+
return isChecked;
|
|
11286
|
+
},
|
|
11287
|
+
enumerable: true,
|
|
11288
|
+
configurable: true
|
|
11289
|
+
});
|
|
11290
|
+
CheckAllDirective.prototype.ngOnChanges = function (changes) {
|
|
11291
|
+
if (isPresent(changes.checkedItems)) {
|
|
11292
|
+
this.updateItems();
|
|
11293
|
+
this.renderer.setProperty(this.element.nativeElement, 'checked', this.isChecked);
|
|
11294
|
+
this.renderer.setProperty(this.element.nativeElement, 'indeterminate', this.isIndeterminate);
|
|
11295
|
+
}
|
|
11296
|
+
};
|
|
11297
|
+
CheckAllDirective.prototype.ngOnInit = function () {
|
|
11298
|
+
var _this = this;
|
|
11299
|
+
if (this.focused) {
|
|
11300
|
+
this.nextTick(function () { return _this.element.nativeElement.focus(); });
|
|
11301
|
+
}
|
|
11302
|
+
};
|
|
11303
|
+
CheckAllDirective.prototype.nextTick = function (fn) {
|
|
11304
|
+
this.zone.runOutsideAngular(function () { return setTimeout(fn); });
|
|
11305
|
+
};
|
|
11306
|
+
CheckAllDirective.prototype.checkNode = function (itemLookup) {
|
|
11307
|
+
var _this = this;
|
|
11308
|
+
if (this.treeview.isDisabled(itemLookup.item.dataItem, itemLookup.item.index)) {
|
|
11309
|
+
return;
|
|
11310
|
+
}
|
|
11311
|
+
var pendingCheck = [];
|
|
11312
|
+
var filter$$1 = function (item) {
|
|
11313
|
+
return _this.treeview.isVisible(item.dataItem, item.index) &&
|
|
11314
|
+
!_this.treeview.isDisabled(item.dataItem, item.index);
|
|
11315
|
+
};
|
|
11316
|
+
pendingCheck.push(itemLookup.item);
|
|
11317
|
+
fetchDescendentNodes(itemLookup, filter$$1)
|
|
11318
|
+
.forEach(function (lookup) { return pendingCheck.push(lookup.item); });
|
|
11319
|
+
pendingCheck.forEach(function (item) {
|
|
11320
|
+
if (_this.currentIndeterminateState) {
|
|
11321
|
+
_this.lastAction === 'check' ?
|
|
11322
|
+
_this.addItem(item) :
|
|
11323
|
+
_this.removeItem(item);
|
|
11324
|
+
return;
|
|
11325
|
+
}
|
|
11326
|
+
_this.currentCheckedState ?
|
|
11327
|
+
_this.addItem(item) :
|
|
11328
|
+
_this.removeItem(item);
|
|
11329
|
+
});
|
|
11330
|
+
};
|
|
11331
|
+
CheckAllDirective.prototype.allChecked = function (lookup) {
|
|
11332
|
+
var _this = this;
|
|
11333
|
+
var children = lookup && lookup.children;
|
|
11334
|
+
if (!Array.isArray(children)) {
|
|
11335
|
+
return;
|
|
11336
|
+
}
|
|
11337
|
+
var childrenChecked = children.every(function (child) {
|
|
11338
|
+
if (child.children.length) {
|
|
11339
|
+
return _this.isItemChecked(child.item) && _this.allChecked(child);
|
|
11340
|
+
}
|
|
11341
|
+
return _this.isItemChecked(child.item);
|
|
11342
|
+
});
|
|
11343
|
+
return childrenChecked && this.isItemChecked(lookup.item);
|
|
11344
|
+
};
|
|
11345
|
+
CheckAllDirective.prototype.someChecked = function (lookup) {
|
|
11346
|
+
var _this = this;
|
|
11347
|
+
var children = lookup && lookup.children;
|
|
11348
|
+
if (!Array.isArray(children)) {
|
|
11349
|
+
return;
|
|
11350
|
+
}
|
|
11351
|
+
var childrenChecked = children.some(function (child) {
|
|
11352
|
+
if (child.children.length) {
|
|
11353
|
+
return _this.isItemChecked(child.item) || _this.someChecked(child);
|
|
11354
|
+
}
|
|
11355
|
+
return _this.isItemChecked(child.item);
|
|
11356
|
+
});
|
|
11357
|
+
return childrenChecked || this.isItemChecked(lookup.item);
|
|
11358
|
+
};
|
|
11359
|
+
__decorate([
|
|
11360
|
+
Input(),
|
|
11361
|
+
__metadata("design:type", String)
|
|
11362
|
+
], CheckAllDirective.prototype, "lastAction", void 0);
|
|
11363
|
+
__decorate([
|
|
11364
|
+
Input(),
|
|
11365
|
+
__metadata("design:type", TreeViewComponent)
|
|
11366
|
+
], CheckAllDirective.prototype, "treeview", void 0);
|
|
11367
|
+
__decorate([
|
|
11368
|
+
Input(),
|
|
11369
|
+
__metadata("design:type", Array)
|
|
11370
|
+
], CheckAllDirective.prototype, "checkedItems", void 0);
|
|
11371
|
+
__decorate([
|
|
11372
|
+
Input(),
|
|
11373
|
+
__metadata("design:type", Object)
|
|
11374
|
+
], CheckAllDirective.prototype, "valueField", void 0);
|
|
11375
|
+
__decorate([
|
|
11376
|
+
Input('checkAll'),
|
|
11377
|
+
__metadata("design:type", Boolean)
|
|
11378
|
+
], CheckAllDirective.prototype, "focused", void 0);
|
|
11379
|
+
__decorate([
|
|
11380
|
+
Output(),
|
|
11381
|
+
__metadata("design:type", EventEmitter)
|
|
11382
|
+
], CheckAllDirective.prototype, "checkedItemsChange", void 0);
|
|
11383
|
+
__decorate([
|
|
11384
|
+
HostListener('change', ['$event.target']),
|
|
11385
|
+
__metadata("design:type", Function),
|
|
11386
|
+
__metadata("design:paramtypes", [Object]),
|
|
11387
|
+
__metadata("design:returntype", void 0)
|
|
11388
|
+
], CheckAllDirective.prototype, "handleChange", null);
|
|
11389
|
+
CheckAllDirective = __decorate([
|
|
11390
|
+
Directive({
|
|
11391
|
+
selector: '[checkAll]' // tslint:disable-line
|
|
11392
|
+
}),
|
|
11393
|
+
__metadata("design:paramtypes", [ElementRef, NgZone, ChangeDetectorRef, Renderer2])
|
|
11394
|
+
], CheckAllDirective);
|
|
11395
|
+
return CheckAllDirective;
|
|
11396
|
+
}(BaseCheckDirective));
|
|
11151
11397
|
|
|
11152
11398
|
var INTERNAL_DIRECTIVES = [
|
|
11153
11399
|
ListComponent,
|
|
@@ -11156,7 +11402,8 @@ var INTERNAL_DIRECTIVES = [
|
|
|
11156
11402
|
SearchBarComponent,
|
|
11157
11403
|
TemplateContextDirective,
|
|
11158
11404
|
TagListComponent,
|
|
11159
|
-
CheckDirective
|
|
11405
|
+
CheckDirective,
|
|
11406
|
+
CheckAllDirective
|
|
11160
11407
|
];
|
|
11161
11408
|
/**
|
|
11162
11409
|
* @hidden
|
|
@@ -11486,4 +11733,4 @@ var DropDownsModule = /** @class */ (function () {
|
|
|
11486
11733
|
* Generated bundle index. Do not edit.
|
|
11487
11734
|
*/
|
|
11488
11735
|
|
|
11489
|
-
export { AUTOCOMPLETE_VALUE_ACCESSOR, COMBOBOX_VALUE_ACCESSOR, TOUCH_ENABLED, DataService, DisabledItemsService, FilterInputDirective, FilterableComponent, ListItemDirective, CustomMessagesComponent, LocalizedMessagesDirective, Messages, NavigationService, SearchBarComponent, SelectionService, TagListComponent, NoDataTemplateDirective, TagTemplateDirective, DROPDOWNLIST_VALUE_ACCESSOR, CheckDirective, MultiSelectTreeSummaryTagDirective, AutoCompleteComponent, ComboBoxComponent, DropDownListComponent, MultiSelectComponent, MultiColumnComboBoxComponent, ComboBoxColumnComponent, ColumnCellTemplateDirective, ColumnHeaderTemplateDirective, DropDownTreeComponent, MultiSelectTreeComponent, DropDownTreeFlatBindingDirective, DropDownTreeHierarchyBindingDirective, MultiSelectTreeFlatBindingDirective, MultiSelectTreeHierarchyBindingDirective, DropDownTreesExpandDirective, DropDownTreesModule, NodeTemplateDirective, ItemTemplateDirective, GroupTemplateDirective, FixedGroupTemplateDirective, CustomItemTemplateDirective, HeaderTemplateDirective, FooterTemplateDirective, ValueTemplateDirective, TemplateContextDirective, GroupTagTemplateDirective, SelectableDirective, SummaryTagDirective, FilterDirective, DropDownsModule, MultiSelectModule, SharedModule, AutoCompleteModule, ComboBoxModule, DropDownListModule, SharedDirectivesModule, ListComponent, PreventableEvent, RemoveTagEvent };
|
|
11736
|
+
export { AUTOCOMPLETE_VALUE_ACCESSOR, COMBOBOX_VALUE_ACCESSOR, TOUCH_ENABLED, DataService, DisabledItemsService, FilterInputDirective, FilterableComponent, ListItemDirective, CustomMessagesComponent, LocalizedMessagesDirective, Messages, NavigationService, SearchBarComponent, SelectionService, TagListComponent, NoDataTemplateDirective, TagTemplateDirective, DROPDOWNLIST_VALUE_ACCESSOR, BaseCheckDirective, CheckAllDirective, CheckDirective, MultiSelectTreeSummaryTagDirective, AutoCompleteComponent, ComboBoxComponent, DropDownListComponent, MultiSelectComponent, MultiColumnComboBoxComponent, ComboBoxColumnComponent, ColumnCellTemplateDirective, ColumnHeaderTemplateDirective, DropDownTreeComponent, MultiSelectTreeComponent, DropDownTreeFlatBindingDirective, DropDownTreeHierarchyBindingDirective, MultiSelectTreeFlatBindingDirective, MultiSelectTreeHierarchyBindingDirective, DropDownTreesExpandDirective, DropDownTreesModule, NodeTemplateDirective, ItemTemplateDirective, GroupTemplateDirective, FixedGroupTemplateDirective, CustomItemTemplateDirective, HeaderTemplateDirective, FooterTemplateDirective, ValueTemplateDirective, TemplateContextDirective, GroupTagTemplateDirective, SelectableDirective, SummaryTagDirective, FilterDirective, DropDownsModule, MultiSelectModule, SharedModule, AutoCompleteModule, ComboBoxModule, DropDownListModule, SharedDirectivesModule, ListComponent, PreventableEvent, RemoveTagEvent };
|
|
@@ -33,6 +33,7 @@ var DEFAULT_FILTER_SETTINGS = {
|
|
|
33
33
|
* public data: Array<string> = ["Albania", "Andorra", "Armenia", "Austria", "Azerbaijan"];
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
|
+
* > Currently, the built-in filtering does not work with [grouped data]({% slug api_kendo-data-query_groupby %}).
|
|
36
37
|
*/
|
|
37
38
|
var FilterDirective = /** @class */ (function () {
|
|
38
39
|
function FilterDirective(component) {
|
|
@@ -23,6 +23,10 @@ var Messages = /** @class */ (function (_super) {
|
|
|
23
23
|
core_1.Input(),
|
|
24
24
|
tslib_1.__metadata("design:type", String)
|
|
25
25
|
], Messages.prototype, "clearTitle", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
core_1.Input(),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], Messages.prototype, "checkAllText", void 0);
|
|
26
30
|
return Messages;
|
|
27
31
|
}(kendo_angular_l10n_1.ComponentMessages));
|
|
28
32
|
exports.Messages = Messages;
|
|
@@ -18,6 +18,7 @@ var list_item_directive_1 = require("./list-item.directive");
|
|
|
18
18
|
var selectable_directive_1 = require("./selection/selectable.directive");
|
|
19
19
|
var template_context_directive_1 = require("./templates/template-context.directive");
|
|
20
20
|
var check_directive_1 = require("../dropdowntrees/checked-state/check.directive");
|
|
21
|
+
var check_all_directive_1 = require("../dropdowntrees/checked-state/check-all.directive");
|
|
21
22
|
var INTERNAL_DIRECTIVES = [
|
|
22
23
|
list_component_1.ListComponent,
|
|
23
24
|
list_item_directive_1.ListItemDirective,
|
|
@@ -25,7 +26,8 @@ var INTERNAL_DIRECTIVES = [
|
|
|
25
26
|
searchbar_component_1.SearchBarComponent,
|
|
26
27
|
template_context_directive_1.TemplateContextDirective,
|
|
27
28
|
taglist_component_1.TagListComponent,
|
|
28
|
-
check_directive_1.CheckDirective
|
|
29
|
+
check_directive_1.CheckDirective,
|
|
30
|
+
check_all_directive_1.CheckAllDirective
|
|
29
31
|
];
|
|
30
32
|
/**
|
|
31
33
|
* @hidden
|
|
@@ -0,0 +1,56 @@
|
|
|
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 util_1 = require("../../common/util");
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*
|
|
13
|
+
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
14
|
+
*/
|
|
15
|
+
var BaseCheckDirective = /** @class */ (function () {
|
|
16
|
+
function BaseCheckDirective() {
|
|
17
|
+
}
|
|
18
|
+
BaseCheckDirective.prototype.addItem = function (item) {
|
|
19
|
+
if (this.isItemChecked(item)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var level = util_1.getHierarchicalItemLevel(item.index);
|
|
23
|
+
var candidate = tslib_1.__assign({}, item, { level: level });
|
|
24
|
+
this.checkedItems.push(candidate);
|
|
25
|
+
this.checkedKeys.add(util_1.valueFrom(candidate, this.valueField));
|
|
26
|
+
};
|
|
27
|
+
BaseCheckDirective.prototype.removeItem = function (item) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
if (!this.isItemChecked(item)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var level = util_1.getHierarchicalItemLevel(item.index);
|
|
33
|
+
var candidate = tslib_1.__assign({}, item, { level: level });
|
|
34
|
+
this.checkedItems = this.checkedItems
|
|
35
|
+
.filter(function (item) { return util_1.valueFrom(item, _this.valueField) !== util_1.valueFrom(candidate, _this.valueField); });
|
|
36
|
+
this.checkedKeys.delete(util_1.valueFrom(candidate, this.valueField));
|
|
37
|
+
};
|
|
38
|
+
BaseCheckDirective.prototype.isItemChecked = function (item) {
|
|
39
|
+
return this.checkedKeys.has(util_1.valueFrom(item, this.valueField));
|
|
40
|
+
};
|
|
41
|
+
BaseCheckDirective.prototype.updateItems = function () {
|
|
42
|
+
var _this = this;
|
|
43
|
+
this.checkedItems = this.checkedItems || [];
|
|
44
|
+
this.checkedKeys = new Set(this.checkedItems.map(function (item) { return util_1.valueFrom(item, _this.valueField); }));
|
|
45
|
+
};
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
core_1.Input(),
|
|
48
|
+
tslib_1.__metadata("design:type", Object)
|
|
49
|
+
], BaseCheckDirective.prototype, "valueField", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
core_1.Input(),
|
|
52
|
+
tslib_1.__metadata("design:type", Array)
|
|
53
|
+
], BaseCheckDirective.prototype, "checkedItems", void 0);
|
|
54
|
+
return BaseCheckDirective;
|
|
55
|
+
}());
|
|
56
|
+
exports.BaseCheckDirective = BaseCheckDirective;
|