@skyux/grids 5.5.0 → 5.6.0

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.
@@ -1,11 +1,9 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChildren, ViewContainerRef, ViewChild, Output, ViewChildren, HostListener, NgModule } from '@angular/core';
3
1
  import * as i8 from '@angular/common';
4
2
  import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { NgModule, ViewContainerRef, Component, ChangeDetectionStrategy, Input, ViewChild, EventEmitter, TemplateRef, ContentChildren, Injectable, Output, ViewChildren, HostListener } from '@angular/core';
5
5
  import * as i10 from '@angular/forms';
6
6
  import { FormsModule } from '@angular/forms';
7
- import * as i2 from 'ng2-dragula';
8
- import { DragulaService, DragulaModule } from 'ng2-dragula';
9
7
  import * as i1 from '@skyux/core';
10
8
  import { SkyAffixAutoFitContext, SkyAffixModule, SkyOverlayModule } from '@skyux/core';
11
9
  import * as i5 from '@skyux/forms';
@@ -16,93 +14,98 @@ import * as i7 from '@skyux/layout';
16
14
  import { SkyInlineDeleteModule } from '@skyux/layout';
17
15
  import * as i9 from '@skyux/popovers';
18
16
  import { SkyPopoverModule } from '@skyux/popovers';
17
+ import * as i2 from 'ng2-dragula';
18
+ import { DragulaService, DragulaModule } from 'ng2-dragula';
19
+ import * as i11 from '@skyux/i18n';
20
+ import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
19
21
  import { getData, ListItemModel } from '@skyux/list-builder-common';
20
22
  import { Subject, BehaviorSubject, fromEvent, merge } from 'rxjs';
21
23
  import { takeUntil, take, map, distinctUntilChanged, takeWhile } from 'rxjs/operators';
22
- import * as i11 from '@skyux/i18n';
23
- import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
24
24
 
25
- const GRID_HEADER_DRAGGING_CLASS = 'sky-grid-header-dragging';
26
- const GRID_HEADER_LOCKED_SELECTOR = '.sky-grid-header-locked';
27
- const GRID_HEADER_RESIZE_HANDLE = '.sky-grid-resize-handle';
28
- const GRID_ROW_DELETE_SELECTOR = '.sky-grid-row-delete-heading';
29
- const GRID_MULTISELECT_SELECTOR = '.sky-grid-multiselect-cell';
30
25
  /**
31
- * @internal
26
+ * NOTICE: DO NOT MODIFY THIS FILE!
27
+ * The contents of this file were automatically generated by
28
+ * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/skyux-grids' schematic.
29
+ * To update this file, simply rerun the command.
32
30
  */
33
- class SkyGridAdapterService {
34
- constructor(rendererFactory) {
35
- this.rendererFactory = rendererFactory;
36
- this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
37
- }
38
- initializeDragAndDrop(dragulaService, dropCallback) {
39
- dragulaService.drag.subscribe(([, source]) => source.classList.add(GRID_HEADER_DRAGGING_CLASS));
40
- dragulaService.dragend.subscribe(([, source]) => source.classList.remove(GRID_HEADER_DRAGGING_CLASS));
41
- dragulaService.drop.subscribe(([, , container]) => {
42
- let columnIds = [];
43
- let nodes = container.querySelectorAll(`th:not(${GRID_MULTISELECT_SELECTOR}):not(${GRID_ROW_DELETE_SELECTOR})`);
44
- for (let i = 0; i < nodes.length; i++) {
45
- let el = nodes[i];
46
- let id = el.getAttribute('sky-cmp-id');
47
- columnIds.push(id);
48
- }
49
- dropCallback(columnIds);
50
- });
51
- dragulaService.setOptions('sky-grid-heading', {
52
- moves: (el, container, handle) => {
53
- const columns = container.querySelectorAll('th div');
54
- const isLeftOfLocked = this.isLeftOfLocked(handle, columns);
55
- return (!el.querySelector(GRID_HEADER_LOCKED_SELECTOR) &&
56
- handle !== undefined &&
57
- !handle.matches(GRID_HEADER_RESIZE_HANDLE) &&
58
- !handle.matches(GRID_MULTISELECT_SELECTOR) &&
59
- !handle.matches(GRID_ROW_DELETE_SELECTOR) &&
60
- !isLeftOfLocked);
61
- },
62
- accepts: (el, target, source, sibling) => {
63
- if (sibling === undefined || !sibling) {
64
- return true;
65
- }
66
- const columns = source.querySelectorAll('th div');
67
- const siblingDiv = sibling.querySelector('div');
68
- const isLeftOfLocked = this.isLeftOfLocked(siblingDiv, columns);
69
- return (!sibling.matches(GRID_HEADER_LOCKED_SELECTOR) &&
70
- !sibling.matches(GRID_HEADER_RESIZE_HANDLE) &&
71
- !isLeftOfLocked);
72
- },
73
- });
31
+ const RESOURCES = {
32
+ 'EN-US': { skyux_grid_multiselect_select_row: { message: 'Select row' } },
33
+ };
34
+ class SkyuxGridsResourcesProvider {
35
+ getString(localeInfo, name) {
36
+ return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
74
37
  }
75
- getRowHeight(el, index) {
76
- return (el.nativeElement.querySelectorAll('tbody tr')[index].scrollHeight + 'px');
38
+ }
39
+ /**
40
+ * Import into any component library module that needs to use resource strings.
41
+ */
42
+ class SkyuxGridsResourcesModule {
43
+ }
44
+ SkyuxGridsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
45
+ SkyuxGridsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, exports: [SkyI18nModule] });
46
+ SkyuxGridsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, providers: [
47
+ {
48
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
49
+ useClass: SkyuxGridsResourcesProvider,
50
+ multi: true,
51
+ },
52
+ ], imports: [SkyI18nModule] });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, decorators: [{
54
+ type: NgModule,
55
+ args: [{
56
+ exports: [SkyI18nModule],
57
+ providers: [
58
+ {
59
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
60
+ useClass: SkyuxGridsResourcesProvider,
61
+ multi: true,
62
+ },
63
+ ],
64
+ }]
65
+ }] });
66
+
67
+ /**
68
+ * @internal
69
+ */
70
+ class SkyGridCellComponent {
71
+ ngOnInit() {
72
+ this.container.createEmbeddedView(this.template, this);
77
73
  }
78
- setStyle(el, style, value) {
79
- if (el) {
80
- this.renderer.setStyle(el.nativeElement, style, value);
81
- }
74
+ get row() {
75
+ return this.item.data;
82
76
  }
83
- isLeftOfLocked(handle, columns) {
84
- let sourceColumn = handle;
85
- for (let column of Array.from(columns)) {
86
- if (column.contains(handle)) {
87
- sourceColumn = column;
88
- }
89
- }
90
- for (let i = columns.length - 1; i >= 0; i--) {
91
- if (columns[i].classList.contains('sky-grid-header-locked')) {
92
- return true;
93
- }
94
- if (columns[i] === sourceColumn) {
95
- break;
96
- }
77
+ get value() {
78
+ if (this.item.data && (this.fieldSelector || this.columnId)) {
79
+ return getData(this.item.data, this.fieldSelector || this.columnId);
97
80
  }
98
- return false;
81
+ return undefined;
99
82
  }
100
83
  }
101
- SkyGridAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
102
- SkyGridAdapterServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService });
103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService, decorators: [{
104
- type: Injectable
105
- }], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
84
+ SkyGridCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
85
+ SkyGridCellComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyGridCellComponent, selector: "sky-grid-cell", inputs: { item: "item", columnId: "columnId", template: "template", fieldSelector: "fieldSelector" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["cell"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #cell></ng-template>', isInline: true, styles: [":host{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;min-height:35px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridCellComponent, decorators: [{
87
+ type: Component,
88
+ args: [{
89
+ selector: 'sky-grid-cell',
90
+ template: '<ng-template #cell></ng-template>',
91
+ styleUrls: ['./grid-cell.component.scss'],
92
+ changeDetection: ChangeDetectionStrategy.OnPush,
93
+ }]
94
+ }], propDecorators: { item: [{
95
+ type: Input
96
+ }], columnId: [{
97
+ type: Input
98
+ }], template: [{
99
+ type: Input
100
+ }], fieldSelector: [{
101
+ type: Input
102
+ }], container: [{
103
+ type: ViewChild,
104
+ args: ['cell', {
105
+ read: ViewContainerRef,
106
+ static: true,
107
+ }]
108
+ }] } });
106
109
 
