@progress/kendo-angular-layout 7.1.6 → 7.2.0-dev.202211241203

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 (88) hide show
  1. package/bundles/kendo-angular-layout.umd.js +1 -1
  2. package/common/util.d.ts +4 -0
  3. package/esm2015/avatar/avatar.component.js +3 -3
  4. package/esm2015/avatar.module.js +4 -4
  5. package/esm2015/card/card-actions.component.js +3 -3
  6. package/esm2015/card/card-body.component.js +3 -3
  7. package/esm2015/card/card-footer.component.js +3 -3
  8. package/esm2015/card/card-header.component.js +3 -3
  9. package/esm2015/card/card.component.js +3 -3
  10. package/esm2015/card/directives/card-media.directive.js +3 -3
  11. package/esm2015/card/directives/card-separator.directive.js +3 -3
  12. package/esm2015/card/directives/card-subtitle.directive.js +3 -3
  13. package/esm2015/card/directives/card-title.directive.js +3 -3
  14. package/esm2015/card.module.js +4 -4
  15. package/esm2015/common/util.js +16 -0
  16. package/esm2015/drawer/drawer-container.component.js +3 -3
  17. package/esm2015/drawer/drawer-content.component.js +3 -3
  18. package/esm2015/drawer/drawer.component.js +3 -3
  19. package/esm2015/drawer/drawer.service.js +3 -3
  20. package/esm2015/drawer/item.component.js +3 -3
  21. package/esm2015/drawer/list.component.js +3 -3
  22. package/esm2015/drawer/template-directives/drawer-template.directive.js +3 -3
  23. package/esm2015/drawer/template-directives/footer-template.directive.js +3 -3
  24. package/esm2015/drawer/template-directives/header-template.directive.js +3 -3
  25. package/esm2015/drawer/template-directives/item-template.directive.js +3 -3
  26. package/esm2015/drawer.module.js +4 -4
  27. package/esm2015/expansionpanel/expansionpanel-title.directive.js +3 -3
  28. package/esm2015/expansionpanel/expansionpanel.component.js +3 -3
  29. package/esm2015/expansionpanel.module.js +4 -4
  30. package/esm2015/gridlayout.module.js +4 -4
  31. package/esm2015/layout.module.js +4 -4
  32. package/esm2015/layouts/grid-layout.component.js +3 -3
  33. package/esm2015/layouts/gridlayout-item.component.js +3 -3
  34. package/esm2015/layouts/stack-layout.component.js +3 -3
  35. package/esm2015/package-metadata.js +1 -1
  36. package/esm2015/panelbar/panelbar-content.directive.js +3 -3
  37. package/esm2015/panelbar/panelbar-item-template.directive.js +3 -3
  38. package/esm2015/panelbar/panelbar-item-title.directive.js +3 -3
  39. package/esm2015/panelbar/panelbar-item.component.js +3 -3
  40. package/esm2015/panelbar/panelbar.component.js +3 -3
  41. package/esm2015/panelbar/panelbar.service.js +3 -3
  42. package/esm2015/panelbar.module.js +4 -4
  43. package/esm2015/splitter/splitter-bar.component.js +3 -3
  44. package/esm2015/splitter/splitter-pane.component.js +3 -3
  45. package/esm2015/splitter/splitter.component.js +3 -3
  46. package/esm2015/splitter/splitter.service.js +3 -3
  47. package/esm2015/splitter.module.js +4 -4
  48. package/esm2015/stacklayout.module.js +4 -4
  49. package/esm2015/stepper/list.component.js +3 -3
  50. package/esm2015/stepper/localization/custom-messages.component.js +3 -3
  51. package/esm2015/stepper/localization/localized-messages.directive.js +3 -3
  52. package/esm2015/stepper/localization/messages.js +3 -3
  53. package/esm2015/stepper/step.component.js +3 -3
  54. package/esm2015/stepper/stepper.component.js +3 -3
  55. package/esm2015/stepper/stepper.service.js +3 -3
  56. package/esm2015/stepper/template-directives/indicator-template.directive.js +3 -3
  57. package/esm2015/stepper/template-directives/label-template.directive.js +3 -3
  58. package/esm2015/stepper/template-directives/step-template.directive.js +3 -3
  59. package/esm2015/stepper.module.js +4 -4
  60. package/esm2015/tabstrip/directives/tab-content.directive.js +3 -3
  61. package/esm2015/tabstrip/directives/tab-title.directive.js +3 -3
  62. package/esm2015/tabstrip/localization/custom-messages.component.js +3 -3
  63. package/esm2015/tabstrip/localization/localized-messages.directive.js +3 -3
  64. package/esm2015/tabstrip/localization/messages.js +3 -3
  65. package/esm2015/tabstrip/models/tabstrip-tab.component.js +3 -3
  66. package/esm2015/tabstrip/rendering/tab.component.js +3 -3
  67. package/esm2015/tabstrip/scrollable-button.component.js +3 -3
  68. package/esm2015/tabstrip/tabstrip-scroll.service.js +3 -3
  69. package/esm2015/tabstrip/tabstrip.component.js +3 -3
  70. package/esm2015/tabstrip/tabstrip.service.js +3 -3
  71. package/esm2015/tabstrip.module.js +4 -4
  72. package/esm2015/tilelayout/dragging-service.js +3 -3
  73. package/esm2015/tilelayout/keyboard-navigation.service.js +148 -0
  74. package/esm2015/tilelayout/models/navigation.interface.js +5 -0
  75. package/esm2015/tilelayout/tilelayout-item-body.component.js +3 -3
  76. package/esm2015/tilelayout/tilelayout-item-header.component.js +3 -3
  77. package/esm2015/tilelayout/tilelayout-item.component.js +92 -14
  78. package/esm2015/tilelayout/tilelayout-resize-handle.directive.js +3 -3
  79. package/esm2015/tilelayout/tilelayout.component.js +31 -9
  80. package/esm2015/tilelayout/util.js +51 -1
  81. package/esm2015/tilelayout.module.js +4 -4
  82. package/fesm2015/kendo-angular-layout.js +548 -248
  83. package/package.json +1 -1
  84. package/tilelayout/keyboard-navigation.service.d.ts +34 -0
  85. package/tilelayout/models/navigation.interface.d.ts +17 -0
  86. package/tilelayout/tilelayout-item.component.d.ts +26 -3
  87. package/tilelayout/tilelayout.component.d.ts +13 -3
  88. package/tilelayout/util.d.ts +18 -0
