@progress/kendo-angular-grid 19.3.0-develop.4 → 19.3.0-develop.41

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 (120) hide show
  1. package/columns/columns-container.d.ts +2 -0
  2. package/common/data-layout-mode.d.ts +21 -0
  3. package/common/grid-col-size.d.ts +13 -0
  4. package/common/provider.service.d.ts +2 -0
  5. package/common/toolbar-tool-base.directive.d.ts +1 -0
  6. package/data/data-mapping.service.d.ts +3 -1
  7. package/directives.d.ts +7 -4
  8. package/editing/toolbar-editing-tool-base.directive.d.ts +3 -2
  9. package/editing-directives/editing-directive-base.d.ts +3 -0
  10. package/editing-directives/in-cell-editing.directive.d.ts +1 -1
  11. package/editing-directives/reactive-editing.directive.d.ts +1 -1
  12. package/editing-directives/template-editing.directive.d.ts +1 -1
  13. package/esm2022/adaptiveness/adaptive-renderer.component.mjs +1 -2
  14. package/esm2022/column-menu/column-chooser.component.mjs +1 -1
  15. package/esm2022/column-menu/column-list.component.mjs +8 -7
  16. package/esm2022/column-menu/column-menu-item.directive.mjs +1 -1
  17. package/esm2022/column-menu/column-menu.component.mjs +1 -1
  18. package/esm2022/columns/column-base.mjs +4 -4
  19. package/esm2022/columns/column.component.mjs +1 -1
  20. package/esm2022/columns/columns-container.mjs +3 -0
  21. package/esm2022/common/column-info.service.mjs +1 -1
  22. package/esm2022/common/data-layout-mode.mjs +5 -0
  23. package/esm2022/common/grid-col-size.mjs +5 -0
  24. package/esm2022/common/provider.service.mjs +1 -0
  25. package/esm2022/common/toolbar-tool-base.directive.mjs +6 -2
  26. package/esm2022/data/data-mapping.service.mjs +14 -3
  27. package/esm2022/directives.mjs +8 -1
  28. package/esm2022/editing/form/form-formfield.component.mjs +2 -2
  29. package/esm2022/editing/toolbar-editing-tool-base.directive.mjs +5 -0
  30. package/esm2022/editing-directives/editing-directive-base.mjs +17 -2
  31. package/esm2022/editing-directives/in-cell-editing.directive.mjs +5 -3
  32. package/esm2022/editing-directives/reactive-editing.directive.mjs +1 -1
  33. package/esm2022/editing-directives/template-editing.directive.mjs +1 -1
  34. package/esm2022/filtering/cell/boolean-filter-cell.component.mjs +1 -1
  35. package/esm2022/filtering/cell/date-filter-cell.component.mjs +1 -1
  36. package/esm2022/filtering/cell/filter-cell-operators.component.mjs +3 -4
  37. package/esm2022/filtering/cell/numeric-filter-cell.component.mjs +1 -1
  38. package/esm2022/filtering/cell/string-filter-cell.component.mjs +1 -1
  39. package/esm2022/filtering/filter-row.component.mjs +6 -3
  40. package/esm2022/filtering/menu/boolean-filter-menu.component.mjs +1 -2
  41. package/esm2022/filtering/menu/date-filter-menu-input.component.mjs +1 -1
  42. package/esm2022/filtering/menu/date-filter-menu.component.mjs +1 -1
  43. package/esm2022/filtering/menu/filter-menu-dropdownlist.directive.mjs +1 -1
  44. package/esm2022/filtering/menu/filter-menu-input-wrapper.component.mjs +1 -1
  45. package/esm2022/filtering/menu/filter-menu.component.mjs +1 -1
  46. package/esm2022/filtering/menu/numeric-filter-menu-input.component.mjs +1 -1
  47. package/esm2022/filtering/menu/numeric-filter-menu.component.mjs +1 -1
  48. package/esm2022/filtering/menu/string-filter-menu-input.component.mjs +1 -1
  49. package/esm2022/filtering/menu/string-filter-menu.component.mjs +1 -1
  50. package/esm2022/grid.component.mjs +191 -39
  51. package/esm2022/grid.module.mjs +103 -100
  52. package/esm2022/grouping/group-header.component.mjs +39 -4
  53. package/esm2022/grouping/group-panel.component.mjs +13 -8
  54. package/esm2022/highlight/highlight-item.mjs +5 -0
  55. package/esm2022/highlight/highlight.directive.mjs +132 -0
  56. package/esm2022/index.mjs +4 -0
  57. package/esm2022/localization/messages.mjs +57 -3
  58. package/esm2022/navigation/navigation-cursor.mjs +7 -1
  59. package/esm2022/navigation/navigation-metadata.mjs +3 -1
  60. package/esm2022/navigation/navigation.service.mjs +162 -16
  61. package/esm2022/navigation/toolbar-tool-name.mjs +2 -1
  62. package/esm2022/package-metadata.mjs +2 -2
  63. package/esm2022/pdf/export-element.mjs +14 -5
  64. package/esm2022/pdf/pdf.component.mjs +3 -1
  65. package/esm2022/rendering/cell.component.mjs +466 -188
  66. package/esm2022/rendering/common/col-group.component.mjs +21 -7
  67. package/esm2022/rendering/details-expand.directive.mjs +5 -2
  68. package/esm2022/rendering/footer/footer.component.mjs +117 -54
  69. package/esm2022/rendering/header/header.component.mjs +13 -9
  70. package/esm2022/rendering/list.component.mjs +19 -12
  71. package/esm2022/rendering/loading-template.directive.mjs +1 -0
  72. package/esm2022/rendering/table-body.component.mjs +394 -174
  73. package/esm2022/rendering/toolbar/tools/ai-assistant/ai-assistant.component.mjs +305 -0
  74. package/esm2022/rendering/toolbar/tools/ai-assistant/ai-tool.directive.mjs +269 -0
  75. package/esm2022/rendering/toolbar/tools/ai-assistant/utils.mjs +74 -0
  76. package/esm2022/rendering/toolbar/tools/column-chooser-tool.directive.mjs +0 -3
  77. package/esm2022/rendering/toolbar/tools/group-toolbar-tool.component.mjs +11 -9
  78. package/esm2022/rendering/toolbar/tools/select-all-command-tool.directive.mjs +93 -0
  79. package/esm2022/row-reordering/row-reorder.service.mjs +2 -2
  80. package/esm2022/row-reordering/utils.mjs +6 -4
  81. package/esm2022/selection/cell-selection.service.mjs +6 -3
  82. package/esm2022/selection/pair-set.mjs +87 -10
  83. package/esm2022/selection/selection-checkbox.directive.mjs +1 -1
  84. package/esm2022/selection/selection.directive.mjs +1 -1
  85. package/esm2022/utils.mjs +0 -4
  86. package/fesm2022/progress-kendo-angular-grid.mjs +2568 -642
  87. package/filtering/filter-row.component.d.ts +1 -0
  88. package/grid.component.d.ts +29 -1
  89. package/grid.module.d.ts +102 -99
  90. package/grouping/group-header.component.d.ts +1 -0
  91. package/grouping/group-panel.component.d.ts +1 -1
  92. package/highlight/highlight-item.d.ts +17 -0
  93. package/highlight/highlight.directive.d.ts +56 -0
  94. package/index.d.ts +8 -1
  95. package/localization/messages.d.ts +39 -3
  96. package/navigation/focus-group.d.ts +1 -1
  97. package/navigation/navigation-metadata.d.ts +2 -1
  98. package/navigation/navigation.service.d.ts +6 -0
  99. package/navigation/toolbar-tool-name.d.ts +1 -0
  100. package/package.json +22 -21
  101. package/rendering/cell.component.d.ts +30 -15
  102. package/rendering/common/col-group.component.d.ts +5 -0
  103. package/rendering/details-expand.directive.d.ts +5 -2
  104. package/rendering/footer/footer.component.d.ts +4 -1
  105. package/rendering/header/header.component.d.ts +1 -0
  106. package/rendering/list.component.d.ts +4 -1
  107. package/rendering/loading-template.directive.d.ts +1 -0
  108. package/rendering/table-body.component.d.ts +3 -1
  109. package/rendering/toolbar/tools/ai-assistant/ai-assistant.component.d.ts +49 -0
  110. package/rendering/toolbar/tools/ai-assistant/ai-tool.directive.d.ts +115 -0
  111. package/rendering/toolbar/tools/ai-assistant/utils.d.ts +124 -0
  112. package/rendering/toolbar/tools/column-chooser-tool.directive.d.ts +0 -1
  113. package/rendering/toolbar/tools/select-all-command-tool.directive.d.ts +36 -0
  114. package/row-reordering/row-reorder.service.d.ts +1 -1
  115. package/row-reordering/utils.d.ts +1 -1
  116. package/schematics/ngAdd/index.js +4 -4
  117. package/selection/cell-selection.service.d.ts +1 -0
  118. package/selection/pair-set.d.ts +36 -8
  119. package/selection/selection.directive.d.ts +1 -1
  120. package/utils.d.ts +0 -4
