@progress/kendo-angular-grid 16.11.0-develop.1 → 16.11.0-develop.2
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/columns/checkbox-column.component.d.ts +15 -3
- package/esm2020/columns/checkbox-column.component.mjs +25 -7
- package/esm2020/databinding.directive.mjs +1 -0
- package/esm2020/grid.component.mjs +34 -4
- package/esm2020/navigation/navigation-cursor.mjs +9 -0
- package/esm2020/navigation/navigation.service.mjs +98 -6
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/rendering/cell.component.mjs +41 -14
- package/esm2020/rendering/table-body.component.mjs +21 -12
- package/esm2020/selection/cell-selection.service.mjs +18 -8
- package/esm2020/selection/selectall-checkbox.directive.mjs +11 -9
- package/esm2020/selection/selection-checkbox.directive.mjs +27 -10
- package/esm2020/selection/selection-default.mjs +3 -0
- package/esm2020/selection/selection.service.mjs +43 -14
- package/fesm2015/progress-kendo-angular-grid.mjs +1478 -1233
- package/fesm2020/progress-kendo-angular-grid.mjs +1209 -969
- package/grid.component.d.ts +19 -5
- package/index.d.ts +1 -1
- package/navigation/navigation.service.d.ts +4 -0
- package/package.json +16 -16
- package/rendering/cell.component.d.ts +1 -0
- package/rendering/common/row-class.d.ts +11 -0
- package/rendering/table-body.component.d.ts +3 -1
- package/schematics/ngAdd/index.js +4 -4
- package/selection/cell-selection.service.d.ts +4 -0
- package/selection/selectall-checkbox.directive.d.ts +3 -1
- package/selection/selection-checkbox.directive.d.ts +3 -1
- package/selection/selection.service.d.ts +4 -1
- package/selection/types.d.ts +5 -0
|
@@ -6,7 +6,7 @@ import * as i0 from '@angular/core';
|
|
|
6
6
|
import { InjectionToken, EventEmitter, Injectable, SecurityContext, Optional, Inject, Directive, SkipSelf, Input, Host, Output, HostBinding, QueryList, isDevMode, Component, ContentChildren, ContentChild, forwardRef, Pipe, TemplateRef, ChangeDetectionStrategy, ViewChildren, ViewChild, Self, NgZone, HostListener, ElementRef, ViewEncapsulation, NgModule } from '@angular/core';
|
|
7
7
|
import { merge, of, Subject, from, Subscription, interval, fromEvent, Observable, zip as zip$1, BehaviorSubject } from 'rxjs';
|
|
8
8
|
import * as i9 from '@progress/kendo-angular-common';
|
|
9
|
-
import { isDocumentAvailable, Keys, anyChanged, TemplateContextDirective, DraggableDirective, EventsOutsideAngularDirective, isChanged as isChanged$1, KendoInput, guid, hasObservers, ResizeSensorComponent,
|
|
9
|
+
import { isDocumentAvailable, Keys, isPresent as isPresent$1, anyChanged, TemplateContextDirective, DraggableDirective, EventsOutsideAngularDirective, isChanged as isChanged$1, KendoInput, guid, hasObservers, ResizeSensorComponent, closest as closest$1, isFocusable as isFocusable$1, shouldShowValidationUI, WatermarkOverlayComponent, ResizeBatchService, DraggableModule } from '@progress/kendo-angular-common';
|
|
10
10
|
import { switchMap, take, map, filter, takeUntil, switchMapTo, delay, tap, throttleTime, debounceTime, distinctUntilChanged, skip, auditTime, bufferCount } from 'rxjs/operators';
|
|
11
11
|
import { plusIcon, cancelIcon, lockIcon, unlockIcon, caretAltDownIcon, caretAltRightIcon, caretAltLeftIcon, arrowLeftIcon, arrowRightIcon, sortDescSmallIcon, sortAscSmallIcon, filterClearIcon, filterIcon, columnsIcon, chevronUpIcon, chevronDownIcon, displayInlineFlexIcon, maxWidthIcon, stickIcon, unstickIcon, setColumnPositionIcon, slidersIcon, moreVerticalIcon, reorderIcon, minusIcon, caretAltToLeftIcon, caretAltToRightIcon, insertMiddleIcon } from '@progress/kendo-svg-icons';
|
|
12
12
|
import * as i1 from '@angular/platform-browser';
|
|
@@ -773,6 +773,10 @@ class NavigationCursor {
|
|
|
773
773
|
if (cell.colSpan > 1 && cell.colIndex <= virtualCol && virtualCol < cell.colIndex + cell.colSpan) {
|
|
774
774
|
nextColIndex = offset > 0 ? Math.min(cell.colIndex + cell.colSpan, lastIndex) : Math.max(0, cell.colIndex + offset);
|
|
775
775
|
const nextCell = this.model.findCell(nextColIndex, prevRow);
|
|
776
|
+
if (!nextCell) {
|
|
777
|
+
this.virtualCol = nextColIndex;
|
|
778
|
+
return this.activate(cell.rowIndex, nextColIndex);
|
|
779
|
+
}
|
|
776
780
|
if (cell !== nextCell) {
|
|
777
781
|
cell = nextCell;
|
|
778
782
|
this.virtualCol = cell.colIndex;
|
|
@@ -780,7 +784,9 @@ class NavigationCursor {
|
|
|
780
784
|
else {
|
|
781
785
|
this.virtualCol = virtualCol;
|
|
782
786
|
}
|
|
787
|
+
return this.activate(cell.rowIndex, this.virtualCol);
|
|
783
788
|
}
|
|
789
|
+
this.virtualCol = cell.colIndex;
|
|
784
790
|
return this.activate(cell.rowIndex, cell.colIndex);
|
|
785
791
|
}
|
|
786
792
|
offsetRow(offset) {
|
|
@@ -807,6 +813,9 @@ class NavigationCursor {
|
|
|
807
813
|
}
|
|
808
814
|
if (cell.rowIndex <= this.virtualRow && offset > 0 && cell.rowSpan > 1) {
|
|
809
815
|
cell = this.model.findCell(this.virtualCol, this.model.findRow(cell.rowIndex + cell.rowSpan - 1 + offset));
|
|
816
|
+
if (!cell) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
810
819
|
}
|
|
811
820
|
nextIndex = cell.rowIndex;
|
|
812
821
|
nextColIndex = cell.colIndex;
|
|
@@ -1860,9 +1869,10 @@ class NavigationService {
|
|
|
1860
1869
|
}
|
|
1861
1870
|
}
|
|
1862
1871
|
get activeRow() {
|
|
1872
|
+
var _a;
|
|
1863
1873
|
if (this.mode !== 0 /* NavigationMode.Standby */) {
|
|
1864
1874
|
return Object.assign({}, this.cursor.row, {
|
|
1865
|
-
cells: this.cursor.row.cells.toArray()
|
|
1875
|
+
cells: (_a = this.cursor.row) === null || _a === void 0 ? void 0 : _a.cells.toArray()
|
|
1866
1876
|
});
|
|
1867
1877
|
}
|
|
1868
1878
|
}
|
|
@@ -2125,6 +2135,7 @@ class NavigationService {
|
|
|
2125
2135
|
return this.ctx.localization.rtl ? this.cursor.moveRight() : this.cursor.moveLeft();
|
|
2126
2136
|
}
|
|
2127
2137
|
onCursorKeydown(args) {
|
|
2138
|
+
var _a, _b;
|
|
2128
2139
|
let preventDefault = false;
|
|
2129
2140
|
const modifier = args.ctrlKey || args.metaKey;
|
|
2130
2141
|
const step = modifier ? 5 : 1;
|
|
@@ -2134,16 +2145,56 @@ class NavigationService {
|
|
|
2134
2145
|
const row = this.cursor.row;
|
|
2135
2146
|
switch (args.keyCode) {
|
|
2136
2147
|
case Keys.ArrowDown:
|
|
2137
|
-
|
|
2148
|
+
if (args.shiftKey) {
|
|
2149
|
+
if (this.ctx.grid.blockArrowSelection) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
preventDefault = this.cursor.moveDown(step);
|
|
2153
|
+
if ((_a = this.activeRow) === null || _a === void 0 ? void 0 : _a.dataItem) {
|
|
2154
|
+
this.handleVerticalArrowSelection(step);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
else {
|
|
2158
|
+
preventDefault = this.cursor.moveDown(step);
|
|
2159
|
+
}
|
|
2138
2160
|
break;
|
|
2139
2161
|
case Keys.ArrowUp:
|
|
2140
|
-
|
|
2162
|
+
if (args.shiftKey) {
|
|
2163
|
+
if (this.ctx.grid.blockArrowSelection) {
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
preventDefault = this.cursor.moveUp(step);
|
|
2167
|
+
if ((_b = this.activeRow) === null || _b === void 0 ? void 0 : _b.dataItem) {
|
|
2168
|
+
this.handleVerticalArrowSelection(-step);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
preventDefault = this.cursor.moveUp(step);
|
|
2173
|
+
}
|
|
2141
2174
|
break;
|
|
2142
2175
|
case Keys.ArrowRight:
|
|
2143
|
-
|
|
2176
|
+
if (args.shiftKey) {
|
|
2177
|
+
if (this.ctx.grid.blockArrowSelection) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
preventDefault = this.moveCursorFwd();
|
|
2181
|
+
this.handleHorizontalArrowSelection(args);
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
preventDefault = this.moveCursorFwd();
|
|
2185
|
+
}
|
|
2144
2186
|
break;
|
|
2145
2187
|
case Keys.ArrowLeft:
|
|
2146
|
-
|
|
2188
|
+
if (args.shiftKey) {
|
|
2189
|
+
if (this.ctx.grid.blockArrowSelection) {
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
preventDefault = this.moveCursorBwd();
|
|
2193
|
+
this.handleHorizontalArrowSelection(args);
|
|
2194
|
+
}
|
|
2195
|
+
else {
|
|
2196
|
+
preventDefault = this.moveCursorBwd();
|
|
2197
|
+
}
|
|
2147
2198
|
break;
|
|
2148
2199
|
case Keys.PageDown:
|
|
2149
2200
|
if (this.metadata.isVirtual && this.viewport) {
|
|
@@ -2334,6 +2385,58 @@ class NavigationService {
|
|
|
2334
2385
|
this.leaveCell();
|
|
2335
2386
|
this.cursor.reset();
|
|
2336
2387
|
}
|
|
2388
|
+
handleVerticalArrowSelection(args) {
|
|
2389
|
+
const cellSelectionEnabled = this.ctx.grid.cellSelectionService.active;
|
|
2390
|
+
const rowSelectionEnabled = this.ctx.grid.selectionService.active && !this.ctx.grid.selectableSettings.checkboxOnly;
|
|
2391
|
+
if (cellSelectionEnabled || rowSelectionEnabled) {
|
|
2392
|
+
const selectionService = this.ctx.grid[cellSelectionEnabled ? 'cellSelectionService' : 'selectionService'];
|
|
2393
|
+
const colIdx = this.cursor.cell ? this.cursor.cell.colIndex : 0;
|
|
2394
|
+
const rowIdx = this.activeRow.dataRowIndex - this.ctx.grid.skip;
|
|
2395
|
+
const dataItem = selectionService.settings.view.at(rowIdx);
|
|
2396
|
+
const item = { index: this.activeRow.dataRowIndex, data: dataItem, column: this.ctx.grid.columnsContainer.leafColumnsToRender[colIdx] };
|
|
2397
|
+
if (selectionService.options.mode === 'multiple') {
|
|
2398
|
+
cellSelectionEnabled ? this.handleMultipleArrowCellSelection(item) : this.handleMultipleArrowRowSelection(item);
|
|
2399
|
+
}
|
|
2400
|
+
else {
|
|
2401
|
+
selectionService.handleClick(item, args);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
handleHorizontalArrowSelection(args) {
|
|
2406
|
+
const cellSelectionEnabled = this.ctx.grid.cellSelectionService.active;
|
|
2407
|
+
if (cellSelectionEnabled) {
|
|
2408
|
+
const selectionService = this.ctx.grid[cellSelectionEnabled ? 'cellSelectionService' : 'selectionService'];
|
|
2409
|
+
const row = this.activeRow;
|
|
2410
|
+
const colIdx = this.cursor.cell ? this.cursor.cell.colIndex : 0;
|
|
2411
|
+
const dataItem = selectionService.settings.view.at(row.dataRowIndex - this.ctx.grid.skip);
|
|
2412
|
+
const item = { index: row.dataRowIndex, data: dataItem, column: this.ctx.grid.columnsContainer.leafColumnsToRender[colIdx] };
|
|
2413
|
+
if (!isPresent$1(dataItem) || !isPresent$1(item.column)) {
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
if (selectionService.options.mode === 'multiple') {
|
|
2417
|
+
this.handleMultipleArrowCellSelection(item);
|
|
2418
|
+
}
|
|
2419
|
+
else {
|
|
2420
|
+
selectionService.handleClick(item, args);
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
handleMultipleArrowCellSelection(item) {
|
|
2425
|
+
const cellSelectionService = this.ctx.grid.cellSelectionService;
|
|
2426
|
+
const startRowIndex = Math.min(cellSelectionService.lastSelectionItemRowIndex, item.index);
|
|
2427
|
+
const startColIndex = Math.min(cellSelectionService.lastSelectionItemColIndex, item.column.leafIndex);
|
|
2428
|
+
const endRowIndex = Math.max(cellSelectionService.lastSelectionItemRowIndex, item.index);
|
|
2429
|
+
const endColIndex = Math.max(cellSelectionService.lastSelectionItemColIndex, item.column.leafIndex);
|
|
2430
|
+
const ev = cellSelectionService.selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex);
|
|
2431
|
+
cellSelectionService.changes.emit(ev);
|
|
2432
|
+
}
|
|
2433
|
+
handleMultipleArrowRowSelection(item) {
|
|
2434
|
+
const rowSelectionService = this.ctx.grid.selectionService;
|
|
2435
|
+
const startRowIndex = Math.min(rowSelectionService.lastSelectionStartIndex, item.index);
|
|
2436
|
+
const endRowIndex = Math.max(rowSelectionService.lastSelectionStartIndex, item.index);
|
|
2437
|
+
const ev = rowSelectionService.selectRange(startRowIndex, endRowIndex);
|
|
2438
|
+
rowSelectionService.changes.emit(ev);
|
|
2439
|
+
}
|
|
2337
2440
|
}
|
|
2338
2441
|
NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NavigationService, deps: [{ token: i0.NgZone }, { token: DomEventsService }, { token: PagerContextService }, { token: ScrollRequestService }, { token: GroupsService }, { token: DetailsService }, { token: FocusRoot }, { token: EditService }, { token: i0.ChangeDetectorRef }, { token: ContextService }, { token: FocusableDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2339
2442
|
NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NavigationService });
|
|
@@ -14115,6 +14218,7 @@ class SelectionService {
|
|
|
14115
14218
|
this.ctxService = ctxService;
|
|
14116
14219
|
this.changes = new EventEmitter();
|
|
14117
14220
|
this.currentSelection = [];
|
|
14221
|
+
this.nonSelectableRows = new Map();
|
|
14118
14222
|
this.selectAllChecked = false;
|
|
14119
14223
|
this.active = false;
|
|
14120
14224
|
this.dragging = false;
|
|
@@ -14135,6 +14239,9 @@ class SelectionService {
|
|
|
14135
14239
|
selectableSettings.drag;
|
|
14136
14240
|
return this.active && dragAndMultiple;
|
|
14137
14241
|
}
|
|
14242
|
+
get hasNonSelectable() {
|
|
14243
|
+
return this.nonSelectableRows.size > 0;
|
|
14244
|
+
}
|
|
14138
14245
|
init(settings) {
|
|
14139
14246
|
var _a, _b, _c, _d, _e, _f;
|
|
14140
14247
|
this.settings = settings;
|
|
@@ -14143,6 +14250,7 @@ class SelectionService {
|
|
|
14143
14250
|
this.lastSelectionData = ((_f = (_e = (_d = this.ctxService) === null || _d === void 0 ? void 0 : _d.grid.selectionDirective) === null || _e === void 0 ? void 0 : _e.rangeSelectionStartRow) === null || _f === void 0 ? void 0 : _f.dataItem) || {};
|
|
14144
14251
|
}
|
|
14145
14252
|
this.currentSelection = [];
|
|
14253
|
+
this.nonSelectableRows = new Map();
|
|
14146
14254
|
if (settings.selectable && settings.selectable.enabled !== false) {
|
|
14147
14255
|
const iterator = this.getIterator();
|
|
14148
14256
|
this._selectAllState = true;
|
|
@@ -14159,6 +14267,10 @@ class SelectionService {
|
|
|
14159
14267
|
else {
|
|
14160
14268
|
this._selectAllState = undefined;
|
|
14161
14269
|
}
|
|
14270
|
+
if (!settings.isRowSelectable(rowArgs)) {
|
|
14271
|
+
this.nonSelectableRows.set(rowArgs.index, rowArgs.dataItem);
|
|
14272
|
+
this._selectAllState = undefined;
|
|
14273
|
+
}
|
|
14162
14274
|
}
|
|
14163
14275
|
item = iterator.next();
|
|
14164
14276
|
}
|
|
@@ -14169,7 +14281,7 @@ class SelectionService {
|
|
|
14169
14281
|
}
|
|
14170
14282
|
isSelected(index) {
|
|
14171
14283
|
if (this.settings && this.active) {
|
|
14172
|
-
return this.options.enabled && isPresent(this.currentSelection[index]);
|
|
14284
|
+
return this.options.enabled && isPresent(this.currentSelection[index]) && !this.nonSelectableRows.has(index);
|
|
14173
14285
|
}
|
|
14174
14286
|
}
|
|
14175
14287
|
handleClick(item, event) {
|
|
@@ -14183,7 +14295,7 @@ class SelectionService {
|
|
|
14183
14295
|
ev = this.toggle(item);
|
|
14184
14296
|
}
|
|
14185
14297
|
else if (this.options.mode === "multiple") {
|
|
14186
|
-
if (ctrlKey && !event.shiftKey) {
|
|
14298
|
+
if ((ctrlKey || !this.options.metaKeyMultiSelect) && !event.shiftKey) {
|
|
14187
14299
|
ev = this.toggle(item);
|
|
14188
14300
|
}
|
|
14189
14301
|
else if (event.shiftKey) {
|
|
@@ -14220,9 +14332,13 @@ class SelectionService {
|
|
|
14220
14332
|
if (this.isSelected(item.index)) {
|
|
14221
14333
|
deselectedRows.push(rowArgs);
|
|
14222
14334
|
}
|
|
14223
|
-
else {
|
|
14335
|
+
else if (!this.nonSelectableRows.has(item.index)) {
|
|
14224
14336
|
selectedRows.push(rowArgs);
|
|
14225
14337
|
}
|
|
14338
|
+
if (this.hasNonSelectable) {
|
|
14339
|
+
const nonSelectableRows = this.currentSelection.filter(i => this.nonSelectableRows.has(i.index));
|
|
14340
|
+
deselectedRows.push(...nonSelectableRows);
|
|
14341
|
+
}
|
|
14226
14342
|
return {
|
|
14227
14343
|
deselectedRows: deselectedRows,
|
|
14228
14344
|
selectedRows: selectedRows
|
|
@@ -14255,7 +14371,7 @@ class SelectionService {
|
|
|
14255
14371
|
const selectedRows = [];
|
|
14256
14372
|
this.lastSelectionStartIndex = item.index;
|
|
14257
14373
|
this.lastSelectionData = item.data;
|
|
14258
|
-
if (!this.isSelected(item.index)) {
|
|
14374
|
+
if (!this.isSelected(item.index) && !this.nonSelectableRows.has(item.index)) {
|
|
14259
14375
|
selectedRows.push({ dataItem: item.data, index: item.index });
|
|
14260
14376
|
}
|
|
14261
14377
|
this.currentSelection.forEach((row) => {
|
|
@@ -14278,7 +14394,7 @@ class SelectionService {
|
|
|
14278
14394
|
dataItem: item.value.data,
|
|
14279
14395
|
index: item.value.index
|
|
14280
14396
|
};
|
|
14281
|
-
if (this.isSelected(rowArgs.index)) {
|
|
14397
|
+
if (this.isSelected(rowArgs.index) || this.nonSelectableRows.has(rowArgs.index)) {
|
|
14282
14398
|
const ev = {
|
|
14283
14399
|
ctrlKey: false,
|
|
14284
14400
|
deselectedRows: [rowArgs],
|
|
@@ -14304,12 +14420,16 @@ class SelectionService {
|
|
|
14304
14420
|
if ((idx < start || idx > end) && this.isSelected(idx) && !ctrlKey) {
|
|
14305
14421
|
deselectedRows.push(rowArgs);
|
|
14306
14422
|
}
|
|
14307
|
-
if ((idx >= start && idx <= end) && !this.isSelected(idx)) {
|
|
14423
|
+
if ((idx >= start && idx <= end) && !this.isSelected(idx) && !this.nonSelectableRows.has(idx)) {
|
|
14308
14424
|
selectedRows.push(rowArgs);
|
|
14309
14425
|
}
|
|
14310
14426
|
}
|
|
14311
14427
|
next = iterator.next();
|
|
14312
14428
|
}
|
|
14429
|
+
if (this.hasNonSelectable) {
|
|
14430
|
+
const nonSelectableRows = this.currentSelection.filter(i => this.nonSelectableRows.has(i.index));
|
|
14431
|
+
deselectedRows.push(...nonSelectableRows);
|
|
14432
|
+
}
|
|
14313
14433
|
return {
|
|
14314
14434
|
deselectedRows: deselectedRows,
|
|
14315
14435
|
selectedRows: selectedRows
|
|
@@ -14325,11 +14445,13 @@ class SelectionService {
|
|
|
14325
14445
|
if (next.value && next.value.type === "data") {
|
|
14326
14446
|
const idx = next.value.index;
|
|
14327
14447
|
const rowArgs = { dataItem: next.value.data, index: idx };
|
|
14328
|
-
if (this.
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14448
|
+
if (!this.nonSelectableRows.has(idx)) {
|
|
14449
|
+
if (this.isSelected(idx) && !selectAllChecked) {
|
|
14450
|
+
deselectedRows.push(rowArgs);
|
|
14451
|
+
}
|
|
14452
|
+
if (!this.isSelected(idx) && selectAllChecked) {
|
|
14453
|
+
selectedRows.push(rowArgs);
|
|
14454
|
+
}
|
|
14333
14455
|
}
|
|
14334
14456
|
}
|
|
14335
14457
|
next = iterator.next();
|
|
@@ -14337,6 +14459,10 @@ class SelectionService {
|
|
|
14337
14459
|
if (!selectedRows.length && !deselectedRows.length) {
|
|
14338
14460
|
return;
|
|
14339
14461
|
}
|
|
14462
|
+
if (this.hasNonSelectable) {
|
|
14463
|
+
const nonSelectableRows = this.currentSelection.filter(i => this.nonSelectableRows.has(i.index));
|
|
14464
|
+
deselectedRows.push(...nonSelectableRows);
|
|
14465
|
+
}
|
|
14340
14466
|
const ev = {
|
|
14341
14467
|
ctrlKey: true,
|
|
14342
14468
|
deselectedRows: deselectedRows,
|
|
@@ -14362,7 +14488,7 @@ class SelectionService {
|
|
|
14362
14488
|
if ((idx < start || idx > end) && this.isSelected(idx)) {
|
|
14363
14489
|
deselectedRows.push(rowArgs);
|
|
14364
14490
|
}
|
|
14365
|
-
if ((idx >= start && idx <= end) && !this.isSelected(idx)) {
|
|
14491
|
+
if ((idx >= start && idx <= end) && !this.isSelected(idx) && !this.nonSelectableRows.has(idx)) {
|
|
14366
14492
|
selectedRows.push(rowArgs);
|
|
14367
14493
|
}
|
|
14368
14494
|
}
|
|
@@ -14372,6 +14498,10 @@ class SelectionService {
|
|
|
14372
14498
|
if (this.options.cellAggregates) {
|
|
14373
14499
|
cellAggregates = this.aggregateService.onSelectionChange({ selectedRows, deselectedRows });
|
|
14374
14500
|
}
|
|
14501
|
+
if (this.hasNonSelectable) {
|
|
14502
|
+
const nonSelectableRows = this.currentSelection.filter(i => this.nonSelectableRows.has(i.index));
|
|
14503
|
+
deselectedRows.push(...nonSelectableRows);
|
|
14504
|
+
}
|
|
14375
14505
|
return {
|
|
14376
14506
|
deselectedRows: deselectedRows,
|
|
14377
14507
|
selectedRows: selectedRows,
|
|
@@ -14391,7 +14521,8 @@ class SelectionService {
|
|
|
14391
14521
|
cellAggregates: false,
|
|
14392
14522
|
checkboxOnly: false,
|
|
14393
14523
|
enabled: true,
|
|
14394
|
-
mode: "multiple"
|
|
14524
|
+
mode: "multiple",
|
|
14525
|
+
metaKeyMultiSelect: true
|
|
14395
14526
|
};
|
|
14396
14527
|
if (!isPresent(this.settings)) {
|
|
14397
14528
|
return defaultOptions;
|
|
@@ -14401,7 +14532,8 @@ class SelectionService {
|
|
|
14401
14532
|
cellAggregates: false,
|
|
14402
14533
|
checkboxOnly: false,
|
|
14403
14534
|
enabled: this.settings.selectable,
|
|
14404
|
-
mode: "multiple"
|
|
14535
|
+
mode: "multiple",
|
|
14536
|
+
metaKeyMultiSelect: true
|
|
14405
14537
|
};
|
|
14406
14538
|
}
|
|
14407
14539
|
else {
|
|
@@ -14478,523 +14610,834 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
14478
14610
|
}], ctorParameters: function () { return [{ type: DomEventsService }, { type: CellSelectionAggregateService }, { type: LocalDataChangesService }, { type: NavigationService }, { type: ContextService }]; } });
|
|
14479
14611
|
|
|
14480
14612
|
/**
|
|
14481
|
-
*
|
|
14482
|
-
*
|
|
14483
|
-
* @example
|
|
14484
|
-
* ```html
|
|
14485
|
-
* <input
|
|
14486
|
-
* type="checkbox"
|
|
14487
|
-
* kendoCheckBox
|
|
14488
|
-
* kendoGridSelectAllCheckbox
|
|
14489
|
-
* [state]="selectAllState"
|
|
14490
|
-
* (selectAllChange)="onSelectAllChange($event)"
|
|
14491
|
-
* />
|
|
14492
|
-
* ```
|
|
14613
|
+
* @hidden
|
|
14493
14614
|
*/
|
|
14494
|
-
class
|
|
14495
|
-
constructor(
|
|
14496
|
-
this.
|
|
14497
|
-
this.
|
|
14498
|
-
this.
|
|
14499
|
-
this.
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
this.
|
|
14505
|
-
this.
|
|
14506
|
-
this.
|
|
14507
|
-
this.
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
ngAfterContentChecked() {
|
|
14512
|
-
this.setState();
|
|
14513
|
-
}
|
|
14514
|
-
ngOnChanges() {
|
|
14515
|
-
this.stateSet = true;
|
|
14615
|
+
class CellSelectionService {
|
|
14616
|
+
constructor(domEvents, aggregateService, localDataChangesService, navigationService) {
|
|
14617
|
+
this.domEvents = domEvents;
|
|
14618
|
+
this.aggregateService = aggregateService;
|
|
14619
|
+
this.localDataChangesService = localDataChangesService;
|
|
14620
|
+
this.navigationService = navigationService;
|
|
14621
|
+
this.changes = new EventEmitter();
|
|
14622
|
+
this.mouseUpEvent = new EventEmitter();
|
|
14623
|
+
this.currentSelection = [];
|
|
14624
|
+
this.active = false;
|
|
14625
|
+
this.nonSelectableRows = new Map();
|
|
14626
|
+
this.dragging = false;
|
|
14627
|
+
this.dragSelectDeselect = false;
|
|
14628
|
+
this.lastSelectionItem = { itemKey: 0, columnKey: 0 };
|
|
14629
|
+
this.lastSelectionItemRowIndex = 0;
|
|
14630
|
+
this.lastSelectionItemColIndex = 0;
|
|
14631
|
+
this.addSubscriptions();
|
|
14516
14632
|
}
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14633
|
+
get enableMarquee() {
|
|
14634
|
+
const checkboxOnly = this.settings && typeof this.settings === 'object' && this.settings.checkboxOnly;
|
|
14635
|
+
if (!this.settings || checkboxOnly) {
|
|
14636
|
+
return false;
|
|
14520
14637
|
}
|
|
14638
|
+
const selectableSettings = this.settings.selectable;
|
|
14639
|
+
const dragAndMultiple = typeof (selectableSettings) === 'object' &&
|
|
14640
|
+
isPresent(selectableSettings) &&
|
|
14641
|
+
selectableSettings.mode === 'multiple' &&
|
|
14642
|
+
selectableSettings.cell &&
|
|
14643
|
+
selectableSettings.enabled !== false &&
|
|
14644
|
+
selectableSettings.drag;
|
|
14645
|
+
return this.active && dragAndMultiple;
|
|
14521
14646
|
}
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14647
|
+
get hasNonSelectable() {
|
|
14648
|
+
return this.nonSelectableRows.size > 0;
|
|
14649
|
+
}
|
|
14650
|
+
init(settings) {
|
|
14651
|
+
this.settings = settings;
|
|
14652
|
+
this.currentSelection = [];
|
|
14653
|
+
this.nonSelectableRows = new Map();
|
|
14654
|
+
if (settings.selectable && settings.selectable.enabled !== false) {
|
|
14655
|
+
const iterator = this.getIterator();
|
|
14656
|
+
let item = iterator.next();
|
|
14657
|
+
while (!item.done) {
|
|
14658
|
+
if (item.value && item.value.type === "data") {
|
|
14659
|
+
const rowArgs = {
|
|
14660
|
+
dataItem: item.value.data,
|
|
14661
|
+
index: item.value.index
|
|
14662
|
+
};
|
|
14663
|
+
settings.columns.forEach(col => {
|
|
14664
|
+
const selectedCellArgs = settings.cellSelected(rowArgs, col, col.leafIndex);
|
|
14665
|
+
if (selectedCellArgs.selected) {
|
|
14666
|
+
this.currentSelection.push(selectedCellArgs.item);
|
|
14667
|
+
}
|
|
14668
|
+
if (!settings.isRowSelectable(rowArgs)) {
|
|
14669
|
+
this.nonSelectableRows.set(rowArgs.index, rowArgs.dataItem);
|
|
14670
|
+
}
|
|
14671
|
+
});
|
|
14539
14672
|
}
|
|
14540
|
-
|
|
14673
|
+
item = iterator.next();
|
|
14674
|
+
}
|
|
14541
14675
|
}
|
|
14542
14676
|
}
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
const state = this.stateSet ? this.stateToBool() : this.selectionService.selectAllState;
|
|
14548
|
-
const elem = this.el.nativeElement;
|
|
14549
|
-
this.renderer.setProperty(elem, 'indeterminate', !isPresent(state));
|
|
14550
|
-
this.renderer.setProperty(elem, 'checked', isPresent(state) ? state : false);
|
|
14551
|
-
}
|
|
14552
|
-
/**
|
|
14553
|
-
* @hidden
|
|
14554
|
-
*/
|
|
14555
|
-
stateToBool() {
|
|
14556
|
-
switch (this.state) {
|
|
14557
|
-
case 'checked':
|
|
14558
|
-
return true;
|
|
14559
|
-
case 'unchecked':
|
|
14560
|
-
return false;
|
|
14561
|
-
default:
|
|
14562
|
-
return undefined;
|
|
14677
|
+
isCellSelected(item, col) {
|
|
14678
|
+
if (this.settings && this.active) {
|
|
14679
|
+
const selectedCellArgs = this.settings.cellSelected({ dataItem: item.data, index: item.index }, col, col.leafIndex);
|
|
14680
|
+
return this.options.enabled && selectedCellArgs.selected && !this.nonSelectableRows.has(item.index);
|
|
14563
14681
|
}
|
|
14682
|
+
return false;
|
|
14564
14683
|
}
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
}
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
}
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14684
|
+
handleClick(item, event) {
|
|
14685
|
+
if (this.dragging) {
|
|
14686
|
+
this.dragging = false;
|
|
14687
|
+
return;
|
|
14688
|
+
}
|
|
14689
|
+
let ev;
|
|
14690
|
+
const ctrlKey = event.ctrlKey || event.metaKey;
|
|
14691
|
+
if (this.options.mode === "single" && ctrlKey && this.isCellSelected(item, item.column)) {
|
|
14692
|
+
ev = this.toggle(item);
|
|
14693
|
+
}
|
|
14694
|
+
else if (this.options.mode === "multiple") {
|
|
14695
|
+
if ((ctrlKey || !this.options.metaKeyMultiSelect) && !event.shiftKey) {
|
|
14696
|
+
ev = this.toggle(item);
|
|
14697
|
+
}
|
|
14698
|
+
else if (event.shiftKey) {
|
|
14699
|
+
const startRowIndex = Math.min(this.lastSelectionItemRowIndex, item.index);
|
|
14700
|
+
const startColIndex = Math.min(this.lastSelectionItemColIndex, item.column.leafIndex);
|
|
14701
|
+
const endRowIndex = Math.max(this.lastSelectionItemRowIndex, item.index);
|
|
14702
|
+
const endColIndex = Math.max(this.lastSelectionItemColIndex, item.column.leafIndex);
|
|
14703
|
+
ev = this.selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex);
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14706
|
+
if (!isPresent(ev)) {
|
|
14707
|
+
ev = this.select(item);
|
|
14708
|
+
this.currentSelection = [this.lastSelectionItem];
|
|
14709
|
+
}
|
|
14710
|
+
if (!ev.selectedCells.length && !ev.deselectedCells.length) {
|
|
14711
|
+
return;
|
|
14712
|
+
}
|
|
14713
|
+
ev.ctrlKey = ctrlKey;
|
|
14714
|
+
ev.shiftKey = event.shiftKey;
|
|
14715
|
+
if (this.options.cellAggregates && !event.shiftKey) {
|
|
14716
|
+
ev.cellAggregates = this.aggregateService.onSelectionChange(ev);
|
|
14717
|
+
}
|
|
14718
|
+
if (ev.shiftKey) {
|
|
14719
|
+
ev.rangeStartCell = this.lastSelectionItem;
|
|
14720
|
+
ev.rangeEndCell = Object.assign({}, this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item);
|
|
14721
|
+
}
|
|
14722
|
+
this.changes.emit(ev);
|
|
14589
14723
|
}
|
|
14590
|
-
|
|
14591
|
-
|
|
14724
|
+
toggle(item) {
|
|
14725
|
+
const selectedCells = [];
|
|
14726
|
+
const deselectedCells = [];
|
|
14727
|
+
this.lastSelectionItem =
|
|
14728
|
+
this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item;
|
|
14729
|
+
this.lastSelectionItemRowIndex = item.index;
|
|
14730
|
+
this.lastSelectionItemColIndex = item.column.leafIndex;
|
|
14731
|
+
if (this.isCellSelected(item, item.column)) {
|
|
14732
|
+
deselectedCells.push(this.lastSelectionItem);
|
|
14733
|
+
}
|
|
14734
|
+
else if (!this.nonSelectableRows.has(item.index)) {
|
|
14735
|
+
selectedCells.push(this.lastSelectionItem);
|
|
14736
|
+
}
|
|
14737
|
+
return {
|
|
14738
|
+
deselectedCells,
|
|
14739
|
+
selectedCells
|
|
14740
|
+
};
|
|
14592
14741
|
}
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
/**
|
|
14603
|
-
* @hidden
|
|
14604
|
-
*/
|
|
14605
|
-
const isRootLevel = ({ parent }) => !isTruthy(parent);
|
|
14606
|
-
const ofColumnType = ({ draggable }) => ['column', 'columnGroup']
|
|
14607
|
-
.indexOf(draggable.context.type) >= 0;
|
|
14608
|
-
const notSameElement = ({ draggable, target }) => draggable.element.nativeElement !== target.element.nativeElement;
|
|
14609
|
-
const inSameParent = (x, y) => x.parent === y.parent ||
|
|
14610
|
-
(isInSpanColumn$1(y) && inSameParent(x, y.parent));
|
|
14611
|
-
const sameParent = ({ draggable, target }) => inSameParent(draggable.context.column, target.context.column);
|
|
14612
|
-
const lastNonLocked = ({ draggable }) => !isTruthy(draggable.context.column.locked) &&
|
|
14613
|
-
isRootLevel(draggable.context.column) &&
|
|
14614
|
-
draggable.context.lastColumn;
|
|
14615
|
-
const notInSpanColumn = ({ draggable }) => !isInSpanColumn$1(draggable.context.column);
|
|
14616
|
-
const reorderable = ({ draggable }) => draggable.context.column.reorderable;
|
|
14617
|
-
const lockable = ({ draggable, target }) => draggable.context.column.lockable !== false ||
|
|
14618
|
-
draggable.context.column.isLocked === target.context.column.isLocked;
|
|
14619
|
-
const rules = and(ofColumnType, reorderable, notInSpanColumn, notSameElement, sameParent, not(lastNonLocked), lockable);
|
|
14620
|
-
const modifierKeys = ['alt', 'ctrl', 'shift', 'meta'];
|
|
14621
|
-
/**
|
|
14622
|
-
* @hidden
|
|
14623
|
-
*/
|
|
14624
|
-
class HeaderComponent {
|
|
14625
|
-
constructor(popupService, hint, cue, reorderService, idService, sortService, columnInfoService, cd, contextService, navigationService) {
|
|
14626
|
-
this.popupService = popupService;
|
|
14627
|
-
this.hint = hint;
|
|
14628
|
-
this.cue = cue;
|
|
14629
|
-
this.reorderService = reorderService;
|
|
14630
|
-
this.idService = idService;
|
|
14631
|
-
this.sortService = sortService;
|
|
14632
|
-
this.columnInfoService = columnInfoService;
|
|
14633
|
-
this.cd = cd;
|
|
14634
|
-
this.contextService = contextService;
|
|
14635
|
-
this.navigationService = navigationService;
|
|
14636
|
-
this.columns = [];
|
|
14637
|
-
this.groups = [];
|
|
14638
|
-
this.sort = new Array();
|
|
14639
|
-
this.sortable = false;
|
|
14640
|
-
this.groupable = false;
|
|
14641
|
-
this.lockedColumnsCount = 0;
|
|
14642
|
-
this.resizable = false;
|
|
14643
|
-
this.reorderable = false;
|
|
14644
|
-
this.columnMenu = false;
|
|
14645
|
-
this.totalColumnsCount = 0;
|
|
14646
|
-
this.size = 'medium';
|
|
14647
|
-
this.sortedFields = {};
|
|
14648
|
-
this.hostClass = true;
|
|
14649
|
-
this.dropTargets = new QueryList();
|
|
14650
|
-
this.sortAscSmallIcon = sortAscSmallIcon;
|
|
14651
|
-
this.sortDescSmallIcon = sortDescSmallIcon;
|
|
14652
|
-
this.subscription = new Subscription();
|
|
14653
|
-
}
|
|
14654
|
-
get headerClass() {
|
|
14655
|
-
return !this.scrollable;
|
|
14656
|
-
}
|
|
14657
|
-
get sortableLabel() {
|
|
14658
|
-
return this.contextService.localization.get('sortable');
|
|
14659
|
-
}
|
|
14660
|
-
get columnMenuSettings() {
|
|
14661
|
-
return this.columnMenu;
|
|
14662
|
-
}
|
|
14663
|
-
// Number of unlocked columns in the next table, if any
|
|
14664
|
-
get unlockedColumnsCount() {
|
|
14665
|
-
return this.totalColumnsCount - this.lockedColumnsCount - this.columns.length;
|
|
14666
|
-
}
|
|
14667
|
-
sortColumn(descriptor) {
|
|
14668
|
-
this.sortService.sort(descriptor);
|
|
14669
|
-
}
|
|
14670
|
-
getColumnComponent(column) {
|
|
14671
|
-
return column;
|
|
14672
|
-
}
|
|
14673
|
-
onSortClick(column, event, link) {
|
|
14674
|
-
const target = event.target;
|
|
14675
|
-
if (column.headerTemplateRef && target !== link) {
|
|
14676
|
-
const hasFocusableParent = Boolean(closestInScope(target, isFocusable, link));
|
|
14677
|
-
if (hasFocusableParent) {
|
|
14678
|
-
// Do not sort when clicking focusable template elements.
|
|
14679
|
-
return;
|
|
14680
|
-
}
|
|
14742
|
+
select(item) {
|
|
14743
|
+
const selectedCells = [];
|
|
14744
|
+
const deselectedCells = [];
|
|
14745
|
+
this.lastSelectionItem =
|
|
14746
|
+
this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item;
|
|
14747
|
+
this.lastSelectionItemRowIndex = item.index;
|
|
14748
|
+
this.lastSelectionItemColIndex = item.column.leafIndex;
|
|
14749
|
+
if (!this.isCellSelected(item, item.column) && !this.nonSelectableRows.has(item.index)) {
|
|
14750
|
+
selectedCells.push(this.lastSelectionItem);
|
|
14681
14751
|
}
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14752
|
+
this.currentSelection.forEach((selectedItem) => {
|
|
14753
|
+
if (selectedItem.itemKey !== this.lastSelectionItem.itemKey || selectedItem.columnKey !== this.lastSelectionItem.columnKey) {
|
|
14754
|
+
deselectedCells.push(selectedItem);
|
|
14755
|
+
}
|
|
14756
|
+
});
|
|
14757
|
+
return {
|
|
14758
|
+
deselectedCells,
|
|
14759
|
+
selectedCells
|
|
14760
|
+
};
|
|
14685
14761
|
}
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14762
|
+
//Used to manually deselect removed items
|
|
14763
|
+
deselect(removedItem) {
|
|
14764
|
+
const iterator = this.getIterator();
|
|
14765
|
+
let item = iterator.next();
|
|
14766
|
+
let rowArgs;
|
|
14767
|
+
while (!item.done) {
|
|
14768
|
+
if (item.value && item.value.type === "data" && item.value.data === removedItem) {
|
|
14769
|
+
rowArgs = {
|
|
14770
|
+
dataItem: item.value.data,
|
|
14771
|
+
index: item.value.index
|
|
14772
|
+
};
|
|
14773
|
+
break;
|
|
14774
|
+
}
|
|
14775
|
+
item = iterator.next();
|
|
14700
14776
|
}
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14777
|
+
if (rowArgs) {
|
|
14778
|
+
const cellsToRemove = this.currentSelection.filter(selectedItem => {
|
|
14779
|
+
const contender = this.settings.cellSelected(rowArgs, null, null).item;
|
|
14780
|
+
return selectedItem.itemKey === contender.itemKey || this.nonSelectableRows.has(rowArgs.index);
|
|
14781
|
+
});
|
|
14782
|
+
if (cellsToRemove.length) {
|
|
14783
|
+
const ev = {
|
|
14784
|
+
ctrlKey: false,
|
|
14785
|
+
deselectedCells: cellsToRemove,
|
|
14786
|
+
selectedCells: []
|
|
14787
|
+
};
|
|
14788
|
+
this.changes.emit(ev);
|
|
14709
14789
|
}
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14790
|
+
}
|
|
14791
|
+
}
|
|
14792
|
+
selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex) {
|
|
14793
|
+
const selectedCells = [];
|
|
14794
|
+
const deselectedCells = [];
|
|
14795
|
+
const selectionStartRow = Math.min(startRowIndex, endRowIndex);
|
|
14796
|
+
const selectionStartCol = Math.min(startColIndex, endColIndex);
|
|
14797
|
+
const selectionEndRow = Math.max(startRowIndex, endRowIndex);
|
|
14798
|
+
const selectionEndCol = Math.max(startColIndex, endColIndex);
|
|
14799
|
+
const iterator = this.getIterator();
|
|
14800
|
+
let next = iterator.next();
|
|
14801
|
+
while (!next.done) {
|
|
14802
|
+
if (next.value && next.value.type === "data") {
|
|
14803
|
+
const idx = next.value.index;
|
|
14804
|
+
const data = next.value.data;
|
|
14805
|
+
const rowArgs = {
|
|
14806
|
+
dataItem: data,
|
|
14807
|
+
index: idx
|
|
14808
|
+
};
|
|
14809
|
+
this.settings.columns.forEach(col => {
|
|
14810
|
+
const { item } = this.settings.cellSelected(rowArgs, col, col.leafIndex);
|
|
14811
|
+
const selected = this.isCellSelected(next.value, col);
|
|
14812
|
+
const isInRowRange = selectionStartRow <= idx && idx <= selectionEndRow;
|
|
14813
|
+
const isInColRange = selectionStartCol <= col.leafIndex && col.leafIndex <= selectionEndCol;
|
|
14814
|
+
const isInSelectionRect = isInRowRange && isInColRange;
|
|
14815
|
+
if (!isInSelectionRect && selected) {
|
|
14816
|
+
deselectedCells.push(item);
|
|
14817
|
+
}
|
|
14818
|
+
if (isInSelectionRect && !selected && !this.nonSelectableRows.has(idx)) {
|
|
14819
|
+
selectedCells.push(item);
|
|
14820
|
+
}
|
|
14713
14821
|
});
|
|
14714
14822
|
}
|
|
14715
|
-
|
|
14716
|
-
return;
|
|
14717
|
-
}
|
|
14718
|
-
const isLeftOrRightArrow = args.keyCode === Keys.ArrowLeft || args.keyCode === Keys.ArrowRight;
|
|
14719
|
-
const isReorderingKeyShortcut = isLeftOrRightArrow && isCtrlOrMeta;
|
|
14720
|
-
if (isReorderingKeyShortcut && this.isReorderable(column)) {
|
|
14721
|
-
args.preventDefault();
|
|
14722
|
-
const columnsCount = this.columnInfoService.leafNamedColumns.length;
|
|
14723
|
-
const reorderDirection = args.keyCode === Keys.ArrowLeft ? -1 : 1;
|
|
14724
|
-
const rtlMultiplier = this.contextService.localization.rtl ? -1 : 1;
|
|
14725
|
-
const reorderDirectionOffset = reorderDirection * rtlMultiplier;
|
|
14726
|
-
const newIndex = column.leafIndex + reorderDirectionOffset;
|
|
14727
|
-
const normalizedNewIndex = Math.min(Math.max(0, newIndex), columnsCount - 1);
|
|
14728
|
-
const gridInstance = this.contextService.grid;
|
|
14729
|
-
gridInstance.reorderColumn(column, normalizedNewIndex, { before: reorderDirectionOffset < 0 });
|
|
14730
|
-
gridInstance.columnReorder.emit(new ColumnReorderEvent({
|
|
14731
|
-
column,
|
|
14732
|
-
newIndex: normalizedNewIndex,
|
|
14733
|
-
oldIndex: column.leafIndex
|
|
14734
|
-
}));
|
|
14735
|
-
return;
|
|
14736
|
-
}
|
|
14737
|
-
if (!this.sortable || args.defaultPrevented || column.sortable === false) {
|
|
14738
|
-
return;
|
|
14823
|
+
next = iterator.next();
|
|
14739
14824
|
}
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
this.
|
|
14825
|
+
let cellAggregates;
|
|
14826
|
+
if (this.options.cellAggregates) {
|
|
14827
|
+
cellAggregates = this.aggregateService.onSelectionChange({ selectedCells, deselectedCells });
|
|
14743
14828
|
}
|
|
14829
|
+
return {
|
|
14830
|
+
deselectedCells,
|
|
14831
|
+
selectedCells,
|
|
14832
|
+
cellAggregates
|
|
14833
|
+
};
|
|
14744
14834
|
}
|
|
14745
|
-
|
|
14746
|
-
const
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
.findIndex(x => x.field === field)
|
|
14756
|
-
+ 1;
|
|
14757
|
-
}
|
|
14758
|
-
sortState(column) {
|
|
14759
|
-
if (!this.isInteractive(column, 'sortable')) {
|
|
14760
|
-
return;
|
|
14835
|
+
get options() {
|
|
14836
|
+
const defaultOptions = {
|
|
14837
|
+
cellAggregates: false,
|
|
14838
|
+
checkboxOnly: false,
|
|
14839
|
+
enabled: true,
|
|
14840
|
+
mode: "multiple",
|
|
14841
|
+
metaKeyMultiSelect: true
|
|
14842
|
+
};
|
|
14843
|
+
if (!isPresent(this.settings)) {
|
|
14844
|
+
return defaultOptions;
|
|
14761
14845
|
}
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14846
|
+
if (typeof this.settings.selectable === 'boolean') {
|
|
14847
|
+
return {
|
|
14848
|
+
cellAggregates: false,
|
|
14849
|
+
checkboxOnly: false,
|
|
14850
|
+
enabled: this.settings.selectable,
|
|
14851
|
+
mode: "multiple",
|
|
14852
|
+
metaKeyMultiSelect: true
|
|
14853
|
+
};
|
|
14765
14854
|
}
|
|
14766
|
-
|
|
14767
|
-
return
|
|
14855
|
+
else {
|
|
14856
|
+
return Object.assign(defaultOptions, this.settings.selectable);
|
|
14768
14857
|
}
|
|
14769
14858
|
}
|
|
14770
|
-
|
|
14771
|
-
|
|
14859
|
+
ngOnDestroy() {
|
|
14860
|
+
this.removeSubscriptions();
|
|
14772
14861
|
}
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
if (mode === 'single' || !modifier) {
|
|
14783
|
-
return [descriptor];
|
|
14862
|
+
addSubscriptions() {
|
|
14863
|
+
if (!this.cellClickSubscription) {
|
|
14864
|
+
this.cellClickSubscription = this.domEvents.cellClick.subscribe((args) => {
|
|
14865
|
+
if (this.options.enabled && !this.options.checkboxOnly && args.type !== 'contextmenu') {
|
|
14866
|
+
if (this.active) {
|
|
14867
|
+
this.handleClick({ index: args.rowIndex, data: args.dataItem, column: args.column }, args.originalEvent);
|
|
14868
|
+
}
|
|
14869
|
+
}
|
|
14870
|
+
});
|
|
14784
14871
|
}
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14872
|
+
if (!this.mousedownSubscription) {
|
|
14873
|
+
this.mousedownSubscription = this.domEvents.cellMousedown.subscribe((args) => {
|
|
14874
|
+
this.mouseDownEventArgs = args;
|
|
14875
|
+
if (this.options.enabled && (!this.options.mode || this.options.mode === "multiple") &&
|
|
14876
|
+
!this.options.checkboxOnly && args.originalEvent.shiftKey) {
|
|
14877
|
+
if (this.active) {
|
|
14878
|
+
args.originalEvent.preventDefault();
|
|
14879
|
+
this.navigationService.focusCellByElement(args.originalEvent.target);
|
|
14880
|
+
}
|
|
14881
|
+
}
|
|
14882
|
+
});
|
|
14796
14883
|
}
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
|
|
14803
|
-
|
|
14804
|
-
}
|
|
14805
|
-
ngDoCheck() {
|
|
14806
|
-
this._leafColumns = columnsToRender(this.columns || []).filter(x => !isColumnGroupComponent(x));
|
|
14807
|
-
}
|
|
14808
|
-
ngOnChanges(changes) {
|
|
14809
|
-
const sortChange = changes.sort;
|
|
14810
|
-
if (sortChange && !sortChange.isFirstChange()) {
|
|
14811
|
-
sortChange.currentValue.forEach(change => {
|
|
14812
|
-
this.sortedFields[change.field] = true;
|
|
14884
|
+
if (this.localDataChangesService && !this.dataChangedSubscription) {
|
|
14885
|
+
this.dataChangedSubscription = this.localDataChangesService.changes.subscribe((args) => {
|
|
14886
|
+
if (this.active) {
|
|
14887
|
+
if (isPresent(args.action) && args.action === 'remove') {
|
|
14888
|
+
this.deselect(args.item);
|
|
14889
|
+
}
|
|
14890
|
+
}
|
|
14813
14891
|
});
|
|
14814
14892
|
}
|
|
14815
14893
|
}
|
|
14816
|
-
|
|
14817
|
-
this.
|
|
14818
|
-
|
|
14894
|
+
getIterator() {
|
|
14895
|
+
const accessor = this.settings.view.accessor();
|
|
14896
|
+
if (!accessor) {
|
|
14897
|
+
return;
|
|
14898
|
+
}
|
|
14899
|
+
return accessor[iterator]();
|
|
14819
14900
|
}
|
|
14820
|
-
|
|
14821
|
-
if (this.
|
|
14822
|
-
this.
|
|
14901
|
+
removeSubscriptions() {
|
|
14902
|
+
if (this.cellClickSubscription) {
|
|
14903
|
+
this.cellClickSubscription.unsubscribe();
|
|
14904
|
+
this.cellClickSubscription = null;
|
|
14823
14905
|
}
|
|
14824
|
-
if (this.
|
|
14825
|
-
this.
|
|
14906
|
+
if (this.mousedownSubscription) {
|
|
14907
|
+
this.mousedownSubscription.unsubscribe();
|
|
14908
|
+
this.mousedownSubscription = null;
|
|
14826
14909
|
}
|
|
14827
|
-
this.
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
return this.idService.selectAllCheckboxId();
|
|
14831
|
-
}
|
|
14832
|
-
get selectAllCheckboxLabel() {
|
|
14833
|
-
return this.contextService.localization.get('selectAllCheckboxLabel');
|
|
14834
|
-
}
|
|
14835
|
-
isFirstOnRow(column, index) {
|
|
14836
|
-
const isTailing = (c) => c &&
|
|
14837
|
-
(this.columnsForLevel(c.level).indexOf(c) > 0 || isTailing(c.parent));
|
|
14838
|
-
return index === 0 && !this.groups.length && !this.detailTemplate && isTailing(column.parent);
|
|
14839
|
-
}
|
|
14840
|
-
logicalColumnIndex(column) {
|
|
14841
|
-
const index = column.leafIndex;
|
|
14842
|
-
if (isPresent(index)) {
|
|
14843
|
-
return index + (isPresent(this.detailTemplate) ? 1 : 0);
|
|
14910
|
+
if (this.dataChangedSubscription) {
|
|
14911
|
+
this.dataChangedSubscription.unsubscribe();
|
|
14912
|
+
this.dataChangedSubscription = null;
|
|
14844
14913
|
}
|
|
14845
|
-
return -1;
|
|
14846
|
-
}
|
|
14847
|
-
get showFilterMenu() {
|
|
14848
|
-
return !this.columnMenu && hasFilterMenu(this.filterable);
|
|
14849
|
-
}
|
|
14850
|
-
get showFilterRow() {
|
|
14851
|
-
return hasFilterRow(this.filterable);
|
|
14852
14914
|
}
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14915
|
+
}
|
|
14916
|
+
CellSelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellSelectionService, deps: [{ token: DomEventsService }, { token: CellSelectionAggregateService }, { token: LocalDataChangesService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14917
|
+
CellSelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellSelectionService });
|
|
14918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellSelectionService, decorators: [{
|
|
14919
|
+
type: Injectable
|
|
14920
|
+
}], ctorParameters: function () { return [{ type: DomEventsService }, { type: CellSelectionAggregateService }, { type: LocalDataChangesService }, { type: NavigationService }]; } });
|
|
14921
|
+
|
|
14922
|
+
/**
|
|
14923
|
+
* Represents the select-all checkbox feature of the Grid ([see example](slug:grid_selection_persistence#toc-selecting-all-items)).
|
|
14924
|
+
*
|
|
14925
|
+
* @example
|
|
14926
|
+
* ```html
|
|
14927
|
+
* <input
|
|
14928
|
+
* type="checkbox"
|
|
14929
|
+
* kendoCheckBox
|
|
14930
|
+
* kendoGridSelectAllCheckbox
|
|
14931
|
+
* [state]="selectAllState"
|
|
14932
|
+
* (selectAllChange)="onSelectAllChange($event)"
|
|
14933
|
+
* />
|
|
14934
|
+
* ```
|
|
14935
|
+
*/
|
|
14936
|
+
class SelectAllCheckboxDirective {
|
|
14937
|
+
constructor(selectionService, cellSelectionService, el, renderer, ngZone) {
|
|
14938
|
+
this.selectionService = selectionService;
|
|
14939
|
+
this.cellSelectionService = cellSelectionService;
|
|
14940
|
+
this.el = el;
|
|
14941
|
+
this.renderer = renderer;
|
|
14942
|
+
this.ngZone = ngZone;
|
|
14943
|
+
/**
|
|
14944
|
+
* Fires when the user clicks the `kendoGridSelectAllCheckbox` select-all checkbox
|
|
14945
|
+
* ([see example](slug:grid_row_selection#toc-select-all-checkbox)).
|
|
14946
|
+
*/
|
|
14947
|
+
this.selectAllChange = new EventEmitter();
|
|
14948
|
+
this.type = 'checkbox';
|
|
14949
|
+
this.stateSet = false;
|
|
14950
|
+
this.ngZone.runOutsideAngular(() => {
|
|
14951
|
+
this.destroyClick = this.renderer.listen(this.el.nativeElement, 'click', this.onClick.bind(this));
|
|
14952
|
+
});
|
|
14856
14953
|
}
|
|
14857
|
-
|
|
14858
|
-
|
|
14954
|
+
ngAfterContentChecked() {
|
|
14955
|
+
this.setState();
|
|
14859
14956
|
}
|
|
14860
|
-
|
|
14861
|
-
|
|
14957
|
+
ngOnChanges() {
|
|
14958
|
+
this.stateSet = true;
|
|
14862
14959
|
}
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
return false;
|
|
14960
|
+
ngOnDestroy() {
|
|
14961
|
+
if (this.destroyClick) {
|
|
14962
|
+
this.destroyClick();
|
|
14867
14963
|
}
|
|
14868
|
-
const groupable = this.isGroupable(column);
|
|
14869
|
-
return groupable || canReorder;
|
|
14870
|
-
}
|
|
14871
|
-
isInteractive(column, prop) {
|
|
14872
|
-
return !isNullOrEmptyString(column.field)
|
|
14873
|
-
&& isTruthy(this[prop]) && isTruthy(column[prop]);
|
|
14874
|
-
}
|
|
14875
|
-
isCheckboxColumn(column) {
|
|
14876
|
-
return isCheckboxColumn(column) && !column.templateRef;
|
|
14877
14964
|
}
|
|
14878
|
-
|
|
14879
|
-
|
|
14965
|
+
/**
|
|
14966
|
+
* @hidden
|
|
14967
|
+
*/
|
|
14968
|
+
onClick() {
|
|
14969
|
+
const uncheckedState = this.el.nativeElement.indeterminate ? 'indeterminate' : 'unchecked';
|
|
14970
|
+
const checkboxState = this.el.nativeElement.checked ? 'checked' : uncheckedState;
|
|
14971
|
+
const isChecked = this.selectionService.hasNonSelectable ? !this.selectionService.selectAllChecked : this.el.nativeElement.checked;
|
|
14972
|
+
const options = this.selectionService.options;
|
|
14973
|
+
const enabledAndMultiple = options.enabled && options.mode === 'multiple' && !this.cellSelectionService.active;
|
|
14974
|
+
const shouldEmitSelectAll = hasObservers(this.selectAllChange);
|
|
14975
|
+
if (enabledAndMultiple || shouldEmitSelectAll) {
|
|
14976
|
+
this.ngZone.run(() => {
|
|
14977
|
+
if (enabledAndMultiple) {
|
|
14978
|
+
this.selectionService.updateAll(isChecked);
|
|
14979
|
+
}
|
|
14980
|
+
if (shouldEmitSelectAll) {
|
|
14981
|
+
this.selectAllChange.emit(checkboxState);
|
|
14982
|
+
}
|
|
14983
|
+
});
|
|
14984
|
+
}
|
|
14880
14985
|
}
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14986
|
+
/**
|
|
14987
|
+
* @hidden
|
|
14988
|
+
*/
|
|
14989
|
+
setState() {
|
|
14990
|
+
const state = this.stateSet ? this.stateToBool() : this.selectionService.selectAllState;
|
|
14991
|
+
const elem = this.el.nativeElement;
|
|
14992
|
+
this.renderer.setProperty(elem, 'indeterminate', !isPresent(state));
|
|
14993
|
+
this.renderer.setProperty(elem, 'checked', isPresent(state) ? state : false);
|
|
14884
14994
|
}
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14995
|
+
/**
|
|
14996
|
+
* @hidden
|
|
14997
|
+
*/
|
|
14998
|
+
stateToBool() {
|
|
14999
|
+
switch (this.state) {
|
|
15000
|
+
case 'checked':
|
|
15001
|
+
return true;
|
|
15002
|
+
case 'unchecked':
|
|
15003
|
+
return false;
|
|
15004
|
+
default:
|
|
15005
|
+
return undefined;
|
|
14894
15006
|
}
|
|
14895
|
-
return { dir, field };
|
|
14896
15007
|
}
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
15008
|
+
}
|
|
15009
|
+
SelectAllCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectAllCheckboxDirective, deps: [{ token: SelectionService }, { token: CellSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
15010
|
+
SelectAllCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SelectAllCheckboxDirective, isStandalone: true, selector: "[kendoGridSelectAllCheckbox]", inputs: { state: "state" }, outputs: { selectAllChange: "selectAllChange" }, host: { properties: { "attr.type": "this.type" } }, usesOnChanges: true, ngImport: i0 });
|
|
15011
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectAllCheckboxDirective, decorators: [{
|
|
15012
|
+
type: Directive,
|
|
15013
|
+
args: [{
|
|
15014
|
+
selector: '[kendoGridSelectAllCheckbox]',
|
|
15015
|
+
standalone: true
|
|
15016
|
+
}]
|
|
15017
|
+
}], ctorParameters: function () { return [{ type: SelectionService }, { type: CellSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { state: [{
|
|
15018
|
+
type: Input
|
|
15019
|
+
}], selectAllChange: [{
|
|
15020
|
+
type: Output
|
|
15021
|
+
}], type: [{
|
|
15022
|
+
type: HostBinding,
|
|
15023
|
+
args: ['attr.type']
|
|
15024
|
+
}] } });
|
|
15025
|
+
|
|
15026
|
+
/**
|
|
15027
|
+
* @hidden
|
|
15028
|
+
*/
|
|
15029
|
+
class ColumnReorderService {
|
|
15030
|
+
constructor() {
|
|
15031
|
+
this.changes = new EventEmitter();
|
|
14900
15032
|
}
|
|
14901
|
-
|
|
14902
|
-
|
|
15033
|
+
reorder(e) {
|
|
15034
|
+
this.changes.emit(e);
|
|
14903
15035
|
}
|
|
14904
|
-
|
|
14905
|
-
|
|
15036
|
+
}
|
|
15037
|
+
ColumnReorderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnReorderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15038
|
+
ColumnReorderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnReorderService });
|
|
15039
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnReorderService, decorators: [{
|
|
15040
|
+
type: Injectable
|
|
15041
|
+
}] });
|
|
15042
|
+
|
|
15043
|
+
const mergeObjects = (...args) => Object.assign.apply(null, [{}].concat(args));
|
|
15044
|
+
const directions = initialDirection => initialDirection === "asc" ? ["asc", "desc"] : ["desc", "asc"];
|
|
15045
|
+
/**
|
|
15046
|
+
* @hidden
|
|
15047
|
+
*/
|
|
15048
|
+
const isRootLevel = ({ parent }) => !isTruthy(parent);
|
|
15049
|
+
const ofColumnType = ({ draggable }) => ['column', 'columnGroup']
|
|
15050
|
+
.indexOf(draggable.context.type) >= 0;
|
|
15051
|
+
const notSameElement = ({ draggable, target }) => draggable.element.nativeElement !== target.element.nativeElement;
|
|
15052
|
+
const inSameParent = (x, y) => x.parent === y.parent ||
|
|
15053
|
+
(isInSpanColumn$1(y) && inSameParent(x, y.parent));
|
|
15054
|
+
const sameParent = ({ draggable, target }) => inSameParent(draggable.context.column, target.context.column);
|
|
15055
|
+
const lastNonLocked = ({ draggable }) => !isTruthy(draggable.context.column.locked) &&
|
|
15056
|
+
isRootLevel(draggable.context.column) &&
|
|
15057
|
+
draggable.context.lastColumn;
|
|
15058
|
+
const notInSpanColumn = ({ draggable }) => !isInSpanColumn$1(draggable.context.column);
|
|
15059
|
+
const reorderable = ({ draggable }) => draggable.context.column.reorderable;
|
|
15060
|
+
const lockable = ({ draggable, target }) => draggable.context.column.lockable !== false ||
|
|
15061
|
+
draggable.context.column.isLocked === target.context.column.isLocked;
|
|
15062
|
+
const rules = and(ofColumnType, reorderable, notInSpanColumn, notSameElement, sameParent, not(lastNonLocked), lockable);
|
|
15063
|
+
const modifierKeys = ['alt', 'ctrl', 'shift', 'meta'];
|
|
15064
|
+
/**
|
|
15065
|
+
* @hidden
|
|
15066
|
+
*/
|
|
15067
|
+
class HeaderComponent {
|
|
15068
|
+
constructor(popupService, hint, cue, reorderService, idService, sortService, columnInfoService, cd, contextService, navigationService) {
|
|
15069
|
+
this.popupService = popupService;
|
|
15070
|
+
this.hint = hint;
|
|
15071
|
+
this.cue = cue;
|
|
15072
|
+
this.reorderService = reorderService;
|
|
15073
|
+
this.idService = idService;
|
|
15074
|
+
this.sortService = sortService;
|
|
15075
|
+
this.columnInfoService = columnInfoService;
|
|
15076
|
+
this.cd = cd;
|
|
15077
|
+
this.contextService = contextService;
|
|
15078
|
+
this.navigationService = navigationService;
|
|
15079
|
+
this.columns = [];
|
|
15080
|
+
this.groups = [];
|
|
15081
|
+
this.sort = new Array();
|
|
15082
|
+
this.sortable = false;
|
|
15083
|
+
this.groupable = false;
|
|
15084
|
+
this.lockedColumnsCount = 0;
|
|
15085
|
+
this.resizable = false;
|
|
15086
|
+
this.reorderable = false;
|
|
15087
|
+
this.columnMenu = false;
|
|
15088
|
+
this.totalColumnsCount = 0;
|
|
15089
|
+
this.size = 'medium';
|
|
15090
|
+
this.sortedFields = {};
|
|
15091
|
+
this.hostClass = true;
|
|
15092
|
+
this.dropTargets = new QueryList();
|
|
15093
|
+
this.sortAscSmallIcon = sortAscSmallIcon;
|
|
15094
|
+
this.sortDescSmallIcon = sortDescSmallIcon;
|
|
15095
|
+
this.subscription = new Subscription();
|
|
14906
15096
|
}
|
|
14907
|
-
get
|
|
14908
|
-
return
|
|
15097
|
+
get headerClass() {
|
|
15098
|
+
return !this.scrollable;
|
|
14909
15099
|
}
|
|
14910
|
-
get
|
|
14911
|
-
return this.
|
|
15100
|
+
get sortableLabel() {
|
|
15101
|
+
return this.contextService.localization.get('sortable');
|
|
14912
15102
|
}
|
|
14913
|
-
|
|
14914
|
-
return this.
|
|
15103
|
+
get columnMenuSettings() {
|
|
15104
|
+
return this.columnMenu;
|
|
14915
15105
|
}
|
|
14916
|
-
|
|
14917
|
-
|
|
15106
|
+
// Number of unlocked columns in the next table, if any
|
|
15107
|
+
get unlockedColumnsCount() {
|
|
15108
|
+
return this.totalColumnsCount - this.lockedColumnsCount - this.columns.length;
|
|
14918
15109
|
}
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
const
|
|
14927
|
-
|
|
14928
|
-
|
|
15110
|
+
sortColumn(descriptor) {
|
|
15111
|
+
this.sortService.sort(descriptor);
|
|
15112
|
+
}
|
|
15113
|
+
getColumnComponent(column) {
|
|
15114
|
+
return column;
|
|
15115
|
+
}
|
|
15116
|
+
onSortClick(column, event, link) {
|
|
15117
|
+
const target = event.target;
|
|
15118
|
+
if (column.headerTemplateRef && target !== link) {
|
|
15119
|
+
const hasFocusableParent = Boolean(closestInScope(target, isFocusable, link));
|
|
15120
|
+
if (hasFocusableParent) {
|
|
15121
|
+
// Do not sort when clicking focusable template elements.
|
|
14929
15122
|
return;
|
|
14930
15123
|
}
|
|
14931
|
-
const targetLocked = isTruthy(target.context.column.isLocked);
|
|
14932
|
-
const draggableLocked = isTruthy(draggable.context.column.isLocked);
|
|
14933
|
-
if (this.lockedColumnsCount > 0 || targetLocked || draggableLocked) {
|
|
14934
|
-
this.hint.toggleLock(targetLocked);
|
|
14935
|
-
}
|
|
14936
|
-
}), filter(({ draggable, target }) => this.canDrop(draggable, target)), switchMap(this.trackMove.bind(this, leaveStream, dropStream)), map((e) => mergeObjects(e, { before: this.calculateBefore(e), changeContainer: e.changeContainer })), map(this.normalizeTarget.bind(this)), tap(this.enter.bind(this)), switchMap((args) => dropStream.pipe(map(() => args), takeUntil(leaveStream.pipe(tap(this.leave.bind(this)))))))
|
|
14937
|
-
.subscribe(this.drop.bind(this)));
|
|
14938
|
-
}
|
|
14939
|
-
normalizeTarget(e) {
|
|
14940
|
-
let target = e.target;
|
|
14941
|
-
const parent = target.context.column.parent;
|
|
14942
|
-
if (parent && parent.isSpanColumn) {
|
|
14943
|
-
const arr = this.dropTargets.toArray();
|
|
14944
|
-
const firstSpan = arr.find(t => t.context.column.parent === parent);
|
|
14945
|
-
const index = arr.indexOf(firstSpan);
|
|
14946
|
-
const adjust = e.before ? 0 : parent.childColumns.length - 1;
|
|
14947
|
-
target = arr[index + adjust];
|
|
14948
15124
|
}
|
|
14949
|
-
|
|
15125
|
+
const modifier = this.matchModifier(event);
|
|
15126
|
+
const toggledColumn = this.toggleSort(column, modifier);
|
|
15127
|
+
this.sortColumn(toggledColumn);
|
|
14950
15128
|
}
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
return e.draggable.drag
|
|
14959
|
-
.pipe(takeUntil(leaveStream), takeUntil(dropStream), map(({ mouseEvent }) => mergeObjects({ changeContainer: true }, e, { mouseEvent })));
|
|
15129
|
+
onHeaderKeydown(column, args) {
|
|
15130
|
+
if (args.keyCode === Keys.ArrowDown && args.altKey && this.showFilterMenu) {
|
|
15131
|
+
args.preventDefault();
|
|
15132
|
+
args.stopImmediatePropagation();
|
|
15133
|
+
const filterMenu = this.filterMenus.find(fm => fm.column === column);
|
|
15134
|
+
filterMenu.toggle(filterMenu.anchor.nativeElement, filterMenu.template);
|
|
15135
|
+
return;
|
|
14960
15136
|
}
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
15137
|
+
if (args.keyCode === Keys.ArrowDown && args.altKey && this.showColumnMenu(column)) {
|
|
15138
|
+
args.preventDefault();
|
|
15139
|
+
args.stopImmediatePropagation();
|
|
15140
|
+
const columnMenu = this.columnMenus.find(cm => cm.column === column);
|
|
15141
|
+
columnMenu.toggle(null, columnMenu.anchor.nativeElement, columnMenu.template);
|
|
15142
|
+
return;
|
|
15143
|
+
}
|
|
15144
|
+
const isCtrlOrMeta = args.ctrlKey || args.metaKey;
|
|
15145
|
+
const isGroupingKeyShortcut = (args.keyCode === Keys.Enter || args.keyCode === Keys.Space) && isCtrlOrMeta;
|
|
15146
|
+
if (isGroupingKeyShortcut && this.isGroupable(column)) {
|
|
15147
|
+
args.preventDefault();
|
|
15148
|
+
args.stopImmediatePropagation();
|
|
15149
|
+
const isGroupedByField = this.groups.some(gr => gr.field === column.field);
|
|
15150
|
+
if (isGroupedByField) {
|
|
15151
|
+
this.groups = this.groups.filter(gr => gr.field !== column.field);
|
|
14973
15152
|
}
|
|
15153
|
+
else {
|
|
15154
|
+
this.groups.push({
|
|
15155
|
+
field: column.field
|
|
15156
|
+
});
|
|
15157
|
+
}
|
|
15158
|
+
this.contextService.grid.groupChange.emit(this.groups);
|
|
15159
|
+
return;
|
|
14974
15160
|
}
|
|
14975
|
-
|
|
14976
|
-
|
|
15161
|
+
const isLeftOrRightArrow = args.keyCode === Keys.ArrowLeft || args.keyCode === Keys.ArrowRight;
|
|
15162
|
+
const isReorderingKeyShortcut = isLeftOrRightArrow && isCtrlOrMeta;
|
|
15163
|
+
if (isReorderingKeyShortcut && this.isReorderable(column)) {
|
|
15164
|
+
args.preventDefault();
|
|
15165
|
+
const columnsCount = this.columnInfoService.leafNamedColumns.length;
|
|
15166
|
+
const reorderDirection = args.keyCode === Keys.ArrowLeft ? -1 : 1;
|
|
15167
|
+
const rtlMultiplier = this.contextService.localization.rtl ? -1 : 1;
|
|
15168
|
+
const reorderDirectionOffset = reorderDirection * rtlMultiplier;
|
|
15169
|
+
const newIndex = column.leafIndex + reorderDirectionOffset;
|
|
15170
|
+
const normalizedNewIndex = Math.min(Math.max(0, newIndex), columnsCount - 1);
|
|
15171
|
+
const gridInstance = this.contextService.grid;
|
|
15172
|
+
gridInstance.reorderColumn(column, normalizedNewIndex, { before: reorderDirectionOffset < 0 });
|
|
15173
|
+
gridInstance.columnReorder.emit(new ColumnReorderEvent({
|
|
15174
|
+
column,
|
|
15175
|
+
newIndex: normalizedNewIndex,
|
|
15176
|
+
oldIndex: column.leafIndex
|
|
15177
|
+
}));
|
|
15178
|
+
return;
|
|
15179
|
+
}
|
|
15180
|
+
if (!this.sortable || args.defaultPrevented || column.sortable === false) {
|
|
15181
|
+
return;
|
|
15182
|
+
}
|
|
15183
|
+
if (args.keyCode === Keys.Enter && isPresent(column.field)) {
|
|
15184
|
+
const modifier = this.matchModifier(args);
|
|
15185
|
+
this.sortService.sort(this.toggleSort(column, modifier));
|
|
14977
15186
|
}
|
|
14978
|
-
return before;
|
|
14979
15187
|
}
|
|
14980
|
-
|
|
14981
|
-
this.
|
|
14982
|
-
|
|
14983
|
-
|
|
15188
|
+
showSortNumbering(column) {
|
|
15189
|
+
const { showIndexes } = normalize$1(this.sortable);
|
|
15190
|
+
return showIndexes
|
|
15191
|
+
&& this.sort
|
|
15192
|
+
&& this.sort.filter(({ dir }) => isPresent(dir)).length > 1
|
|
15193
|
+
&& this.sortOrder(column.field) > 0;
|
|
15194
|
+
}
|
|
15195
|
+
sortOrder(field) {
|
|
15196
|
+
return this.sort
|
|
15197
|
+
.filter(({ dir }) => isPresent(dir))
|
|
15198
|
+
.findIndex(x => x.field === field)
|
|
15199
|
+
+ 1;
|
|
15200
|
+
}
|
|
15201
|
+
sortState(column) {
|
|
15202
|
+
if (!this.isInteractive(column, 'sortable')) {
|
|
15203
|
+
return;
|
|
15204
|
+
}
|
|
15205
|
+
const state = this.sortDescriptor(column.field);
|
|
15206
|
+
if (state.dir === 'asc') {
|
|
15207
|
+
return 'ascending';
|
|
15208
|
+
}
|
|
15209
|
+
if (state.dir === 'desc') {
|
|
15210
|
+
return 'descending';
|
|
14984
15211
|
}
|
|
14985
|
-
this.cue.position(position(target.element.nativeElement, before));
|
|
14986
15212
|
}
|
|
14987
|
-
|
|
14988
|
-
this.
|
|
14989
|
-
this.cue.hide();
|
|
15213
|
+
get isNavigable() {
|
|
15214
|
+
return this.navigationService.tableEnabled;
|
|
14990
15215
|
}
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
15216
|
+
/**
|
|
15217
|
+
*
|
|
15218
|
+
* @param column
|
|
15219
|
+
* @param modifier - Indicates whether the client-defined `multiSortKey` modifier is met. Defaults to `true`.
|
|
15220
|
+
* @returns - SortDescriptor[]
|
|
15221
|
+
*/
|
|
15222
|
+
toggleSort(column, modifier = true) {
|
|
15223
|
+
const { allowUnsort, mode, initialDirection } = normalize$1(this.sortable, column.sortable);
|
|
15224
|
+
const descriptor = this.toggleDirection(column.field, allowUnsort, initialDirection);
|
|
15225
|
+
if (mode === 'single' || !modifier) {
|
|
15226
|
+
return [descriptor];
|
|
15227
|
+
}
|
|
15228
|
+
return [...this.sort.filter(desc => desc.field !== column.field), descriptor];
|
|
15229
|
+
}
|
|
15230
|
+
/**
|
|
15231
|
+
*
|
|
15232
|
+
* Determines whether the modifier key (if any) passed
|
|
15233
|
+
* with a click/keyboard event matches the user-defined multiSortKey.
|
|
15234
|
+
*/
|
|
15235
|
+
matchModifier(event) {
|
|
15236
|
+
const { multiSortKey } = normalize$1(this.sortable);
|
|
15237
|
+
if (multiSortKey === 'none') {
|
|
15238
|
+
return modifierKeys.every(key => !event[`${key}Key`]);
|
|
15239
|
+
}
|
|
15240
|
+
return multiSortKey === 'ctrl'
|
|
15241
|
+
? event.ctrlKey || event.metaKey
|
|
15242
|
+
: event[`${multiSortKey}Key`];
|
|
15243
|
+
}
|
|
15244
|
+
ngAfterViewInit() {
|
|
15245
|
+
this.subscription.add(observe(this.dropTargets)
|
|
15246
|
+
.subscribe(this.attachTargets.bind(this)));
|
|
15247
|
+
}
|
|
15248
|
+
ngDoCheck() {
|
|
15249
|
+
this._leafColumns = columnsToRender(this.columns || []).filter(x => !isColumnGroupComponent(x));
|
|
15250
|
+
}
|
|
15251
|
+
ngOnChanges(changes) {
|
|
15252
|
+
const sortChange = changes.sort;
|
|
15253
|
+
if (sortChange && !sortChange.isFirstChange()) {
|
|
15254
|
+
sortChange.currentValue.forEach(change => {
|
|
15255
|
+
this.sortedFields[change.field] = true;
|
|
15256
|
+
});
|
|
15257
|
+
}
|
|
15258
|
+
}
|
|
15259
|
+
ngOnInit() {
|
|
15260
|
+
this.subscription.add(this.contextService.localization.changes
|
|
15261
|
+
.subscribe(() => this.cd.markForCheck()));
|
|
15262
|
+
}
|
|
15263
|
+
ngOnDestroy() {
|
|
15264
|
+
if (this.targetSubscription) {
|
|
15265
|
+
this.targetSubscription.unsubscribe();
|
|
15266
|
+
}
|
|
15267
|
+
if (this.popupService) {
|
|
15268
|
+
this.popupService.destroy();
|
|
15269
|
+
}
|
|
15270
|
+
this.subscription.unsubscribe();
|
|
15271
|
+
}
|
|
15272
|
+
selectAllCheckboxId() {
|
|
15273
|
+
return this.idService.selectAllCheckboxId();
|
|
15274
|
+
}
|
|
15275
|
+
get selectAllCheckboxLabel() {
|
|
15276
|
+
return this.contextService.localization.get('selectAllCheckboxLabel');
|
|
15277
|
+
}
|
|
15278
|
+
isFirstOnRow(column, index) {
|
|
15279
|
+
const isTailing = (c) => c &&
|
|
15280
|
+
(this.columnsForLevel(c.level).indexOf(c) > 0 || isTailing(c.parent));
|
|
15281
|
+
return index === 0 && !this.groups.length && !this.detailTemplate && isTailing(column.parent);
|
|
15282
|
+
}
|
|
15283
|
+
logicalColumnIndex(column) {
|
|
15284
|
+
const index = column.leafIndex;
|
|
15285
|
+
if (isPresent(index)) {
|
|
15286
|
+
return index + (isPresent(this.detailTemplate) ? 1 : 0);
|
|
15287
|
+
}
|
|
15288
|
+
return -1;
|
|
15289
|
+
}
|
|
15290
|
+
get showFilterMenu() {
|
|
15291
|
+
return !this.columnMenu && hasFilterMenu(this.filterable);
|
|
15292
|
+
}
|
|
15293
|
+
get showFilterRow() {
|
|
15294
|
+
return hasFilterRow(this.filterable);
|
|
15295
|
+
}
|
|
15296
|
+
showColumnMenu(column) {
|
|
15297
|
+
return this.columnMenu && column.columnMenu &&
|
|
15298
|
+
(this.columnMenuTemplate || column.columnMenuTemplates.length || hasItems(this.columnMenu, column));
|
|
15299
|
+
}
|
|
15300
|
+
isFilterable(column) {
|
|
15301
|
+
return !isNullOrEmptyString(column.field) && column.filterable === true;
|
|
15302
|
+
}
|
|
15303
|
+
canDrop(draggable, target) {
|
|
15304
|
+
return this.reorderable && rules({ draggable, target });
|
|
15305
|
+
}
|
|
15306
|
+
shouldActivate(column) {
|
|
15307
|
+
const canReorder = this.isReorderable(column);
|
|
15308
|
+
if (!canReorder && !isColumnComponent(column)) {
|
|
15309
|
+
return false;
|
|
15310
|
+
}
|
|
15311
|
+
const groupable = this.isGroupable(column);
|
|
15312
|
+
return groupable || canReorder;
|
|
15313
|
+
}
|
|
15314
|
+
isInteractive(column, prop) {
|
|
15315
|
+
return !isNullOrEmptyString(column.field)
|
|
15316
|
+
&& isTruthy(this[prop]) && isTruthy(column[prop]);
|
|
15317
|
+
}
|
|
15318
|
+
isCheckboxColumn(column) {
|
|
15319
|
+
return isCheckboxColumn(column) && !column.templateRef;
|
|
15320
|
+
}
|
|
15321
|
+
trackByIndex(index, _item) {
|
|
15322
|
+
return index;
|
|
15323
|
+
}
|
|
15324
|
+
addStickyStyles(column) {
|
|
15325
|
+
const stickyStyles = this.columnInfoService.stickyColumnsStyles(column);
|
|
15326
|
+
return Object.assign(Object.assign({}, column.headerStyle), stickyStyles);
|
|
15327
|
+
}
|
|
15328
|
+
toggleDirection(field, allowUnsort, initialDirection) {
|
|
15329
|
+
const descriptor = this.sortDescriptor(field);
|
|
15330
|
+
const [first, second] = directions(initialDirection);
|
|
15331
|
+
let dir = first;
|
|
15332
|
+
if (descriptor.dir === first) {
|
|
15333
|
+
dir = second;
|
|
15334
|
+
}
|
|
15335
|
+
else if (descriptor.dir === second && allowUnsort) {
|
|
15336
|
+
dir = undefined;
|
|
15337
|
+
}
|
|
15338
|
+
return { dir, field };
|
|
15339
|
+
}
|
|
15340
|
+
columnsForLevel(level) {
|
|
15341
|
+
const columns = this.columns ? this.columns.filter(column => column.level === level) : [];
|
|
15342
|
+
return sortColumns(columnsToRender(columns));
|
|
15343
|
+
}
|
|
15344
|
+
isColumnGroupComponent(column) {
|
|
15345
|
+
return isColumnGroupComponent(column);
|
|
15346
|
+
}
|
|
15347
|
+
sortDescriptor(field) {
|
|
15348
|
+
return this.sort.find(item => item.field === field) || { field };
|
|
15349
|
+
}
|
|
15350
|
+
get columnLevels() {
|
|
15351
|
+
return new Array((this.totalColumnLevels || 0) + 1);
|
|
15352
|
+
}
|
|
15353
|
+
get leafColumns() {
|
|
15354
|
+
return this._leafColumns;
|
|
15355
|
+
}
|
|
15356
|
+
isReorderable(column) {
|
|
15357
|
+
return this.reorderable && column.reorderable;
|
|
15358
|
+
}
|
|
15359
|
+
isGroupable(column) {
|
|
15360
|
+
return this.groupable && isColumnComponent(column) && column.groupable !== false;
|
|
15361
|
+
}
|
|
15362
|
+
attachTargets() {
|
|
15363
|
+
if (this.targetSubscription) {
|
|
15364
|
+
this.targetSubscription.unsubscribe();
|
|
15365
|
+
}
|
|
15366
|
+
this.targetSubscription = new Subscription();
|
|
15367
|
+
const enterStream = merge(...this.dropTargets.map(target => target.enter));
|
|
15368
|
+
const leaveStream = merge(...this.dropTargets.map(target => target.leave));
|
|
15369
|
+
const dropStream = merge(...this.dropTargets.map(target => target.drop));
|
|
15370
|
+
this.targetSubscription.add(enterStream.pipe(tap(({ target, draggable }) => {
|
|
15371
|
+
if (draggable.context.type === 'groupIndicator') {
|
|
15372
|
+
return;
|
|
15373
|
+
}
|
|
15374
|
+
const targetLocked = isTruthy(target.context.column.isLocked);
|
|
15375
|
+
const draggableLocked = isTruthy(draggable.context.column.isLocked);
|
|
15376
|
+
if (this.lockedColumnsCount > 0 || targetLocked || draggableLocked) {
|
|
15377
|
+
this.hint.toggleLock(targetLocked);
|
|
15378
|
+
}
|
|
15379
|
+
}), filter(({ draggable, target }) => this.canDrop(draggable, target)), switchMap(this.trackMove.bind(this, leaveStream, dropStream)), map((e) => mergeObjects(e, { before: this.calculateBefore(e), changeContainer: e.changeContainer })), map(this.normalizeTarget.bind(this)), tap(this.enter.bind(this)), switchMap((args) => dropStream.pipe(map(() => args), takeUntil(leaveStream.pipe(tap(this.leave.bind(this)))))))
|
|
15380
|
+
.subscribe(this.drop.bind(this)));
|
|
15381
|
+
}
|
|
15382
|
+
normalizeTarget(e) {
|
|
15383
|
+
let target = e.target;
|
|
15384
|
+
const parent = target.context.column.parent;
|
|
15385
|
+
if (parent && parent.isSpanColumn) {
|
|
15386
|
+
const arr = this.dropTargets.toArray();
|
|
15387
|
+
const firstSpan = arr.find(t => t.context.column.parent === parent);
|
|
15388
|
+
const index = arr.indexOf(firstSpan);
|
|
15389
|
+
const adjust = e.before ? 0 : parent.childColumns.length - 1;
|
|
15390
|
+
target = arr[index + adjust];
|
|
15391
|
+
}
|
|
15392
|
+
return mergeObjects(e, { target });
|
|
15393
|
+
}
|
|
15394
|
+
trackMove(leaveStream, dropStream, e) {
|
|
15395
|
+
const column = e.target.context.column;
|
|
15396
|
+
const levelColumns = this.columnsForLevel(column.level);
|
|
15397
|
+
const index = levelColumns.indexOf(column);
|
|
15398
|
+
const isFirst = (column.locked ? index === levelColumns.length - 1 : index === 0);
|
|
15399
|
+
const changed = e.draggable.context.column.isLocked !== column.isLocked;
|
|
15400
|
+
if (changed && isFirst) {
|
|
15401
|
+
return e.draggable.drag
|
|
15402
|
+
.pipe(takeUntil(leaveStream), takeUntil(dropStream), map(({ mouseEvent }) => mergeObjects({ changeContainer: true }, e, { mouseEvent })));
|
|
15403
|
+
}
|
|
15404
|
+
return of(mergeObjects({ changeContainer: changed }, e));
|
|
15405
|
+
}
|
|
15406
|
+
calculateBefore({ draggable, target, mouseEvent, changeContainer = false }) {
|
|
15407
|
+
const targetElement = target.element.nativeElement;
|
|
15408
|
+
let before = false;
|
|
15409
|
+
if (changeContainer) {
|
|
15410
|
+
const { left } = offset(targetElement);
|
|
15411
|
+
const halfWidth = targetElement.offsetWidth / 2;
|
|
15412
|
+
const middle = left + halfWidth;
|
|
15413
|
+
before = middle > mouseEvent.pageX;
|
|
15414
|
+
if (this.contextService.localization.rtl) {
|
|
15415
|
+
before = !before;
|
|
15416
|
+
}
|
|
15417
|
+
}
|
|
15418
|
+
else {
|
|
15419
|
+
before = isTargetBefore(draggable.element.nativeElement, targetElement);
|
|
15420
|
+
}
|
|
15421
|
+
return before;
|
|
15422
|
+
}
|
|
15423
|
+
enter({ target, before }) {
|
|
15424
|
+
this.hint.enable();
|
|
15425
|
+
if (this.contextService.localization.rtl) {
|
|
15426
|
+
before = !before;
|
|
15427
|
+
}
|
|
15428
|
+
this.cue.position(position(target.element.nativeElement, before));
|
|
15429
|
+
}
|
|
15430
|
+
leave() {
|
|
15431
|
+
this.hint.disable();
|
|
15432
|
+
this.cue.hide();
|
|
15433
|
+
}
|
|
15434
|
+
drop({ draggable, target, before, changeContainer }) {
|
|
15435
|
+
this.reorderService.reorder({
|
|
15436
|
+
before,
|
|
15437
|
+
changeContainer,
|
|
15438
|
+
source: draggable.context.column,
|
|
15439
|
+
target: target.context.column
|
|
15440
|
+
});
|
|
14998
15441
|
}
|
|
14999
15442
|
}
|
|
15000
15443
|
HeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HeaderComponent, deps: [{ token: SinglePopupService }, { token: DragHintService }, { token: DropCueService }, { token: ColumnReorderService }, { token: IdService }, { token: SortService }, { token: ColumnInfoService }, { token: i0.ChangeDetectorRef }, { token: ContextService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -15742,9 +16185,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
15742
16185
|
* ```
|
|
15743
16186
|
*/
|
|
15744
16187
|
class CheckboxColumnComponent extends ColumnBase {
|
|
15745
|
-
constructor(parent, idService) {
|
|
16188
|
+
constructor(selectionService, cellSelectionService, parent, idService) {
|
|
15746
16189
|
super(parent, idService);
|
|
16190
|
+
this.selectionService = selectionService;
|
|
16191
|
+
this.cellSelectionService = cellSelectionService;
|
|
15747
16192
|
this.parent = parent;
|
|
16193
|
+
/**
|
|
16194
|
+
* Determines whether checkboxes will be rendered for rows which are marked as non-selectable. By default, such checkboxes are visible and disabled.
|
|
16195
|
+
*/
|
|
16196
|
+
this.showDisabledCheckbox = true;
|
|
15748
16197
|
/*
|
|
15749
16198
|
* @hidden
|
|
15750
16199
|
*/
|
|
@@ -15753,9 +16202,15 @@ class CheckboxColumnComponent extends ColumnBase {
|
|
|
15753
16202
|
get templateRef() {
|
|
15754
16203
|
return this.template ? this.template.templateRef : undefined;
|
|
15755
16204
|
}
|
|
16205
|
+
/**
|
|
16206
|
+
* @hidden
|
|
16207
|
+
*/
|
|
16208
|
+
rowSelectable(rowIdx) {
|
|
16209
|
+
return !this.selectionService.nonSelectableRows.has(rowIdx) && !this.cellSelectionService.nonSelectableRows.has(rowIdx);
|
|
16210
|
+
}
|
|
15756
16211
|
}
|
|
15757
|
-
CheckboxColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CheckboxColumnComponent, deps: [{ token: ColumnBase, host: true, optional: true, skipSelf: true }, { token: IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
15758
|
-
CheckboxColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CheckboxColumnComponent, isStandalone: true, selector: "kendo-grid-checkbox-column", inputs: { showSelectAll: "showSelectAll" }, providers: [
|
|
16212
|
+
CheckboxColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CheckboxColumnComponent, deps: [{ token: SelectionService }, { token: CellSelectionService }, { token: ColumnBase, host: true, optional: true, skipSelf: true }, { token: IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
16213
|
+
CheckboxColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CheckboxColumnComponent, isStandalone: true, selector: "kendo-grid-checkbox-column", inputs: { showSelectAll: "showSelectAll", showDisabledCheckbox: "showDisabledCheckbox" }, providers: [
|
|
15759
16214
|
{
|
|
15760
16215
|
provide: ColumnBase,
|
|
15761
16216
|
useExisting: forwardRef(() => CheckboxColumnComponent)
|
|
@@ -15775,7 +16230,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
15775
16230
|
standalone: true
|
|
15776
16231
|
}]
|
|
15777
16232
|
}], ctorParameters: function () {
|
|
15778
|
-
return [{ type: ColumnBase, decorators: [{
|
|
16233
|
+
return [{ type: SelectionService }, { type: CellSelectionService }, { type: ColumnBase, decorators: [{
|
|
15779
16234
|
type: SkipSelf
|
|
15780
16235
|
}, {
|
|
15781
16236
|
type: Host
|
|
@@ -15784,781 +16239,525 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
15784
16239
|
}] }, { type: IdService, decorators: [{
|
|
15785
16240
|
type: Optional
|
|
15786
16241
|
}] }];
|
|
15787
|
-
}, propDecorators: { showSelectAll: [{
|
|
15788
|
-
type: Input
|
|
15789
|
-
}], template: [{
|
|
15790
|
-
type: ContentChild,
|
|
15791
|
-
args: [CellTemplateDirective, { static: false }]
|
|
15792
|
-
}] } });
|
|
15793
|
-
|
|
15794
|
-
/**
|
|
15795
|
-
* Represents the row-selection checkbox of the Grid. The directive expects the
|
|
15796
|
-
* index of the current row as an input parameter. Inside the [`CellTemplateDirective`](slug:api_grid_celltemplatedirective), apply the
|
|
15797
|
-
* `kendoGridSelectionCheckbox` to an `<input type="checkbox"/>` element. When the user clicks the checkbox that is associated
|
|
15798
|
-
* with the directive, a [selectionChange](slug:api_grid_gridcomponent#toc-selectionChange)
|
|
15799
|
-
* event is triggered.
|
|
15800
|
-
*
|
|
15801
|
-
* @example
|
|
15802
|
-
* ```html
|
|
15803
|
-
* <kendo-grid ... >
|
|
15804
|
-
* <kendo-grid-column>
|
|
15805
|
-
* <ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
|
|
15806
|
-
* <input ... [kendoGridSelectionCheckbox]="rowIndex"/>
|
|
15807
|
-
* </ng-template>
|
|
15808
|
-
* </kendo-grid-column>
|
|
15809
|
-
* </kendo-grid>
|
|
15810
|
-
* ```
|
|
15811
|
-
*/
|
|
15812
|
-
class SelectionCheckboxDirective {
|
|
15813
|
-
constructor(selectionService, aggregateService, el, renderer, ngZone) {
|
|
15814
|
-
this.selectionService = selectionService;
|
|
15815
|
-
this.aggregateService = aggregateService;
|
|
15816
|
-
this.el = el;
|
|
15817
|
-
this.renderer = renderer;
|
|
15818
|
-
this.ngZone = ngZone;
|
|
15819
|
-
this.type = 'checkbox';
|
|
15820
|
-
this.ngZone.runOutsideAngular(() => {
|
|
15821
|
-
this.destroyClick = this.renderer.listen(this.el.nativeElement, 'click', this.onClick.bind(this));
|
|
15822
|
-
this.destroyKeyDown = this.renderer.listen(this.el.nativeElement, 'keydown', this.onKeyDown.bind(this));
|
|
15823
|
-
});
|
|
15824
|
-
}
|
|
15825
|
-
ngAfterContentChecked() {
|
|
15826
|
-
this.setCheckedState();
|
|
15827
|
-
}
|
|
15828
|
-
ngOnDestroy() {
|
|
15829
|
-
if (this.destroyClick) {
|
|
15830
|
-
this.destroyClick();
|
|
15831
|
-
}
|
|
15832
|
-
if (this.destroyKeyDown) {
|
|
15833
|
-
this.destroyKeyDown();
|
|
15834
|
-
}
|
|
15835
|
-
}
|
|
15836
|
-
onClick() {
|
|
15837
|
-
if (this.selectionService.options.enabled) {
|
|
15838
|
-
this.ngZone.run(() => {
|
|
15839
|
-
const ev = this.selectionService.toggleByIndex(this.itemIndex);
|
|
15840
|
-
ev.ctrlKey = true;
|
|
15841
|
-
ev.shiftKey = false;
|
|
15842
|
-
if (this.selectionService.options.cellAggregates) {
|
|
15843
|
-
ev.cellAggregates = this.aggregateService.onSelectionChange(ev);
|
|
15844
|
-
}
|
|
15845
|
-
this.selectionService.changes.emit(ev);
|
|
15846
|
-
});
|
|
15847
|
-
}
|
|
15848
|
-
}
|
|
15849
|
-
onKeyDown(e) {
|
|
15850
|
-
if (e.keyCode === Keys.Enter) {
|
|
15851
|
-
this.onClick();
|
|
15852
|
-
}
|
|
15853
|
-
}
|
|
15854
|
-
/*
|
|
15855
|
-
* @hidden
|
|
15856
|
-
*/
|
|
15857
|
-
setCheckedState() {
|
|
15858
|
-
this.renderer.setProperty(this.el.nativeElement, 'checked', this.selectionService.isSelected(this.itemIndex));
|
|
15859
|
-
}
|
|
15860
|
-
}
|
|
15861
|
-
SelectionCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectionCheckboxDirective, deps: [{ token: SelectionService }, { token: CellSelectionAggregateService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
15862
|
-
SelectionCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SelectionCheckboxDirective, isStandalone: true, selector: "[kendoGridSelectionCheckbox]", inputs: { itemIndex: ["kendoGridSelectionCheckbox", "itemIndex"] }, host: { properties: { "attr.type": "this.type" } }, ngImport: i0 });
|
|
15863
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectionCheckboxDirective, decorators: [{
|
|
15864
|
-
type: Directive,
|
|
15865
|
-
args: [{
|
|
15866
|
-
selector: '[kendoGridSelectionCheckbox]',
|
|
15867
|
-
standalone: true
|
|
15868
|
-
}]
|
|
15869
|
-
}], ctorParameters: function () { return [{ type: SelectionService }, { type: CellSelectionAggregateService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { itemIndex: [{
|
|
15870
|
-
type: Input,
|
|
15871
|
-
args: ['kendoGridSelectionCheckbox']
|
|
15872
|
-
}], type: [{
|
|
15873
|
-
type: HostBinding,
|
|
15874
|
-
args: ['attr.type']
|
|
15875
|
-
}] } });
|
|
15876
|
-
|
|
15877
|
-
/**
|
|
15878
|
-
* @hidden
|
|
15879
|
-
*/
|
|
15880
|
-
function defaultTrackBy(index, item) {
|
|
15881
|
-
if (item.type === 'data' && item.isEditing) {
|
|
15882
|
-
return item.data;
|
|
15883
|
-
}
|
|
15884
|
-
return index;
|
|
15885
|
-
}
|
|
15886
|
-
|
|
15887
|
-
/**
|
|
15888
|
-
* @hidden
|
|
15889
|
-
*/
|
|
15890
|
-
const NON_DATA_CELL_CLASSES = 'k-hierarchy-cell k-detail-cell k-group-cell';
|
|
15891
|
-
/**
|
|
15892
|
-
* @hidden
|
|
15893
|
-
*/
|
|
15894
|
-
const NON_DATA_ROW_CLASSES = 'k-grouping-row k-group-footer k-detail-row k-grid-norecords';
|
|
15895
|
-
/**
|
|
15896
|
-
* @hidden
|
|
15897
|
-
*/
|
|
15898
|
-
const IGNORE_TARGET_CLASSSES = 'k-icon k-svg-icon';
|
|
15899
|
-
/**
|
|
15900
|
-
* @hidden
|
|
15901
|
-
*/
|
|
15902
|
-
const IGNORE_CONTAINER_CLASSES = 'k-grid k-grid-ignore-click';
|
|
15903
|
-
|
|
15904
|
-
/**
|
|
15905
|
-
* @hidden
|
|
15906
|
-
*/
|
|
15907
|
-
class CellComponent {
|
|
15908
|
-
constructor(editService, idService, ctx, cellContext) {
|
|
15909
|
-
this.editService = editService;
|
|
15910
|
-
this.idService = idService;
|
|
15911
|
-
this.ctx = ctx;
|
|
15912
|
-
this.cellContext = cellContext;
|
|
15913
|
-
this.isNew = false;
|
|
15914
|
-
this.isLoading = false;
|
|
15915
|
-
this.isVirtual = false;
|
|
15916
|
-
this.reorderIcon = reorderIcon;
|
|
15917
|
-
this._templateContext = {};
|
|
15918
|
-
this._editTemplateContext = {};
|
|
15919
|
-
}
|
|
15920
|
-
get commandCellClass() {
|
|
15921
|
-
return this.isCommand(this.column);
|
|
15922
|
-
}
|
|
15923
|
-
get dragHandleCellClass() {
|
|
15924
|
-
return isRowReorderColumn(this.column);
|
|
15925
|
-
}
|
|
15926
|
-
get dragRowHandleLabel() {
|
|
15927
|
-
return isRowReorderColumn(this.column) ? this.ctx.localization.get('dragRowHandleLabel') : undefined;
|
|
15928
|
-
}
|
|
15929
|
-
set rowIndex(index) {
|
|
15930
|
-
this._rowIndex = index;
|
|
15931
|
-
this.updateCellContext();
|
|
15932
|
-
}
|
|
15933
|
-
get rowIndex() {
|
|
15934
|
-
return this._rowIndex;
|
|
15935
|
-
}
|
|
15936
|
-
get isEdited() {
|
|
15937
|
-
if (!(this.editService.isEditing() || this.isNew) || !this.isColumnEditable) {
|
|
15938
|
-
return false;
|
|
15939
|
-
}
|
|
15940
|
-
const editContext = this.editService.columnContext(this.rowIndex, this.column);
|
|
15941
|
-
return this.isFieldEditable(editContext, this.column);
|
|
15942
|
-
}
|
|
15943
|
-
get showLoading() {
|
|
15944
|
-
return this.isVirtual && this.isLoading;
|
|
15945
|
-
}
|
|
15946
|
-
get formGroup() {
|
|
15947
|
-
return this.editService.context(this.rowIndex).group;
|
|
15948
|
-
}
|
|
15949
|
-
get templateContext() {
|
|
15950
|
-
return this._templateContext;
|
|
15951
|
-
}
|
|
15952
|
-
get editTemplateContext() {
|
|
15953
|
-
this._editTemplateContext.$implicit = this.formGroup;
|
|
15954
|
-
this._editTemplateContext.isNew = this.isNew;
|
|
15955
|
-
this._editTemplateContext.column = this.column;
|
|
15956
|
-
this._editTemplateContext.dataItem = this.dataItem;
|
|
15957
|
-
this._editTemplateContext.formGroup = this.formGroup;
|
|
15958
|
-
this._editTemplateContext.rowIndex = this.rowIndex;
|
|
15959
|
-
return this._editTemplateContext;
|
|
15960
|
-
}
|
|
15961
|
-
get format() {
|
|
15962
|
-
if (isColumnComponent(this.column) && !isNullOrEmptyString(this.column.format)) {
|
|
15963
|
-
return extractFormat(this.column.format);
|
|
15964
|
-
}
|
|
15965
|
-
return undefined;
|
|
15966
|
-
}
|
|
15967
|
-
get isBoundColumn() {
|
|
15968
|
-
return this.column.field && !this.column.templateRef;
|
|
15969
|
-
}
|
|
15970
|
-
get isCheckboxColumn() {
|
|
15971
|
-
return isCheckboxColumn(this.column) && !this.column.templateRef;
|
|
15972
|
-
}
|
|
15973
|
-
get selectionCheckboxId() {
|
|
15974
|
-
return this.idService.selectionCheckboxId(this.rowIndex);
|
|
15975
|
-
}
|
|
15976
|
-
get selectionCheckboxLabel() {
|
|
15977
|
-
return this.ctx.localization.get('selectionCheckboxLabel');
|
|
15978
|
-
}
|
|
15979
|
-
get isSpanColumn() {
|
|
15980
|
-
return isSpanColumn(this.column) && !this.column.templateRef;
|
|
15981
|
-
}
|
|
15982
|
-
get childColumns() {
|
|
15983
|
-
return columnsToRender([this.column]);
|
|
15984
|
-
}
|
|
15985
|
-
get isRowReorderColumn() {
|
|
15986
|
-
return isRowReorderColumn(this.column) && !this.column.templateRef;
|
|
15987
|
-
}
|
|
15988
|
-
get isColumnEditable() {
|
|
15989
|
-
if (!this.column || this.isCommand(this.column)) {
|
|
15990
|
-
return false;
|
|
15991
|
-
}
|
|
15992
|
-
return this.column.editable !== false;
|
|
15993
|
-
}
|
|
15994
|
-
ngDoCheck() {
|
|
15995
|
-
this.updateCellContext();
|
|
15996
|
-
}
|
|
15997
|
-
ngOnChanges(_changes) {
|
|
15998
|
-
this.updateTemplateContext();
|
|
15999
|
-
}
|
|
16000
|
-
ngAfterContentChecked() {
|
|
16001
|
-
this.updateTemplateContext();
|
|
16002
|
-
}
|
|
16003
|
-
isCommand(column) {
|
|
16004
|
-
return column instanceof CommandColumnComponent;
|
|
16005
|
-
}
|
|
16006
|
-
isFieldEditable(editContext, column) {
|
|
16007
|
-
if (!isPresent(editContext)) {
|
|
16008
|
-
return false;
|
|
16009
|
-
}
|
|
16010
|
-
if (isPresent(column.editTemplate)) {
|
|
16011
|
-
return true;
|
|
16012
|
-
}
|
|
16013
|
-
return isPresent(editContext.group) && isPresent(editContext.group.get(column.field));
|
|
16014
|
-
}
|
|
16015
|
-
updateCellContext() {
|
|
16016
|
-
if (this.cellContext) {
|
|
16017
|
-
this.cellContext.rowIndex = this._rowIndex;
|
|
16018
|
-
}
|
|
16019
|
-
}
|
|
16020
|
-
updateTemplateContext() {
|
|
16021
|
-
if (!this.column.templateRef) {
|
|
16022
|
-
return;
|
|
16023
|
-
}
|
|
16024
|
-
const context = this._templateContext;
|
|
16025
|
-
context.isNew = this.isNew;
|
|
16026
|
-
context.column = this.column;
|
|
16027
|
-
context.dataItem = this.dataItem;
|
|
16028
|
-
context.rowIndex = this.rowIndex;
|
|
16029
|
-
context.columnIndex = this.columnIndex;
|
|
16030
|
-
context.$implicit = this.dataItem;
|
|
16031
|
-
}
|
|
16032
|
-
}
|
|
16033
|
-
CellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellComponent, deps: [{ token: EditService }, { token: IdService }, { token: ContextService }, { token: CELL_CONTEXT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
16034
|
-
CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CellComponent, isStandalone: true, selector: "[kendoGridCell]", inputs: { column: "column", columnIndex: "columnIndex", isNew: "isNew", isLoading: "isLoading", isVirtual: "isVirtual", loadingTemplate: "loadingTemplate", rowIndex: "rowIndex", dataItem: "dataItem" }, host: { properties: { "class.k-command-cell": "this.commandCellClass", "class.k-drag-cell": "this.dragHandleCellClass", "class.k-touch-action-none": "this.dragHandleCellClass", "attr.aria-label": "this.dragRowHandleLabel" } }, usesOnChanges: true, ngImport: i0, template: `
|
|
16035
|
-
<ng-container [ngSwitch]="isEdited">
|
|
16036
|
-
<ng-container *ngSwitchCase="false">
|
|
16037
|
-
<ng-container *ngIf="!showLoading; else loading">
|
|
16038
|
-
<ng-template *ngIf="column.templateRef"
|
|
16039
|
-
[ngTemplateOutlet]="column.templateRef"
|
|
16040
|
-
[ngTemplateOutletContext]="templateContext">
|
|
16041
|
-
</ng-template>
|
|
16042
|
-
<ng-container *ngIf="isSpanColumn">
|
|
16043
|
-
<ng-container *ngFor="let childColumn of childColumns">
|
|
16044
|
-
{{ dataItem | valueOf: childColumn.field: childColumn.format}}
|
|
16045
|
-
</ng-container>
|
|
16046
|
-
</ng-container>
|
|
16047
|
-
<ng-container *ngIf="isBoundColumn">{{ dataItem | valueOf: column.field: column.format}}</ng-container>
|
|
16048
|
-
<ng-container *ngIf="isCheckboxColumn && !isNew">
|
|
16049
|
-
<span class="k-checkbox-wrap">
|
|
16050
|
-
<input
|
|
16051
|
-
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16052
|
-
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16053
|
-
[attr.id]="selectionCheckboxId"
|
|
16054
|
-
[attr.aria-label]="selectionCheckboxLabel" />
|
|
16055
|
-
</span>
|
|
16056
|
-
</ng-container>
|
|
16057
|
-
<ng-container *ngIf="isRowReorderColumn && !isNew">
|
|
16058
|
-
<kendo-icon-wrapper
|
|
16059
|
-
name="reorder"
|
|
16060
|
-
[svgIcon]="reorderIcon">
|
|
16061
|
-
</kendo-icon-wrapper>
|
|
16062
|
-
</ng-container>
|
|
16063
|
-
</ng-container>
|
|
16064
|
-
<ng-template #loading>
|
|
16065
|
-
<ng-template
|
|
16066
|
-
*ngIf="loadingTemplate"
|
|
16067
|
-
[ngTemplateOutlet]="loadingTemplate"
|
|
16068
|
-
[ngTemplateOutletContext]="{$implicit: column}">
|
|
16069
|
-
</ng-template>
|
|
16070
|
-
<div *ngIf="!loadingTemplate" class="k-skeleton-text k-skeleton"></div>
|
|
16071
|
-
</ng-template>
|
|
16072
|
-
</ng-container>
|
|
16073
|
-
<ng-container *ngSwitchCase="true">
|
|
16074
|
-
<ng-template
|
|
16075
|
-
*ngIf="column.editTemplateRef"
|
|
16076
|
-
[ngTemplateOutlet]="column.editTemplateRef"
|
|
16077
|
-
[ngTemplateOutletContext]="editTemplateContext">
|
|
16078
|
-
</ng-template>
|
|
16079
|
-
<ng-container [ngSwitch]="column.editor" *ngIf="!column.editTemplateRef">
|
|
16080
|
-
<kendo-numerictextbox
|
|
16081
|
-
*ngSwitchCase="'numeric'"
|
|
16082
|
-
[format]="format"
|
|
16083
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16084
|
-
kendoGridFocusable
|
|
16085
|
-
></kendo-numerictextbox>
|
|
16086
|
-
|
|
16087
|
-
<kendo-datepicker
|
|
16088
|
-
*ngSwitchCase="'date'"
|
|
16089
|
-
[format]="format"
|
|
16090
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16091
|
-
kendoGridFocusable
|
|
16092
|
-
></kendo-datepicker>
|
|
16093
|
-
|
|
16094
|
-
<span class="k-checkbox-wrap">
|
|
16095
|
-
<input
|
|
16096
|
-
*ngSwitchCase="'boolean'"
|
|
16097
|
-
type="checkbox"
|
|
16098
|
-
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16099
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16100
|
-
kendoGridFocusable
|
|
16101
|
-
/>
|
|
16102
|
-
</span>
|
|
16103
|
-
|
|
16104
|
-
<input
|
|
16105
|
-
*ngSwitchDefault
|
|
16106
|
-
type="text"
|
|
16107
|
-
class="k-textbox k-input k-input-md k-input-solid k-rounded-md"
|
|
16108
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16109
|
-
kendoGridFocusable
|
|
16110
|
-
/>
|
|
16111
|
-
</ng-container>
|
|
16112
|
-
</ng-container>
|
|
16113
|
-
</ng-container>
|
|
16114
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: FocusableDirective, selector: "[kendoGridFocusable],\n [kendoGridEditCommand],\n [kendoGridRemoveCommand],\n [kendoGridSaveCommand],\n [kendoGridCancelCommand],\n [kendoGridSelectionCheckbox]\n ", inputs: ["kendoGridFocusable"] }, { kind: "directive", type: SelectionCheckboxDirective, selector: "[kendoGridSelectionCheckbox]", inputs: ["kendoGridSelectionCheckbox"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "component", type: DatePickerComponent, selector: "kendo-datepicker", inputs: ["focusableId", "cellTemplate", "clearButton", "inputAttributes", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate", "headerTemplate", "footerTemplate", "footer", "navigationItemTemplate", "weekDaysFormat", "showOtherMonthDays", "activeView", "bottomView", "topView", "calendarType", "animateCalendarNavigation", "disabled", "readonly", "readOnlyInput", "popupSettings", "navigation", "min", "max", "incompleteDateValidation", "autoCorrectParts", "autoSwitchParts", "autoSwitchKeys", "enableMouseWheel", "allowCaretMode", "autoFill", "focusedDate", "value", "format", "twoDigitYearMax", "formatPlaceholder", "placeholder", "tabindex", "tabIndex", "disabledDates", "title", "subtitle", "rangeValidation", "disabledDatesValidation", "weekNumber", "size", "rounded", "fillMode", "adaptiveMode"], outputs: ["valueChange", "focus", "blur", "open", "close", "escape"], exportAs: ["kendo-datepicker"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "pipe", type: FieldAccessorPipe, name: "valueOf" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
16115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellComponent, decorators: [{
|
|
16116
|
-
type: Component,
|
|
16117
|
-
args: [{
|
|
16118
|
-
selector: '[kendoGridCell]',
|
|
16119
|
-
template: `
|
|
16120
|
-
<ng-container [ngSwitch]="isEdited">
|
|
16121
|
-
<ng-container *ngSwitchCase="false">
|
|
16122
|
-
<ng-container *ngIf="!showLoading; else loading">
|
|
16123
|
-
<ng-template *ngIf="column.templateRef"
|
|
16124
|
-
[ngTemplateOutlet]="column.templateRef"
|
|
16125
|
-
[ngTemplateOutletContext]="templateContext">
|
|
16126
|
-
</ng-template>
|
|
16127
|
-
<ng-container *ngIf="isSpanColumn">
|
|
16128
|
-
<ng-container *ngFor="let childColumn of childColumns">
|
|
16129
|
-
{{ dataItem | valueOf: childColumn.field: childColumn.format}}
|
|
16130
|
-
</ng-container>
|
|
16131
|
-
</ng-container>
|
|
16132
|
-
<ng-container *ngIf="isBoundColumn">{{ dataItem | valueOf: column.field: column.format}}</ng-container>
|
|
16133
|
-
<ng-container *ngIf="isCheckboxColumn && !isNew">
|
|
16134
|
-
<span class="k-checkbox-wrap">
|
|
16135
|
-
<input
|
|
16136
|
-
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16137
|
-
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16138
|
-
[attr.id]="selectionCheckboxId"
|
|
16139
|
-
[attr.aria-label]="selectionCheckboxLabel" />
|
|
16140
|
-
</span>
|
|
16141
|
-
</ng-container>
|
|
16142
|
-
<ng-container *ngIf="isRowReorderColumn && !isNew">
|
|
16143
|
-
<kendo-icon-wrapper
|
|
16144
|
-
name="reorder"
|
|
16145
|
-
[svgIcon]="reorderIcon">
|
|
16146
|
-
</kendo-icon-wrapper>
|
|
16147
|
-
</ng-container>
|
|
16148
|
-
</ng-container>
|
|
16149
|
-
<ng-template #loading>
|
|
16150
|
-
<ng-template
|
|
16151
|
-
*ngIf="loadingTemplate"
|
|
16152
|
-
[ngTemplateOutlet]="loadingTemplate"
|
|
16153
|
-
[ngTemplateOutletContext]="{$implicit: column}">
|
|
16154
|
-
</ng-template>
|
|
16155
|
-
<div *ngIf="!loadingTemplate" class="k-skeleton-text k-skeleton"></div>
|
|
16156
|
-
</ng-template>
|
|
16157
|
-
</ng-container>
|
|
16158
|
-
<ng-container *ngSwitchCase="true">
|
|
16159
|
-
<ng-template
|
|
16160
|
-
*ngIf="column.editTemplateRef"
|
|
16161
|
-
[ngTemplateOutlet]="column.editTemplateRef"
|
|
16162
|
-
[ngTemplateOutletContext]="editTemplateContext">
|
|
16163
|
-
</ng-template>
|
|
16164
|
-
<ng-container [ngSwitch]="column.editor" *ngIf="!column.editTemplateRef">
|
|
16165
|
-
<kendo-numerictextbox
|
|
16166
|
-
*ngSwitchCase="'numeric'"
|
|
16167
|
-
[format]="format"
|
|
16168
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16169
|
-
kendoGridFocusable
|
|
16170
|
-
></kendo-numerictextbox>
|
|
16171
|
-
|
|
16172
|
-
<kendo-datepicker
|
|
16173
|
-
*ngSwitchCase="'date'"
|
|
16174
|
-
[format]="format"
|
|
16175
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16176
|
-
kendoGridFocusable
|
|
16177
|
-
></kendo-datepicker>
|
|
16178
|
-
|
|
16179
|
-
<span class="k-checkbox-wrap">
|
|
16180
|
-
<input
|
|
16181
|
-
*ngSwitchCase="'boolean'"
|
|
16182
|
-
type="checkbox"
|
|
16183
|
-
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16184
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16185
|
-
kendoGridFocusable
|
|
16186
|
-
/>
|
|
16187
|
-
</span>
|
|
16188
|
-
|
|
16189
|
-
<input
|
|
16190
|
-
*ngSwitchDefault
|
|
16191
|
-
type="text"
|
|
16192
|
-
class="k-textbox k-input k-input-md k-input-solid k-rounded-md"
|
|
16193
|
-
[formControl]="$any(formGroup.get(column.field))"
|
|
16194
|
-
kendoGridFocusable
|
|
16195
|
-
/>
|
|
16196
|
-
</ng-container>
|
|
16197
|
-
</ng-container>
|
|
16198
|
-
</ng-container>
|
|
16199
|
-
`,
|
|
16200
|
-
standalone: true,
|
|
16201
|
-
imports: [NgSwitch, NgSwitchCase, NgIf, NgTemplateOutlet, NgFor, FocusableDirective, SelectionCheckboxDirective,
|
|
16202
|
-
IconWrapperComponent, NumericTextBoxComponent, DatePickerComponent, NgSwitchDefault, FieldAccessorPipe, ReactiveFormsModule]
|
|
16203
|
-
}]
|
|
16204
|
-
}], ctorParameters: function () {
|
|
16205
|
-
return [{ type: EditService }, { type: IdService }, { type: ContextService }, { type: undefined, decorators: [{
|
|
16206
|
-
type: Optional
|
|
16207
|
-
}, {
|
|
16208
|
-
type: Inject,
|
|
16209
|
-
args: [CELL_CONTEXT]
|
|
16210
|
-
}] }];
|
|
16211
|
-
}, propDecorators: { commandCellClass: [{
|
|
16212
|
-
type: HostBinding,
|
|
16213
|
-
args: ['class.k-command-cell']
|
|
16214
|
-
}], dragHandleCellClass: [{
|
|
16215
|
-
type: HostBinding,
|
|
16216
|
-
args: ['class.k-drag-cell']
|
|
16217
|
-
}, {
|
|
16218
|
-
type: HostBinding,
|
|
16219
|
-
args: ['class.k-touch-action-none']
|
|
16220
|
-
}], dragRowHandleLabel: [{
|
|
16221
|
-
type: HostBinding,
|
|
16222
|
-
args: ['attr.aria-label']
|
|
16223
|
-
}], column: [{
|
|
16224
|
-
type: Input
|
|
16225
|
-
}], columnIndex: [{
|
|
16226
|
-
type: Input
|
|
16227
|
-
}], isNew: [{
|
|
16228
|
-
type: Input
|
|
16229
|
-
}], isLoading: [{
|
|
16230
|
-
type: Input
|
|
16231
|
-
}], isVirtual: [{
|
|
16232
|
-
type: Input
|
|
16233
|
-
}], loadingTemplate: [{
|
|
16234
|
-
type: Input
|
|
16235
|
-
}], rowIndex: [{
|
|
16242
|
+
}, propDecorators: { showSelectAll: [{
|
|
16236
16243
|
type: Input
|
|
16237
|
-
}],
|
|
16244
|
+
}], showDisabledCheckbox: [{
|
|
16238
16245
|
type: Input
|
|
16246
|
+
}], template: [{
|
|
16247
|
+
type: ContentChild,
|
|
16248
|
+
args: [CellTemplateDirective, { static: false }]
|
|
16239
16249
|
}] } });
|
|
16240
16250
|
|
|
16241
16251
|
/**
|
|
16242
|
-
*
|
|
16252
|
+
* Represents the row-selection checkbox of the Grid. The directive expects the
|
|
16253
|
+
* index of the current row as an input parameter. Inside the [`CellTemplateDirective`](slug:api_grid_celltemplatedirective), apply the
|
|
16254
|
+
* `kendoGridSelectionCheckbox` to an `<input type="checkbox"/>` element. When the user clicks the checkbox that is associated
|
|
16255
|
+
* with the directive, a [selectionChange](slug:api_grid_gridcomponent#toc-selectionChange)
|
|
16256
|
+
* event is triggered.
|
|
16257
|
+
*
|
|
16258
|
+
* @example
|
|
16259
|
+
* ```html
|
|
16260
|
+
* <kendo-grid ... >
|
|
16261
|
+
* <kendo-grid-column>
|
|
16262
|
+
* <ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
|
|
16263
|
+
* <input ... [kendoGridSelectionCheckbox]="rowIndex"/>
|
|
16264
|
+
* </ng-template>
|
|
16265
|
+
* </kendo-grid-column>
|
|
16266
|
+
* </kendo-grid>
|
|
16267
|
+
* ```
|
|
16243
16268
|
*/
|
|
16244
|
-
class
|
|
16245
|
-
constructor(ngZone) {
|
|
16269
|
+
class SelectionCheckboxDirective {
|
|
16270
|
+
constructor(selectionService, cellSelectionService, aggregateService, el, renderer, ngZone) {
|
|
16271
|
+
this.selectionService = selectionService;
|
|
16272
|
+
this.cellSelectionService = cellSelectionService;
|
|
16273
|
+
this.aggregateService = aggregateService;
|
|
16274
|
+
this.el = el;
|
|
16275
|
+
this.renderer = renderer;
|
|
16246
16276
|
this.ngZone = ngZone;
|
|
16247
|
-
this.
|
|
16277
|
+
this.type = 'checkbox';
|
|
16278
|
+
this.ngZone.runOutsideAngular(() => {
|
|
16279
|
+
this.destroyClick = this.renderer.listen(this.el.nativeElement, 'click', this.onClick.bind(this));
|
|
16280
|
+
this.destroyKeyDown = this.renderer.listen(this.el.nativeElement, 'keydown', this.onKeyDown.bind(this));
|
|
16281
|
+
});
|
|
16248
16282
|
}
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16283
|
+
ngAfterContentChecked() {
|
|
16284
|
+
this.setCheckedState();
|
|
16285
|
+
}
|
|
16286
|
+
ngOnDestroy() {
|
|
16287
|
+
if (this.destroyClick) {
|
|
16288
|
+
this.destroyClick();
|
|
16289
|
+
}
|
|
16290
|
+
if (this.destroyKeyDown) {
|
|
16291
|
+
this.destroyKeyDown();
|
|
16292
|
+
}
|
|
16293
|
+
}
|
|
16294
|
+
onClick(event) {
|
|
16295
|
+
const nonSelectableRow = this.selectionService.nonSelectableRows.has(this.itemIndex) || this.cellSelectionService.nonSelectableRows.has(this.itemIndex);
|
|
16296
|
+
if (nonSelectableRow || this.cellSelectionService.options.cell) {
|
|
16297
|
+
event.preventDefault();
|
|
16298
|
+
return;
|
|
16299
|
+
}
|
|
16300
|
+
if (this.selectionService.options.enabled) {
|
|
16301
|
+
this.ngZone.run(() => {
|
|
16302
|
+
let ev;
|
|
16303
|
+
const ctrlKey = event.ctrlKey || event.metaKey;
|
|
16304
|
+
if (event.shiftKey) {
|
|
16305
|
+
const item = { index: this.itemIndex };
|
|
16306
|
+
ev = this.selectionService.addAllTo(item, ctrlKey);
|
|
16307
|
+
}
|
|
16308
|
+
else {
|
|
16309
|
+
ev = this.selectionService.toggleByIndex(this.itemIndex);
|
|
16310
|
+
}
|
|
16311
|
+
ev.ctrlKey = event.ctrlKey;
|
|
16312
|
+
ev.shiftKey = event.shiftKey;
|
|
16313
|
+
if (this.selectionService.options.cellAggregates) {
|
|
16314
|
+
ev.cellAggregates = this.aggregateService.onSelectionChange(ev);
|
|
16315
|
+
}
|
|
16316
|
+
this.selectionService.changes.emit(ev);
|
|
16317
|
+
});
|
|
16318
|
+
}
|
|
16319
|
+
}
|
|
16320
|
+
onKeyDown(e) {
|
|
16321
|
+
if (e.keyCode === Keys.Enter) {
|
|
16322
|
+
this.onClick(e);
|
|
16254
16323
|
}
|
|
16255
16324
|
}
|
|
16325
|
+
/*
|
|
16326
|
+
* @hidden
|
|
16327
|
+
*/
|
|
16328
|
+
setCheckedState() {
|
|
16329
|
+
const isSelected = this.selectionService.nonSelectableRows.has(this.itemIndex) ? false : this.selectionService.isSelected(this.itemIndex);
|
|
16330
|
+
this.renderer.setProperty(this.el.nativeElement, 'checked', isSelected);
|
|
16331
|
+
}
|
|
16256
16332
|
}
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
16260
|
-
type:
|
|
16261
|
-
|
|
16333
|
+
SelectionCheckboxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectionCheckboxDirective, deps: [{ token: SelectionService }, { token: CellSelectionService }, { token: CellSelectionAggregateService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
16334
|
+
SelectionCheckboxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SelectionCheckboxDirective, isStandalone: true, selector: "[kendoGridSelectionCheckbox]", inputs: { itemIndex: ["kendoGridSelectionCheckbox", "itemIndex"] }, host: { properties: { "attr.type": "this.type" } }, ngImport: i0 });
|
|
16335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectionCheckboxDirective, decorators: [{
|
|
16336
|
+
type: Directive,
|
|
16337
|
+
args: [{
|
|
16338
|
+
selector: '[kendoGridSelectionCheckbox]',
|
|
16339
|
+
standalone: true
|
|
16340
|
+
}]
|
|
16341
|
+
}], ctorParameters: function () { return [{ type: SelectionService }, { type: CellSelectionService }, { type: CellSelectionAggregateService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { itemIndex: [{
|
|
16342
|
+
type: Input,
|
|
16343
|
+
args: ['kendoGridSelectionCheckbox']
|
|
16344
|
+
}], type: [{
|
|
16345
|
+
type: HostBinding,
|
|
16346
|
+
args: ['attr.type']
|
|
16347
|
+
}] } });
|
|
16262
16348
|
|
|
16263
16349
|
/**
|
|
16264
16350
|
* @hidden
|
|
16265
16351
|
*/
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
this.aggregateService = aggregateService;
|
|
16270
|
-
this.localDataChangesService = localDataChangesService;
|
|
16271
|
-
this.navigationService = navigationService;
|
|
16272
|
-
this.changes = new EventEmitter();
|
|
16273
|
-
this.mouseUpEvent = new EventEmitter();
|
|
16274
|
-
this.currentSelection = [];
|
|
16275
|
-
this.active = false;
|
|
16276
|
-
this.dragging = false;
|
|
16277
|
-
this.dragSelectDeselect = false;
|
|
16278
|
-
this.lastSelectionItem = { itemKey: 0, columnKey: 0 };
|
|
16279
|
-
this.lastSelectionItemRowIndex = 0;
|
|
16280
|
-
this.lastSelectionItemColIndex = 0;
|
|
16281
|
-
this.addSubscriptions();
|
|
16282
|
-
}
|
|
16283
|
-
get enableMarquee() {
|
|
16284
|
-
const checkboxOnly = this.settings && typeof this.settings === 'object' && this.settings.checkboxOnly;
|
|
16285
|
-
if (!this.settings || checkboxOnly) {
|
|
16286
|
-
return false;
|
|
16287
|
-
}
|
|
16288
|
-
const selectableSettings = this.settings.selectable;
|
|
16289
|
-
const dragAndMultiple = typeof (selectableSettings) === 'object' &&
|
|
16290
|
-
isPresent(selectableSettings) &&
|
|
16291
|
-
selectableSettings.mode === 'multiple' &&
|
|
16292
|
-
selectableSettings.cell &&
|
|
16293
|
-
selectableSettings.enabled !== false &&
|
|
16294
|
-
selectableSettings.drag;
|
|
16295
|
-
return this.active && dragAndMultiple;
|
|
16296
|
-
}
|
|
16297
|
-
init(settings) {
|
|
16298
|
-
this.settings = settings;
|
|
16299
|
-
this.currentSelection = [];
|
|
16300
|
-
if (settings.selectable && settings.selectable.enabled !== false) {
|
|
16301
|
-
const iterator = this.getIterator();
|
|
16302
|
-
let item = iterator.next();
|
|
16303
|
-
while (!item.done) {
|
|
16304
|
-
if (item.value && item.value.type === "data") {
|
|
16305
|
-
const rowArgs = {
|
|
16306
|
-
dataItem: item.value.data,
|
|
16307
|
-
index: item.value.index
|
|
16308
|
-
};
|
|
16309
|
-
settings.columns.forEach(col => {
|
|
16310
|
-
const selectedCellArgs = settings.cellSelected(rowArgs, col, col.leafIndex);
|
|
16311
|
-
if (selectedCellArgs.selected) {
|
|
16312
|
-
this.currentSelection.push(selectedCellArgs.item);
|
|
16313
|
-
}
|
|
16314
|
-
});
|
|
16315
|
-
}
|
|
16316
|
-
item = iterator.next();
|
|
16317
|
-
}
|
|
16318
|
-
}
|
|
16352
|
+
function defaultTrackBy(index, item) {
|
|
16353
|
+
if (item.type === 'data' && item.isEditing) {
|
|
16354
|
+
return item.data;
|
|
16319
16355
|
}
|
|
16320
|
-
|
|
16321
|
-
|
|
16322
|
-
|
|
16323
|
-
|
|
16324
|
-
|
|
16325
|
-
|
|
16356
|
+
return index;
|
|
16357
|
+
}
|
|
16358
|
+
|
|
16359
|
+
/**
|
|
16360
|
+
* @hidden
|
|
16361
|
+
*/
|
|
16362
|
+
const NON_DATA_CELL_CLASSES = 'k-hierarchy-cell k-detail-cell k-group-cell';
|
|
16363
|
+
/**
|
|
16364
|
+
* @hidden
|
|
16365
|
+
*/
|
|
16366
|
+
const NON_DATA_ROW_CLASSES = 'k-grouping-row k-group-footer k-detail-row k-grid-norecords';
|
|
16367
|
+
/**
|
|
16368
|
+
* @hidden
|
|
16369
|
+
*/
|
|
16370
|
+
const IGNORE_TARGET_CLASSSES = 'k-icon k-svg-icon';
|
|
16371
|
+
/**
|
|
16372
|
+
* @hidden
|
|
16373
|
+
*/
|
|
16374
|
+
const IGNORE_CONTAINER_CLASSES = 'k-grid k-grid-ignore-click';
|
|
16375
|
+
|
|
16376
|
+
/**
|
|
16377
|
+
* @hidden
|
|
16378
|
+
*/
|
|
16379
|
+
class CellComponent {
|
|
16380
|
+
constructor(editService, idService, ctx, cellContext) {
|
|
16381
|
+
this.editService = editService;
|
|
16382
|
+
this.idService = idService;
|
|
16383
|
+
this.ctx = ctx;
|
|
16384
|
+
this.cellContext = cellContext;
|
|
16385
|
+
this.isNew = false;
|
|
16386
|
+
this.isLoading = false;
|
|
16387
|
+
this.isVirtual = false;
|
|
16388
|
+
this.reorderIcon = reorderIcon;
|
|
16389
|
+
this._templateContext = {};
|
|
16390
|
+
this._editTemplateContext = {};
|
|
16326
16391
|
}
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
this.dragging = false;
|
|
16330
|
-
return;
|
|
16331
|
-
}
|
|
16332
|
-
let ev;
|
|
16333
|
-
const ctrlKey = event.ctrlKey || event.metaKey;
|
|
16334
|
-
if (this.options.mode === "single" && ctrlKey && this.isCellSelected(item, item.column)) {
|
|
16335
|
-
ev = this.toggle(item);
|
|
16336
|
-
}
|
|
16337
|
-
else if (this.options.mode === "multiple") {
|
|
16338
|
-
if (ctrlKey && !event.shiftKey) {
|
|
16339
|
-
ev = this.toggle(item);
|
|
16340
|
-
}
|
|
16341
|
-
else if (event.shiftKey) {
|
|
16342
|
-
const startRowIndex = Math.min(this.lastSelectionItemRowIndex, item.index);
|
|
16343
|
-
const startColIndex = Math.min(this.lastSelectionItemColIndex, item.column.leafIndex);
|
|
16344
|
-
const endRowIndex = Math.max(this.lastSelectionItemRowIndex, item.index);
|
|
16345
|
-
const endColIndex = Math.max(this.lastSelectionItemColIndex, item.column.leafIndex);
|
|
16346
|
-
ev = this.selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex);
|
|
16347
|
-
}
|
|
16348
|
-
}
|
|
16349
|
-
if (!isPresent(ev)) {
|
|
16350
|
-
ev = this.select(item);
|
|
16351
|
-
this.currentSelection = [this.lastSelectionItem];
|
|
16352
|
-
}
|
|
16353
|
-
if (!ev.selectedCells.length && !ev.deselectedCells.length) {
|
|
16354
|
-
return;
|
|
16355
|
-
}
|
|
16356
|
-
ev.ctrlKey = ctrlKey;
|
|
16357
|
-
ev.shiftKey = event.shiftKey;
|
|
16358
|
-
if (this.options.cellAggregates && !event.shiftKey) {
|
|
16359
|
-
ev.cellAggregates = this.aggregateService.onSelectionChange(ev);
|
|
16360
|
-
}
|
|
16361
|
-
if (ev.shiftKey) {
|
|
16362
|
-
ev.rangeStartCell = this.lastSelectionItem;
|
|
16363
|
-
ev.rangeEndCell = Object.assign({}, this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item);
|
|
16364
|
-
}
|
|
16365
|
-
this.changes.emit(ev);
|
|
16392
|
+
get commandCellClass() {
|
|
16393
|
+
return this.isCommand(this.column);
|
|
16366
16394
|
}
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
const deselectedCells = [];
|
|
16370
|
-
this.lastSelectionItem =
|
|
16371
|
-
this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item;
|
|
16372
|
-
this.lastSelectionItemRowIndex = item.index;
|
|
16373
|
-
this.lastSelectionItemColIndex = item.column.leafIndex;
|
|
16374
|
-
if (this.isCellSelected(item, item.column)) {
|
|
16375
|
-
deselectedCells.push(this.lastSelectionItem);
|
|
16376
|
-
}
|
|
16377
|
-
else {
|
|
16378
|
-
selectedCells.push(this.lastSelectionItem);
|
|
16379
|
-
}
|
|
16380
|
-
return {
|
|
16381
|
-
deselectedCells,
|
|
16382
|
-
selectedCells
|
|
16383
|
-
};
|
|
16395
|
+
get dragHandleCellClass() {
|
|
16396
|
+
return isRowReorderColumn(this.column);
|
|
16384
16397
|
}
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
const deselectedCells = [];
|
|
16388
|
-
this.lastSelectionItem =
|
|
16389
|
-
this.settings.cellSelected({ dataItem: item.data, index: item.index }, item.column, item.column.leafIndex).item;
|
|
16390
|
-
this.lastSelectionItemRowIndex = item.index;
|
|
16391
|
-
this.lastSelectionItemColIndex = item.column.leafIndex;
|
|
16392
|
-
if (!this.isCellSelected(item, item.column)) {
|
|
16393
|
-
selectedCells.push(this.lastSelectionItem);
|
|
16394
|
-
}
|
|
16395
|
-
this.currentSelection.forEach((selectedItem) => {
|
|
16396
|
-
if (selectedItem.itemKey !== this.lastSelectionItem.itemKey || selectedItem.columnKey !== this.lastSelectionItem.columnKey) {
|
|
16397
|
-
deselectedCells.push(selectedItem);
|
|
16398
|
-
}
|
|
16399
|
-
});
|
|
16400
|
-
return {
|
|
16401
|
-
deselectedCells,
|
|
16402
|
-
selectedCells
|
|
16403
|
-
};
|
|
16398
|
+
get dragRowHandleLabel() {
|
|
16399
|
+
return isRowReorderColumn(this.column) ? this.ctx.localization.get('dragRowHandleLabel') : undefined;
|
|
16404
16400
|
}
|
|
16405
|
-
|
|
16406
|
-
|
|
16407
|
-
|
|
16408
|
-
let item = iterator.next();
|
|
16409
|
-
let rowArgs;
|
|
16410
|
-
while (!item.done) {
|
|
16411
|
-
if (item.value && item.value.type === "data" && item.value.data === removedItem) {
|
|
16412
|
-
rowArgs = {
|
|
16413
|
-
dataItem: item.value.data,
|
|
16414
|
-
index: item.value.index
|
|
16415
|
-
};
|
|
16416
|
-
break;
|
|
16417
|
-
}
|
|
16418
|
-
item = iterator.next();
|
|
16419
|
-
}
|
|
16420
|
-
if (rowArgs) {
|
|
16421
|
-
const cellsToRemove = this.currentSelection.filter(selectedItem => {
|
|
16422
|
-
const contender = this.settings.cellSelected(rowArgs, null, null).item;
|
|
16423
|
-
return selectedItem.itemKey === contender.itemKey;
|
|
16424
|
-
});
|
|
16425
|
-
if (cellsToRemove.length) {
|
|
16426
|
-
const ev = {
|
|
16427
|
-
ctrlKey: false,
|
|
16428
|
-
deselectedCells: cellsToRemove,
|
|
16429
|
-
selectedCells: []
|
|
16430
|
-
};
|
|
16431
|
-
this.changes.emit(ev);
|
|
16432
|
-
}
|
|
16433
|
-
}
|
|
16401
|
+
set rowIndex(index) {
|
|
16402
|
+
this._rowIndex = index;
|
|
16403
|
+
this.updateCellContext();
|
|
16434
16404
|
}
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
const deselectedCells = [];
|
|
16438
|
-
const selectionStartRow = Math.min(startRowIndex, endRowIndex);
|
|
16439
|
-
const selectionStartCol = Math.min(startColIndex, endColIndex);
|
|
16440
|
-
const selectionEndRow = Math.max(startRowIndex, endRowIndex);
|
|
16441
|
-
const selectionEndCol = Math.max(startColIndex, endColIndex);
|
|
16442
|
-
const iterator = this.getIterator();
|
|
16443
|
-
let next = iterator.next();
|
|
16444
|
-
while (!next.done) {
|
|
16445
|
-
if (next.value && next.value.type === "data") {
|
|
16446
|
-
const idx = next.value.index;
|
|
16447
|
-
const data = next.value.data;
|
|
16448
|
-
const rowArgs = {
|
|
16449
|
-
dataItem: data,
|
|
16450
|
-
index: idx
|
|
16451
|
-
};
|
|
16452
|
-
this.settings.columns.forEach(col => {
|
|
16453
|
-
const { item } = this.settings.cellSelected(rowArgs, col, col.leafIndex);
|
|
16454
|
-
const selected = this.isCellSelected(next.value, col);
|
|
16455
|
-
const isInRowRange = selectionStartRow <= idx && idx <= selectionEndRow;
|
|
16456
|
-
const isInColRange = selectionStartCol <= col.leafIndex && col.leafIndex <= selectionEndCol;
|
|
16457
|
-
const isInSelectionRect = isInRowRange && isInColRange;
|
|
16458
|
-
if (!isInSelectionRect && selected) {
|
|
16459
|
-
deselectedCells.push(item);
|
|
16460
|
-
}
|
|
16461
|
-
if (isInSelectionRect && !selected) {
|
|
16462
|
-
selectedCells.push(item);
|
|
16463
|
-
}
|
|
16464
|
-
});
|
|
16465
|
-
}
|
|
16466
|
-
next = iterator.next();
|
|
16467
|
-
}
|
|
16468
|
-
let cellAggregates;
|
|
16469
|
-
if (this.options.cellAggregates) {
|
|
16470
|
-
cellAggregates = this.aggregateService.onSelectionChange({ selectedCells, deselectedCells });
|
|
16471
|
-
}
|
|
16472
|
-
return {
|
|
16473
|
-
deselectedCells,
|
|
16474
|
-
selectedCells,
|
|
16475
|
-
cellAggregates
|
|
16476
|
-
};
|
|
16405
|
+
get rowIndex() {
|
|
16406
|
+
return this._rowIndex;
|
|
16477
16407
|
}
|
|
16478
|
-
get
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
checkboxOnly: false,
|
|
16482
|
-
enabled: true,
|
|
16483
|
-
mode: "multiple"
|
|
16484
|
-
};
|
|
16485
|
-
if (!isPresent(this.settings)) {
|
|
16486
|
-
return defaultOptions;
|
|
16408
|
+
get isEdited() {
|
|
16409
|
+
if (!(this.editService.isEditing() || this.isNew) || !this.isColumnEditable) {
|
|
16410
|
+
return false;
|
|
16487
16411
|
}
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
|
|
16412
|
+
const editContext = this.editService.columnContext(this.rowIndex, this.column);
|
|
16413
|
+
return this.isFieldEditable(editContext, this.column);
|
|
16414
|
+
}
|
|
16415
|
+
get showLoading() {
|
|
16416
|
+
return this.isVirtual && this.isLoading;
|
|
16417
|
+
}
|
|
16418
|
+
get formGroup() {
|
|
16419
|
+
return this.editService.context(this.rowIndex).group;
|
|
16420
|
+
}
|
|
16421
|
+
get templateContext() {
|
|
16422
|
+
return this._templateContext;
|
|
16423
|
+
}
|
|
16424
|
+
get editTemplateContext() {
|
|
16425
|
+
this._editTemplateContext.$implicit = this.formGroup;
|
|
16426
|
+
this._editTemplateContext.isNew = this.isNew;
|
|
16427
|
+
this._editTemplateContext.column = this.column;
|
|
16428
|
+
this._editTemplateContext.dataItem = this.dataItem;
|
|
16429
|
+
this._editTemplateContext.formGroup = this.formGroup;
|
|
16430
|
+
this._editTemplateContext.rowIndex = this.rowIndex;
|
|
16431
|
+
return this._editTemplateContext;
|
|
16432
|
+
}
|
|
16433
|
+
get format() {
|
|
16434
|
+
if (isColumnComponent(this.column) && !isNullOrEmptyString(this.column.format)) {
|
|
16435
|
+
return extractFormat(this.column.format);
|
|
16495
16436
|
}
|
|
16496
|
-
|
|
16497
|
-
|
|
16437
|
+
return undefined;
|
|
16438
|
+
}
|
|
16439
|
+
get isBoundColumn() {
|
|
16440
|
+
return this.column.field && !this.column.templateRef;
|
|
16441
|
+
}
|
|
16442
|
+
get isCheckboxColumn() {
|
|
16443
|
+
return isCheckboxColumn(this.column) && !this.column.templateRef;
|
|
16444
|
+
}
|
|
16445
|
+
get selectionCheckboxId() {
|
|
16446
|
+
return this.idService.selectionCheckboxId(this.rowIndex);
|
|
16447
|
+
}
|
|
16448
|
+
get selectionCheckboxLabel() {
|
|
16449
|
+
return this.ctx.localization.get('selectionCheckboxLabel');
|
|
16450
|
+
}
|
|
16451
|
+
get isSpanColumn() {
|
|
16452
|
+
return isSpanColumn(this.column) && !this.column.templateRef;
|
|
16453
|
+
}
|
|
16454
|
+
get childColumns() {
|
|
16455
|
+
return columnsToRender([this.column]);
|
|
16456
|
+
}
|
|
16457
|
+
get isRowReorderColumn() {
|
|
16458
|
+
return isRowReorderColumn(this.column) && !this.column.templateRef;
|
|
16459
|
+
}
|
|
16460
|
+
get isRowSelectable() {
|
|
16461
|
+
return this.column.rowSelectable(this._rowIndex);
|
|
16462
|
+
}
|
|
16463
|
+
get isColumnEditable() {
|
|
16464
|
+
if (!this.column || this.isCommand(this.column)) {
|
|
16465
|
+
return false;
|
|
16498
16466
|
}
|
|
16467
|
+
return this.column.editable !== false;
|
|
16499
16468
|
}
|
|
16500
|
-
|
|
16501
|
-
this.
|
|
16469
|
+
ngDoCheck() {
|
|
16470
|
+
this.updateCellContext();
|
|
16502
16471
|
}
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
|
|
16511
|
-
|
|
16472
|
+
ngOnChanges(_changes) {
|
|
16473
|
+
this.updateTemplateContext();
|
|
16474
|
+
}
|
|
16475
|
+
ngAfterContentChecked() {
|
|
16476
|
+
this.updateTemplateContext();
|
|
16477
|
+
}
|
|
16478
|
+
isCommand(column) {
|
|
16479
|
+
return column instanceof CommandColumnComponent;
|
|
16480
|
+
}
|
|
16481
|
+
isFieldEditable(editContext, column) {
|
|
16482
|
+
if (!isPresent(editContext)) {
|
|
16483
|
+
return false;
|
|
16512
16484
|
}
|
|
16513
|
-
if (
|
|
16514
|
-
|
|
16515
|
-
this.mouseDownEventArgs = args;
|
|
16516
|
-
if (this.options.enabled && (!this.options.mode || this.options.mode === "multiple") &&
|
|
16517
|
-
!this.options.checkboxOnly && args.originalEvent.shiftKey) {
|
|
16518
|
-
if (this.active) {
|
|
16519
|
-
args.originalEvent.preventDefault();
|
|
16520
|
-
this.navigationService.focusCellByElement(args.originalEvent.target);
|
|
16521
|
-
}
|
|
16522
|
-
}
|
|
16523
|
-
});
|
|
16485
|
+
if (isPresent(column.editTemplate)) {
|
|
16486
|
+
return true;
|
|
16524
16487
|
}
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
}
|
|
16531
|
-
}
|
|
16532
|
-
});
|
|
16488
|
+
return isPresent(editContext.group) && isPresent(editContext.group.get(column.field));
|
|
16489
|
+
}
|
|
16490
|
+
updateCellContext() {
|
|
16491
|
+
if (this.cellContext) {
|
|
16492
|
+
this.cellContext.rowIndex = this._rowIndex;
|
|
16533
16493
|
}
|
|
16534
16494
|
}
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
if (!accessor) {
|
|
16495
|
+
updateTemplateContext() {
|
|
16496
|
+
if (!this.column.templateRef) {
|
|
16538
16497
|
return;
|
|
16539
16498
|
}
|
|
16540
|
-
|
|
16499
|
+
const context = this._templateContext;
|
|
16500
|
+
context.isNew = this.isNew;
|
|
16501
|
+
context.column = this.column;
|
|
16502
|
+
context.dataItem = this.dataItem;
|
|
16503
|
+
context.rowIndex = this.rowIndex;
|
|
16504
|
+
context.columnIndex = this.columnIndex;
|
|
16505
|
+
context.$implicit = this.dataItem;
|
|
16506
|
+
}
|
|
16507
|
+
}
|
|
16508
|
+
CellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellComponent, deps: [{ token: EditService }, { token: IdService }, { token: ContextService }, { token: CELL_CONTEXT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
16509
|
+
CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CellComponent, isStandalone: true, selector: "[kendoGridCell]", inputs: { column: "column", columnIndex: "columnIndex", isNew: "isNew", isLoading: "isLoading", isVirtual: "isVirtual", loadingTemplate: "loadingTemplate", rowIndex: "rowIndex", dataItem: "dataItem" }, host: { properties: { "class.k-command-cell": "this.commandCellClass", "class.k-drag-cell": "this.dragHandleCellClass", "class.k-touch-action-none": "this.dragHandleCellClass", "attr.aria-label": "this.dragRowHandleLabel" } }, usesOnChanges: true, ngImport: i0, template: `
|
|
16510
|
+
<ng-container [ngSwitch]="isEdited">
|
|
16511
|
+
<ng-container *ngSwitchCase="false">
|
|
16512
|
+
<ng-container *ngIf="!showLoading; else loading">
|
|
16513
|
+
<ng-template *ngIf="column.templateRef"
|
|
16514
|
+
[ngTemplateOutlet]="column.templateRef"
|
|
16515
|
+
[ngTemplateOutletContext]="templateContext">
|
|
16516
|
+
</ng-template>
|
|
16517
|
+
<ng-container *ngIf="isSpanColumn">
|
|
16518
|
+
<ng-container *ngFor="let childColumn of childColumns">
|
|
16519
|
+
{{ dataItem | valueOf: childColumn.field: childColumn.format}}
|
|
16520
|
+
</ng-container>
|
|
16521
|
+
</ng-container>
|
|
16522
|
+
<ng-container *ngIf="isBoundColumn">{{ dataItem | valueOf: column.field: column.format}}</ng-container>
|
|
16523
|
+
<ng-container *ngIf="isCheckboxColumn && !isNew">
|
|
16524
|
+
<ng-container *ngIf="isRowSelectable; else nonSelectableRow">
|
|
16525
|
+
<span class="k-checkbox-wrap">
|
|
16526
|
+
<input
|
|
16527
|
+
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16528
|
+
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16529
|
+
[attr.id]="selectionCheckboxId"
|
|
16530
|
+
[attr.aria-label]="selectionCheckboxLabel" />
|
|
16531
|
+
</span>
|
|
16532
|
+
</ng-container>
|
|
16533
|
+
<ng-template #nonSelectableRow>
|
|
16534
|
+
<span class="k-checkbox-wrap" *ngIf="column.showDisabledCheckbox">
|
|
16535
|
+
<input
|
|
16536
|
+
class="k-checkbox k-checkbox-md k-rounded-md k-disabled"
|
|
16537
|
+
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16538
|
+
[attr.id]="selectionCheckboxId"
|
|
16539
|
+
[attr.aria-label]="selectionCheckboxLabel"
|
|
16540
|
+
[disabled]="true" />
|
|
16541
|
+
</span>
|
|
16542
|
+
</ng-template>
|
|
16543
|
+
</ng-container>
|
|
16544
|
+
<ng-container *ngIf="isRowReorderColumn && !isNew">
|
|
16545
|
+
<kendo-icon-wrapper
|
|
16546
|
+
name="reorder"
|
|
16547
|
+
[svgIcon]="reorderIcon">
|
|
16548
|
+
</kendo-icon-wrapper>
|
|
16549
|
+
</ng-container>
|
|
16550
|
+
</ng-container>
|
|
16551
|
+
<ng-template #loading>
|
|
16552
|
+
<ng-template
|
|
16553
|
+
*ngIf="loadingTemplate"
|
|
16554
|
+
[ngTemplateOutlet]="loadingTemplate"
|
|
16555
|
+
[ngTemplateOutletContext]="{$implicit: column}">
|
|
16556
|
+
</ng-template>
|
|
16557
|
+
<div *ngIf="!loadingTemplate" class="k-skeleton-text k-skeleton"></div>
|
|
16558
|
+
</ng-template>
|
|
16559
|
+
</ng-container>
|
|
16560
|
+
<ng-container *ngSwitchCase="true">
|
|
16561
|
+
<ng-template
|
|
16562
|
+
*ngIf="column.editTemplateRef"
|
|
16563
|
+
[ngTemplateOutlet]="column.editTemplateRef"
|
|
16564
|
+
[ngTemplateOutletContext]="editTemplateContext">
|
|
16565
|
+
</ng-template>
|
|
16566
|
+
<ng-container [ngSwitch]="column.editor" *ngIf="!column.editTemplateRef">
|
|
16567
|
+
<kendo-numerictextbox
|
|
16568
|
+
*ngSwitchCase="'numeric'"
|
|
16569
|
+
[format]="format"
|
|
16570
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16571
|
+
kendoGridFocusable
|
|
16572
|
+
></kendo-numerictextbox>
|
|
16573
|
+
|
|
16574
|
+
<kendo-datepicker
|
|
16575
|
+
*ngSwitchCase="'date'"
|
|
16576
|
+
[format]="format"
|
|
16577
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16578
|
+
kendoGridFocusable
|
|
16579
|
+
></kendo-datepicker>
|
|
16580
|
+
|
|
16581
|
+
<span class="k-checkbox-wrap">
|
|
16582
|
+
<input
|
|
16583
|
+
*ngSwitchCase="'boolean'"
|
|
16584
|
+
type="checkbox"
|
|
16585
|
+
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16586
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16587
|
+
kendoGridFocusable
|
|
16588
|
+
/>
|
|
16589
|
+
</span>
|
|
16590
|
+
|
|
16591
|
+
<input
|
|
16592
|
+
*ngSwitchDefault
|
|
16593
|
+
type="text"
|
|
16594
|
+
class="k-textbox k-input k-input-md k-input-solid k-rounded-md"
|
|
16595
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16596
|
+
kendoGridFocusable
|
|
16597
|
+
/>
|
|
16598
|
+
</ng-container>
|
|
16599
|
+
</ng-container>
|
|
16600
|
+
</ng-container>
|
|
16601
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: FocusableDirective, selector: "[kendoGridFocusable],\n [kendoGridEditCommand],\n [kendoGridRemoveCommand],\n [kendoGridSaveCommand],\n [kendoGridCancelCommand],\n [kendoGridSelectionCheckbox]\n ", inputs: ["kendoGridFocusable"] }, { kind: "directive", type: SelectionCheckboxDirective, selector: "[kendoGridSelectionCheckbox]", inputs: ["kendoGridSelectionCheckbox"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "component", type: DatePickerComponent, selector: "kendo-datepicker", inputs: ["focusableId", "cellTemplate", "clearButton", "inputAttributes", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate", "headerTemplate", "footerTemplate", "footer", "navigationItemTemplate", "weekDaysFormat", "showOtherMonthDays", "activeView", "bottomView", "topView", "calendarType", "animateCalendarNavigation", "disabled", "readonly", "readOnlyInput", "popupSettings", "navigation", "min", "max", "incompleteDateValidation", "autoCorrectParts", "autoSwitchParts", "autoSwitchKeys", "enableMouseWheel", "allowCaretMode", "autoFill", "focusedDate", "value", "format", "twoDigitYearMax", "formatPlaceholder", "placeholder", "tabindex", "tabIndex", "disabledDates", "title", "subtitle", "rangeValidation", "disabledDatesValidation", "weekNumber", "size", "rounded", "fillMode", "adaptiveMode"], outputs: ["valueChange", "focus", "blur", "open", "close", "escape"], exportAs: ["kendo-datepicker"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "pipe", type: FieldAccessorPipe, name: "valueOf" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
16602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CellComponent, decorators: [{
|
|
16603
|
+
type: Component,
|
|
16604
|
+
args: [{
|
|
16605
|
+
selector: '[kendoGridCell]',
|
|
16606
|
+
template: `
|
|
16607
|
+
<ng-container [ngSwitch]="isEdited">
|
|
16608
|
+
<ng-container *ngSwitchCase="false">
|
|
16609
|
+
<ng-container *ngIf="!showLoading; else loading">
|
|
16610
|
+
<ng-template *ngIf="column.templateRef"
|
|
16611
|
+
[ngTemplateOutlet]="column.templateRef"
|
|
16612
|
+
[ngTemplateOutletContext]="templateContext">
|
|
16613
|
+
</ng-template>
|
|
16614
|
+
<ng-container *ngIf="isSpanColumn">
|
|
16615
|
+
<ng-container *ngFor="let childColumn of childColumns">
|
|
16616
|
+
{{ dataItem | valueOf: childColumn.field: childColumn.format}}
|
|
16617
|
+
</ng-container>
|
|
16618
|
+
</ng-container>
|
|
16619
|
+
<ng-container *ngIf="isBoundColumn">{{ dataItem | valueOf: column.field: column.format}}</ng-container>
|
|
16620
|
+
<ng-container *ngIf="isCheckboxColumn && !isNew">
|
|
16621
|
+
<ng-container *ngIf="isRowSelectable; else nonSelectableRow">
|
|
16622
|
+
<span class="k-checkbox-wrap">
|
|
16623
|
+
<input
|
|
16624
|
+
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16625
|
+
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16626
|
+
[attr.id]="selectionCheckboxId"
|
|
16627
|
+
[attr.aria-label]="selectionCheckboxLabel" />
|
|
16628
|
+
</span>
|
|
16629
|
+
</ng-container>
|
|
16630
|
+
<ng-template #nonSelectableRow>
|
|
16631
|
+
<span class="k-checkbox-wrap" *ngIf="column.showDisabledCheckbox">
|
|
16632
|
+
<input
|
|
16633
|
+
class="k-checkbox k-checkbox-md k-rounded-md k-disabled"
|
|
16634
|
+
[kendoGridSelectionCheckbox]="rowIndex"
|
|
16635
|
+
[attr.id]="selectionCheckboxId"
|
|
16636
|
+
[attr.aria-label]="selectionCheckboxLabel"
|
|
16637
|
+
[disabled]="true" />
|
|
16638
|
+
</span>
|
|
16639
|
+
</ng-template>
|
|
16640
|
+
</ng-container>
|
|
16641
|
+
<ng-container *ngIf="isRowReorderColumn && !isNew">
|
|
16642
|
+
<kendo-icon-wrapper
|
|
16643
|
+
name="reorder"
|
|
16644
|
+
[svgIcon]="reorderIcon">
|
|
16645
|
+
</kendo-icon-wrapper>
|
|
16646
|
+
</ng-container>
|
|
16647
|
+
</ng-container>
|
|
16648
|
+
<ng-template #loading>
|
|
16649
|
+
<ng-template
|
|
16650
|
+
*ngIf="loadingTemplate"
|
|
16651
|
+
[ngTemplateOutlet]="loadingTemplate"
|
|
16652
|
+
[ngTemplateOutletContext]="{$implicit: column}">
|
|
16653
|
+
</ng-template>
|
|
16654
|
+
<div *ngIf="!loadingTemplate" class="k-skeleton-text k-skeleton"></div>
|
|
16655
|
+
</ng-template>
|
|
16656
|
+
</ng-container>
|
|
16657
|
+
<ng-container *ngSwitchCase="true">
|
|
16658
|
+
<ng-template
|
|
16659
|
+
*ngIf="column.editTemplateRef"
|
|
16660
|
+
[ngTemplateOutlet]="column.editTemplateRef"
|
|
16661
|
+
[ngTemplateOutletContext]="editTemplateContext">
|
|
16662
|
+
</ng-template>
|
|
16663
|
+
<ng-container [ngSwitch]="column.editor" *ngIf="!column.editTemplateRef">
|
|
16664
|
+
<kendo-numerictextbox
|
|
16665
|
+
*ngSwitchCase="'numeric'"
|
|
16666
|
+
[format]="format"
|
|
16667
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16668
|
+
kendoGridFocusable
|
|
16669
|
+
></kendo-numerictextbox>
|
|
16670
|
+
|
|
16671
|
+
<kendo-datepicker
|
|
16672
|
+
*ngSwitchCase="'date'"
|
|
16673
|
+
[format]="format"
|
|
16674
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16675
|
+
kendoGridFocusable
|
|
16676
|
+
></kendo-datepicker>
|
|
16677
|
+
|
|
16678
|
+
<span class="k-checkbox-wrap">
|
|
16679
|
+
<input
|
|
16680
|
+
*ngSwitchCase="'boolean'"
|
|
16681
|
+
type="checkbox"
|
|
16682
|
+
class="k-checkbox k-checkbox-md k-rounded-md"
|
|
16683
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16684
|
+
kendoGridFocusable
|
|
16685
|
+
/>
|
|
16686
|
+
</span>
|
|
16687
|
+
|
|
16688
|
+
<input
|
|
16689
|
+
*ngSwitchDefault
|
|
16690
|
+
type="text"
|
|
16691
|
+
class="k-textbox k-input k-input-md k-input-solid k-rounded-md"
|
|
16692
|
+
[formControl]="$any(formGroup.get(column.field))"
|
|
16693
|
+
kendoGridFocusable
|
|
16694
|
+
/>
|
|
16695
|
+
</ng-container>
|
|
16696
|
+
</ng-container>
|
|
16697
|
+
</ng-container>
|
|
16698
|
+
`,
|
|
16699
|
+
standalone: true,
|
|
16700
|
+
imports: [NgSwitch, NgSwitchCase, NgIf, NgTemplateOutlet, NgFor, FocusableDirective, SelectionCheckboxDirective,
|
|
16701
|
+
IconWrapperComponent, NumericTextBoxComponent, DatePickerComponent, NgSwitchDefault, FieldAccessorPipe, ReactiveFormsModule]
|
|
16702
|
+
}]
|
|
16703
|
+
}], ctorParameters: function () {
|
|
16704
|
+
return [{ type: EditService }, { type: IdService }, { type: ContextService }, { type: undefined, decorators: [{
|
|
16705
|
+
type: Optional
|
|
16706
|
+
}, {
|
|
16707
|
+
type: Inject,
|
|
16708
|
+
args: [CELL_CONTEXT]
|
|
16709
|
+
}] }];
|
|
16710
|
+
}, propDecorators: { commandCellClass: [{
|
|
16711
|
+
type: HostBinding,
|
|
16712
|
+
args: ['class.k-command-cell']
|
|
16713
|
+
}], dragHandleCellClass: [{
|
|
16714
|
+
type: HostBinding,
|
|
16715
|
+
args: ['class.k-drag-cell']
|
|
16716
|
+
}, {
|
|
16717
|
+
type: HostBinding,
|
|
16718
|
+
args: ['class.k-touch-action-none']
|
|
16719
|
+
}], dragRowHandleLabel: [{
|
|
16720
|
+
type: HostBinding,
|
|
16721
|
+
args: ['attr.aria-label']
|
|
16722
|
+
}], column: [{
|
|
16723
|
+
type: Input
|
|
16724
|
+
}], columnIndex: [{
|
|
16725
|
+
type: Input
|
|
16726
|
+
}], isNew: [{
|
|
16727
|
+
type: Input
|
|
16728
|
+
}], isLoading: [{
|
|
16729
|
+
type: Input
|
|
16730
|
+
}], isVirtual: [{
|
|
16731
|
+
type: Input
|
|
16732
|
+
}], loadingTemplate: [{
|
|
16733
|
+
type: Input
|
|
16734
|
+
}], rowIndex: [{
|
|
16735
|
+
type: Input
|
|
16736
|
+
}], dataItem: [{
|
|
16737
|
+
type: Input
|
|
16738
|
+
}] } });
|
|
16739
|
+
|
|
16740
|
+
/**
|
|
16741
|
+
* @hidden
|
|
16742
|
+
*/
|
|
16743
|
+
class ChangeNotificationService {
|
|
16744
|
+
constructor(ngZone) {
|
|
16745
|
+
this.ngZone = ngZone;
|
|
16746
|
+
this.changes = new EventEmitter();
|
|
16541
16747
|
}
|
|
16542
|
-
|
|
16543
|
-
if (this.
|
|
16544
|
-
this.
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
if (this.mousedownSubscription) {
|
|
16548
|
-
this.mousedownSubscription.unsubscribe();
|
|
16549
|
-
this.mousedownSubscription = null;
|
|
16550
|
-
}
|
|
16551
|
-
if (this.dataChangedSubscription) {
|
|
16552
|
-
this.dataChangedSubscription.unsubscribe();
|
|
16553
|
-
this.dataChangedSubscription = null;
|
|
16748
|
+
notify() {
|
|
16749
|
+
if (!this.subscription || this.subscription.closed) {
|
|
16750
|
+
this.subscription = this.ngZone.onStable
|
|
16751
|
+
.asObservable().pipe(take(1))
|
|
16752
|
+
.subscribe(() => this.changes.emit());
|
|
16554
16753
|
}
|
|
16555
16754
|
}
|
|
16556
16755
|
}
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
16756
|
+
ChangeNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChangeNotificationService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
16757
|
+
ChangeNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChangeNotificationService });
|
|
16758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChangeNotificationService, decorators: [{
|
|
16560
16759
|
type: Injectable
|
|
16561
|
-
}], ctorParameters: function () { return [{ type:
|
|
16760
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
16562
16761
|
|
|
16563
16762
|
const columnCellIndex = (cell, cells) => {
|
|
16564
16763
|
let cellIndex = 0;
|
|
@@ -16672,12 +16871,18 @@ class TableBodyComponent {
|
|
|
16672
16871
|
isOdd(item) {
|
|
16673
16872
|
return item.index % 2 !== 0;
|
|
16674
16873
|
}
|
|
16675
|
-
isSelectable() {
|
|
16676
|
-
|
|
16874
|
+
isSelectable(args) {
|
|
16875
|
+
const rowSelectable = this.isRowSelectable(args);
|
|
16876
|
+
const selectionEnabled = this.selectable && this.selectable.enabled !== false;
|
|
16877
|
+
return selectionEnabled && rowSelectable;
|
|
16677
16878
|
}
|
|
16678
16879
|
isRowSelected(item) {
|
|
16679
16880
|
return this.selectionService.isSelected(item.index);
|
|
16680
16881
|
}
|
|
16882
|
+
isRowSelectable(args) {
|
|
16883
|
+
var _a, _b;
|
|
16884
|
+
return ((_a = this.selectionService.settings) === null || _a === void 0 ? void 0 : _a.isRowSelectable(args)) || ((_b = this.cellSelectionService.settings) === null || _b === void 0 ? void 0 : _b.isRowSelectable(args));
|
|
16885
|
+
}
|
|
16681
16886
|
trackByWrapper(index, item) {
|
|
16682
16887
|
if (item.type === 'data') {
|
|
16683
16888
|
item.isEditing = this.editService.hasEdited(item.index);
|
|
@@ -16835,6 +17040,10 @@ class TableBodyComponent {
|
|
|
16835
17040
|
if (!focusable && !matchesNodeName('label')(target) && !hasClasses(target, IGNORE_TARGET_CLASSSES) &&
|
|
16836
17041
|
!closestInScope(target, matchesClasses(IGNORE_CONTAINER_CLASSES), cell)) {
|
|
16837
17042
|
const args = this.cellClickArgs(cell, row, eventArg);
|
|
17043
|
+
const selectionEnabled = this.selectable && this.selectable.enabled !== false;
|
|
17044
|
+
if (selectionEnabled && !this.isRowSelectable({ index: args.rowIndex, dataItem: args.dataItem })) {
|
|
17045
|
+
return;
|
|
17046
|
+
}
|
|
16838
17047
|
if (eventArg.type === 'mousedown' || eventArg.type === 'touchstart') {
|
|
16839
17048
|
this.domEvents.cellMousedown.emit(args);
|
|
16840
17049
|
}
|
|
@@ -17007,9 +17216,9 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
|
|
|
17007
17216
|
[ngClass]="rowClass({ dataItem: item.data, index: $any(item).index })"
|
|
17008
17217
|
[class.k-master-row]="true"
|
|
17009
17218
|
[class.k-grid-edit-row]="isEditingRow($any(item).index)"
|
|
17010
|
-
[attr.aria-selected]="lockedColumnsCount < 1 ? isSelectable() && isRowSelected(item) : undefined"
|
|
17219
|
+
[attr.aria-selected]="lockedColumnsCount < 1 ? isSelectable({ dataItem: item.data, index: $any(item).index }) && isRowSelected(item) : undefined"
|
|
17011
17220
|
[attr.data-kendo-grid-item-index]="$any(item).index"
|
|
17012
|
-
[class.k-selected]="isSelectable() && isRowSelected(item)">
|
|
17221
|
+
[class.k-selected]="isSelectable({ dataItem: item.data, index: $any(item).index }) && isRowSelected(item)">
|
|
17013
17222
|
<ng-container *ngIf="!skipGroupDecoration">
|
|
17014
17223
|
<td class="k-group-cell k-table-td" *ngFor="let g of groups" role="presentation"></td>
|
|
17015
17224
|
</ng-container>
|
|
@@ -17052,10 +17261,10 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
|
|
|
17052
17261
|
[colSpan]="column.colspan"
|
|
17053
17262
|
[attr.role]="column.tableCellsRole"
|
|
17054
17263
|
class="k-table-td"
|
|
17055
|
-
[attr.aria-selected]="lockedColumnsCount < 1 && isSelectable() ? isAriaSelected(item, column) : undefined"
|
|
17264
|
+
[attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
|
|
17056
17265
|
[class.k-grid-content-sticky]="column.sticky"
|
|
17057
|
-
[class.k-touch-action-none]="isSelectable() && $any(selectable).drag"
|
|
17058
|
-
[class.k-touch-action-auto]="!(isSelectable() && $any(selectable).drag)"
|
|
17266
|
+
[class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
|
|
17267
|
+
[class.k-touch-action-auto]="!(isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag)"
|
|
17059
17268
|
[ngClass]="column.cssClass"
|
|
17060
17269
|
[class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
|
|
17061
17270
|
[ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
|
|
@@ -17236,9 +17445,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
17236
17445
|
[ngClass]="rowClass({ dataItem: item.data, index: $any(item).index })"
|
|
17237
17446
|
[class.k-master-row]="true"
|
|
17238
17447
|
[class.k-grid-edit-row]="isEditingRow($any(item).index)"
|
|
17239
|
-
[attr.aria-selected]="lockedColumnsCount < 1 ? isSelectable() && isRowSelected(item) : undefined"
|
|
17448
|
+
[attr.aria-selected]="lockedColumnsCount < 1 ? isSelectable({ dataItem: item.data, index: $any(item).index }) && isRowSelected(item) : undefined"
|
|
17240
17449
|
[attr.data-kendo-grid-item-index]="$any(item).index"
|
|
17241
|
-
[class.k-selected]="isSelectable() && isRowSelected(item)">
|
|
17450
|
+
[class.k-selected]="isSelectable({ dataItem: item.data, index: $any(item).index }) && isRowSelected(item)">
|
|
17242
17451
|
<ng-container *ngIf="!skipGroupDecoration">
|
|
17243
17452
|
<td class="k-group-cell k-table-td" *ngFor="let g of groups" role="presentation"></td>
|
|
17244
17453
|
</ng-container>
|
|
@@ -17281,10 +17490,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
17281
17490
|
[colSpan]="column.colspan"
|
|
17282
17491
|
[attr.role]="column.tableCellsRole"
|
|
17283
17492
|
class="k-table-td"
|
|
17284
|
-
[attr.aria-selected]="lockedColumnsCount < 1 && isSelectable() ? isAriaSelected(item, column) : undefined"
|
|
17493
|
+
[attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
|
|
17285
17494
|
[class.k-grid-content-sticky]="column.sticky"
|
|
17286
|
-
[class.k-touch-action-none]="isSelectable() && $any(selectable).drag"
|
|
17287
|
-
[class.k-touch-action-auto]="!(isSelectable() && $any(selectable).drag)"
|
|
17495
|
+
[class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
|
|
17496
|
+
[class.k-touch-action-auto]="!(isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag)"
|
|
17288
17497
|
[ngClass]="column.cssClass"
|
|
17289
17498
|
[class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
|
|
17290
17499
|
[ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
|
|
@@ -19511,8 +19720,8 @@ const packageMetadata = {
|
|
|
19511
19720
|
name: '@progress/kendo-angular-grid',
|
|
19512
19721
|
productName: 'Kendo UI for Angular',
|
|
19513
19722
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
19514
|
-
publishDate:
|
|
19515
|
-
version: '16.11.0-develop.
|
|
19723
|
+
publishDate: 1727423166,
|
|
19724
|
+
version: '16.11.0-develop.2',
|
|
19516
19725
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
19517
19726
|
};
|
|
19518
19727
|
|
|
@@ -20004,6 +20213,9 @@ class Selection {
|
|
|
20004
20213
|
if (!isPresent(this.ctx.grid.rowSelected)) {
|
|
20005
20214
|
this.ctx.grid.rowSelected = (row) => this.rowSelectionState.has(this.getItemKey(row));
|
|
20006
20215
|
}
|
|
20216
|
+
if (!isPresent(this.ctx.grid.isRowSelectable)) {
|
|
20217
|
+
this.ctx.grid.isRowSelectable = (_row) => Boolean(this.ctx.grid.selectable);
|
|
20218
|
+
}
|
|
20007
20219
|
if (!isPresent(this.ctx.grid.cellSelected)) {
|
|
20008
20220
|
this.ctx.grid.cellSelected = (row, column, colIndex) => {
|
|
20009
20221
|
const contender = this.getSelectionItem(row, column, colIndex);
|
|
@@ -22874,11 +23086,16 @@ class GridComponent {
|
|
|
22874
23086
|
this._data = [];
|
|
22875
23087
|
this.cachedWindowWidth = 0;
|
|
22876
23088
|
this._rowSelected = null;
|
|
23089
|
+
this._isRowSelectable = null;
|
|
22877
23090
|
this._cellSelected = null;
|
|
22878
23091
|
this._rowReorderable = false;
|
|
22879
23092
|
this._navigable = [];
|
|
22880
23093
|
this._size = 'medium';
|
|
22881
23094
|
this._loading = false;
|
|
23095
|
+
/**
|
|
23096
|
+
* @hidden
|
|
23097
|
+
*/
|
|
23098
|
+
this.blockArrowSelection = false;
|
|
22882
23099
|
this.rtl = false;
|
|
22883
23100
|
this._rowClass = () => null;
|
|
22884
23101
|
const isValid = validatePackage(packageMetadata);
|
|
@@ -22924,7 +23141,11 @@ class GridComponent {
|
|
|
22924
23141
|
* ([more information and example]({% slug binding_grid %})).
|
|
22925
23142
|
*/
|
|
22926
23143
|
set data(value) {
|
|
23144
|
+
var _a;
|
|
22927
23145
|
this._data = value;
|
|
23146
|
+
if (this.selectable && ((_a = this.selectableSettings) === null || _a === void 0 ? void 0 : _a.enabled) && this.isVirtual) {
|
|
23147
|
+
this.blockArrowSelection = false;
|
|
23148
|
+
}
|
|
22928
23149
|
if (this.notifyTimeout) {
|
|
22929
23150
|
clearTimeout(this.notifyTimeout);
|
|
22930
23151
|
this.notifyTimeout = null;
|
|
@@ -23151,6 +23372,19 @@ class GridComponent {
|
|
|
23151
23372
|
get rowSelected() {
|
|
23152
23373
|
return this._rowSelected;
|
|
23153
23374
|
}
|
|
23375
|
+
/**
|
|
23376
|
+
* Defines a Boolean function that is executed for each data row in the component.
|
|
23377
|
+
* Determines whether the row will be selectable.
|
|
23378
|
+
*/
|
|
23379
|
+
set isRowSelectable(fn) {
|
|
23380
|
+
if (isDevMode() && typeof fn !== 'function') {
|
|
23381
|
+
throw new Error(GridConfigurationErrorMessages.functionType('isRowSelectable', fn));
|
|
23382
|
+
}
|
|
23383
|
+
this._isRowSelectable = fn;
|
|
23384
|
+
}
|
|
23385
|
+
get isRowSelectable() {
|
|
23386
|
+
return this._isRowSelectable;
|
|
23387
|
+
}
|
|
23154
23388
|
/**
|
|
23155
23389
|
* Defines a function that determines the selected state of a data cell.
|
|
23156
23390
|
* Returns an object with `selected` and `item` properties.
|
|
@@ -23954,6 +24188,12 @@ class GridComponent {
|
|
|
23954
24188
|
get flatData() {
|
|
23955
24189
|
return isArray(this.data) ? this.data : this.data.data;
|
|
23956
24190
|
}
|
|
24191
|
+
/**
|
|
24192
|
+
* @hidden
|
|
24193
|
+
*/
|
|
24194
|
+
updateNavigationMetadata() {
|
|
24195
|
+
this.navigationService.metadata = this.navigationMetadata();
|
|
24196
|
+
}
|
|
23957
24197
|
/**
|
|
23958
24198
|
* @hidden
|
|
23959
24199
|
*/
|
|
@@ -24069,6 +24309,7 @@ class GridComponent {
|
|
|
24069
24309
|
activeService.init({
|
|
24070
24310
|
cellSelected: cellSelectionMode ? this.cellSelected : undefined,
|
|
24071
24311
|
rowSelected: cellSelectionMode ? undefined : this.rowSelected,
|
|
24312
|
+
isRowSelectable: this.isRowSelectable,
|
|
24072
24313
|
selectable: this.selectable,
|
|
24073
24314
|
view: this.view,
|
|
24074
24315
|
columns: cellSelectionMode ? this.columnList.toArray() : undefined
|
|
@@ -24183,8 +24424,12 @@ class GridComponent {
|
|
|
24183
24424
|
filter: filter, group: this.group, skip: 0, sort: this.sort, take: this.pageSize
|
|
24184
24425
|
}))))
|
|
24185
24426
|
.subscribe(x => {
|
|
24427
|
+
var _a;
|
|
24186
24428
|
this.closeCell();
|
|
24187
24429
|
this.cancelCell();
|
|
24430
|
+
if (this.selectable && ((_a = this.selectableSettings) === null || _a === void 0 ? void 0 : _a.enabled) && this.isVirtual) {
|
|
24431
|
+
this.blockArrowSelection = true;
|
|
24432
|
+
}
|
|
24188
24433
|
this.dataStateChange.emit(x);
|
|
24189
24434
|
});
|
|
24190
24435
|
}
|
|
@@ -24370,9 +24615,6 @@ class GridComponent {
|
|
|
24370
24615
|
const headerRows = this.totalColumnLevels + 1 + filterRowOffset + addRowOffset;
|
|
24371
24616
|
return new NavigationMetadata(dataRows, headerRows, isVirtual, this.hasPager, isPresent(this.detailTemplate), this.wrapper, this.virtualColumns, this.columnsContainer);
|
|
24372
24617
|
}
|
|
24373
|
-
updateNavigationMetadata() {
|
|
24374
|
-
this.navigationService.metadata = this.navigationMetadata();
|
|
24375
|
-
}
|
|
24376
24618
|
applyAutoSize() {
|
|
24377
24619
|
const cols = this.columns.filter((c) => this.autoSize ? c.autoSize !== false : c.autoSize);
|
|
24378
24620
|
if (cols.length > 0) {
|
|
@@ -24477,7 +24719,7 @@ class GridComponent {
|
|
|
24477
24719
|
}
|
|
24478
24720
|
}
|
|
24479
24721
|
GridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GridComponent, deps: [{ token: BrowserSupportService }, { token: SelectionService }, { token: CellSelectionService }, { token: i0.ElementRef }, { token: GroupInfoService }, { token: GroupsService }, { token: ChangeNotificationService }, { token: DetailsService }, { token: EditService }, { token: FilterService }, { token: PDFService }, { token: ResponsiveService }, { token: i0.Renderer2 }, { token: ExcelService }, { token: i0.NgZone }, { token: ScrollSyncService }, { token: DomEventsService }, { token: ColumnResizingService }, { token: i0.ChangeDetectorRef }, { token: ColumnReorderService }, { token: ColumnInfoService }, { token: NavigationService }, { token: SortService }, { token: ScrollRequestService }, { token: i1$2.LocalizationService }, { token: ContextService }, { token: SizingOptionsService }, { token: RowReorderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
24480
|
-
GridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GridComponent, isStandalone: true, selector: "kendo-grid", inputs: { data: "data", pageSize: "pageSize", height: "height", rowHeight: "rowHeight", detailRowHeight: "detailRowHeight", skip: "skip", scrollable: "scrollable", selectable: "selectable", sort: "sort", size: "size", trackBy: "trackBy", filter: "filter", group: "group", virtualColumns: "virtualColumns", filterable: "filterable", sortable: "sortable", pageable: "pageable", groupable: "groupable", rowReorderable: "rowReorderable", navigable: "navigable", navigatable: "navigatable", autoSize: "autoSize", rowClass: "rowClass", rowSticky: "rowSticky", rowSelected: "rowSelected", cellSelected: "cellSelected", resizable: "resizable", reorderable: "reorderable", loading: "loading", columnMenu: "columnMenu", hideHeader: "hideHeader", isDetailExpanded: "isDetailExpanded", isGroupExpanded: "isGroupExpanded" }, outputs: { filterChange: "filterChange", pageChange: "pageChange", groupChange: "groupChange", sortChange: "sortChange", selectionChange: "selectionChange", rowReorder: "rowReorder", dataStateChange: "dataStateChange", groupExpand: "groupExpand", groupCollapse: "groupCollapse", detailExpand: "detailExpand", detailCollapse: "detailCollapse", edit: "edit", cancel: "cancel", save: "save", remove: "remove", add: "add", cellClose: "cellClose", cellClick: "cellClick", pdfExport: "pdfExport", excelExport: "excelExport", columnResize: "columnResize", columnReorder: "columnReorder", columnVisibilityChange: "columnVisibilityChange", columnLockedChange: "columnLockedChange", columnStickyChange: "columnStickyChange", scrollBottom: "scrollBottom", contentScroll: "contentScroll" }, host: { properties: { "attr.dir": "this.dir", "class.k-grid": "this.hostClass", "class.k-grid-sm": "this.sizeSmallClass", "class.k-grid-md": "this.sizeMediumClass", "class.k-grid-lockedcolumns": "this.lockedClasses", "class.k-grid-virtual": "this.virtualClasses", "class.k-grid-no-scrollbar": "this.noScrollbarClass" } }, providers: [
|
|
24722
|
+
GridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GridComponent, isStandalone: true, selector: "kendo-grid", inputs: { data: "data", pageSize: "pageSize", height: "height", rowHeight: "rowHeight", detailRowHeight: "detailRowHeight", skip: "skip", scrollable: "scrollable", selectable: "selectable", sort: "sort", size: "size", trackBy: "trackBy", filter: "filter", group: "group", virtualColumns: "virtualColumns", filterable: "filterable", sortable: "sortable", pageable: "pageable", groupable: "groupable", rowReorderable: "rowReorderable", navigable: "navigable", navigatable: "navigatable", autoSize: "autoSize", rowClass: "rowClass", rowSticky: "rowSticky", rowSelected: "rowSelected", isRowSelectable: "isRowSelectable", cellSelected: "cellSelected", resizable: "resizable", reorderable: "reorderable", loading: "loading", columnMenu: "columnMenu", hideHeader: "hideHeader", isDetailExpanded: "isDetailExpanded", isGroupExpanded: "isGroupExpanded" }, outputs: { filterChange: "filterChange", pageChange: "pageChange", groupChange: "groupChange", sortChange: "sortChange", selectionChange: "selectionChange", rowReorder: "rowReorder", dataStateChange: "dataStateChange", groupExpand: "groupExpand", groupCollapse: "groupCollapse", detailExpand: "detailExpand", detailCollapse: "detailCollapse", edit: "edit", cancel: "cancel", save: "save", remove: "remove", add: "add", cellClose: "cellClose", cellClick: "cellClick", pdfExport: "pdfExport", excelExport: "excelExport", columnResize: "columnResize", columnReorder: "columnReorder", columnVisibilityChange: "columnVisibilityChange", columnLockedChange: "columnLockedChange", columnStickyChange: "columnStickyChange", scrollBottom: "scrollBottom", contentScroll: "contentScroll" }, host: { properties: { "attr.dir": "this.dir", "class.k-grid": "this.hostClass", "class.k-grid-sm": "this.sizeSmallClass", "class.k-grid-md": "this.sizeMediumClass", "class.k-grid-lockedcolumns": "this.lockedClasses", "class.k-grid-virtual": "this.virtualClasses", "class.k-grid-no-scrollbar": "this.noScrollbarClass" } }, providers: [
|
|
24481
24723
|
BrowserSupportService,
|
|
24482
24724
|
LocalizationService,
|
|
24483
24725
|
ColumnInfoService,
|
|
@@ -25803,6 +26045,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
25803
26045
|
type: Input
|
|
25804
26046
|
}], rowSelected: [{
|
|
25805
26047
|
type: Input
|
|
26048
|
+
}], isRowSelectable: [{
|
|
26049
|
+
type: Input
|
|
25806
26050
|
}], cellSelected: [{
|
|
25807
26051
|
type: Input
|
|
25808
26052
|
}], resizable: [{
|
|
@@ -26131,6 +26375,7 @@ class DataBindingDirective {
|
|
|
26131
26375
|
}
|
|
26132
26376
|
updateGridData() {
|
|
26133
26377
|
this.grid.data = this.process(this.state);
|
|
26378
|
+
this.grid.updateNavigationMetadata();
|
|
26134
26379
|
this.dataChanged = false;
|
|
26135
26380
|
}
|
|
26136
26381
|
}
|