@@ -8,13 +8,15 @@ import { Subscription } from 'rxjs';
8
8
  import { Draggable } from '@progress/kendo-draggable';
9
9
  import { TileLayoutItemComponent } from './tilelayout-item.component';
10
10
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
11
- import { hasObservers } from '@progress/kendo-angular-common';
11
+ import { hasObservers, isChanged } from '@progress/kendo-angular-common';
12
12
  import { validatePackage } from '@progress/kendo-licensing';
13
13
  import { packageMetadata } from '../package-metadata';
14
14
  import { isPresent } from '../common/util';
15
+ import { TileLayoutKeyboardNavigationService } from './keyboard-navigation.service';
15
16
  import * as i0 from "@angular/core";
16
17
  import * as i1 from "@progress/kendo-angular-l10n";
17
18
  import * as i2 from "./dragging-service";
19
+ import * as i3 from "./keyboard-navigation.service";
18
20
  const autoFlowClasses = {
19
21
  column: 'k-grid-flow-col',
20
22
  row: 'k-grid-flow-row',
@@ -25,12 +27,13 @@ const autoFlowClasses = {
25
27
  * Represents the [Kendo UI TileLayout component for Angular]({% slug overview_tilelayout %})
26
28
  */
27
29
  export class TileLayoutComponent {
28
- constructor(elem, renderer, localization, draggingService, zone) {
30
+ constructor(zone, elem, renderer, localization, draggingService, navigationService) {
31
+ this.zone = zone;
29
32
  this.elem = elem;
30
33
  this.renderer = renderer;
31
34
  this.localization = localization;
32
35
  this.draggingService = draggingService;
33
- this.zone = zone;
36
+ this.navigationService = navigationService;
34
37
  /**
35
38
  * Defines the number of columns ([see example]({% slug tiles_tilelayout %}#toc-tile-size-and-position)).
36
39
  * @default 1
@@ -69,6 +72,13 @@ export class TileLayoutComponent {
69
72
  *
70
73
  */
71
74
  this.autoFlow = 'column';
75
+ /**
76
+ * If set to true, the user can use dedicated shortcuts to interact with the TileLayout.
77
+ * By default, navigation is disabled and focusable TileLayout content is a part of the natural tab sequence of the page.
78
+ *
79
+ * @default false
80
+ */
81
+ this.navigable = false;
72
82
  /**
73
83
  * Fires when the user completes the reordering of the item ([see example]({% slug reordering_tilelayout %})).
74
84
  * This event is preventable. If you cancel it, the item will not be reordered.
@@ -80,6 +90,7 @@ export class TileLayoutComponent {
80
90
  */
81
91
  this.resize = new EventEmitter();
82
92
  this.hostClass = true;
93
+ this.hostRole = 'list';
83
94
  this.subs = new Subscription();
84
95
  this._gap = {
85
96
  rows: 16,
@@ -121,6 +132,7 @@ export class TileLayoutComponent {
121
132
  this.applyRowStyling();
122
133
  this.draggingService.reorderable.next(this.reorderable);
123
134
  this.draggingService.resizable.next(this.resizable);
135
+ this.navigationService.navigable.next(this.navigable);
124
136
  if (hasObservers(this.reorder)) {
125
137
  this.subs.add(this.draggingService.reorder.subscribe(e => this.reorder.emit(e)));
126
138
  }
@@ -159,10 +171,10 @@ export class TileLayoutComponent {
159
171
  if (changes.rowHeight) {
160
172
  this.applyRowStyling();
161
173
  }
162
- if (changes.reorderable) {
174
+ if (isChanged('reorderable', changes)) {
163
175
  this.draggingService.reorderable.next(changes.reorderable.currentValue);
164
176
  }
165
- if (changes.resizable) {
177
+ if (isChanged('resizable', changes)) {
166
178
  this.draggingService.resizable.next(changes.resizable.currentValue);
167
179
  }
168
180
  if (changes.gap || changes.autoFlow || changes.columns) {
@@ -171,6 +183,9 @@ export class TileLayoutComponent {
171
183
  this.applyAutoFlow(autoFlowClasses[changes.autoFlow.previousValue] || '', autoFlowClasses[changes.autoFlow.currentValue]);
172
184
  }
173
185
  }
186
+ if (isChanged('navigable', changes)) {
187
+ this.navigationService.navigable.next(changes.navigable.currentValue);
188
+ }
174
189
  }
175
190
  ngOnDestroy() {
176
191
  if (this.draggable) {
@@ -232,10 +247,11 @@ export class TileLayoutComponent {
232
247
  });
233
248
  }
234
249
  }
235
- TileLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i2.TileLayoutDraggingService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
236
- TileLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TileLayoutComponent, selector: "kendo-tilelayout", inputs: { columns: "columns", columnWidth: "columnWidth", gap: "gap", reorderable: "reorderable", resizable: "resizable", rowHeight: "rowHeight", autoFlow: "autoFlow" }, outputs: { reorder: "reorder", resize: "resize" }, host: { properties: { "class.k-widget": "this.hostClass", "class.k-tilelayout": "this.hostClass", "style.gap": "this.gapStyle", "style.padding": "this.gapStyle", "attr.dir": "this.direction" } }, providers: [
250
+ TileLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i2.TileLayoutDraggingService }, { token: i3.TileLayoutKeyboardNavigationService }], target: i0.ɵɵFactoryTarget.Component });
251
+ TileLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TileLayoutComponent, selector: "kendo-tilelayout", inputs: { columns: "columns", columnWidth: "columnWidth", gap: "gap", reorderable: "reorderable", resizable: "resizable", rowHeight: "rowHeight", autoFlow: "autoFlow", navigable: "navigable" }, outputs: { reorder: "reorder", resize: "resize" }, host: { properties: { "class.k-widget": "this.hostClass", "class.k-tilelayout": "this.hostClass", "attr.role": "this.hostRole", "style.gap": "this.gapStyle", "style.padding": "this.gapStyle", "attr.dir": "this.direction" } }, providers: [
237
252
  LocalizationService,
238
253
  TileLayoutDraggingService,
254
+ TileLayoutKeyboardNavigationService,
239
255
  {
240
256
  provide: L10N_PREFIX,
241
257
  useValue: 'kendo.tilelayout.component'
@@ -251,13 +267,14 @@ TileLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
251
267
  [style.gridRowStart]="currentRowStart"
252
268
  [style.zIndex]="'1'"></div>
253
269
  `, isInline: true });
254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutComponent, decorators: [{
270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutComponent, decorators: [{
255
271
  type: Component,
256
272
  args: [{
257
273
  selector: 'kendo-tilelayout',
258
274
  providers: [
259
275
  LocalizationService,
260
276
  TileLayoutDraggingService,
277
+ TileLayoutKeyboardNavigationService,
261
278
  {
262
279
  provide: L10N_PREFIX,
263
280
  useValue: 'kendo.tilelayout.component'
@@ -275,7 +292,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
275
292
  [style.zIndex]="'1'"></div>
276
293
  `
277
294
  }]
278
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i2.TileLayoutDraggingService }, { type: i0.NgZone }]; }, propDecorators: { columns: [{
295
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i2.TileLayoutDraggingService }, { type: i3.TileLayoutKeyboardNavigationService }]; }, propDecorators: { columns: [{
279
296
  type: Input
280
297
  }], columnWidth: [{
281
298
  type: Input
@@ -289,6 +306,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
289
306
  type: Input
290
307
  }], autoFlow: [{
291
308
  type: Input
309
+ }], navigable: [{
310
+ type: Input
292
311
  }], reorder: [{
293
312
  type: Output
294
313
  }], resize: [{
@@ -299,6 +318,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
299
318
  }, {
300
319
  type: HostBinding,
301
320
  args: ['class.k-tilelayout']
321
+ }], hostRole: [{
322
+ type: HostBinding,
323
+ args: ['attr.role']
302
324
  }], gapStyle: [{
303
325
  type: HostBinding,
304
326
  args: ['style.gap']
@@ -2,8 +2,18 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
5
+ import { isDocumentAvailable, Keys } from '@progress/kendo-angular-common';
6
6
  import { isPresent } from '../common/util';
7
+ /**
8
+ * @hidden
9
+ */
10
+ let idx = 0;
11
+ /**
12
+ * @hidden
13
+ */
14
+ export const getId = (prefix) => {
15
+ return `${prefix}-${++idx}`;
16
+ };
7
17
  /**
8
18
  * @hidden
9
19
  */
@@ -85,3 +95,43 @@ export const calculateOrderFromCell = (row, col, items, draggedItem, tileLayoutE
85
95
  });
86
96
  return order;
87
97
  };
98
+ /**
99
+ * @hidden
100
+ */
101
+ export const shouldResize = (keyCode, col, selectedTile, settings) => {
102
+ const resizeRight = keyCode === Keys.ArrowRight && col + selectedTile.colSpan <= settings.columns;
103
+ const resizeLeft = keyCode === Keys.ArrowLeft && selectedTile.colSpan > 1;
104
+ const resizeDown = keyCode === Keys.ArrowDown;
105
+ const resizeUp = keyCode === Keys.ArrowUp && selectedTile.rowSpan > 1;
106
+ return { resizeRight, resizeLeft, resizeDown, resizeUp };
107
+ };
108
+ /**
109
+ * @hidden
110
+ */
111
+ export const shouldReorder = (keyCode, col, selectedTile, settings) => {
112
+ let reorderRight;
113
+ let reorderLeft;
114
+ if (selectedTile.col) {
115
+ reorderRight = keyCode === Keys.ArrowRight && selectedTile.colSpan + col <= settings.columns;
116
+ reorderLeft = keyCode === Keys.ArrowLeft && col > 1;
117
+ }
118
+ else {
119
+ reorderRight = keyCode === Keys.ArrowRight && selectedTile.colSpan + selectedTile.order < settings.items.length;
120
+ reorderLeft = keyCode === Keys.ArrowLeft && selectedTile.order > 0;
121
+ }
122
+ return { reorderLeft, reorderRight };
123
+ };
124
+ /**
125
+ * @hidden
126
+ */
127
+ export const getCurrentCol = (selectedTile, settings, rtl) => {
128
+ const rects = selectedTile.elem.nativeElement.getBoundingClientRect();
129
+ const targetSize = {
130
+ rowSpan: selectedTile.rowSpan,
131
+ colSpan: selectedTile.colSpan
132
+ };
133
+ const width = (rects.width - ((targetSize.colSpan - 1) * settings.gap.columns)) / targetSize.colSpan;
134
+ const height = (rects.height - ((targetSize.rowSpan - 1) * settings.gap.rows)) / targetSize.rowSpan;
135
+ const { col } = calculateCellFromPosition({ x: rects.x, y: rects.y }, settings.tileLayoutElement, settings.gap, { width: width, height: height }, settings.columns, rtl);
136
+ return col;
137
+ };
@@ -32,8 +32,8 @@ const declarations = [
32
32
  */
33
33
  export class TileLayoutModule {
34
34
  }
35
- TileLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
36
- TileLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutModule, declarations: [TileLayoutComponent,
35
+ TileLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
36
+ TileLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutModule, declarations: [TileLayoutComponent,
37
37
  TileLayoutItemComponent,
38
38
  TileLayoutItemHeaderComponent,
39
39
  TileLayoutItemBodyComponent,
@@ -42,8 +42,8 @@ TileLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
42
42
  TileLayoutItemHeaderComponent,
43
43
  TileLayoutItemBodyComponent,
44
44
  TileLayoutResizeHandleDirective] });
45
- TileLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutModule, imports: [[CommonModule]] });
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TileLayoutModule, decorators: [{
45
+ TileLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutModule, imports: [[CommonModule]] });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TileLayoutModule, decorators: [{
47
47
  type: NgModule,
48
48
  args: [{
49
49
  declarations: [declarations],