@progress/kendo-angular-grid 18.4.1-develop.2 → 18.5.0-develop.10

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.
Files changed (61) hide show
  1. package/column-menu/column-chooser.component.d.ts +0 -4
  2. package/column-menu/column-menu-item.component.d.ts +3 -4
  3. package/columns/column-base.d.ts +3 -2
  4. package/columns/column.component.d.ts +5 -5
  5. package/common/dom-events.service.d.ts +1 -0
  6. package/common/field-datatype.d.ts +9 -0
  7. package/directives.d.ts +5 -3
  8. package/editing/form/dialog-form.component.d.ts +27 -0
  9. package/editing/form/form-formfield.component.d.ts +24 -0
  10. package/editing/form/form.component.d.ts +28 -0
  11. package/editing/form/index.d.ts +8 -0
  12. package/editing/form/models.d.ts +196 -0
  13. package/editing-directives/editing-directive-base.d.ts +10 -3
  14. package/editing-directives/external-editing.directive.d.ts +46 -0
  15. package/esm2022/column-menu/column-chooser.component.mjs +2 -13
  16. package/esm2022/column-menu/column-list.component.mjs +53 -33
  17. package/esm2022/column-menu/column-menu-item.component.mjs +3 -4
  18. package/esm2022/columns/column-base.mjs +4 -0
  19. package/esm2022/columns/column.component.mjs +0 -4
  20. package/esm2022/common/dom-events.service.mjs +1 -0
  21. package/esm2022/common/field-datatype.mjs +5 -0
  22. package/esm2022/directives.mjs +8 -1
  23. package/esm2022/editing/edit.service.mjs +1 -1
  24. package/esm2022/editing/form/dialog-form.component.mjs +102 -0
  25. package/esm2022/editing/form/form-formfield.component.mjs +161 -0
  26. package/esm2022/editing/form/form.component.mjs +153 -0
  27. package/esm2022/editing/form/index.mjs +8 -0
  28. package/esm2022/editing/form/models.mjs +5 -0
  29. package/esm2022/editing-directives/editing-directive-base.mjs +33 -5
  30. package/esm2022/editing-directives/external-editing.directive.mjs +130 -0
  31. package/esm2022/filtering/cell/filter-cell-host.directive.mjs +5 -5
  32. package/esm2022/filtering/filter-host.directive.mjs +5 -7
  33. package/esm2022/filtering/menu/filter-menu-host.directive.mjs +5 -5
  34. package/esm2022/grid.component.mjs +78 -14
  35. package/esm2022/grid.module.mjs +15 -11
  36. package/esm2022/index.mjs +1 -0
  37. package/esm2022/localization/messages.mjs +62 -1
  38. package/esm2022/navigation/navigation.service.mjs +46 -16
  39. package/esm2022/package-metadata.mjs +2 -2
  40. package/esm2022/rendering/footer/footer.component.mjs +12 -5
  41. package/esm2022/rendering/table-body.component.mjs +1 -1
  42. package/esm2022/selection/cell-selection.service.mjs +12 -4
  43. package/esm2022/selection/marquee.directive.mjs +7 -2
  44. package/esm2022/selection/selection.service.mjs +10 -6
  45. package/esm2022/utils.mjs +10 -1
  46. package/fesm2022/progress-kendo-angular-grid.mjs +858 -141
  47. package/filtering/cell/filter-cell-host.directive.d.ts +2 -2
  48. package/filtering/filter-host.directive.d.ts +2 -3
  49. package/filtering/menu/filter-menu-host.directive.d.ts +2 -2
  50. package/grid.component.d.ts +0 -6
  51. package/grid.module.d.ts +15 -11
  52. package/index.d.ts +3 -0
  53. package/localization/messages.d.ts +46 -1
  54. package/navigation/navigation.service.d.ts +2 -0
  55. package/package.json +19 -19
  56. package/rendering/footer/footer.component.d.ts +3 -1
  57. package/schematics/ngAdd/index.js +4 -4
  58. package/selection/cell-selection.service.d.ts +1 -1
  59. package/selection/selection.service.d.ts +2 -2
  60. package/selection/types.d.ts +5 -0
  61. package/utils.d.ts +5 -0
