@progress/kendo-angular-grid 20.0.4-develop.2 → 20.1.0-develop.1
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/adaptiveness/adaptive-renderer.component.d.ts +2 -3
- package/column-menu/column-chooser-content.component.d.ts +60 -0
- package/column-menu/column-chooser.component.d.ts +15 -4
- package/column-menu/column-list-kb-nav.service.d.ts +2 -2
- package/column-menu/column-list.component.d.ts +30 -21
- package/column-menu/column-menu-chooser.component.d.ts +2 -7
- package/column-menu/column-menu.component.d.ts +0 -4
- package/columns/column-base.d.ts +8 -0
- package/directives.d.ts +1 -2
- package/esm2022/adaptiveness/adaptive-renderer.component.mjs +26 -46
- package/esm2022/column-menu/column-chooser-content.component.mjs +306 -0
- package/esm2022/column-menu/column-chooser.component.mjs +39 -31
- package/esm2022/column-menu/column-list-kb-nav.service.mjs +3 -3
- package/esm2022/column-menu/column-list.component.mjs +258 -177
- package/esm2022/column-menu/column-menu-chooser.component.mjs +17 -36
- package/esm2022/column-menu/column-menu.component.mjs +12 -28
- package/esm2022/columns/column-base.mjs +8 -0
- package/esm2022/common/column-info.service.mjs +3 -0
- package/esm2022/directives.mjs +0 -2
- package/esm2022/grid.component.mjs +6 -0
- package/esm2022/grid.module.mjs +47 -48
- package/esm2022/localization/messages.mjs +12 -1
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/rendering/toolbar/tools/column-chooser-tool.directive.mjs +38 -12
- package/fesm2022/progress-kendo-angular-grid.mjs +702 -367
- package/grid.module.d.ts +46 -47
- package/localization/messages.d.ts +10 -1
- package/package.json +21 -21
- package/rendering/toolbar/tools/column-chooser-tool.directive.d.ts +13 -1
- package/schematics/ngAdd/index.js +4 -4
- package/column-menu/column-chooser-item-checked.directive.d.ts +0 -21
- package/esm2022/column-menu/column-chooser-item-checked.directive.mjs +0 -45
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Component, HostBinding, Input, ElementRef, NgZone, Renderer2, Output, EventEmitter,
|
|
5
|
+
import { Component, HostBinding, Input, ElementRef, NgZone, Renderer2, Output, EventEmitter, ViewChildren, QueryList, Optional, ChangeDetectorRef } from '@angular/core';
|
|
6
6
|
import { ColumnMenuService } from './column-menu.service';
|
|
7
7
|
import { ColumnListKeyboardNavigation } from './column-list-kb-nav.service';
|
|
8
|
-
import {
|
|
9
|
-
import { Keys, normalizeNumpadKeys } from '@progress/kendo-angular-common';
|
|
8
|
+
import { EventsOutsideAngularDirective, Keys, normalizeNumpadKeys } from '@progress/kendo-angular-common';
|
|
10
9
|
import { Subscription } from 'rxjs';
|
|
11
|
-
import { NgFor, NgIf
|
|
10
|
+
import { NgFor, NgIf } from '@angular/common';
|
|
12
11
|
import { CheckBoxComponent } from '@progress/kendo-angular-inputs';
|
|
13
12
|
import { take } from 'rxjs/operators';
|
|
14
|
-
import { arrowRotateCcwIcon, checkIcon } from '@progress/kendo-svg-icons';
|
|
15
|
-
import { ButtonComponent } from '@progress/kendo-angular-buttons';
|
|
16
13
|
import { ContextService } from '../common/provider.service';
|
|
17
14
|
import { AdaptiveGridService } from '../common/adaptiveness.service';
|
|
15
|
+
import { ColumnInfoService } from '../common/column-info.service';
|
|
18
16
|
import * as i0 from "@angular/core";
|
|
19
17
|
import * as i1 from "./column-list-kb-nav.service";
|
|
20
|
-
import * as i2 from "../common/
|
|
21
|
-
import * as i3 from "../common/
|
|
18
|
+
import * as i2 from "../common/column-info.service";
|
|
19
|
+
import * as i3 from "../common/adaptiveness.service";
|
|
20
|
+
import * as i4 from "../common/provider.service";
|
|
22
21
|
/**
|
|
23
22
|
* @hidden
|
|
24
23
|
*/
|
|
@@ -27,10 +26,10 @@ export class ColumnListComponent {
|
|
|
27
26
|
ngZone;
|
|
28
27
|
renderer;
|
|
29
28
|
listNavigationService;
|
|
29
|
+
cdr;
|
|
30
|
+
columnInfoService;
|
|
30
31
|
adaptiveGridService;
|
|
31
32
|
ctx;
|
|
32
|
-
checkIcon = checkIcon;
|
|
33
|
-
arrowRotateCcwIcon = arrowRotateCcwIcon;
|
|
34
33
|
className = true;
|
|
35
34
|
get listSizeMd() {
|
|
36
35
|
return !(this.ctx?.grid?.isActionSheetExpanded);
|
|
@@ -42,40 +41,59 @@ export class ColumnListComponent {
|
|
|
42
41
|
apply = new EventEmitter();
|
|
43
42
|
columnChange = new EventEmitter();
|
|
44
43
|
set columns(value) {
|
|
44
|
+
this.listNavigationService.items = this.checkboxes?.toArray();
|
|
45
45
|
this._columns = value.filter(column => column.includeInChooser !== false);
|
|
46
|
-
this.allColumns = value;
|
|
47
|
-
this.updateColumnState();
|
|
48
46
|
}
|
|
49
47
|
get columns() {
|
|
50
48
|
return this._columns;
|
|
51
49
|
}
|
|
52
|
-
|
|
50
|
+
get checkedCheckboxesLength() {
|
|
51
|
+
return this.columns?.filter(column => column.currentlyChecked).length;
|
|
52
|
+
}
|
|
53
|
+
filteredColumns = [];
|
|
53
54
|
autoSync = true;
|
|
55
|
+
showSelectAll = false;
|
|
56
|
+
isFiltered = false;
|
|
54
57
|
ariaLabel;
|
|
55
58
|
allowHideAll = false;
|
|
56
59
|
applyText;
|
|
57
60
|
resetText;
|
|
58
|
-
actionsClass = 'k-actions k-actions-stretched k-actions-horizontal';
|
|
59
61
|
isLast;
|
|
60
62
|
isExpanded;
|
|
61
63
|
service;
|
|
64
|
+
filterable = false;
|
|
65
|
+
checkboxes;
|
|
66
|
+
get columnCheckboxes() {
|
|
67
|
+
if (this.showSelectAll) {
|
|
68
|
+
return this.checkboxes?.toArray().slice(1);
|
|
69
|
+
}
|
|
70
|
+
return this.checkboxes?.toArray();
|
|
71
|
+
}
|
|
72
|
+
get lockedColumnCheckboxes() {
|
|
73
|
+
return this.columnCheckboxes?.filter((checkbox, index) => this.filteredColumns[index]?.locked);
|
|
74
|
+
}
|
|
75
|
+
get unlockedColumnCheckboxes() {
|
|
76
|
+
return this.columnCheckboxes?.filter((checkbox, index) => !this.filteredColumns[index]?.locked);
|
|
77
|
+
}
|
|
78
|
+
get checkedCheckboxes() {
|
|
79
|
+
if (this.showSelectAll && !this.isFiltered) {
|
|
80
|
+
return this.checkboxes?.toArray().slice(1).filter(checkbox => checkbox.checkedState).length;
|
|
81
|
+
}
|
|
82
|
+
return this.checkboxes?.filter(checkbox => checkbox.checkedState).length;
|
|
83
|
+
}
|
|
62
84
|
resetButton;
|
|
63
85
|
applyButton;
|
|
64
|
-
|
|
65
|
-
checkboxes;
|
|
66
|
-
hasLocked;
|
|
67
|
-
hasVisibleLocked;
|
|
68
|
-
unlockedCount = 0;
|
|
69
|
-
hasUnlockedFiltered;
|
|
70
|
-
hasFiltered;
|
|
86
|
+
filterInput;
|
|
71
87
|
_columns;
|
|
72
|
-
allColumns;
|
|
73
88
|
domSubscriptions = new Subscription();
|
|
74
|
-
|
|
89
|
+
lastDisabledCheckbox;
|
|
90
|
+
constructor(element, ngZone, renderer, listNavigationService, cdr, columnInfoService, adaptiveGridService, ctx) {
|
|
75
91
|
this.element = element;
|
|
76
92
|
this.ngZone = ngZone;
|
|
77
93
|
this.renderer = renderer;
|
|
78
94
|
this.listNavigationService = listNavigationService;
|
|
95
|
+
this.cdr = cdr;
|
|
96
|
+
this.columnInfoService = columnInfoService;
|
|
79
97
|
this.adaptiveGridService = adaptiveGridService;
|
|
80
98
|
this.ctx = ctx;
|
|
81
99
|
}
|
|
@@ -85,17 +103,17 @@ export class ColumnListComponent {
|
|
|
85
103
|
}
|
|
86
104
|
this.ngZone.runOutsideAngular(() => {
|
|
87
105
|
this.domSubscriptions.add(this.renderer.listen(this.element.nativeElement, 'click', (e) => {
|
|
88
|
-
e.
|
|
89
|
-
|
|
90
|
-
this.
|
|
91
|
-
}
|
|
106
|
+
if (e.target.classList.contains('k-checkbox')) {
|
|
107
|
+
const label = e.target.closest('.k-column-list-item');
|
|
108
|
+
this.setTabindex(label);
|
|
109
|
+
}
|
|
92
110
|
}));
|
|
93
111
|
this.domSubscriptions.add(this.renderer.listen(this.element.nativeElement, 'keydown', this.onKeydown));
|
|
94
112
|
});
|
|
95
113
|
}
|
|
96
114
|
ngAfterViewInit() {
|
|
97
115
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
98
|
-
this.listNavigationService.items = this.
|
|
116
|
+
this.listNavigationService.items = this.checkboxes.toArray();
|
|
99
117
|
if (this.adaptiveGridService?.viewType !== 'columnMenu') {
|
|
100
118
|
this.listNavigationService.toggle(0, true);
|
|
101
119
|
}
|
|
@@ -112,38 +130,97 @@ export class ColumnListComponent {
|
|
|
112
130
|
return;
|
|
113
131
|
}
|
|
114
132
|
if (changes['isLast'] && this.isLast) {
|
|
115
|
-
this.service.menuTabbingService.lastFocusable = this.applyButton
|
|
133
|
+
this.service.menuTabbingService.lastFocusable = this.applyButton?.nativeElement;
|
|
116
134
|
}
|
|
117
135
|
if (changes['isExpanded'] && this.isExpanded && this.isLast && this.applyButton) {
|
|
118
136
|
this.service.menuTabbingService.lastFocusable = this.applyButton.nativeElement;
|
|
119
137
|
}
|
|
120
138
|
}
|
|
139
|
+
onSelectAllClick(e) {
|
|
140
|
+
if (e.target.classList.contains('k-checkbox')) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
const label = e.target.closest('.k-column-list-item');
|
|
145
|
+
const input = label?.querySelector('input');
|
|
146
|
+
input.click();
|
|
147
|
+
}
|
|
148
|
+
onSelectAllCheckboxChange(checkedState) {
|
|
149
|
+
if (!checkedState && !this.allowHideAll) {
|
|
150
|
+
const columnsToKeep = [];
|
|
151
|
+
if (!columnsToKeep.length) {
|
|
152
|
+
const unlockedColumns = this.filteredColumns.filter(c => !c.locked);
|
|
153
|
+
if (unlockedColumns.length > 0) {
|
|
154
|
+
columnsToKeep.push(unlockedColumns[0]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (this.lockedColumnCheckboxes.length > 0) {
|
|
158
|
+
const lockedColumns = this.filteredColumns.filter(c => c.locked);
|
|
159
|
+
if (lockedColumns.length > 0) {
|
|
160
|
+
columnsToKeep.unshift(lockedColumns[0]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this.filteredColumns.forEach(column => {
|
|
164
|
+
const isChecked = columnsToKeep.indexOf(column) >= 0;
|
|
165
|
+
column.currentlyChecked = isChecked;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.filteredColumns.forEach(column => {
|
|
170
|
+
column.currentlyChecked = checkedState;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (this.autoSync) {
|
|
174
|
+
const changedColumns = this.filteredColumns.filter(column => column.initiallyChecked !== column.currentlyChecked);
|
|
175
|
+
if (changedColumns.length > 0) {
|
|
176
|
+
changedColumns.forEach(column => {
|
|
177
|
+
column.hidden = !column.currentlyChecked;
|
|
178
|
+
column.initiallyChecked = column.currentlyChecked;
|
|
179
|
+
});
|
|
180
|
+
this.ngZone.run(() => {
|
|
181
|
+
this.columnChange.emit(changedColumns);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
this.filteredColumns = [...this.filteredColumns];
|
|
186
|
+
this.updateDisabled();
|
|
187
|
+
}
|
|
121
188
|
ngOnDestroy() {
|
|
122
189
|
this.domSubscriptions.unsubscribe();
|
|
123
190
|
}
|
|
124
|
-
isDisabled(column) {
|
|
125
|
-
return !(this.allowHideAll || this.hasFiltered || column.hidden || this.columns.find(current => current !== column && !current.hidden)) ||
|
|
126
|
-
(this.hasVisibleLocked && !this.hasUnlockedFiltered && this.unlockedCount === 1 && !column.locked && !column.hidden);
|
|
127
|
-
}
|
|
128
191
|
cancelChanges() {
|
|
129
|
-
this.
|
|
130
|
-
|
|
192
|
+
this.columns.forEach((column) => {
|
|
193
|
+
column.currentlyChecked = !column.hidden;
|
|
194
|
+
column.initiallyChecked = !column.hidden;
|
|
195
|
+
});
|
|
196
|
+
this.filteredColumns.forEach((column) => {
|
|
197
|
+
column.currentlyChecked = !column.hidden;
|
|
198
|
+
column.initiallyChecked = !column.hidden;
|
|
131
199
|
});
|
|
132
200
|
this.updateDisabled();
|
|
133
201
|
this.reset.emit();
|
|
134
202
|
}
|
|
135
203
|
applyChanges() {
|
|
136
204
|
const changed = [];
|
|
137
|
-
this.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (Boolean(column.hidden) !== hidden) {
|
|
141
|
-
column.hidden = hidden;
|
|
205
|
+
this.columns.forEach(column => {
|
|
206
|
+
if (column.initiallyChecked !== column.currentlyChecked) {
|
|
207
|
+
column.hidden = !column.currentlyChecked;
|
|
142
208
|
changed.push(column);
|
|
143
209
|
}
|
|
144
210
|
});
|
|
145
211
|
this.updateDisabled();
|
|
146
212
|
this.apply.emit(changed);
|
|
213
|
+
if (changed.length) {
|
|
214
|
+
this.cdr.markForCheck();
|
|
215
|
+
this.columnInfoService?.changeVisibility(changed);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
focusActiveColumn(e) {
|
|
219
|
+
const keyboardEvent = e;
|
|
220
|
+
if (keyboardEvent.shiftKey) {
|
|
221
|
+
this.listNavigationService.toggle(this.listNavigationService.activeIndex, true);
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
}
|
|
147
224
|
}
|
|
148
225
|
onTab(e) {
|
|
149
226
|
if (this.isLast) {
|
|
@@ -151,6 +228,9 @@ export class ColumnListComponent {
|
|
|
151
228
|
if (this.service) {
|
|
152
229
|
this.service.menuTabbingService.firstFocusable.focus();
|
|
153
230
|
}
|
|
231
|
+
else if (this.filterable) {
|
|
232
|
+
this.filterInput?.input.nativeElement.focus();
|
|
233
|
+
}
|
|
154
234
|
else {
|
|
155
235
|
this.listNavigationService.toggle(this.listNavigationService.activeIndex, true);
|
|
156
236
|
}
|
|
@@ -161,10 +241,30 @@ export class ColumnListComponent {
|
|
|
161
241
|
if (code !== Keys.Tab) {
|
|
162
242
|
e.preventDefault();
|
|
163
243
|
}
|
|
244
|
+
if (code === 'Tab' && e.shiftKey) {
|
|
245
|
+
this.resetButton?.nativeElement.focus();
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
}
|
|
164
248
|
if (code === 'Tab' && !e.shiftKey && this.autoSync) {
|
|
249
|
+
if (this.filterable) {
|
|
250
|
+
this.filterInput?.input.nativeElement.focus();
|
|
251
|
+
}
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
}
|
|
254
|
+
if (code === 'Tab' && e.shiftKey && this.autoSync && this.filterable) {
|
|
255
|
+
this.filterInput?.input.nativeElement.focus();
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
}
|
|
258
|
+
if (code === 'Tab' && !e.shiftKey && !this.autoSync) {
|
|
259
|
+
this.applyButton?.nativeElement.focus();
|
|
165
260
|
e.preventDefault();
|
|
166
261
|
}
|
|
167
262
|
if (code === 'Tab' && e.shiftKey) {
|
|
263
|
+
if (!this.autoSync && this.filterable && e.target.matches('.k-column-list-item')) {
|
|
264
|
+
this.filterInput?.input.nativeElement.focus();
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
168
268
|
this.ngZone.run(() => {
|
|
169
269
|
if (e.target.matches('.k-column-list-item')) {
|
|
170
270
|
e.preventDefault();
|
|
@@ -183,46 +283,33 @@ export class ColumnListComponent {
|
|
|
183
283
|
}
|
|
184
284
|
};
|
|
185
285
|
updateDisabled() {
|
|
186
|
-
|
|
286
|
+
const hasLockedColumns = this.columns.filter(c => c.locked).length > 0;
|
|
287
|
+
if (this.allowHideAll && !hasLockedColumns) {
|
|
187
288
|
return;
|
|
188
289
|
}
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// Reset all disabled states first
|
|
194
|
-
this.setDisabledState(checkbox, false);
|
|
195
|
-
if (checkbox.checkedState) {
|
|
196
|
-
visibleColumns.push({ checkbox, index });
|
|
197
|
-
columnMap.set(index, this.columns[index]);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
// Only apply disabled states where needed
|
|
201
|
-
if (!this.allowHideAll && visibleColumns.length === 1 && !this.hasFiltered) {
|
|
202
|
-
this.setDisabledState(visibleColumns[0].checkbox, true);
|
|
203
|
-
}
|
|
204
|
-
else if (this.hasLocked && !this.hasUnlockedFiltered) {
|
|
205
|
-
const checkedUnlocked = visibleColumns.filter(item => !columnMap.get(item.index).locked);
|
|
206
|
-
if (checkedUnlocked.length === 1) {
|
|
207
|
-
this.setDisabledState(checkedUnlocked[0].checkbox, true);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
updateColumnState() {
|
|
212
|
-
this.hasLocked = this.allColumns.filter(column => column.locked && (!column.hidden || column.includeInChooser !== false)).length > 0;
|
|
213
|
-
this.hasVisibleLocked = this.allColumns.filter(column => column.locked && !column.hidden).length > 0;
|
|
214
|
-
this.unlockedCount = this.columns.filter(column => !column.locked && !column.hidden).length;
|
|
215
|
-
const filteredColumns = this.allColumns.filter(column => column.includeInChooser === false && !column.hidden);
|
|
216
|
-
if (filteredColumns.length) {
|
|
217
|
-
this.hasFiltered = filteredColumns.length > 0;
|
|
218
|
-
this.hasUnlockedFiltered = filteredColumns.filter(column => !column.locked).length > 0;
|
|
290
|
+
const currentlyCheckedUnlockedColumns = this.columns.filter(column => !column.locked && column.currentlyChecked).length;
|
|
291
|
+
const shouldEnforceMinimumColumns = hasLockedColumns || !this.allowHideAll;
|
|
292
|
+
if (shouldEnforceMinimumColumns && currentlyCheckedUnlockedColumns === 1) {
|
|
293
|
+
this.disableFirstUnlockedCheckedCheckbox();
|
|
219
294
|
}
|
|
220
295
|
else {
|
|
221
|
-
this.
|
|
222
|
-
this.hasUnlockedFiltered = false;
|
|
296
|
+
this.enableLastDisabledColumn();
|
|
223
297
|
}
|
|
224
298
|
}
|
|
299
|
+
disableFirstUnlockedCheckedCheckbox() {
|
|
300
|
+
const index = this.filteredColumns.filter(c => !c.locked).findIndex(column => column.currentlyChecked);
|
|
301
|
+
const firstUnlockedCheckedCheckbox = this.unlockedColumnCheckboxes[index];
|
|
302
|
+
this.setDisabledState(firstUnlockedCheckedCheckbox, true);
|
|
303
|
+
this.lastDisabledCheckbox = firstUnlockedCheckedCheckbox;
|
|
304
|
+
}
|
|
305
|
+
enableLastDisabledColumn() {
|
|
306
|
+
this.setDisabledState(this.lastDisabledCheckbox, false);
|
|
307
|
+
this.lastDisabledCheckbox = null;
|
|
308
|
+
}
|
|
225
309
|
setDisabledState(checkbox, disabled) {
|
|
310
|
+
if (!checkbox) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
226
313
|
if (checkbox.disabled !== disabled) {
|
|
227
314
|
this.ngZone.runOutsideAngular(() => {
|
|
228
315
|
checkbox.disabled = disabled;
|
|
@@ -239,85 +326,87 @@ export class ColumnListComponent {
|
|
|
239
326
|
});
|
|
240
327
|
}
|
|
241
328
|
}
|
|
242
|
-
|
|
329
|
+
checkBoxClick(e) {
|
|
243
330
|
const closestItem = e.target.closest('.k-column-list-item');
|
|
244
|
-
if (closestItem)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (Boolean(column.hidden) !== hidden) {
|
|
259
|
-
this.ngZone.runOutsideAngular(() => {
|
|
260
|
-
column.hidden = hidden;
|
|
261
|
-
this.ngZone.run(() => {
|
|
262
|
-
this.columnChange.emit([column]);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
this.ngZone.run(() => this.updateDisabled());
|
|
269
|
-
}
|
|
270
|
-
if (index !== this.listNavigationService.activeIndex) {
|
|
271
|
-
this.listNavigationService.toggle(this.listNavigationService.activeIndex, false);
|
|
272
|
-
this.listNavigationService.activeIndex = index;
|
|
273
|
-
this.listNavigationService.toggle(index, true);
|
|
331
|
+
if (!closestItem)
|
|
332
|
+
return;
|
|
333
|
+
const checkboxElement = closestItem.querySelector('.k-checkbox-wrap');
|
|
334
|
+
const input = checkboxElement?.querySelector('input');
|
|
335
|
+
if (e.target === input) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
e.preventDefault();
|
|
339
|
+
if (input) {
|
|
340
|
+
const index = parseInt(input.getAttribute('data-index'), 10);
|
|
341
|
+
const column = this.filteredColumns[index];
|
|
342
|
+
const isDisabled = checkboxElement.classList.contains('k-disabled');
|
|
343
|
+
if (column && !isDisabled) {
|
|
344
|
+
input.click();
|
|
274
345
|
}
|
|
275
346
|
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
347
|
+
}
|
|
348
|
+
onCheckboxChange(checkedState, column, _index) {
|
|
349
|
+
column.currentlyChecked = checkedState;
|
|
350
|
+
if (this.autoSync) {
|
|
351
|
+
column.hidden = !checkedState;
|
|
352
|
+
column.initiallyChecked = checkedState;
|
|
353
|
+
this.columnChange.emit([column]);
|
|
354
|
+
}
|
|
355
|
+
this.updateDisabled();
|
|
356
|
+
}
|
|
357
|
+
setTabindex(labelElement) {
|
|
358
|
+
if (!labelElement) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const allLabels = this.checkboxes.map(checkbox => checkbox.hostElement.nativeElement.parentElement);
|
|
362
|
+
allLabels.forEach((label) => {
|
|
363
|
+
const input = label.querySelector('input');
|
|
364
|
+
input.classList.remove('k-focus');
|
|
365
|
+
this.renderer.removeAttribute(label, 'tabindex');
|
|
366
|
+
});
|
|
367
|
+
this.renderer.setAttribute(labelElement, 'tabindex', '0');
|
|
368
|
+
labelElement.focus();
|
|
369
|
+
this.listNavigationService.activeIndex = allLabels.indexOf(labelElement);
|
|
370
|
+
}
|
|
371
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnListComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.ColumnListKeyboardNavigation }, { token: i0.ChangeDetectorRef }, { token: i2.ColumnInfoService, optional: true }, { token: i3.AdaptiveGridService, optional: true }, { token: i4.ContextService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
372
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColumnListComponent, isStandalone: true, selector: "kendo-grid-columnlist", inputs: { columns: "columns", filteredColumns: "filteredColumns", autoSync: "autoSync", showSelectAll: "showSelectAll", isFiltered: "isFiltered", ariaLabel: "ariaLabel", allowHideAll: "allowHideAll", applyText: "applyText", resetText: "resetText", isLast: "isLast", isExpanded: "isExpanded", service: "service", filterable: "filterable" }, outputs: { reset: "reset", apply: "apply", columnChange: "columnChange" }, host: { properties: { "class.k-column-list-wrapper": "this.className", "class.k-column-list-md": "this.listSizeMd", "class.k-column-list-lg": "this.listSizeLg" } }, providers: [ColumnListKeyboardNavigation], viewQueries: [{ propertyName: "checkboxes", predicate: CheckBoxComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
279
373
|
<div
|
|
280
374
|
class="k-column-list"
|
|
281
375
|
role="listbox"
|
|
282
376
|
aria-multiselectable="true"
|
|
283
377
|
[attr.aria-label]="ariaLabel">
|
|
284
378
|
<label
|
|
285
|
-
*
|
|
379
|
+
*ngIf="showSelectAll"
|
|
380
|
+
class='k-column-list-item'
|
|
381
|
+
role="option"
|
|
382
|
+
[kendoEventsOutsideAngular]="{click: onSelectAllClick}"
|
|
383
|
+
[scope]="this">
|
|
384
|
+
<kendo-checkbox
|
|
385
|
+
#checkbox
|
|
386
|
+
[inputAttributes]="{'data-index': '0'}"
|
|
387
|
+
[tabindex]="-1"
|
|
388
|
+
[checkedState]="checkedCheckboxesLength === columns.length"
|
|
389
|
+
(checkedStateChange)="onSelectAllCheckboxChange($event)"
|
|
390
|
+
></kendo-checkbox>
|
|
391
|
+
<span class="k-checkbox-label">{{ 'Select all' }}</span>
|
|
392
|
+
</label>
|
|
393
|
+
<label
|
|
394
|
+
*ngFor="let column of filteredColumns; let index = index;"
|
|
286
395
|
class='k-column-list-item'
|
|
287
|
-
|
|
288
|
-
|
|
396
|
+
role="option"
|
|
397
|
+
[kendoEventsOutsideAngular]="{click: checkBoxClick}"
|
|
398
|
+
[scope]="this">
|
|
289
399
|
<kendo-checkbox
|
|
400
|
+
#checkbox
|
|
290
401
|
[inputAttributes]="{'data-index': index.toString()}"
|
|
291
402
|
[tabindex]="-1"
|
|
292
|
-
[checkedState]="
|
|
293
|
-
|
|
403
|
+
[checkedState]="column.currentlyChecked"
|
|
404
|
+
(checkedStateChange)="onCheckboxChange($event, column, index)"
|
|
294
405
|
></kendo-checkbox>
|
|
295
406
|
<span class="k-checkbox-label">{{ column.displayTitle }}</span>
|
|
296
407
|
</label>
|
|
297
408
|
</div>
|
|
298
|
-
|
|
299
|
-
<button
|
|
300
|
-
#applyButton
|
|
301
|
-
kendoButton
|
|
302
|
-
type="button"
|
|
303
|
-
icon="check"
|
|
304
|
-
[svgIcon]="checkIcon"
|
|
305
|
-
themeColor="primary"
|
|
306
|
-
(click)="applyChanges()"
|
|
307
|
-
(keydown.enter)="$event.preventDefault(); $event.stopPropagation(); applyChanges();"
|
|
308
|
-
(keydown.space)="$event.preventDefault(); $event.stopPropagation(); applyChanges();">{{ applyText }}</button>
|
|
309
|
-
<button
|
|
310
|
-
#resetButton
|
|
311
|
-
kendoButton
|
|
312
|
-
type="button"
|
|
313
|
-
icon="reset"
|
|
314
|
-
[svgIcon]="arrowRotateCcwIcon"
|
|
315
|
-
(keydown.tab)="onTab($event)"
|
|
316
|
-
(click)="cancelChanges()"
|
|
317
|
-
(keydown.enter)="$event.preventDefault(); $event.stopPropagation(); cancelChanges();"
|
|
318
|
-
(keydown.space)="$event.preventDefault(); $event.stopPropagation(); cancelChanges();">{{ resetText }}</button>
|
|
319
|
-
</div>
|
|
320
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: ColumnMenuChooserItemCheckedDirective, selector: "[kendoColumnMenuChooserItemChecked]", inputs: ["kendoColumnMenuChooserItemChecked"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["checkedState", "rounded"], outputs: ["checkedStateChange"], exportAs: ["kendoCheckBox"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
409
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["checkedState", "rounded"], outputs: ["checkedStateChange"], exportAs: ["kendoCheckBox"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }] });
|
|
321
410
|
}
|
|
322
411
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnListComponent, decorators: [{
|
|
323
412
|
type: Component,
|
|
@@ -331,48 +420,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
331
420
|
aria-multiselectable="true"
|
|
332
421
|
[attr.aria-label]="ariaLabel">
|
|
333
422
|
<label
|
|
334
|
-
*
|
|
423
|
+
*ngIf="showSelectAll"
|
|
335
424
|
class='k-column-list-item'
|
|
336
|
-
|
|
337
|
-
|
|
425
|
+
role="option"
|
|
426
|
+
[kendoEventsOutsideAngular]="{click: onSelectAllClick}"
|
|
427
|
+
[scope]="this">
|
|
338
428
|
<kendo-checkbox
|
|
429
|
+
#checkbox
|
|
430
|
+
[inputAttributes]="{'data-index': '0'}"
|
|
431
|
+
[tabindex]="-1"
|
|
432
|
+
[checkedState]="checkedCheckboxesLength === columns.length"
|
|
433
|
+
(checkedStateChange)="onSelectAllCheckboxChange($event)"
|
|
434
|
+
></kendo-checkbox>
|
|
435
|
+
<span class="k-checkbox-label">{{ 'Select all' }}</span>
|
|
436
|
+
</label>
|
|
437
|
+
<label
|
|
438
|
+
*ngFor="let column of filteredColumns; let index = index;"
|
|
439
|
+
class='k-column-list-item'
|
|
440
|
+
role="option"
|
|
441
|
+
[kendoEventsOutsideAngular]="{click: checkBoxClick}"
|
|
442
|
+
[scope]="this">
|
|
443
|
+
<kendo-checkbox
|
|
444
|
+
#checkbox
|
|
339
445
|
[inputAttributes]="{'data-index': index.toString()}"
|
|
340
446
|
[tabindex]="-1"
|
|
341
|
-
[checkedState]="
|
|
342
|
-
|
|
447
|
+
[checkedState]="column.currentlyChecked"
|
|
448
|
+
(checkedStateChange)="onCheckboxChange($event, column, index)"
|
|
343
449
|
></kendo-checkbox>
|
|
344
450
|
<span class="k-checkbox-label">{{ column.displayTitle }}</span>
|
|
345
451
|
</label>
|
|
346
452
|
</div>
|
|
347
|
-
<div [ngClass]="actionsClass" *ngIf="!autoSync && showActions">
|
|
348
|
-
<button
|
|
349
|
-
#applyButton
|
|
350
|
-
kendoButton
|
|
351
|
-
type="button"
|
|
352
|
-
icon="check"
|
|
353
|
-
[svgIcon]="checkIcon"
|
|
354
|
-
themeColor="primary"
|
|
355
|
-
(click)="applyChanges()"
|
|
356
|
-
(keydown.enter)="$event.preventDefault(); $event.stopPropagation(); applyChanges();"
|
|
357
|
-
(keydown.space)="$event.preventDefault(); $event.stopPropagation(); applyChanges();">{{ applyText }}</button>
|
|
358
|
-
<button
|
|
359
|
-
#resetButton
|
|
360
|
-
kendoButton
|
|
361
|
-
type="button"
|
|
362
|
-
icon="reset"
|
|
363
|
-
[svgIcon]="arrowRotateCcwIcon"
|
|
364
|
-
(keydown.tab)="onTab($event)"
|
|
365
|
-
(click)="cancelChanges()"
|
|
366
|
-
(keydown.enter)="$event.preventDefault(); $event.stopPropagation(); cancelChanges();"
|
|
367
|
-
(keydown.space)="$event.preventDefault(); $event.stopPropagation(); cancelChanges();">{{ resetText }}</button>
|
|
368
|
-
</div>
|
|
369
453
|
`,
|
|
370
454
|
standalone: true,
|
|
371
|
-
imports: [NgFor,
|
|
455
|
+
imports: [NgFor, NgIf, CheckBoxComponent, EventsOutsideAngularDirective]
|
|
372
456
|
}]
|
|
373
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.ColumnListKeyboardNavigation }, { type: i2.
|
|
457
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.ColumnListKeyboardNavigation }, { type: i0.ChangeDetectorRef }, { type: i2.ColumnInfoService, decorators: [{
|
|
458
|
+
type: Optional
|
|
459
|
+
}] }, { type: i3.AdaptiveGridService, decorators: [{
|
|
374
460
|
type: Optional
|
|
375
|
-
}] }, { type:
|
|
461
|
+
}] }, { type: i4.ContextService, decorators: [{
|
|
376
462
|
type: Optional
|
|
377
463
|
}] }]; }, propDecorators: { className: [{
|
|
378
464
|
type: HostBinding,
|
|
@@ -391,10 +477,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
391
477
|
type: Output
|
|
392
478
|
}], columns: [{
|
|
393
479
|
type: Input
|
|
394
|
-
}],
|
|
480
|
+
}], filteredColumns: [{
|
|
395
481
|
type: Input
|
|
396
482
|
}], autoSync: [{
|
|
397
483
|
type: Input
|
|
484
|
+
}], showSelectAll: [{
|
|
485
|
+
type: Input
|
|
486
|
+
}], isFiltered: [{
|
|
487
|
+
type: Input
|
|
398
488
|
}], ariaLabel: [{
|
|
399
489
|
type: Input
|
|
400
490
|
}], allowHideAll: [{
|
|
@@ -403,23 +493,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
403
493
|
type: Input
|
|
404
494
|
}], resetText: [{
|
|
405
495
|
type: Input
|
|
406
|
-
}], actionsClass: [{
|
|
407
|
-
type: Input
|
|
408
496
|
}], isLast: [{
|
|
409
497
|
type: Input
|
|
410
498
|
}], isExpanded: [{
|
|
411
499
|
type: Input
|
|
412
500
|
}], service: [{
|
|
413
501
|
type: Input
|
|
414
|
-
}],
|
|
415
|
-
type:
|
|
416
|
-
args: ['resetButton', { static: false }]
|
|
417
|
-
}], applyButton: [{
|
|
418
|
-
type: ViewChild,
|
|
419
|
-
args: ['applyButton', { static: false }]
|
|
420
|
-
}], options: [{
|
|
421
|
-
type: ViewChildren,
|
|
422
|
-
args: [ColumnMenuChooserItemCheckedDirective]
|
|
502
|
+
}], filterable: [{
|
|
503
|
+
type: Input
|
|
423
504
|
}], checkboxes: [{
|
|
424
505
|
type: ViewChildren,
|
|
425
506
|
args: [CheckBoxComponent]
|