107
110
  /**
108
111
  * Specifies the column information.
@@ -218,6 +221,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
218
221
  args: [TemplateRef]
219
222
  }] } });
220
223
 
224
+ const GRID_HEADER_DRAGGING_CLASS = 'sky-grid-header-dragging';
225
+ const GRID_HEADER_LOCKED_SELECTOR = '.sky-grid-header-locked';
226
+ const GRID_HEADER_RESIZE_HANDLE = '.sky-grid-resize-handle';
227
+ const GRID_ROW_DELETE_SELECTOR = '.sky-grid-row-delete-heading';
228
+ const GRID_MULTISELECT_SELECTOR = '.sky-grid-multiselect-cell';
229
+ /**
230
+ * @internal
231
+ */
232
+ class SkyGridAdapterService {
233
+ constructor(rendererFactory) {
234
+ this.rendererFactory = rendererFactory;
235
+ this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
236
+ }
237
+ initializeDragAndDrop(dragulaService, dropCallback) {
238
+ dragulaService.drag.subscribe(([, source]) => source.classList.add(GRID_HEADER_DRAGGING_CLASS));
239
+ dragulaService.dragend.subscribe(([, source]) => source.classList.remove(GRID_HEADER_DRAGGING_CLASS));
240
+ dragulaService.drop.subscribe(([, , container]) => {
241
+ const columnIds = [];
242
+ const nodes = container.querySelectorAll(`th:not(${GRID_MULTISELECT_SELECTOR}):not(${GRID_ROW_DELETE_SELECTOR})`);
243
+ for (let i = 0; i < nodes.length; i++) {
244
+ const el = nodes[i];
245
+ const id = el.getAttribute('sky-cmp-id');
246
+ columnIds.push(id);
247
+ }
248
+ dropCallback(columnIds);
249
+ });
250
+ dragulaService.setOptions('sky-grid-heading', {
251
+ moves: (el, container, handle) => {
252
+ const columns = container.querySelectorAll('th div');
253
+ const isLeftOfLocked = this.isLeftOfLocked(handle, columns);
254
+ return (!el.querySelector(GRID_HEADER_LOCKED_SELECTOR) &&
255
+ handle !== undefined &&
256
+ !handle.matches(GRID_HEADER_RESIZE_HANDLE) &&
257
+ !handle.matches(GRID_MULTISELECT_SELECTOR) &&
258
+ !handle.matches(GRID_ROW_DELETE_SELECTOR) &&
259
+ !isLeftOfLocked);
260
+ },
261
+ accepts: (el, target, source, sibling) => {
262
+ if (sibling === undefined || !sibling) {
263
+ return true;
264
+ }
265
+ const columns = source.querySelectorAll('th div');
266
+ const siblingDiv = sibling.querySelector('div');
267
+ const isLeftOfLocked = this.isLeftOfLocked(siblingDiv, columns);
268
+ return (!sibling.matches(GRID_HEADER_LOCKED_SELECTOR) &&
269
+ !sibling.matches(GRID_HEADER_RESIZE_HANDLE) &&
270
+ !isLeftOfLocked);
271
+ },
272
+ });
273
+ }
274
+ getRowHeight(el, index) {
275
+ return (el.nativeElement.querySelectorAll('tbody tr')[index].scrollHeight + 'px');
276
+ }
277
+ setStyle(el, style, value) {
278
+ if (el) {
279
+ this.renderer.setStyle(el.nativeElement, style, value);
280
+ }
281
+ }
282
+ isLeftOfLocked(handle, columns) {
283
+ let sourceColumn = handle;
284
+ for (const column of Array.from(columns)) {
285
+ if (column.contains(handle)) {
286
+ sourceColumn = column;
287
+ }
288
+ }
289
+ for (let i = columns.length - 1; i >= 0; i--) {
290
+ if (columns[i].classList.contains('sky-grid-header-locked')) {
291
+ return true;
292
+ }
293
+ if (columns[i] === sourceColumn) {
294
+ break;
295
+ }
296
+ }
297
+ return false;
298
+ }
299
+ }
300
+ SkyGridAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
301
+ SkyGridAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService });
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridAdapterService, decorators: [{
303
+ type: Injectable
304
+ }], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
305
+
221
306
  /**
222
307
  * @internal
223
308
  */
@@ -275,49 +360,6 @@ var SkyGridSelectedRowsSource;
275
360
  SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["SelectedRowIdsChange"] = 4] = "SelectedRowIdsChange";
276
361
  })(SkyGridSelectedRowsSource || (SkyGridSelectedRowsSource = {}));
277
362
 
278
- /**
279
- * @internal
280
- */
281
- class SkyGridCellComponent {
282
- ngOnInit() {
283
- this.container.createEmbeddedView(this.template, this);
284
- }
285
- get row() {
286
- return this.item.data;
287
- }
288
- get value() {
289
- if (this.item.data && (this.fieldSelector || this.columnId)) {
290
- return getData(this.item.data, this.fieldSelector || this.columnId);
291
- }
292
- return undefined;
293
- }
294
- }
295
- SkyGridCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
296
- SkyGridCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyGridCellComponent, selector: "sky-grid-cell", inputs: { item: "item", columnId: "columnId", template: "template", fieldSelector: "fieldSelector" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["cell"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #cell></ng-template>', isInline: true, styles: [":host{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;min-height:35px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridCellComponent, decorators: [{
298
- type: Component,
299
- args: [{
300
- selector: 'sky-grid-cell',
301
- template: '<ng-template #cell></ng-template>',
302
- styleUrls: ['./grid-cell.component.scss'],
303
- changeDetection: ChangeDetectionStrategy.OnPush,
304
- }]
305
- }], propDecorators: { item: [{
306
- type: Input
307
- }], columnId: [{
308
- type: Input
309
- }], template: [{
310
- type: Input
311
- }], fieldSelector: [{
312
- type: Input
313
- }], container: [{
314
- type: ViewChild,
315
- args: ['cell', {
316
- read: ViewContainerRef,
317
- static: true,
318
- }]
319
- }] } });
320
-
321
363
  let nextId = 0;
322
364
  class SkyGridComponent {
323
365
  constructor(affixService, changeDetector, dragulaService, gridAdapter, overlayService, skyWindow, uiConfigService) {
@@ -401,6 +443,22 @@ class SkyGridComponent {
401
443
  descending: false,
402
444
  });
403
445
  }
