@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
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-dropdowns',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1635524416,
|
|
13
13
|
version: '',
|
|
14
14
|
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'
|
|
15
15
|
};
|
package/dist/fesm2015/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const 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
|
};
|
|
@@ -8650,8 +8650,8 @@ let DropDownTreeComponent = DropDownTreeComponent_1 = class DropDownTreeComponen
|
|
|
8650
8650
|
dataItem;
|
|
8651
8651
|
const shouldUpdateValue = newValue !== this.value;
|
|
8652
8652
|
if (shouldUpdateValue) {
|
|
8653
|
-
this.dataItem = dataItem;
|
|
8654
8653
|
this.value = newValue;
|
|
8654
|
+
this.dataItem = dataItem;
|
|
8655
8655
|
this.emitValueChange(this.value);
|
|
8656
8656
|
}
|
|
8657
8657
|
this.togglePopup(false);
|
|
@@ -8851,7 +8851,6 @@ let DropDownTreeComponent = DropDownTreeComponent_1 = class DropDownTreeComponen
|
|
|
8851
8851
|
}
|
|
8852
8852
|
clearState() {
|
|
8853
8853
|
this.text = undefined;
|
|
8854
|
-
this.valueDepth = undefined;
|
|
8855
8854
|
this.selectedKeys = [];
|
|
8856
8855
|
}
|
|
8857
8856
|
subscribeEvents() {
|
|
@@ -9361,6 +9360,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
9361
9360
|
* @default false
|
|
9362
9361
|
*/
|
|
9363
9362
|
this.filterable = false;
|
|
9363
|
+
/**
|
|
9364
|
+
* If `checkАll` is set to `true` and the checkboxes are enabled, a tri-state checkbox appears above the embedded treeview.
|
|
9365
|
+
* Clicking the checkbox checks or unchecks all enabled items of the treeview that are loaded.
|
|
9366
|
+
* @default false
|
|
9367
|
+
*/
|
|
9368
|
+
this.checkAll = false;
|
|
9364
9369
|
/**
|
|
9365
9370
|
* A function which determines if a specific node has child nodes.
|
|
9366
9371
|
*/
|
|
@@ -9464,6 +9469,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
9464
9469
|
this._checkableSettings = DEFAULT_CHECKABLE_SETTINGS;
|
|
9465
9470
|
this._isFocused = false;
|
|
9466
9471
|
this.subscriptions = [];
|
|
9472
|
+
this.lastAction = 'check';
|
|
9467
9473
|
this.onTouchedCallback = noop;
|
|
9468
9474
|
this.onChangeCallback = noop;
|
|
9469
9475
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
@@ -9473,7 +9479,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
9473
9479
|
this._treeview = treeview;
|
|
9474
9480
|
if (treeview) {
|
|
9475
9481
|
// If filtering is enabled, focus the TreeView on mobile devices instead of the filter input
|
|
9476
|
-
if (this.isFocused && !this.filterable || this.touchEnabled) {
|
|
9482
|
+
if (this.isFocused && !this.filterable && !this.checkAll || this.touchEnabled) {
|
|
9477
9483
|
treeview.focus();
|
|
9478
9484
|
}
|
|
9479
9485
|
/**
|
|
@@ -9704,6 +9710,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
9704
9710
|
get isWrapperActive() {
|
|
9705
9711
|
return document.activeElement === this.wrapper.nativeElement;
|
|
9706
9712
|
}
|
|
9713
|
+
get isFilterActive() {
|
|
9714
|
+
return this.filterInput && document.activeElement === this.filterInput.nativeElement;
|
|
9715
|
+
}
|
|
9716
|
+
get isCheckAllActive() {
|
|
9717
|
+
return this.checkAllInput && document.activeElement === this.checkAllInput.nativeElement;
|
|
9718
|
+
}
|
|
9707
9719
|
ngOnInit() {
|
|
9708
9720
|
this.renderer.removeAttribute(this.hostElement.nativeElement, 'tabindex');
|
|
9709
9721
|
this.renderer.setAttribute(this.wrapper.nativeElement, 'aria-expanded', String(this.isOpen));
|
|
@@ -9920,6 +9932,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
9920
9932
|
*/
|
|
9921
9933
|
handleCheckedItemsChange(items) {
|
|
9922
9934
|
this.valueDepth = items.map(item => item.level);
|
|
9935
|
+
this.lastAction = items.length > this.dataItems.length ? 'check' : 'uncheck';
|
|
9923
9936
|
this.dataItems = items.slice();
|
|
9924
9937
|
this.updateValue(this.dataItems);
|
|
9925
9938
|
}
|
|
@@ -10008,6 +10021,13 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
10008
10021
|
this.filterChange.next(term);
|
|
10009
10022
|
this.allNodesHidden = this.nodes.every((node, index) => !this.isVisible(node, String(index)));
|
|
10010
10023
|
}
|
|
10024
|
+
/**
|
|
10025
|
+
* @hidden
|
|
10026
|
+
*/
|
|
10027
|
+
toggleCheckAll() {
|
|
10028
|
+
this.checkAllInput.nativeElement.focus();
|
|
10029
|
+
this.checkAllInput.nativeElement.click();
|
|
10030
|
+
}
|
|
10011
10031
|
verifySettings() {
|
|
10012
10032
|
if (!isDevMode()) {
|
|
10013
10033
|
return;
|
|
@@ -10130,17 +10150,20 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
10130
10150
|
return;
|
|
10131
10151
|
}
|
|
10132
10152
|
const isFirstNodeActive = this.treeview['navigationService']['activeIndex'] === '0';
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
if (isFilterActive) {
|
|
10136
|
-
this.focus();
|
|
10137
|
-
}
|
|
10138
|
-
else if (!isFilterActive && isFirstNodeActive) {
|
|
10139
|
-
this.filterInput.nativeElement.focus();
|
|
10140
|
-
}
|
|
10141
|
-
}
|
|
10142
|
-
if (!this.filterable && isFirstNodeActive) {
|
|
10153
|
+
// Current focus is on the filter input => should focus the wrapper
|
|
10154
|
+
if (this.filterable && this.isFilterActive) {
|
|
10143
10155
|
this.focus();
|
|
10156
|
+
// Current focus is on the treeview first node => should focus the check all checkbox if enabled
|
|
10157
|
+
}
|
|
10158
|
+
else if (this.checkAll && !this.isCheckAllActive && isFirstNodeActive) {
|
|
10159
|
+
this.checkAllInput.nativeElement.focus();
|
|
10160
|
+
// Current focus is either on the check all checkbox or the treeview's first node
|
|
10161
|
+
// => should focus either the filter input (if enabled) or the wrapper
|
|
10162
|
+
}
|
|
10163
|
+
else if (this.isCheckAllActive || isFirstNodeActive) {
|
|
10164
|
+
this.filterable ?
|
|
10165
|
+
this.filterInput.nativeElement.focus() :
|
|
10166
|
+
this.focus();
|
|
10144
10167
|
}
|
|
10145
10168
|
}
|
|
10146
10169
|
handleDownKey(event) {
|
|
@@ -10148,9 +10171,14 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
|
|
|
10148
10171
|
return;
|
|
10149
10172
|
}
|
|
10150
10173
|
event.originalEvent.preventDefault();
|
|
10151
|
-
//
|
|
10174
|
+
// Current focus is on the wrapper => should focus the filter input
|
|
10152
10175
|
if (this.filterable && this.isWrapperActive) {
|
|
10153
10176
|
this.filterInput.nativeElement.focus();
|
|
10177
|
+
// Current focus is on the wrapper/filter input => should focus check all checkbox if enabled
|
|
10178
|
+
}
|
|
10179
|
+
else if (this.checkAll && (this.isWrapperActive || this.isFilterActive)) {
|
|
10180
|
+
this.checkAllInput.nativeElement.focus();
|
|
10181
|
+
// Should focus the treeview if filterable and check all are disabled
|
|
10154
10182
|
}
|
|
10155
10183
|
else if (!this.treeview.isActive) {
|
|
10156
10184
|
this.treeview.focus();
|
|
@@ -10308,6 +10336,10 @@ __decorate([
|
|
|
10308
10336
|
ViewChild('filterInput', { static: false }),
|
|
10309
10337
|
__metadata("design:type", ElementRef)
|
|
10310
10338
|
], MultiSelectTreeComponent.prototype, "filterInput", void 0);
|
|
10339
|
+
__decorate([
|
|
10340
|
+
ViewChild('checkAllInput', { static: false }),
|
|
10341
|
+
__metadata("design:type", ElementRef)
|
|
10342
|
+
], MultiSelectTreeComponent.prototype, "checkAllInput", void 0);
|
|
10311
10343
|
__decorate([
|
|
10312
10344
|
Input(),
|
|
10313
10345
|
__metadata("design:type", Number),
|
|
@@ -10390,6 +10422,10 @@ __decorate([
|
|
|
10390
10422
|
Input(),
|
|
10391
10423
|
__metadata("design:type", Boolean)
|
|
10392
10424
|
], MultiSelectTreeComponent.prototype, "filterable", void 0);
|
|
10425
|
+
__decorate([
|
|
10426
|
+
Input(),
|
|
10427
|
+
__metadata("design:type", Boolean)
|
|
10428
|
+
], MultiSelectTreeComponent.prototype, "checkAll", void 0);
|
|
10393
10429
|
__decorate([
|
|
10394
10430
|
Input(),
|
|
10395
10431
|
__metadata("design:type", Function)
|
|
@@ -10497,6 +10533,9 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
|
|
|
10497
10533
|
|
|
10498
10534
|
i18n-clearTitle="kendo.multiselecttree.clearTitle|The title of the clear button"
|
|
10499
10535
|
clearTitle="clear"
|
|
10536
|
+
|
|
10537
|
+
i18n-checkAllText="kendo.multiselecttree.checkAllText|The text displayed for the check-all checkbox"
|
|
10538
|
+
checkAllText="Check all"
|
|
10500
10539
|
>
|
|
10501
10540
|
</ng-container>
|
|
10502
10541
|
<div #wrapper
|
|
@@ -10565,9 +10604,7 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
|
|
|
10565
10604
|
#filterInput
|
|
10566
10605
|
(input)="handleFilterInputChange($event.target.value)"
|
|
10567
10606
|
[filterInput]="filterable && !touchEnabled"
|
|
10568
|
-
(keydown
|
|
10569
|
-
(keydown.arrowup)="handleKeydown($event)"
|
|
10570
|
-
(keydown.alt.arrowup)="handleKeydown($event)"
|
|
10607
|
+
(keydown)="handleKeydown($event)"
|
|
10571
10608
|
[(ngModel)]="filter"
|
|
10572
10609
|
class="k-textbox"
|
|
10573
10610
|
role="textbox"
|
|
@@ -10590,6 +10627,35 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
|
|
|
10590
10627
|
templateRef: headerTemplate?.templateRef
|
|
10591
10628
|
}">
|
|
10592
10629
|
</ng-template>
|
|
10630
|
+
<div *ngIf="checkAll" class="k-check-all">
|
|
10631
|
+
<input
|
|
10632
|
+
#checkAllInput
|
|
10633
|
+
[checkAll]="!filterable && !touchEnabled"
|
|
10634
|
+
type="checkbox"
|
|
10635
|
+
class="k-checkbox"
|
|
10636
|
+
role="checkbox"
|
|
10637
|
+
tabindex="0"
|
|
10638
|
+
aria-disabled="false"
|
|
10639
|
+
aria-readonly="false"
|
|
10640
|
+
[treeview]="treeview"
|
|
10641
|
+
[checkedItems]="checkedItems"
|
|
10642
|
+
[valueField]="valueField"
|
|
10643
|
+
[lastAction]="lastAction"
|
|
10644
|
+
(checkedItemsChange)="handleCheckedItemsChange($event)"
|
|
10645
|
+
(keydown)="handleKeydown($event)"
|
|
10646
|
+
[kendoEventsOutsideAngular]="{
|
|
10647
|
+
blur: handleBlur
|
|
10648
|
+
}"
|
|
10649
|
+
[scope]="this"
|
|
10650
|
+
>
|
|
10651
|
+
<span
|
|
10652
|
+
class="k-checkbox-label"
|
|
10653
|
+
(click)="toggleCheckAll()"
|
|
10654
|
+
(mousedown)="$event.preventDefault()"
|
|
10655
|
+
>
|
|
10656
|
+
{{ messageFor('checkAllText') }}
|
|
10657
|
+
</span>
|
|
10658
|
+
</div>
|
|
10593
10659
|
<kendo-treeview
|
|
10594
10660
|
#treeview
|
|
10595
10661
|
[nodes]="data"
|
|
@@ -10948,6 +11014,10 @@ __decorate([
|
|
|
10948
11014
|
Input(),
|
|
10949
11015
|
__metadata("design:type", String)
|
|
10950
11016
|
], Messages.prototype, "clearTitle", void 0);
|
|
11017
|
+
__decorate([
|
|
11018
|
+
Input(),
|
|
11019
|
+
__metadata("design:type", String)
|
|
11020
|
+
], Messages.prototype, "checkAllText", void 0);
|
|
10951
11021
|
|
|
10952
11022
|
var LocalizedMessagesDirective_1;
|
|
10953
11023
|
/**
|
|
@@ -11033,6 +11103,7 @@ const DEFAULT_FILTER_SETTINGS = {
|
|
|
11033
11103
|
* public data: Array<string> = ["Albania", "Andorra", "Armenia", "Austria", "Azerbaijan"];
|
|
11034
11104
|
* }
|
|
11035
11105
|
* ```
|
|
11106
|
+
* > Currently, the built-in filtering does not work with [grouped data]({% slug api_kendo-data-query_groupby %}).
|
|
11036
11107
|
*/
|
|
11037
11108
|
let FilterDirective = class FilterDirective {
|
|
11038
11109
|
constructor(component) {
|
|
@@ -11307,8 +11378,51 @@ TemplateContextDirective = __decorate([
|
|
|
11307
11378
|
*
|
|
11308
11379
|
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
11309
11380
|
*/
|
|
11310
|
-
|
|
11381
|
+
class BaseCheckDirective {
|
|
11382
|
+
addItem(item) {
|
|
11383
|
+
if (this.isItemChecked(item)) {
|
|
11384
|
+
return;
|
|
11385
|
+
}
|
|
11386
|
+
const level = getHierarchicalItemLevel(item.index);
|
|
11387
|
+
const candidate = Object.assign({}, item, { level });
|
|
11388
|
+
this.checkedItems.push(candidate);
|
|
11389
|
+
this.checkedKeys.add(valueFrom(candidate, this.valueField));
|
|
11390
|
+
}
|
|
11391
|
+
removeItem(item) {
|
|
11392
|
+
if (!this.isItemChecked(item)) {
|
|
11393
|
+
return;
|
|
11394
|
+
}
|
|
11395
|
+
const level = getHierarchicalItemLevel(item.index);
|
|
11396
|
+
const candidate = Object.assign({}, item, { level });
|
|
11397
|
+
this.checkedItems = this.checkedItems
|
|
11398
|
+
.filter(item => valueFrom(item, this.valueField) !== valueFrom(candidate, this.valueField));
|
|
11399
|
+
this.checkedKeys.delete(valueFrom(candidate, this.valueField));
|
|
11400
|
+
}
|
|
11401
|
+
isItemChecked(item) {
|
|
11402
|
+
return this.checkedKeys.has(valueFrom(item, this.valueField));
|
|
11403
|
+
}
|
|
11404
|
+
updateItems() {
|
|
11405
|
+
this.checkedItems = this.checkedItems || [];
|
|
11406
|
+
this.checkedKeys = new Set(this.checkedItems.map(item => valueFrom(item, this.valueField)));
|
|
11407
|
+
}
|
|
11408
|
+
}
|
|
11409
|
+
__decorate([
|
|
11410
|
+
Input(),
|
|
11411
|
+
__metadata("design:type", Object)
|
|
11412
|
+
], BaseCheckDirective.prototype, "valueField", void 0);
|
|
11413
|
+
__decorate([
|
|
11414
|
+
Input(),
|
|
11415
|
+
__metadata("design:type", Array)
|
|
11416
|
+
], BaseCheckDirective.prototype, "checkedItems", void 0);
|
|
11417
|
+
|
|
11418
|
+
/**
|
|
11419
|
+
* @hidden
|
|
11420
|
+
*
|
|
11421
|
+
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
11422
|
+
*/
|
|
11423
|
+
let CheckDirective = class CheckDirective extends BaseCheckDirective {
|
|
11311
11424
|
constructor(treeView) {
|
|
11425
|
+
super();
|
|
11312
11426
|
this.treeView = treeView;
|
|
11313
11427
|
/**
|
|
11314
11428
|
* Fires when the `checkedItems` collection was updated.
|
|
@@ -11331,8 +11445,7 @@ let CheckDirective = class CheckDirective {
|
|
|
11331
11445
|
this.toggleCheckOnClick();
|
|
11332
11446
|
}
|
|
11333
11447
|
if (isPresent(changes.checkedItems)) {
|
|
11334
|
-
this.
|
|
11335
|
-
this.checkedKeys = new Set(this.checkedItems.map(item => valueFrom(item, this.valueField)));
|
|
11448
|
+
this.updateItems();
|
|
11336
11449
|
}
|
|
11337
11450
|
}
|
|
11338
11451
|
ngOnDestroy() {
|
|
@@ -11412,28 +11525,6 @@ let CheckDirective = class CheckDirective {
|
|
|
11412
11525
|
currentParent = currentParent.parent;
|
|
11413
11526
|
}
|
|
11414
11527
|
}
|
|
11415
|
-
addItem(item) {
|
|
11416
|
-
if (this.isItemChecked(item)) {
|
|
11417
|
-
return;
|
|
11418
|
-
}
|
|
11419
|
-
const level = getHierarchicalItemLevel(item.index);
|
|
11420
|
-
const candidate = Object.assign({}, item, { level });
|
|
11421
|
-
this.checkedItems.push(candidate);
|
|
11422
|
-
this.checkedKeys.add(valueFrom(candidate, this.valueField));
|
|
11423
|
-
}
|
|
11424
|
-
removeItem(item) {
|
|
11425
|
-
if (!this.isItemChecked(item)) {
|
|
11426
|
-
return;
|
|
11427
|
-
}
|
|
11428
|
-
const level = getHierarchicalItemLevel(item.index);
|
|
11429
|
-
const candidate = Object.assign({}, item, { level });
|
|
11430
|
-
this.checkedItems = this.checkedItems
|
|
11431
|
-
.filter(item => valueFrom(item, this.valueField) !== valueFrom(candidate, this.valueField));
|
|
11432
|
-
this.checkedKeys.delete(valueFrom(candidate, this.valueField));
|
|
11433
|
-
}
|
|
11434
|
-
isItemChecked(item) {
|
|
11435
|
-
return this.checkedKeys.has(valueFrom(item, this.valueField));
|
|
11436
|
-
}
|
|
11437
11528
|
isItemIndeterminate(lookup) {
|
|
11438
11529
|
const children = lookup.children;
|
|
11439
11530
|
if (!Array.isArray(children) || children.length === 0) {
|
|
@@ -11474,6 +11565,158 @@ CheckDirective = __decorate([
|
|
|
11474
11565
|
__metadata("design:paramtypes", [TreeViewComponent])
|
|
11475
11566
|
], CheckDirective);
|
|
11476
11567
|
|
|
11568
|
+
/**
|
|
11569
|
+
* @hidden
|
|
11570
|
+
*
|
|
11571
|
+
* A directive which manages the in-memory checked state of the MultiSelectTree nodes.
|
|
11572
|
+
*/
|
|
11573
|
+
let CheckAllDirective = class CheckAllDirective extends BaseCheckDirective {
|
|
11574
|
+
constructor(element, zone, cdr, renderer) {
|
|
11575
|
+
super();
|
|
11576
|
+
this.element = element;
|
|
11577
|
+
this.zone = zone;
|
|
11578
|
+
this.cdr = cdr;
|
|
11579
|
+
this.renderer = renderer;
|
|
11580
|
+
/**
|
|
11581
|
+
* Fires when the `checkedItems` collection was updated.
|
|
11582
|
+
*/
|
|
11583
|
+
this.checkedItemsChange = new EventEmitter();
|
|
11584
|
+
/**
|
|
11585
|
+
* Holds a Set with just the checked item keys.
|
|
11586
|
+
*
|
|
11587
|
+
* Should be updated each time the `checkedItems` value or content is changed.
|
|
11588
|
+
* Can be used for efficient look-up of whether an item is checked or not (O(1) access time).
|
|
11589
|
+
*/
|
|
11590
|
+
this.checkedKeys = new Set();
|
|
11591
|
+
}
|
|
11592
|
+
handleChange(event) {
|
|
11593
|
+
// Need to store the current checkbox state at the moment of click
|
|
11594
|
+
this.currentCheckedState = event.checked;
|
|
11595
|
+
this.currentIndeterminateState = this.isIndeterminate;
|
|
11596
|
+
this.treeview.nodes.map((_value, index) => {
|
|
11597
|
+
const itemIndex = String(index);
|
|
11598
|
+
const itemLookup = this.treeview.itemLookup(itemIndex);
|
|
11599
|
+
this.checkNode(itemLookup);
|
|
11600
|
+
});
|
|
11601
|
+
this.checkedItemsChange.emit(this.checkedItems.slice());
|
|
11602
|
+
}
|
|
11603
|
+
get isIndeterminate() {
|
|
11604
|
+
const isIndeterminate = this.treeview.nodes.some((_node, index) => {
|
|
11605
|
+
const itemIndex = String(index);
|
|
11606
|
+
const itemLookup = this.treeview.itemLookup(itemIndex);
|
|
11607
|
+
return this.someChecked(itemLookup);
|
|
11608
|
+
});
|
|
11609
|
+
return this.isChecked ? false : isIndeterminate;
|
|
11610
|
+
}
|
|
11611
|
+
get isChecked() {
|
|
11612
|
+
const isChecked = this.treeview.nodes.every((_node, index) => {
|
|
11613
|
+
const itemIndex = String(index);
|
|
11614
|
+
const itemLookup = this.treeview.itemLookup(itemIndex);
|
|
11615
|
+
return this.allChecked(itemLookup);
|
|
11616
|
+
});
|
|
11617
|
+
return isChecked;
|
|
11618
|
+
}
|
|
11619
|
+
ngOnChanges(changes) {
|
|
11620
|
+
if (isPresent(changes.checkedItems)) {
|
|
11621
|
+
this.updateItems();
|
|
11622
|
+
this.renderer.setProperty(this.element.nativeElement, 'checked', this.isChecked);
|
|
11623
|
+
this.renderer.setProperty(this.element.nativeElement, 'indeterminate', this.isIndeterminate);
|
|
11624
|
+
}
|
|
11625
|
+
}
|
|
11626
|
+
ngOnInit() {
|
|
11627
|
+
if (this.focused) {
|
|
11628
|
+
this.nextTick(() => this.element.nativeElement.focus());
|
|
11629
|
+
}
|
|
11630
|
+
}
|
|
11631
|
+
nextTick(fn) {
|
|
11632
|
+
this.zone.runOutsideAngular(() => setTimeout(fn));
|
|
11633
|
+
}
|
|
11634
|
+
checkNode(itemLookup) {
|
|
11635
|
+
if (this.treeview.isDisabled(itemLookup.item.dataItem, itemLookup.item.index)) {
|
|
11636
|
+
return;
|
|
11637
|
+
}
|
|
11638
|
+
const pendingCheck = [];
|
|
11639
|
+
const filter$$1 = (item) => this.treeview.isVisible(item.dataItem, item.index) &&
|
|
11640
|
+
!this.treeview.isDisabled(item.dataItem, item.index);
|
|
11641
|
+
pendingCheck.push(itemLookup.item);
|
|
11642
|
+
fetchDescendentNodes(itemLookup, filter$$1)
|
|
11643
|
+
.forEach(lookup => pendingCheck.push(lookup.item));
|
|
11644
|
+
pendingCheck.forEach(item => {
|
|
11645
|
+
if (this.currentIndeterminateState) {
|
|
11646
|
+
this.lastAction === 'check' ?
|
|
11647
|
+
this.addItem(item) :
|
|
11648
|
+
this.removeItem(item);
|
|
11649
|
+
return;
|
|
11650
|
+
}
|
|
11651
|
+
this.currentCheckedState ?
|
|
11652
|
+
this.addItem(item) :
|
|
11653
|
+
this.removeItem(item);
|
|
11654
|
+
});
|
|
11655
|
+
}
|
|
11656
|
+
allChecked(lookup) {
|
|
11657
|
+
const children = lookup && lookup.children;
|
|
11658
|
+
if (!Array.isArray(children)) {
|
|
11659
|
+
return;
|
|
11660
|
+
}
|
|
11661
|
+
const childrenChecked = children.every(child => {
|
|
11662
|
+
if (child.children.length) {
|
|
11663
|
+
return this.isItemChecked(child.item) && this.allChecked(child);
|
|
11664
|
+
}
|
|
11665
|
+
return this.isItemChecked(child.item);
|
|
11666
|
+
});
|
|
11667
|
+
return childrenChecked && this.isItemChecked(lookup.item);
|
|
11668
|
+
}
|
|
11669
|
+
someChecked(lookup) {
|
|
11670
|
+
const children = lookup && lookup.children;
|
|
11671
|
+
if (!Array.isArray(children)) {
|
|
11672
|
+
return;
|
|
11673
|
+
}
|
|
11674
|
+
const childrenChecked = children.some(child => {
|
|
11675
|
+
if (child.children.length) {
|
|
11676
|
+
return this.isItemChecked(child.item) || this.someChecked(child);
|
|
11677
|
+
}
|
|
11678
|
+
return this.isItemChecked(child.item);
|
|
11679
|
+
});
|
|
11680
|
+
return childrenChecked || this.isItemChecked(lookup.item);
|
|
11681
|
+
}
|
|
11682
|
+
};
|
|
11683
|
+
__decorate([
|
|
11684
|
+
Input(),
|
|
11685
|
+
__metadata("design:type", String)
|
|
11686
|
+
], CheckAllDirective.prototype, "lastAction", void 0);
|
|
11687
|
+
__decorate([
|
|
11688
|
+
Input(),
|
|
11689
|
+
__metadata("design:type", TreeViewComponent)
|
|
11690
|
+
], CheckAllDirective.prototype, "treeview", void 0);
|
|
11691
|
+
__decorate([
|
|
11692
|
+
Input(),
|
|
11693
|
+
__metadata("design:type", Array)
|
|
11694
|
+
], CheckAllDirective.prototype, "checkedItems", void 0);
|
|
11695
|
+
__decorate([
|
|
11696
|
+
Input(),
|
|
11697
|
+
__metadata("design:type", Object)
|
|
11698
|
+
], CheckAllDirective.prototype, "valueField", void 0);
|
|
11699
|
+
__decorate([
|
|
11700
|
+
Input('checkAll'),
|
|
11701
|
+
__metadata("design:type", Boolean)
|
|
11702
|
+
], CheckAllDirective.prototype, "focused", void 0);
|
|
11703
|
+
__decorate([
|
|
11704
|
+
Output(),
|
|
11705
|
+
__metadata("design:type", EventEmitter)
|
|
11706
|
+
], CheckAllDirective.prototype, "checkedItemsChange", void 0);
|
|
11707
|
+
__decorate([
|
|
11708
|
+
HostListener('change', ['$event.target']),
|
|
11709
|
+
__metadata("design:type", Function),
|
|
11710
|
+
__metadata("design:paramtypes", [Object]),
|
|
11711
|
+
__metadata("design:returntype", void 0)
|
|
11712
|
+
], CheckAllDirective.prototype, "handleChange", null);
|
|
11713
|
+
CheckAllDirective = __decorate([
|
|
11714
|
+
Directive({
|
|
11715
|
+
selector: '[checkAll]' // tslint:disable-line
|
|
11716
|
+
}),
|
|
11717
|
+
__metadata("design:paramtypes", [ElementRef, NgZone, ChangeDetectorRef, Renderer2])
|
|
11718
|
+
], CheckAllDirective);
|
|
11719
|
+
|
|
11477
11720
|
const INTERNAL_DIRECTIVES = [
|
|
11478
11721
|
ListComponent,
|
|
11479
11722
|
ListItemDirective,
|
|
@@ -11481,7 +11724,8 @@ const INTERNAL_DIRECTIVES = [
|
|
|
11481
11724
|
SearchBarComponent,
|
|
11482
11725
|
TemplateContextDirective,
|
|
11483
11726
|
TagListComponent,
|
|
11484
|
-
CheckDirective
|
|
11727
|
+
CheckDirective,
|
|
11728
|
+
CheckAllDirective
|
|
11485
11729
|
];
|
|
11486
11730
|
/**
|
|
11487
11731
|
* @hidden
|
|
@@ -11788,4 +12032,4 @@ DropDownsModule = __decorate([
|
|
|
11788
12032
|
* Generated bundle index. Do not edit.
|
|
11789
12033
|
*/
|
|
11790
12034
|
|
|
11791
|
-
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 };
|
|
12035
|
+
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 };
|