@@ -8,7 +8,7 @@ import { IconWrapperComponent } from '@progress/kendo-angular-icons';
8
8
  import { chevronUpIcon, chevronDownIcon, xCircleIcon, plusCircleIcon, xIcon } from '@progress/kendo-svg-icons';
9
9
  import { KENDO_BUTTON } from '@progress/kendo-angular-buttons';
10
10
  import { take } from 'rxjs/operators';
11
- import { isPresent } from '@progress/kendo-angular-common';
11
+ import { isPresent, Keys, normalizeNumpadKeys } from '@progress/kendo-angular-common';
12
12
  import * as i0 from "@angular/core";
13
13
  import * as i1 from "@progress/kendo-angular-buttons";
14
14
  /**
@@ -172,30 +172,32 @@ export class GroupToolbarToolComponent {
172
172
  this.currentFocusedItemIndex = currentIndex;
173
173
  }
174
174
  handleGroupedKeydown(column, index, ev) {
175
- if (ev.code === 'Enter' || ev.code === 'Backspace' || ev.code === 'Delete') {
175
+ const code = normalizeNumpadKeys(ev);
176
+ if (code === Keys.Enter || code === Keys.Backspace || code === Keys.Delete) {
176
177
  this.removeGroup(column, ev);
177
178
  }
178
- else if (ev.code === 'ArrowUp' && ev.shiftKey) {
179
+ else if (code === Keys.ArrowUp && ev.shiftKey) {
179
180
  this.moveGroupUp(column, ev);
180
181
  }
181
- else if (ev.code === 'ArrowDown' && ev.shiftKey) {
182
+ else if (code === Keys.ArrowDown && ev.shiftKey) {
182
183
  this.moveGroupDown(column, ev);
183
184
  }
184
- else if (ev.code === 'ArrowUp') {
185
+ else if (code === Keys.ArrowUp) {
185
186
  this.navigateToPreviousItem();
186
187
  }
187
- else if (ev.code === 'ArrowDown') {
188
+ else if (code === Keys.ArrowDown) {
188
189
  this.navigateToNextItem();
189
190
  }
190
191
  }
191
192
  handleUngroupedKeydown(column, index, ev) {
192
- if (ev.code === 'Enter') {
193
+ const code = normalizeNumpadKeys(ev);
194
+ if (code === Keys.Enter) {
193
195
  this.addGroup(column, ev);
194
196
  }
195
- else if (ev.code === 'ArrowUp') {
197
+ else if (code === Keys.ArrowUp) {
196
198
  this.navigateToPreviousItem();
197
199
  }
198
- else if (ev.code === 'ArrowDown') {
200
+ else if (code === Keys.ArrowDown) {
199
201
  this.navigateToNextItem();
200
202
  }
201
203
  }
@@ -0,0 +1,93 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, forwardRef } from '@angular/core';
6
+ import { ContextService } from '../../../common/provider.service';
7
+ import { CheckBoxComponent } from '@progress/kendo-angular-inputs';
8
+ import { IdService } from '../../../common/id.service';
9
+ import { ToolBarToolComponent } from '@progress/kendo-angular-toolbar';
10
+ import { SelectAllCheckboxDirective } from '../../../selection/selectall-checkbox.directive';
11
+ import { FocusableDirective } from '../../../navigation/focusable.directive';
12
+ import { LabelDirective } from '@progress/kendo-angular-label';
13
+ import * as i0 from "@angular/core";
14
+ import * as i1 from "../../../common/id.service";
15
+ import * as i2 from "../../../common/provider.service";
16
+ /**
17
+ * Represents the toolbar tool for showing a select-all `kendoGridSelectAllCheckbox` checkbox.
18
+ * Use this component inside a ToolbarComponent in the Grid.
19
+ *
20
+ * @example
21
+ * ```html
22
+ * <kendo-grid>
23
+ * <kendo-toolbar>
24
+ * <kendo-grid-select-all-tool text="Select All"></kendo-grid-select-all-tool>
25
+ * </kendo-toolbar>
26
+ * </kendo-grid>
27
+ * ```
28
+ */
29
+ export class SelectAllToolbarToolComponent extends ToolBarToolComponent {
30
+ idService;
31
+ ctx;
32
+ constructor(idService, ctx) {
33
+ super();
34
+ this.idService = idService;
35
+ this.ctx = ctx;
36
+ }
37
+ /**
38
+ * @hidden
39
+ */
40
+ selectAllCheckboxId() {
41
+ return this.idService.selectAllCheckboxId();
42
+ }
43
+ /**
44
+ * @hidden
45
+ */
46
+ get selectAllCheckboxLabel() {
47
+ return this.ctx.localization.get('selectAllCheckboxLabel');
48
+ }
49
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectAllToolbarToolComponent, deps: [{ token: i1.IdService }, { token: i2.ContextService }], target: i0.ɵɵFactoryTarget.Component });
50
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectAllToolbarToolComponent, isStandalone: true, selector: "kendo-grid-select-all-tool", providers: [
51
+ {
52
+ provide: ToolBarToolComponent,
53
+ useExisting: forwardRef(() => SelectAllToolbarToolComponent)
54
+ }
55
+ ], usesInheritance: true, ngImport: i0, template: `
56
+ <ng-template #toolbarTemplate #sectionTemplate #popupTemplate>
57
+ <kendo-checkbox #checkbox
58
+ [attr.id]="selectAllCheckboxId()"
59
+ size="large"
60
+ [inputAttributes]="{'aria-label': selectAllCheckboxLabel}"
61
+ kendoGridSelectAllCheckbox
62
+ kendoGridFocusable
63
+ ></kendo-checkbox>
64
+ <label class="k-checkbox-label" [for]="checkbox.focusableId">{{selectAllCheckboxLabel}}</label>
65
+ </ng-template>
66
+ `, isInline: true, dependencies: [{ kind: "component", type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["checkedState", "rounded"], outputs: ["checkedStateChange"], exportAs: ["kendoCheckBox"] }, { kind: "directive", type: SelectAllCheckboxDirective, selector: "[kendoGridSelectAllCheckbox]", inputs: ["state"], outputs: ["selectAllChange"] }, { kind: "directive", type: FocusableDirective, selector: "[kendoGridFocusable],\n [kendoGridEditCommand],\n [kendoGridRemoveCommand],\n [kendoGridSaveCommand],\n [kendoGridCancelCommand],\n [kendoGridSelectionCheckbox]\n ", inputs: ["kendoGridFocusable"] }, { kind: "directive", type: LabelDirective, selector: "label[for]", inputs: ["for", "labelClass"] }] });
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectAllToolbarToolComponent, decorators: [{
69
+ type: Component,
70
+ args: [{
71
+ providers: [
72
+ {
73
+ provide: ToolBarToolComponent,
74
+ useExisting: forwardRef(() => SelectAllToolbarToolComponent)
75
+ }
76
+ ],
77
+ selector: 'kendo-grid-select-all-tool',
78
+ template: `
79
+ <ng-template #toolbarTemplate #sectionTemplate #popupTemplate>
80
+ <kendo-checkbox #checkbox
81
+ [attr.id]="selectAllCheckboxId()"
82
+ size="large"
83
+ [inputAttributes]="{'aria-label': selectAllCheckboxLabel}"
84
+ kendoGridSelectAllCheckbox
85
+ kendoGridFocusable
86
+ ></kendo-checkbox>
87
+ <label class="k-checkbox-label" [for]="checkbox.focusableId">{{selectAllCheckboxLabel}}</label>
88
+ </ng-template>
89
+ `,
90
+ standalone: true,
91
+ imports: [CheckBoxComponent, SelectAllCheckboxDirective, FocusableDirective, LabelDirective]
92
+ }]
93
+ }], ctorParameters: function () { return [{ type: i1.IdService }, { type: i2.ContextService }]; } });
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { EventEmitter, Injectable, Output, Renderer2 } from '@angular/core';
6
6
  import { isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
7
- import { getOffset, isNextSibling, isPreviousSibling, dropPosition, hintIcons, hintSVGIcons, hintClasses, hintStyles, dropIndicatorClasses, dropIndicatorStyles, isDifferentParent, defaultSelectors } from './utils';
7
+ import { getOffset, isNextSibling, isPreviousSibling, dropPosition, hintIcons, hintSVGIcons, hintClasses, hintStyles, dropIndicatorClasses, dropIndicatorStyles, isDifferentParent, getDefaultSelectors } from './utils';
8
8
  import * as i0 from "@angular/core";
9
9
  /**
10
10
  * @hidden
@@ -12,7 +12,7 @@ import * as i0 from "@angular/core";
12
12
  export class RowReorderService {
13
13
  renderer;
14
14
  hintElement = null;
15
- defaultSelectors = defaultSelectors;
15
+ defaultSelectors = getDefaultSelectors;
16
16
  hintText = '';
17
17
  skip;
18
18
  dropIndicator;
@@ -77,10 +77,12 @@ export const dropIndicatorClasses = ['k-drop-hint', 'k-drop-hint-h'];
77
77
  /**
78
78
  * @hidden
79
79
  */
80
- export const defaultSelectors = {
81
- handle: '.k-table-td.k-drag-cell',
82
- dragTarget: '.k-master-row',
83
- dropTarget: '.k-master-row'
80
+ export const getDefaultSelectors = (isStacked) => {
81
+ return {
82
+ handle: isStacked ? '.k-grid-stack-cell.k-drag-cell' : '.k-table-td.k-drag-cell',
83
+ dragTarget: '.k-master-row',
84
+ dropTarget: '.k-master-row'
85
+ };
84
86
  };
85
87
  const getDocument = element => element?.ownerDocument.documentElement;
86
88
  const getWindow = element => element?.ownerDocument.defaultView;
@@ -31,7 +31,7 @@ export class CellSelectionService {
31
31
  nonSelectableRows = new Map();
32
32
  get enableMarquee() {
33
33
  const checkboxOnly = this.settings && typeof this.settings === 'object' && this.settings.checkboxOnly;
34
- if (!this.settings || checkboxOnly) {
34
+ if (!this.settings || checkboxOnly || this.settings.isStacked) {
35
35
  return false;
36
36
  }
37
37
  const selectableSettings = this.settings.selectable;
@@ -67,7 +67,7 @@ export class CellSelectionService {
67
67
  this.settings = settings;
68
68
  this.currentSelection = [];
69
69
  this.nonSelectableRows = new Map();
70
- if (settings.selectable && settings.selectable.enabled !== false) {
70
+ if (settings.selectable && settings.selectable.enabled !== false && !settings.isStacked) {
71
71
  const iterator = this.getIterator();
72
72
  let item = iterator.next();
73
73
  while (!item.done) {
@@ -91,7 +91,7 @@ export class CellSelectionService {
91
91
  }
92
92
  }
93
93
  isCellSelected(item, col) {
94
- if (this.settings && this.active) {
94
+ if (this.settings && this.active && !this.settings.isStacked) {
95
95
  const selectedCellArgs = this.settings.cellSelected({ dataItem: item.data, index: item.index }, col, col.leafIndex);
96
96
  return this.options.enabled && selectedCellArgs.selected && !this.nonSelectableRows.has(item.index);
97
97
  }
@@ -102,6 +102,9 @@ export class CellSelectionService {
102
102
  this.dragging = false;
103
103
  return;
104
104
  }
105
+ if (this.settings.isStacked) {
106
+ return;
107
+ }
105
108
  let ev;
106
109
  const ctrlKey = event.ctrlKey || event.metaKey;
107
110
  if (this.options.mode === "single" && ctrlKey && this.isCellSelected(item, item.column)) {
@@ -5,13 +5,17 @@
5
5
  /**
6
6
  * @hidden
7
7
  *
8
- * Quick look-up structure for combinations of keys.
9
- * Similar to the native JS Set, however, working with a couple of keys instead of with a single key.
8
+ * Quick look-up structure for combinations of keys or single keys.
9
+ * Similar to the native JS Set, however, working with single keys or a couple of keys.
10
10
  * Supports both primitive keys and object keys (compared by reference).
11
11
  */
12
12
  export class PairSet {
13
13
  /**
14
- * Gets the total number of X/Y key pairs.
14
+ * Symbol used internally to represent "no Y key" when storing single X keys.
15
+ */
16
+ static SINGLE_KEY_SYMBOL = Symbol('SINGLE_KEY');
17
+ /**
18
+ * Gets the total number of key entries (both single keys and key pairs).
15
19
  */
16
20
  get size() {
17
21
  return this.totalKeysCount;
@@ -19,17 +23,38 @@ export class PairSet {
19
23
  /**
20
24
  * Holds a set of Y keys for each defined X key.
21
25
  * Each X key creates a map which holds a set of Y keys.
26
+ * For single keys, the Y value is the SINGLE_KEY_SYMBOL.
22
27
  *
23
- * Map { 1 => Set { 1, 2, 3 } } // pairs: [1, 1], [1, 2], [1, 3]
28
+ * Map { 'foo' => Set { Symbol(SINGLE_KEY) } } // single key: {x: 'foo'}
29
+ * Map { 'foo2' => Set { 'bar', 'baz' } } // pairs: {x: 'foo2', y: 'bar'}, {x: 'foo2', y: 'baz'}
24
30
  */
25
31
  keysX = new Map();
26
32
  /**
27
- * Count the each added or deleted key manually to avoid iterating over all items when calling `this.size`.
33
+ * Count each added or deleted key manually to avoid iterating over all items when calling `this.size`.
28
34
  */
29
35
  totalKeysCount = 0;
30
36
  constructor(items, keyXField, keyYField) {
31
- if (items && keyXField && keyYField) {
32
- items.forEach(item => this.add(item[keyXField], item[keyYField]));
37
+ if (items && keyXField) {
38
+ items.forEach(item => {
39
+ if (keyYField && item[keyYField] !== undefined) {
40
+ this.add(item[keyXField], item[keyYField]);
41
+ }
42
+ else {
43
+ this.addSingle(item[keyXField]);
44
+ }
45
+ });
46
+ }
47
+ }
48
+ /**
49
+ * Adds a single key entry.
50
+ */
51
+ addSingle(keyX) {
52
+ if (!this.keysX.has(keyX)) {
53
+ this.keysX.set(keyX, new Set());
54
+ }
55
+ if (!this.hasSingle(keyX)) {
56
+ this.keysX.get(keyX).add(PairSet.SINGLE_KEY_SYMBOL);
57
+ this.totalKeysCount += 1;
33
58
  }
34
59
  }
35
60
  /**
@@ -45,14 +70,35 @@ export class PairSet {
45
70
  }
46
71
  }
47
72
  /**
48
- * Adds a combination of a couple of items identified together.
73
+ * Deletes a single key entry.
74
+ */
75
+ deleteSingle(keyX) {
76
+ if (this.hasSingle(keyX)) {
77
+ this.keysX.get(keyX).delete(PairSet.SINGLE_KEY_SYMBOL);
78
+ this.totalKeysCount -= 1;
79
+ if (this.keysX.get(keyX).size === 0) {
80
+ this.keysX.delete(keyX);
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * Deletes a combination of a couple of items identified together.
49
86
  */
50
87
  delete(keyX, keyY) {
51
88
  if (this.has(keyX, keyY)) {
52
89
  this.keysX.get(keyX).delete(keyY);
53
90
  this.totalKeysCount -= 1;
91
+ if (this.keysX.get(keyX).size === 0) {
92
+ this.keysX.delete(keyX);
93
+ }
54
94
  }
55
95
  }
96
+ /**
97
+ * Checks whether a single key is stored.
98
+ */
99
+ hasSingle(keyX) {
100
+ return this.keysX.has(keyX) && this.keysX.get(keyX).has(PairSet.SINGLE_KEY_SYMBOL);
101
+ }
56
102
  /**
57
103
  * Checks whether the defined combination is stored.
58
104
  */
@@ -60,7 +106,23 @@ export class PairSet {
60
106
  return this.keysX.has(keyX) && this.keysX.get(keyX).has(keyY);
61
107
  }
62
108
  /**
63
- * Clears all key combinations.
109
+ * Checks whether any entry exists for the given X key (single or paired).
110
+ */
111
+ hasX(keyX) {
112
+ return this.keysX.has(keyX) && this.keysX.get(keyX).size > 0;
113
+ }
114
+ /**
115
+ * Gets all Y keys for a given X key, excluding single key entries.
116
+ */
117
+ getYKeys(keyX) {
118
+ if (!this.keysX.has(keyX)) {
119
+ return [];
120
+ }
121
+ const yKeys = Array.from(this.keysX.get(keyX));
122
+ return yKeys.filter(yKey => yKey !== PairSet.SINGLE_KEY_SYMBOL);
123
+ }
124
+ /**
125
+ * Clears all key combinations and single keys.
64
126
  */
65
127
  clear() {
66
128
  this.keysX.clear();
@@ -69,12 +131,27 @@ export class PairSet {
69
131
  /**
70
132
  * Converts the persisted data structure to an array of objects,
71
133
  * using the provided field names for the object props.
134
+ * Single keys will only have the keyXField property.
135
+ * Pair keys will have both keyXField and keyYField properties.
72
136
  */
73
137
  toArray(keyXField, keyYField) {
74
138
  return Array.from(this.keysX).reduce((pairs, pair) => {
75
139
  // Array.from(mapInstance) returns an array of arrays [[itemKey1, columnKeysSet1], [itemKey2, columnKeysSet2]]
76
140
  const [keyX, keysY] = pair;
77
- Array.from(keysY).forEach(keyY => pairs.push({ [keyXField]: keyX, [keyYField]: keyY }));
141
+ Array.from(keysY).forEach(keyY => {
142
+ if (keyY === PairSet.SINGLE_KEY_SYMBOL) {
143
+ // Single key entry
144
+ pairs.push({ [keyXField]: keyX });
145
+ }
146
+ else {
147
+ // Pair key entry
148
+ const entry = { [keyXField]: keyX };
149
+ if (keyYField) {
150
+ entry[keyYField] = keyY;
151
+ }
152
+ pairs.push(entry);
153
+ }
154
+ });
78
155
  return pairs;
79
156
  }, []);
80
157
  }
@@ -97,7 +97,7 @@ export class SelectionCheckboxDirective {
97
97
  }
98
98
  }
99
99
  onKeyDown(e) {
100
- if (e.keyCode === Keys.Enter) {
100
+ if (e.code === Keys.Enter || e.code === Keys.NumpadEnter) {
101
101
  this.onClick(e);
102
102
  }
103
103
  }
@@ -12,7 +12,7 @@ import * as i1 from "../common/provider.service";
12
12
  * ([see example]({% slug selection_grid %}#toc-toggling-the-selection-functionality)).
13
13
  *
14
14
  * @example
15
- * ```typescript
15
+ * ```html
16
16
  * <kendo-grid kendoGridSelectBy="ProductID"></kendo-grid>
17
17
  *
18
18
  * <kendo-grid [kendoGridSelectBy]="myKey"></kendo-grid>
package/esm2022/utils.mjs CHANGED
@@ -113,10 +113,6 @@ export const cancelAnimationFrame = wnd.cancelAnimationFrame || wnd.msCancelRequ
113
113
  * @hidden
114
114
  */
115
115
  export const nodesToArray = (nodes) => [].slice.call(nodes);
116
- /**
117
- * @hidden
118
- */
119
- export const replaceMessagePlaceholder = (message, name, value) => (message ?? '').replace(new RegExp(`{\\s*${name}\\s*}`, 'g'), value);
120
116
  /**
121
117
  * @hidden
122
118
  */