446
+ /**
447
+ * Specifies columns and column properties for the grid.
448
+ */
449
+ set columns(newColumns) {
450
+ const oldColumns = this.columns;
451
+ this._columns = newColumns;
452
+ if (oldColumns) {
453
+ this.transferColumnWidths(oldColumns, this.columns);
454
+ this.isResized = false;
455
+ this.setDisplayedColumns(true);
456
+ }
457
+ this.changeDetector.markForCheck();
458
+ }
459
+ get columns() {
460
+ return this._columns;
461
+ }
404
462
  /**
405
463
  * Specifies the columns to display in the grid based on the `id` or `field` properties
406
464
  * of the columns. If no columns are specified, then the grid displays all columns.
@@ -494,7 +552,7 @@ class SkyGridComponent {
494
552
  else {
495
553
  // The rows re-render thus messing up the affixers. We must reaffix them so that things
496
554
  // continue to render correctly.
497
- let rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + id + '"]');
555
+ const rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + id + '"]');
498
556
  this.rowDeleteContents[id].affixer.affixTo(rowElement, {
499
557
  autoFitContext: SkyAffixAutoFitContext.Viewport,
500
558
  isSticky: true,
@@ -530,7 +588,7 @@ class SkyGridComponent {
530
588
  return this.tableElementRef.nativeElement.scrollWidth;
531
589
  }
532
590
  getTableClassNames() {
533
- let classNames = [];
591
+ const classNames = [];
534
592
  if (this.fit !== 'scroll') {
535
593
  classNames.push('sky-grid-fit');
536
594
  }
@@ -540,14 +598,14 @@ class SkyGridComponent {
540
598
  return this.addDelimeter(classNames, ' ');
541
599
  }
542
600
  getTableHeaderClassNames(column) {
543
- let classNames = [];
601
+ const classNames = [];
544
602
  if (column && column.locked) {
545
603
  classNames.push('sky-grid-header-locked');
546
604
  }
547
605
  return this.addDelimeter(classNames, ' ');
548
606
  }
549
607
  getCaretIconNames(column) {
550
- let iconNames = [];
608
+ const iconNames = [];
551
609
  this.getSortDirection(column.field).subscribe((sortDir) => {
552
610
  if (sortDir === 'asc') {
553
611
  iconNames.push('caret-up');
@@ -696,20 +754,20 @@ class SkyGridComponent {
696
754
  }
697
755
  onInputChangeResizeCol(event) {
698
756
  const input = event.target;
699
- let newValue = Number(input.value);
700
- let deltaX = newValue - this.startColumnWidth;
757
+ const newValue = Number(input.value);
758
+ const deltaX = newValue - this.startColumnWidth;
701
759
  this.resizeColumnByIndex(this.activeResizeColumnIndex, newValue, deltaX);
702
760
  const left = input.getBoundingClientRect().left;
703
761
  this.setResizeBarPosition(left);
704
762
  }
705
763
  onResizeHandleMove(event) {
706
- let deltaX = event.pageX - this.xPosStart;
707
- let newColWidth = this.startColumnWidth + deltaX;
764
+ const deltaX = event.pageX - this.xPosStart;
765
+ const newColWidth = this.startColumnWidth + deltaX;
708
766
  if (newColWidth <= this.minColWidth) {
709
767
  event.stopPropagation();
710
768
  return;
711
769
  }
712
- let max = this.getMaxRangeByIndex(this.activeResizeColumnIndex);
770
+ const max = this.getMaxRangeByIndex(this.activeResizeColumnIndex);
713
771
  if (this.fit === 'width' && newColWidth > max) {
714
772
  event.stopPropagation();
715
773
  return;
@@ -728,8 +786,8 @@ class SkyGridComponent {
728
786
  }
729
787
  onResizeHandleRelease(event) {
730
788
  this.showResizeBar = false;
731
- let deltaX = event.pageX - this.xPosStart;
732
- let newColWidth = this.startColumnWidth + deltaX;
789
+ const deltaX = event.pageX - this.xPosStart;
790
+ const newColWidth = this.startColumnWidth + deltaX;
733
791
  this.resizeColumnByIndex(this.activeResizeColumnIndex, newColWidth, deltaX);
734
792
  this.isDraggingResizeHandle = false;
735
793
  this.activeResizeColumnIndex = undefined;
@@ -808,9 +866,9 @@ class SkyGridComponent {
808
866
  const windowSize = this.skyWindow.nativeWindow.innerWidth;
809
867
  this.columnElementRefs.forEach((col) => {
810
868
  if (!this.showTopScroll) {
811
- let computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
812
- let offsetWidth = col.nativeElement.offsetWidth;
813
- let width = Math.max(computedWidth || offsetWidth, this.minColWidth);
869
+ const computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
870
+ const offsetWidth = col.nativeElement.offsetWidth;
871
+ const width = Math.max(computedWidth || offsetWidth, this.minColWidth);
814
872
  columnsWidthTotal = columnsWidthTotal + width;
815
873
  if (columnsWidthTotal > windowSize) {
816
874
  this.showTopScroll = true;
@@ -858,7 +916,7 @@ class SkyGridComponent {
858
916
  id: message.data.promptDeleteRow.id,
859
917
  pending: false,
860
918
  });
861
- let overlay = this.overlayService.create({
919
+ const overlay = this.overlayService.create({
862
920
  enableScroll: true,
863
921
  showBackdrop: false,
864
922
  closeOnNavigation: true,
@@ -882,8 +940,8 @@ class SkyGridComponent {
882
940
  return (elRef.nativeElement.id ===
883
941
  'row-delete-ref-' + message.data.promptDeleteRow.id);
884
942
  });
885
- let affixer = this.affixService.createAffixer(inlineDeleteRef);
886
- let rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + message.data.promptDeleteRow.id + '"]');
943
+ const affixer = this.affixService.createAffixer(inlineDeleteRef);
944
+ const rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + message.data.promptDeleteRow.id + '"]');
887
945
  affixer.affixTo(rowElement, {
888
946
  autoFitContext: SkyAffixAutoFitContext.Viewport,
889
947
  isSticky: true,
@@ -919,23 +977,27 @@ class SkyGridComponent {
919
977
  this.changeDetector.markForCheck();
920
978
  }
921
979
  setDisplayedColumns(respectHidden = false) {
922
- if (this.selectedColumnIds !== undefined) {
923
- // setup displayed columns
924
- this.displayedColumns = this.selectedColumnIds
925
- .filter((columnId) => {
926
- return this.columns.find((column) => column.id === columnId);
927
- })
928
- .map((columnId) => {
929
- return this.columns.filter((column) => column.id === columnId)[0];
930
- });
931
- }
932
- else if (respectHidden) {
933
- this.displayedColumns = this.columns.filter((column) => {
934
- return !column.hidden;
935
- });
936
- }
937
- else {
938
- this.displayedColumns = this.columns;
980
+ /* sanity check */
981
+ /* istanbul ignore else */
982
+ if (this.columns) {
983
+ if (this.selectedColumnIds !== undefined) {
984
+ // setup displayed columns
985
+ this.displayedColumns = this.selectedColumnIds
986
+ .filter((columnId) => {
987
+ return this.columns.find((column) => column.id === columnId);
988
+ })
989
+ .map((columnId) => {
990
+ return this.columns.filter((column) => column.id === columnId)[0];
991
+ });
992
+ }
993
+ else if (respectHidden) {
994
+ this.displayedColumns = this.columns.filter((column) => {
995
+ return !column.hidden;
996
+ });
997
+ }
998
+ else {
999
+ this.displayedColumns = this.columns;
1000
+ }
939
1001
  }
940
1002
  }