@@ -27,6 +27,7 @@ export class FooterComponent {
27
27
  lockedColumnsCount = 0;
28
28
  logicalRowIndex = 0;
29
29
  totalColumns;
30
+ totalColumnsCount = 0;
30
31
  get footerClass() {
31
32
  return !this.scrollable;
32
33
  }
@@ -38,6 +39,10 @@ export class FooterComponent {
38
39
  get columnsToRender() {
39
40
  return columnsToRender(this.columns || []);
40
41
  }
42
+ // Number of unlocked columns in the next table, if any
43
+ get unlockedColumnsCount() {
44
+ return this.totalColumnsCount - this.lockedColumnsCount - this.columns.length;
45
+ }
41
46
  trackByIndex(index) {
42
47
  return index;
43
48
  }
@@ -56,15 +61,15 @@ export class FooterComponent {
56
61
  return isColumnGroupComponent(column);
57
62
  }
58
63
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FooterComponent, deps: [{ token: i1.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Component });
59
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FooterComponent, isStandalone: true, selector: "[kendoGridFooter]", inputs: { columns: "columns", groups: "groups", detailTemplate: "detailTemplate", scrollable: "scrollable", lockedColumnsCount: "lockedColumnsCount", logicalRowIndex: "logicalRowIndex", totalColumns: "totalColumns" }, host: { properties: { "class.k-grid-footer": "this.footerClass", "class.k-table-tfoot": "this.hostClass", "attr.role": "this.hostRole" } }, ngImport: i0, template: `
64
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FooterComponent, isStandalone: true, selector: "[kendoGridFooter]", inputs: { columns: "columns", groups: "groups", detailTemplate: "detailTemplate", scrollable: "scrollable", lockedColumnsCount: "lockedColumnsCount", logicalRowIndex: "logicalRowIndex", totalColumns: "totalColumns", totalColumnsCount: "totalColumnsCount" }, host: { properties: { "class.k-grid-footer": "this.footerClass", "class.k-table-tfoot": "this.hostClass", "attr.role": "this.hostRole" } }, ngImport: i0, template: `
60
65
  <ng-container>
61
66
  <tr
62
- [class.k-footer-template]="true"
67
+ class="k-footer-template"
63
68
  kendoGridLogicalRow
64
69
  [logicalRowIndex]="logicalRowIndex"
65
70
  [logicalSlaveRow]="lockedColumnsCount > 0"
66
71
  [logicalCellsCount]="columns.length"
67
- [logicalSlaveCellsCount]="columns.length - lockedColumnsCount"
72
+ [logicalSlaveCellsCount]="unlockedColumnsCount"
68
73
  [totalColumns]="totalColumns"
69
74
  >
70
75
  <td
@@ -109,12 +114,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
109
114
  template: `
110
115
  <ng-container>
111
116
  <tr
112
- [class.k-footer-template]="true"
117
+ class="k-footer-template"
113
118
  kendoGridLogicalRow
114
119
  [logicalRowIndex]="logicalRowIndex"
115
120
  [logicalSlaveRow]="lockedColumnsCount > 0"
116
121
  [logicalCellsCount]="columns.length"
117
- [logicalSlaveCellsCount]="columns.length - lockedColumnsCount"
122
+ [logicalSlaveCellsCount]="unlockedColumnsCount"
118
123
  [totalColumns]="totalColumns"
119
124
  >
120
125
  <td
@@ -168,6 +173,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
168
173
  type: Input
169
174
  }], totalColumns: [{
170
175
  type: Input
176
+ }], totalColumnsCount: [{
177
+ type: Input
171
178
  }], footerClass: [{
172
179
  type: HostBinding,
173
180
  args: ['class.k-grid-footer']
@@ -148,7 +148,7 @@ export class TableBodyComponent {
148
148
  }
149
149
  });
150
150
  const contentColumnsCount = this.totalColumnsCount - this.lockedColumnsCount - allColumnsCount;
151
- const headerFooterColumnsCount = this.totalColumnsCount - this.lockedColumnsCount - (this.allColumns || this.columns).length;
151
+ const headerFooterColumnsCount = this.totalColumnsCount - this.lockedColumnsCount - allColumns.length;
152
152
  return item && this.isDataItem(item) ? contentColumnsCount : headerFooterColumnsCount;
153
153
  }
154
154
  shouldSkipCell(rowIndex, colIndex) {
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Injectable, EventEmitter } from '@angular/core';
6
- import { iterator } from '../utils';
6
+ import { iterator, isMultipleRangesEnabled } from '../utils';
7
7
  import { isPresent } from '../utils';
8
8
  import { DomEventsService } from '../common/dom-events.service';
9
9
  import { LocalDataChangesService } from '../editing/local-data-changes.service';
@@ -116,7 +116,12 @@ export class CellSelectionService {
116
116
  const startColIndex = Math.min(this.lastSelectionItemColIndex, item.column.leafIndex);
117
117
  const endRowIndex = Math.max(this.lastSelectionItemRowIndex, item.index);
118
118
  const endColIndex = Math.max(this.lastSelectionItemColIndex, item.column.leafIndex);
119
- ev = this.selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex);
119
+ const preserveCurrentSelection = isMultipleRangesEnabled(this.settings);
120
+ ev = this.selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex, preserveCurrentSelection);
121
+ if (preserveCurrentSelection) {
122
+ this.lastSelectionItemRowIndex = item.index;
123
+ this.lastSelectionItemColIndex = item.column.leafIndex;
124
+ }
120
125
  }
121
126
  }
122
127
  if (!isPresent(ev)) {
@@ -207,7 +212,7 @@ export class CellSelectionService {
207
212
  }
208
213
  }
209
214
  }
210
- selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex) {
215
+ selectRange(startRowIndex, startColIndex, endRowIndex, endColIndex, preserveSelection = false, existingSelections = []) {
211
216
  const selectedCells = [];
212
217
  const deselectedCells = [];
213
218
  const selectionStartRow = Math.min(startRowIndex, endRowIndex);
@@ -231,7 +236,10 @@ export class CellSelectionService {
231
236
  const isInColRange = selectionStartCol <= col.leafIndex && col.leafIndex <= selectionEndCol;
232
237
  const isInSelectionRect = isInRowRange && isInColRange;
233
238
  if (!isInSelectionRect && selected) {
234
- deselectedCells.push(item);
239
+ const deselectCell = !(preserveSelection || existingSelections.find((value) => value && value.itemKey === item.itemKey && value.columnKey === item.columnKey));
240
+ if (deselectCell) {
241
+ deselectedCells.push(item);
242
+ }
235
243
  }
236
244
  if (isInSelectionRect && !selected && !this.nonSelectableRows.has(idx)) {
237
245
  selectedCells.push(item);
@@ -9,6 +9,7 @@ import { SelectionService } from './selection.service';
9
9
  import { CellSelectionService } from './cell-selection.service';
10
10
  import { take, delay } from 'rxjs/operators';
11
11
  import { merge } from 'rxjs';
12
+ import { isMultipleRangesEnabled } from '../utils';
12
13
  import * as i0 from "@angular/core";
13
14
  import * as i1 from "@progress/kendo-angular-common";
14
15
  import * as i2 from "./selection.service";
@@ -115,13 +116,17 @@ export class GridMarqueeDirective {
115
116
  }
116
117
  endSelection(args) {
117
118
  if (args.type === 'mouseup' || args.type === 'touchend') {
119
+ const modifier = args.originalEvent.ctrlKey || args.originalEvent.metaKey;
120
+ const preserveCurrentSelection = modifier &&
121
+ (isMultipleRangesEnabled(this.selection.settings) ||
122
+ isMultipleRangesEnabled(this.cellSelection.settings));
118
123
  if (this.cellSelection.active) {
119
124
  this.cellSelection.dragging = true;
120
- this.cellSelection.changes.emit(this.cellSelection.selectRange(this.pressTarget.rowIndex, this.pressTarget.column.leafIndex, args.rowIndex, args.column.leafIndex));
125
+ this.cellSelection.changes.emit(this.cellSelection.selectRange(this.pressTarget.rowIndex, this.pressTarget.column.leafIndex, args.rowIndex, args.column.leafIndex, preserveCurrentSelection));
121
126
  }
122
127
  else if (this.selection.active) {
123
128
  this.selection.dragging = true;
124
- this.selection.changes.emit(this.selection.selectRange(this.pressTarget.rowIndex, args.rowIndex));
129
+ this.selection.changes.emit(this.selection.selectRange(this.pressTarget.rowIndex, args.rowIndex, preserveCurrentSelection));
125
130
  }
126
131
  }
127
132
  this.clean();
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Injectable, EventEmitter } from '@angular/core';
6
6
  import { iterator } from '../utils';
7
- import { isPresent } from '../utils';
7
+ import { isPresent, isMultipleRangesEnabled } from '../utils';
8
8
  import { DomEventsService } from '../common/dom-events.service';
9
9
  import { LocalDataChangesService } from '../editing/local-data-changes.service';
10
10
  import { NavigationService } from '../navigation/navigation.service';
@@ -121,7 +121,8 @@ export class SelectionService {
121
121
  ev = this.toggle(item);
122
122
  }
123
123
  else if (event.shiftKey) {
124
- ev = this.addAllTo(item, ctrlKey);
124
+ const preserveCurrentSelection = isMultipleRangesEnabled(this.settings);
125
+ ev = this.addAllTo(item, ctrlKey, preserveCurrentSelection);
125
126
  }
126
127
  }
127
128
  if (!isPresent(ev)) {
@@ -228,7 +229,7 @@ export class SelectionService {
228
229
  item = iterator.next();
229
230
  }
230
231
  }
231
- addAllTo(item, ctrlKey) {
232
+ addAllTo(item, ctrlKey, preserveSelection = false) {
232
233
  const selectedRows = [];
233
234
  const deselectedRows = [];
234
235
  const start = Math.min(this.lastSelectionStartIndex, item.index);
@@ -239,7 +240,7 @@ export class SelectionService {
239
240
  if (next.value && next.value.type === "data") {
240
241
  const idx = next.value.index;
241
242
  const rowArgs = { dataItem: next.value.data, index: idx };
242
- if ((idx < start || idx > end) && this.isSelected(idx) && !ctrlKey) {
243
+ if ((idx < start || idx > end) && this.isSelected(idx) && !ctrlKey && !preserveSelection) {
243
244
  deselectedRows.push(rowArgs);
244
245
  }
245
246
  if ((idx >= start && idx <= end) && !this.isSelected(idx) && !this.nonSelectableRows.has(idx)) {
@@ -296,7 +297,7 @@ export class SelectionService {
296
297
  }
297
298
  this.changes.emit(ev);
298
299
  }
299
- selectRange(startIndex, endIndex) {
300
+ selectRange(startIndex, endIndex, preserveSelection, existingSelections = []) {
300
301
  const selectedRows = [];
301
302
  const deselectedRows = [];
302
303
  const start = Math.min(startIndex, endIndex);
@@ -308,7 +309,10 @@ export class SelectionService {
308
309
  const idx = next.value.index;
309
310
  const rowArgs = { dataItem: next.value.data, index: idx };
310
311
  if ((idx < start || idx > end) && this.isSelected(idx)) {
311
- deselectedRows.push(rowArgs);
312
+ const deselectRow = !(preserveSelection || existingSelections.find((value) => value && value.dataItem === rowArgs.dataItem && value.index === rowArgs.index));
313
+ if (deselectRow) {
314
+ deselectedRows.push(rowArgs);
315
+ }
312
316
  }
313
317
  if ((idx >= start && idx <= end) && !this.isSelected(idx) && !this.nonSelectableRows.has(idx)) {
314
318
  selectedRows.push(rowArgs);
package/esm2022/utils.mjs CHANGED
@@ -128,7 +128,7 @@ export const nodesToArray = (nodes) => [].slice.call(nodes);
128
128
  /**
129
129
  * @hidden
130
130
  */
131
- export const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`\{\\s*${name}\\s*\}`, 'g'), value);
131
+ export const replaceMessagePlaceholder = (message, name, value) => (message ?? '').replace(new RegExp(`{\\s*${name}\\s*}`, 'g'), value);
132
132
  /**
133
133
  * @hidden
134
134
  */
@@ -190,3 +190,12 @@ const findRowSpan = (data, index, field) => {
190
190
  }
191
191
  return rowspan;
192
192
  };
193
+ /**
194
+ * @hidden
195
+ * Determines whether selection of multiple ranges is enabled in the selectable settings.
196
+ */
197
+ export const isMultipleRangesEnabled = (selectableSettings) => {
198
+ return selectableSettings &&
199
+ typeof selectableSettings === 'object' &&
200
+ selectableSettings.selectable.multipleRanges;
201
+ };