941
1003
  transformData() {
@@ -956,7 +1018,7 @@ class SkyGridComponent {
956
1018
  }
957
1019
  }
958
1020
  getGridDataWithSelectedRows() {
959
- let selectedRows = this.getSelectedRows();
1021
+ const selectedRows = this.getSelectedRows();
960
1022
  return this.data.map((item) => {
961
1023
  let checked;
962
1024
  if (item.hasOwnProperty(this.multiselectRowId)) {
@@ -987,15 +1049,13 @@ class SkyGridComponent {
987
1049
  }
988
1050
  updateColumns() {
989
1051
  this.getColumnsFromComponent();
990
- this.setDisplayedColumns(true);
991
- this.changeDetector.markForCheck();
992
1052
  // This set timeout is necessary to ensure the columns have rendered in the grid
993
1053
  setTimeout(() => {
994
1054
  this.checkUserColumnWidthsForScroll();
995
1055
  });
996
1056
  }
997
1057
  resizeColumnByIndex(columnIndex, newColWidth, deltaX) {
998
- let column = this.getColumnModelByIndex(columnIndex);
1058
+ const column = this.getColumnModelByIndex(columnIndex);
999
1059
  // Prevent accidental shrinkage below minimum width.
1000
1060
  if (newColWidth <= this.minColWidth) {
1001
1061
  deltaX = deltaX + this.minColWidth - newColWidth;
@@ -1004,9 +1064,9 @@ class SkyGridComponent {
1004
1064
  // fit=width adds/removes width from the last column
1005
1065
  // fit=scroll adds/removes width from the table
1006
1066
  if (this.fit === 'width') {
1007
- let lastColumn = this.getLastDisplayedColumn();
1067
+ const lastColumn = this.getLastDisplayedColumn();
1008
1068
  // Prevent accidental growth that would bump last column off screen.
1009
- let max = this.getMaxRangeByIndex(columnIndex);
1069
+ const max = this.getMaxRangeByIndex(columnIndex);
1010
1070
  if (newColWidth > max) {
1011
1071
  newColWidth = max;
1012
1072
  deltaX = max - this.startColumnWidth;
@@ -1028,8 +1088,8 @@ class SkyGridComponent {
1028
1088
  // Set column widths based on the width initially given by the browser.
1029
1089
  // computedWidth prevents accidental overflow for browsers with sub-pixel widths.
1030
1090
  this.columnElementRefs.forEach((col, index) => {
1031
- let computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
1032
- let offsetWidth = col.nativeElement.offsetWidth;
1091
+ const computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
1092
+ const offsetWidth = col.nativeElement.offsetWidth;
1033
1093
  /* istanbul ignore next */
1034
1094
  this.getColumnModelByIndex(index).width = Math.max(computedWidth || offsetWidth, this.minColWidth);
1035
1095
  });
@@ -1043,8 +1103,23 @@ class SkyGridComponent {
1043
1103
  }
1044
1104
  this.changeDetector.detectChanges();
1045
1105
  }
1106
+ transferColumnWidths(oldColumns, newColumns) {
1107
+ /* sanity check */
1108
+ /* istanbul ignore else */
1109
+ if (oldColumns && newColumns) {
1110
+ for (const oldColumn of oldColumns) {
1111
+ if (oldColumn.width) {
1112
+ const matchingColumn = newColumns.find((newColumn) => oldColumn.id === newColumn.id);
1113
+ if (matchingColumn && !matchingColumn.width) {
1114
+ matchingColumn.width = oldColumn.width;
1115
+ }
1116
+ }
1117
+ }
1118
+ }
1119
+ this.changeDetector.markForCheck();
1120
+ }
1046
1121
  getColumnWidthModelChange() {
1047
- let columnWidthModelChange = new Array();
1122
+ const columnWidthModelChange = new Array();
1048
1123
  this.columns.forEach((column) => {
1049
1124
  columnWidthModelChange.push({
1050
1125
  id: column.id,
@@ -1055,10 +1130,10 @@ class SkyGridComponent {
1055
1130
  return columnWidthModelChange;
1056
1131
  }
1057
1132
  updateMaxRange() {
1058
- let leftoverWidth = this.getLastDisplayedColumn().width - this.minColWidth;
1133
+ const leftoverWidth = this.getLastDisplayedColumn().width - this.minColWidth;
1059
1134
  this.displayedColumns.forEach((column, index) => {
1060
- let newMaxRange = column.width + leftoverWidth;
1061
- let rangeInput = this.getRangeInputByIndex(index);
1135
+ const newMaxRange = column.width + leftoverWidth;
1136
+ const rangeInput = this.getRangeInputByIndex(index);
1062
1137
  rangeInput.nativeElement.max = newMaxRange;
1063
1138
  rangeInput.nativeElement.setAttribute('aria-valuemax', newMaxRange);
1064
1139
  });
@@ -1066,7 +1141,7 @@ class SkyGridComponent {
1066
1141
  initializeResizeColumn(event) {
1067
1142
  const clickTarget = event.target;
1068
1143
  this.activeResizeColumnIndex = clickTarget.getAttribute('sky-cmp-index');
1069
- let column = this.getColumnModelByIndex(this.activeResizeColumnIndex);
1144
+ const column = this.getColumnModelByIndex(this.activeResizeColumnIndex);
1070
1145
  this.startColumnWidth = column.width;
1071
1146
  }
1072
1147
  resetTableWidth() {
@@ -1084,8 +1159,8 @@ class SkyGridComponent {
1084
1159
  return this.displayedColumns[Number(index)];
1085
1160
  }
1086
1161
  getMaxRangeByIndex(index) {
1087
- let columnElementRef = this.columnElementRefs.find((th) => th.nativeElement.getAttribute('sky-cmp-index') === index);
1088
- let rangeInput = columnElementRef.nativeElement.querySelector('.sky-grid-column-input-aria-only');
1162
+ const columnElementRef = this.columnElementRefs.find((th) => th.nativeElement.getAttribute('sky-cmp-index') === index);
1163
+ const rangeInput = columnElementRef.nativeElement.querySelector('.sky-grid-column-input-aria-only');
1089
1164
  return Number(rangeInput.max);
1090
1165
  }
1091
1166
  getLastDisplayedColumn() {
@@ -1104,7 +1179,7 @@ class SkyGridComponent {
1104
1179
  }
1105
1180
  }
1106
1181
  emitSelectedRows(source) {
1107
- let selectedRows = {
1182
+ const selectedRows = {
1108
1183
  selectedRowIds: this.getSelectedRows(),
1109
1184
  source: source,
1110
1185
  };
@@ -1123,7 +1198,7 @@ class SkyGridComponent {
1123
1198
  });
1124
1199
  }
1125
1200
  isInteractiveElement(event) {
1126
- let interactiveElSelectors = `
1201
+ const interactiveElSelectors = `
1127
1202
  a,
1128
1203
  button,
1129
1204
  input,
@@ -1139,8 +1214,8 @@ class SkyGridComponent {
1139
1214
  return event.target.closest(interactiveElSelectors);
1140
1215
  }
1141
1216
  setResizeBarPosition(xPosition) {
1142
- let parentScroll = this.tableContainerElementRef.nativeElement.scrollLeft;
1143
- let resizeBarX = xPosition -
1217
+ const parentScroll = this.tableContainerElementRef.nativeElement.scrollLeft;
1218
+ const resizeBarX = xPosition -
1144
1219
  this.tableElementRef.nativeElement.getBoundingClientRect().left -
1145
1220
  parentScroll;
1146
1221
  this.gridAdapter.setStyle(this.resizeBar, 'left', resizeBarX + 'px');
@@ -1208,7 +1283,7 @@ class SkyGridComponent {
1208
1283
  }
1209
1284
  }
1210
1285
  SkyGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridComponent, deps: [{ token: i1.SkyAffixService }, { token: i0.ChangeDetectorRef }, { token: i2.DragulaService }, { token: SkyGridAdapterService }, { token: i1.SkyOverlayService }, { token: i1.SkyAppWindowRef }, { token: i1.SkyUIConfigService }], target: i0.ɵɵFactoryTarget.Component });
1211
- SkyGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyGridComponent, selector: "sky-grid", inputs: { columns: "columns", data: "data", enableMultiselect: "enableMultiselect", fit: "fit", hasToolbar: "hasToolbar", height: "height", highlightText: "highlightText", messageStream: "messageStream", multiselectRowId: "multiselectRowId", rowHighlightedId: "rowHighlightedId", selectedColumnIds: "selectedColumnIds", selectedRowIds: "selectedRowIds", settingsKey: "settingsKey", sortField: "sortField", width: "width" }, outputs: { columnWidthChange: "columnWidthChange", multiselectSelectionChange: "multiselectSelectionChange", rowDeleteCancel: "rowDeleteCancel", rowDeleteConfirm: "rowDeleteConfirm", selectedColumnIdsChange: "selectedColumnIdsChange", sortFieldChange: "sortFieldChange" }, host: { listeners: { "window:resize": "onWindowResize()" } }, providers: [SkyGridAdapterService], queries: [{ propertyName: "columnComponents", predicate: SkyGridColumnComponent }], viewQueries: [{ propertyName: "inlineDeleteTemplateRef", first: true, predicate: ["inlineDeleteTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "tableContainerElementRef", first: true, predicate: ["gridContainer"], descendants: true }, { propertyName: "tableElementRef", first: true, predicate: ["gridTable"], descendants: true }, { propertyName: "topScrollContainerElementRef", first: true, predicate: ["topScrollContainer"], descendants: true }, { propertyName: "resizeBar", first: true, predicate: ["resizeBar"], descendants: true }, { propertyName: "columnElementRefs", predicate: ["gridCol"], descendants: true }, { propertyName: "columnRangeInputElementRefs", predicate: ["colSizeRange"], descendants: true }, { propertyName: "inlineDeleteRefs", predicate: ["inlineDeleteRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-grid\">\n <div\n *ngIf=\"showTopScroll\"\n class=\"sky-grid-top-scroll-container\"\n (scroll)=\"onTopScroll($event)\"\n #topScrollContainer\n >\n <div\n class=\"sky-grid-top-scroll\"\n [style.width.px]=\"getTopScrollWidth()\"\n ></div>\n </div>\n <div\n class=\"sky-grid-table-container\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\"\n (scroll)=\"onGridScroll($event)\"\n #gridContainer\n >\n <table class=\"sky-grid-table\" [ngClass]=\"getTableClassNames()\" #gridTable>\n <thead>\n <tr dragula=\"sky-grid-heading\">\n <th\n *ngIf=\"enableMultiselect\"\n class=\"\n sky-grid-heading sky-grid-multiselect-cell sky-grid-header-locked\n \"\n scope=\"col\"\n [style.max-width.px]=\"minColWidth\"\n [style.width.px]=\"minColWidth\"\n >\n <span class=\"screen-reader-only\">\n {{ 'skyux_grid_multiselect_select_row' | skyLibResources }}\n </span>\n </th>\n <th\n *ngFor=\"\n let column of displayedColumns;\n let last = last;\n let i = index\n \"\n class=\"sky-grid-heading sky-field-label\"\n scope=\"col\"\n [attr.sky-cmp-index]=\"i\"\n [attr.sky-cmp-id]=\"column.id || column.field\"\n [attr.aria-sort]=\"getAriaSortDirection(column) | async\"\n [id]=\"'sky-grid-' + gridId + '-column-' + i\"\n [ngClass]=\"'sky-grid-column-alignment-' + column.alignment\"\n [style.max-width.px]=\"column.width\"\n [style.width.px]=\"column.width\"\n [tabIndex]=\"column.isSortable ? 0 : -1\"\n (mouseup)=\"sortByColumn(column)\"\n (keydown)=\"onKeydown($event, column)\"\n (touchmove)=\"onTouchMove($event)\"\n #gridCol\n >\n <div\n class=\"overflow\"\n [ngClass]=\"getTableHeaderClassNames(column)\"\n [style.max-width.px]=\"column.width - 1\"\n [style.width.px]=\"column.width - 1\"\n >\n <span\n *ngIf=\"(getCaretVisibility(column.field) | async) === 'hidden'\"\n class=\"sky-grid-header-caret-hidden-spacing\"\n ></span>\n <!-- The no spacing here is intentional to avoid extra spaces due to these being inline elements -->\n <span class=\"sky-grid-header-text\">{{\n column.heading?.trim()\n }}</span>\n <sky-icon\n class=\"sky-grid-heading-sort\"\n [ngClass]=\"\n 'sky-grid-heading-sort-' +\n (getCaretVisibility(column.field) | async)\n \"\n [icon]=\"getCaretIconNames(column)\"\n >\n </sky-icon>\n <sky-help-inline\n *ngIf=\"column.inlineHelpPopover\"\n [ngClass]=\"{\n 'sky-grid-help-inline-sort-hidden':\n getHelpInlineClass(column.field) | async\n }\"\n [skyPopover]=\"column.inlineHelpPopover\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n </sky-help-inline>\n </div>\n <span\n *ngIf=\"(fit === 'width' && !last) || fit === 'scroll'\"\n aria-hidden=\"true\"\n class=\"sky-grid-resize-handle\"\n tabindex=\"-1\"\n [attr.sky-cmp-index]=\"i\"\n (mousedown)=\"onResizeColumnStart($event)\"\n (touchstart)=\"onResizeColumnStart($event)\"\n >\n </span>\n <input\n aria-label=\"Width of column\"\n class=\"sky-grid-column-input-aria-only\"\n role=\"slider\"\n type=\"range\"\n [attr.aria-controls]=\"'sky-grid-' + gridId + '-column-' + i\"\n [attr.aria-valuemin]=\"minColWidth\"\n [attr.aria-valuemax]=\"maxColWidth\"\n [attr.aria-valuenow]=\"column.width\"\n [attr.sky-cmp-index]=\"i\"\n [min]=\"minColWidth\"\n [max]=\"maxColWidth\"\n [step]=\"columnResizeStep\"\n [(ngModel)]=\"column.width\"\n (blur)=\"onResizeHandleBlur($event)\"\n (focus)=\"onResizeHandleFocus($event)\"\n (keydown)=\"onKeydownResizeCol($event)\"\n (change)=\"onInputChangeResizeCol($event)\"\n #colSizeRange\n />\n </th>\n </tr>\n </thead>\n <tbody class=\"sky-grid-tbody\">\n <tr\n class=\"sky-grid-row\"\n *ngFor=\"let item of items; let i = index\"\n [attr.aria-current]=\"isRowHighlighted(item.id) ? true : null\"\n [attr.aria-selected]=\"item.isSelected\"\n [attr.sky-cmp-id]=\"item.id\"\n [ngClass]=\"{\n 'sky-grid-multiselect-selected-row': item.isSelected,\n 'sky-grid-multiselect-row': enableMultiselect,\n 'sky-grid-row-highlight': isRowHighlighted(item.id)\n }\"\n (click)=\"onRowClick($event, item)\"\n >\n <td\n *ngIf=\"enableMultiselect\"\n class=\"sky-grid-multiselect-cell sky-grid-header-locked\"\n >\n <div\n [style.max-width.px]=\"minColWidth\"\n [style.width.px]=\"minColWidth\"\n >\n <sky-checkbox\n [label]=\"'skyux_grid_multiselect_select_row' | skyLibResources\"\n (change)=\"onMultiselectCheckboxChange()\"\n [(ngModel)]=\"item.isSelected\"\n >\n </sky-checkbox>\n </div>\n </td>\n <td\n *ngFor=\"\n let column of displayedColumns;\n let last = last;\n let i = index\n \"\n class=\"sky-grid-cell\"\n [ngClass]=\"'sky-grid-column-alignment-' + column.alignment\"\n [style.max-width.px]=\"column.width\"\n [style.width.px]=\"column.width\"\n >\n <sky-grid-cell\n [skyHighlight]=\"\n !column.excludeFromHighlighting ? highlightText : undefined\n \"\n [template]=\"column.template || defaultCellTemplate\"\n [fieldSelector]=\"column.field\"\n [item]=\"item\"\n [columnId]=\"column.id\"\n [attr.sky-cmp-id]=\"column.id || column.field\"\n >\n </sky-grid-cell>\n </td>\n </tr>\n </tbody>\n </table>\n <div\n *ngIf=\"showResizeBar\"\n aria-hidden=\"true\"\n id=\"sky-grid-resize-bar\"\n tabindex=\"-1\"\n #resizeBar\n ></div>\n </div>\n</div>\n\n<ng-template #defaultCellTemplate let-row=\"row\" let-value=\"value\">{{\n value\n}}</ng-template>\n\n<ng-template let-item #inlineDeleteTemplateRef>\n <div\n [id]=\"'row-delete-ref-' + item.id\"\n [ngStyle]=\"{\n height: getRowHeight(0),\n position: 'fixed',\n width: tableWidth + 'px'\n }\"\n #inlineDeleteRef\n >\n <sky-inline-delete\n [pending]=\"getRowDeleteItem(item.id).pending\"\n (cancelTriggered)=\"cancelRowDelete(item.id)\"\n (deleteTriggered)=\"confirmRowDelete(item.id)\"\n ></sky-inline-delete>\n </div>\n</ng-template>\n", styles: [".sky-grid{position:relative;display:block}.sky-grid-table-container{overflow:auto}.sky-grid-table{position:relative;table-layout:fixed;border-collapse:collapse;margin:0;font-size:15px;min-width:100%}.sky-grid-table.sky-grid-fit{max-width:100%;width:100%}.sky-grid-tbody{background-color:#fff}.sky-grid-row{border-bottom:1px dotted #cdcfd2}.sky-grid-row:nth-child(odd){background-color:#fbfbfb}.sky-grid-row.sky-grid-row-highlight{border-top:1px solid #0974a1;box-shadow:0 0 0 3px inset #0974a1}.sky-grid-row .sky-grid-cell{padding:0;min-width:10px}.sky-grid-heading{position:relative;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;border-right-width:0px;padding:0;cursor:pointer;background-color:#fff;overflow:visible;background-clip:padding-box;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;user-select:none}.sky-grid-heading:first-child{border-left:1px solid transparent}.sky-grid-heading.sky-grid-header-dragging{background-color:#eeeeef}.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-heading-sort,.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-heading-sort{width:14px}.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-help-inline-sort-hidden,.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-help-inline-sort-hidden{margin-left:-14px;margin-right:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-header-caret-hidden-spacing{padding-left:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-heading-sort-visible{width:14px}.sky-grid-heading div{padding:8px}.sky-grid-heading .overflow{text-overflow:ellipsis;white-space:nowrap;position:relative;z-index:1;overflow:hidden;min-width:100%}.sky-grid-heading .sky-grid-column-input-aria-only{-webkit-appearance:none;-moz-appearance:none;height:100%;width:5px;position:absolute;display:block;top:0;bottom:0;right:0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-track{background:transparent}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-ms-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only:focus{background-color:#00b4f1}.sky-grid-column-alignment-left{text-align:left}.sky-grid-column-alignment-center{text-align:center}.sky-grid-column-alignment-right{text-align:right}.sky-grid-multiselect-cell{padding:0;text-align:center}.sky-grid-multiselect-cell ::ng-deep .sky-switch-control{margin:0 auto}th.sky-grid-multiselect-cell{cursor:default}th.sky-grid-multiselect-cell .screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:none;white-space:nowrap}@-moz-document url-prefix(){.sky-grid-multiselect-row td{border-left:0px solid transparent;border-right:0px solid transparent}}.sky-grid-multiselect-row:hover{background-color:#e9e4f1}.sky-grid-multiselect-row:hover:nth-child(odd){background:#e9e4f1}.sky-grid-multiselect-selected-row{background:#f1eef6;border-top:1px solid #dadbf6;border-bottom:1px solid #dadbf6}.sky-grid-multiselect-selected-row:nth-child(odd){background:#f1eef6}.sky-grid-has-toolbar .sky-grid-heading{border-top-width:0px}.sky-grid-heading-sort.sky-grid-heading-sort-hidden{visibility:hidden}.sky-grid-heading-sort.sky-grid-heading-sort-visible{visibility:visible;padding-left:5px}.sky-grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:30px;z-index:2;min-height:20px;height:100%!important;vertical-align:middle;cursor:col-resize}.sky-grid-resize-handle:hover:after{background-color:#00b4f1}.sky-grid-resize-handle:after{position:absolute;right:0;top:0;bottom:0;width:5px;height:100%;content:\"\"}#sky-grid-resize-bar{position:absolute;top:0;left:0;z-index:99;height:100%;width:5px;background:#00b4f1;opacity:.6}tr{position:relative}.sky-grid-top-scroll-container{overflow:auto}.sky-grid-top-scroll{height:1px}\n"], components: [{ type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i4.λ3, selector: "sky-help-inline", outputs: ["actionClick"] }, { type: i5.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: SkyGridCellComponent, selector: "sky-grid-cell", inputs: ["item", "columnId", "template", "fieldSelector"] }, { type: i7.λ8, selector: "sky-inline-delete", inputs: ["pending"], outputs: ["cancelTriggered", "deleteTriggered"] }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }, { type: i8.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.λ7, selector: "[skyPopover]", inputs: ["skyPopover", "skyPopoverAlignment", "skyPopoverMessageStream", "skyPopoverPlacement", "skyPopoverTrigger"] }, { type: i10.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { type: i10.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i10.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4.λ11, selector: "[skyHighlight]", inputs: ["skyHighlight"] }, { type: i8.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "skyLibResources": i11.SkyLibResourcesPipe, "async": i8.AsyncPipe }, viewProviders: [DragulaService], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1286
+ SkyGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyGridComponent, selector: "sky-grid", inputs: { columns: "columns", data: "data", enableMultiselect: "enableMultiselect", fit: "fit", hasToolbar: "hasToolbar", height: "height", highlightText: "highlightText", messageStream: "messageStream", multiselectRowId: "multiselectRowId", rowHighlightedId: "rowHighlightedId", selectedColumnIds: "selectedColumnIds", selectedRowIds: "selectedRowIds", settingsKey: "settingsKey", sortField: "sortField", width: "width" }, outputs: { columnWidthChange: "columnWidthChange", multiselectSelectionChange: "multiselectSelectionChange", rowDeleteCancel: "rowDeleteCancel", rowDeleteConfirm: "rowDeleteConfirm", selectedColumnIdsChange: "selectedColumnIdsChange", sortFieldChange: "sortFieldChange" }, host: { listeners: { "window:resize": "onWindowResize()" } }, providers: [SkyGridAdapterService], queries: [{ propertyName: "columnComponents", predicate: SkyGridColumnComponent }], viewQueries: [{ propertyName: "inlineDeleteTemplateRef", first: true, predicate: ["inlineDeleteTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "tableContainerElementRef", first: true, predicate: ["gridContainer"], descendants: true }, { propertyName: "tableElementRef", first: true, predicate: ["gridTable"], descendants: true }, { propertyName: "topScrollContainerElementRef", first: true, predicate: ["topScrollContainer"], descendants: true }, { propertyName: "resizeBar", first: true, predicate: ["resizeBar"], descendants: true }, { propertyName: "columnElementRefs", predicate: ["gridCol"], descendants: true }, { propertyName: "columnRangeInputElementRefs", predicate: ["colSizeRange"], descendants: true }, { propertyName: "inlineDeleteRefs", predicate: ["inlineDeleteRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-grid\">\n <div\n *ngIf=\"showTopScroll\"\n class=\"sky-grid-top-scroll-container\"\n (scroll)=\"onTopScroll($event)\"\n #topScrollContainer\n >\n <div\n class=\"sky-grid-top-scroll\"\n [style.width.px]=\"getTopScrollWidth()\"\n ></div>\n </div>\n <div\n class=\"sky-grid-table-container\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\"\n (scroll)=\"onGridScroll($event)\"\n #gridContainer\n >\n <table class=\"sky-grid-table\" [ngClass]=\"getTableClassNames()\" #gridTable>\n <thead>\n <tr dragula=\"sky-grid-heading\">\n <th\n *ngIf=\"enableMultiselect\"\n class=\"\n sky-grid-heading sky-grid-multiselect-cell sky-grid-header-locked\n \"\n scope=\"col\"\n [style.max-width.px]=\"minColWidth\"\n [style.width.px]=\"minColWidth\"\n >\n <span class=\"screen-reader-only\">\n {{ 'skyux_grid_multiselect_select_row' | skyLibResources }}\n </span>\n </th>\n <th\n *ngFor=\"\n let column of displayedColumns;\n let last = last;\n let i = index\n \"\n class=\"sky-grid-heading sky-field-label\"\n scope=\"col\"\n [attr.sky-cmp-index]=\"i\"\n [attr.sky-cmp-id]=\"column.id || column.field\"\n [attr.aria-sort]=\"getAriaSortDirection(column) | async\"\n [id]=\"'sky-grid-' + gridId + '-column-' + i\"\n [ngClass]=\"'sky-grid-column-alignment-' + column.alignment\"\n [style.max-width.px]=\"column.width\"\n [style.width.px]=\"column.width\"\n [tabIndex]=\"column.isSortable ? 0 : -1\"\n (mouseup)=\"sortByColumn(column)\"\n (keydown)=\"onKeydown($event, column)\"\n (touchmove)=\"onTouchMove($event)\"\n #gridCol\n >\n <div\n class=\"overflow\"\n [ngClass]=\"getTableHeaderClassNames(column)\"\n [style.max-width.px]=\"column.width - 1\"\n [style.width.px]=\"column.width - 1\"\n >\n <span\n *ngIf=\"(getCaretVisibility(column.field) | async) === 'hidden'\"\n class=\"sky-grid-header-caret-hidden-spacing\"\n ></span>\n <!-- The no spacing here is intentional to avoid extra spaces due to these being inline elements -->\n <span class=\"sky-grid-header-text\">{{\n column.heading?.trim()\n }}</span>\n <sky-icon\n class=\"sky-grid-heading-sort\"\n [ngClass]=\"\n 'sky-grid-heading-sort-' +\n (getCaretVisibility(column.field) | async)\n \"\n [icon]=\"getCaretIconNames(column)\"\n >\n </sky-icon>\n <sky-help-inline\n *ngIf=\"column.inlineHelpPopover\"\n [ngClass]=\"{\n 'sky-grid-help-inline-sort-hidden':\n getHelpInlineClass(column.field) | async\n }\"\n [skyPopover]=\"column.inlineHelpPopover\"\n (keydown.enter)=\"$event.stopPropagation()\"\n (keydown.space)=\"$event.stopPropagation()\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n </sky-help-inline>\n </div>\n <span\n *ngIf=\"(fit === 'width' && !last) || fit === 'scroll'\"\n aria-hidden=\"true\"\n class=\"sky-grid-resize-handle\"\n tabindex=\"-1\"\n [attr.sky-cmp-index]=\"i\"\n (mousedown)=\"onResizeColumnStart($event)\"\n (touchstart)=\"onResizeColumnStart($event)\"\n >\n </span>\n <input\n aria-label=\"Width of column\"\n class=\"sky-grid-column-input-aria-only\"\n role=\"slider\"\n type=\"range\"\n [attr.aria-controls]=\"'sky-grid-' + gridId + '-column-' + i\"\n [attr.aria-valuemin]=\"minColWidth\"\n [attr.aria-valuemax]=\"maxColWidth\"\n [attr.aria-valuenow]=\"column.width\"\n [attr.sky-cmp-index]=\"i\"\n [min]=\"minColWidth\"\n [max]=\"maxColWidth\"\n [step]=\"columnResizeStep\"\n [(ngModel)]=\"column.width\"\n (blur)=\"onResizeHandleBlur($event)\"\n (focus)=\"onResizeHandleFocus($event)\"\n (keydown)=\"onKeydownResizeCol($event)\"\n (change)=\"onInputChangeResizeCol($event)\"\n #colSizeRange\n />\n </th>\n </tr>\n </thead>\n <tbody class=\"sky-grid-tbody\">\n <tr\n class=\"sky-grid-row\"\n *ngFor=\"let item of items; let i = index\"\n [attr.aria-current]=\"isRowHighlighted(item.id) ? true : null\"\n [attr.sky-cmp-id]=\"item.id\"\n [ngClass]=\"{\n 'sky-grid-multiselect-selected-row': item.isSelected,\n 'sky-grid-multiselect-row': enableMultiselect,\n 'sky-grid-row-highlight': isRowHighlighted(item.id)\n }\"\n (click)=\"onRowClick($event, item)\"\n >\n <td\n *ngIf=\"enableMultiselect\"\n class=\"sky-grid-multiselect-cell sky-grid-header-locked\"\n >\n <div\n [style.max-width.px]=\"minColWidth\"\n [style.width.px]=\"minColWidth\"\n >\n <sky-checkbox\n [label]=\"'skyux_grid_multiselect_select_row' | skyLibResources\"\n (change)=\"onMultiselectCheckboxChange()\"\n [(ngModel)]=\"item.isSelected\"\n >\n </sky-checkbox>\n </div>\n </td>\n <td\n *ngFor=\"\n let column of displayedColumns;\n let last = last;\n let i = index\n \"\n class=\"sky-grid-cell\"\n [ngClass]=\"'sky-grid-column-alignment-' + column.alignment\"\n [style.max-width.px]=\"column.width\"\n [style.width.px]=\"column.width\"\n >\n <sky-grid-cell\n [skyHighlight]=\"\n !column.excludeFromHighlighting ? highlightText : undefined\n \"\n [template]=\"column.template || defaultCellTemplate\"\n [fieldSelector]=\"column.field\"\n [item]=\"item\"\n [columnId]=\"column.id\"\n [attr.sky-cmp-id]=\"column.id || column.field\"\n >\n </sky-grid-cell>\n </td>\n </tr>\n </tbody>\n </table>\n <div\n *ngIf=\"showResizeBar\"\n aria-hidden=\"true\"\n id=\"sky-grid-resize-bar\"\n tabindex=\"-1\"\n #resizeBar\n ></div>\n </div>\n</div>\n\n<ng-template #defaultCellTemplate let-row=\"row\" let-value=\"value\">{{\n value\n}}</ng-template>\n\n<ng-template let-item #inlineDeleteTemplateRef>\n <div\n [id]=\"'row-delete-ref-' + item.id\"\n [ngStyle]=\"{\n height: getRowHeight(0),\n position: 'fixed',\n width: tableWidth + 'px'\n }\"\n #inlineDeleteRef\n >\n <sky-inline-delete\n [pending]=\"getRowDeleteItem(item.id).pending\"\n (cancelTriggered)=\"cancelRowDelete(item.id)\"\n (deleteTriggered)=\"confirmRowDelete(item.id)\"\n ></sky-inline-delete>\n </div>\n</ng-template>\n", styles: [".sky-grid{position:relative;display:block}.sky-grid-table-container{overflow:auto}.sky-grid-table{position:relative;table-layout:fixed;border-collapse:collapse;margin:0;font-size:15px;min-width:100%}.sky-grid-table.sky-grid-fit{max-width:100%;width:100%}.sky-grid-tbody{background-color:#fff}.sky-grid-row{border-bottom:1px dotted #cdcfd2}.sky-grid-row:nth-child(odd){background-color:#fbfbfb}.sky-grid-row.sky-grid-row-highlight{border-top:1px solid #0974a1;box-shadow:0 0 0 3px inset #0974a1}.sky-grid-row .sky-grid-cell{padding:0;min-width:10px}.sky-grid-heading{position:relative;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;border-right-width:0px;padding:0;cursor:pointer;background-color:#fff;overflow:visible;background-clip:padding-box;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;user-select:none}.sky-grid-heading:first-child{border-left:1px solid transparent}.sky-grid-heading.sky-grid-header-dragging{background-color:#eeeeef}.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-heading-sort,.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-heading-sort{width:14px}.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-help-inline-sort-hidden,.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-help-inline-sort-hidden{margin-left:-14px;margin-right:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-header-caret-hidden-spacing{padding-left:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-heading-sort-visible{width:14px}.sky-grid-heading div{padding:8px}.sky-grid-heading .overflow{text-overflow:ellipsis;white-space:nowrap;position:relative;z-index:1;overflow:hidden;min-width:100%}.sky-grid-heading .sky-grid-column-input-aria-only{-webkit-appearance:none;-moz-appearance:none;height:100%;width:5px;position:absolute;display:block;top:0;bottom:0;right:0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-track{background:transparent}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-ms-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-grid-heading .sky-grid-column-input-aria-only:focus{background-color:#00b4f1}.sky-grid-column-alignment-left{text-align:left}.sky-grid-column-alignment-center{text-align:center}.sky-grid-column-alignment-right{text-align:right}.sky-grid-multiselect-cell{padding:0;text-align:center}.sky-grid-multiselect-cell ::ng-deep .sky-switch-control{margin:0 auto}th.sky-grid-multiselect-cell{cursor:default}th.sky-grid-multiselect-cell .screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:none;white-space:nowrap}@-moz-document url-prefix(){.sky-grid-multiselect-row td{border-left:0px solid transparent;border-right:0px solid transparent}}.sky-grid-multiselect-row:hover{background-color:#e9e4f1}.sky-grid-multiselect-row:hover:nth-child(odd){background:#e9e4f1}.sky-grid-multiselect-selected-row{background:#f1eef6;border-top:1px solid #dadbf6;border-bottom:1px solid #dadbf6}.sky-grid-multiselect-selected-row:nth-child(odd){background:#f1eef6}.sky-grid-has-toolbar .sky-grid-heading{border-top-width:0px}.sky-grid-heading-sort.sky-grid-heading-sort-hidden{visibility:hidden}.sky-grid-heading-sort.sky-grid-heading-sort-visible{visibility:visible;padding-left:5px}.sky-grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:30px;z-index:2;min-height:20px;height:100%!important;vertical-align:middle;cursor:col-resize}.sky-grid-resize-handle:hover:after{background-color:#00b4f1}.sky-grid-resize-handle:after{position:absolute;right:0;top:0;bottom:0;width:5px;height:100%;content:\"\"}#sky-grid-resize-bar{position:absolute;top:0;left:0;z-index:99;height:100%;width:5px;background:#00b4f1;opacity:.6}tr{position:relative}.sky-grid-top-scroll-container{overflow:auto}.sky-grid-top-scroll{height:1px}\n"], components: [{ type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i4.λ3, selector: "sky-help-inline", outputs: ["actionClick"] }, { type: i5.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: SkyGridCellComponent, selector: "sky-grid-cell", inputs: ["item", "columnId", "template", "fieldSelector"] }, { type: i7.λ8, selector: "sky-inline-delete", inputs: ["pending"], outputs: ["cancelTriggered", "deleteTriggered"] }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }, { type: i8.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.λ7, selector: "[skyPopover]", inputs: ["skyPopover", "skyPopoverAlignment", "skyPopoverMessageStream", "skyPopoverPlacement", "skyPopoverTrigger"] }, { type: i10.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { type: i10.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i10.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4.λ11, selector: "[skyHighlight]", inputs: ["skyHighlight"] }, { type: i8.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "skyLibResources": i11.SkyLibResourcesPipe, "async": i8.AsyncPipe }, viewProviders: [DragulaService], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1212
1287
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridComponent, decorators: [{
1213
1288
  type: Component,
1214
1289
  args: [{
@@ -1293,48 +1368,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1293
1368
  args: ['window:resize']
1294
1369
  }] } });
1295
1370
 
1296
- /**
1297
- * NOTICE: DO NOT MODIFY THIS FILE!
1298
- * The contents of this file were automatically generated by
1299
- * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/skyux-grids' schematic.
1300
- * To update this file, simply rerun the command.
1301
- */
1302
- const RESOURCES = {
1303
- 'EN-US': { skyux_grid_multiselect_select_row: { message: 'Select row' } },
1304
- };
1305
- class SkyuxGridsResourcesProvider {
1306
- getString(localeInfo, name) {
1307
- return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
1308
- }
1309
- }
1310
- /**
1311
- * Import into any component library module that needs to use resource strings.
1312
- */
1313
- class SkyuxGridsResourcesModule {
1314
- }
1315
- SkyuxGridsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1316
- SkyuxGridsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, exports: [SkyI18nModule] });
1317
- SkyuxGridsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, providers: [
1318
- {
1319
- provide: SKY_LIB_RESOURCES_PROVIDERS,
1320
- useClass: SkyuxGridsResourcesProvider,
1321
- multi: true,
1322
- },
1323
- ], imports: [SkyI18nModule] });
1324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyuxGridsResourcesModule, decorators: [{
1325
- type: NgModule,
1326
- args: [{
1327
- exports: [SkyI18nModule],
1328
- providers: [
1329
- {
1330
- provide: SKY_LIB_RESOURCES_PROVIDERS,
1331
- useClass: SkyuxGridsResourcesProvider,
1332
- multi: true,
1333
- },
1334
- ],
1335
- }]
1336
- }] });
1337
-
1338
1371
  class SkyGridModule {
1339
1372
  }
1340
1373
  SkyGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });