@skyux/grids 4.0.6 → 5.0.1

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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/bundles/skyux-grids.umd.js +864 -744
  3. package/bundles/skyux-grids.umd.js.map +1 -1
  4. package/documentation.json +4089 -0
  5. package/esm2015/modules/grid/grid-adapter.service.js +22 -24
  6. package/esm2015/modules/grid/grid-cell.component.js +30 -32
  7. package/esm2015/modules/grid/grid-column.component.js +54 -63
  8. package/esm2015/modules/grid/grid-column.model.js +1 -1
  9. package/esm2015/modules/grid/grid.component.js +216 -210
  10. package/esm2015/modules/grid/grid.module.js +51 -30
  11. package/esm2015/modules/grid/types/grid-column-alignment.js +2 -1
  12. package/esm2015/modules/grid/types/grid-column-description-model-change.js +2 -1
  13. package/esm2015/modules/grid/types/grid-column-heading-model-change.js +2 -1
  14. package/esm2015/modules/grid/types/grid-column-inline-help-popover-model-change.js +2 -1
  15. package/esm2015/modules/grid/types/grid-column-width-model-change.js +2 -1
  16. package/esm2015/modules/grid/types/grid-message-type.js +1 -1
  17. package/esm2015/modules/grid/types/grid-message.js +2 -1
  18. package/esm2015/modules/grid/types/grid-row-delete-cancel-args.js +2 -1
  19. package/esm2015/modules/grid/types/grid-row-delete-config.js +2 -1
  20. package/esm2015/modules/grid/types/grid-row-delete-confirm-args.js +2 -1
  21. package/esm2015/modules/grid/types/grid-row-delete-contents.js +2 -1
  22. package/esm2015/modules/grid/types/grid-selected-rows-model-change.js +2 -1
  23. package/esm2015/modules/grid/types/grid-selected-rows-source.js +1 -1
  24. package/esm2015/modules/grid/types/grid-ui-config.js +2 -1
  25. package/esm2015/modules/shared/skyux-grids-resources.module.js +45 -0
  26. package/esm2015/public-api.js +20 -0
  27. package/esm2015/skyux-grids.js +2 -6
  28. package/fesm2015/skyux-grids.js +486 -482
  29. package/fesm2015/skyux-grids.js.map +1 -1
  30. package/modules/grid/grid-adapter.service.d.ts +3 -0
  31. package/modules/grid/grid-cell.component.d.ts +3 -0
  32. package/modules/grid/grid-column.component.d.ts +5 -1
  33. package/modules/grid/grid.component.d.ts +6 -4
  34. package/modules/grid/grid.module.d.ts +16 -0
  35. package/modules/shared/skyux-grids-resources.module.d.ts +14 -0
  36. package/package.json +15 -30
  37. package/{public_api.d.ts → public-api.d.ts} +0 -0
  38. package/skyux-grids.d.ts +2 -5
  39. package/CHANGELOG.md +0 -188
  40. package/bundles/skyux-grids.umd.min.js +0 -16
  41. package/bundles/skyux-grids.umd.min.js.map +0 -1
  42. package/esm2015/modules/shared/grids-resources.module.js +0 -20
  43. package/esm2015/plugin-resources/grids-resources-provider.js +0 -16
  44. package/esm2015/polyfills.js +0 -29
  45. package/esm2015/public_api.js +0 -9
  46. package/esm5/modules/grid/grid-adapter.service.js +0 -106
  47. package/esm5/modules/grid/grid-cell.component.js +0 -59
  48. package/esm5/modules/grid/grid-column.component.js +0 -129
  49. package/esm5/modules/grid/grid-column.model.js +0 -27
  50. package/esm5/modules/grid/grid.component.js +0 -1016
  51. package/esm5/modules/grid/grid.module.js +0 -53
  52. package/esm5/modules/grid/types/grid-column-alignment.js +0 -1
  53. package/esm5/modules/grid/types/grid-column-description-model-change.js +0 -1
  54. package/esm5/modules/grid/types/grid-column-heading-model-change.js +0 -1
  55. package/esm5/modules/grid/types/grid-column-inline-help-popover-model-change.js +0 -1
  56. package/esm5/modules/grid/types/grid-column-width-model-change.js +0 -1
  57. package/esm5/modules/grid/types/grid-message-type.js +0 -20
  58. package/esm5/modules/grid/types/grid-message.js +0 -1
  59. package/esm5/modules/grid/types/grid-row-delete-cancel-args.js +0 -1
  60. package/esm5/modules/grid/types/grid-row-delete-config.js +0 -1
  61. package/esm5/modules/grid/types/grid-row-delete-confirm-args.js +0 -1
  62. package/esm5/modules/grid/types/grid-row-delete-contents.js +0 -1
  63. package/esm5/modules/grid/types/grid-selected-rows-model-change.js +0 -1
  64. package/esm5/modules/grid/types/grid-selected-rows-source.js +0 -12
  65. package/esm5/modules/grid/types/grid-ui-config.js +0 -1
  66. package/esm5/modules/shared/grids-resources.module.js +0 -23
  67. package/esm5/plugin-resources/grids-resources-provider.js +0 -17
  68. package/esm5/polyfills.js +0 -29
  69. package/esm5/public_api.js +0 -9
  70. package/esm5/skyux-grids.js +0 -9
  71. package/fesm5/skyux-grids.js +0 -1463
  72. package/fesm5/skyux-grids.js.map +0 -1
  73. package/modules/shared/grids-resources.module.d.ts +0 -2
  74. package/plugin-resources/grids-resources-provider.d.ts +0 -5
  75. package/polyfills.d.ts +0 -0
  76. package/skyux-grids.metadata.json +0 -1
  77. package/src/assets/locales/resources_en_US.json +0 -6
@@ -1,1463 +0,0 @@
1
- import { __decorate, __read, __values } from 'tslib';
2
- import { EventEmitter, Input, ContentChildren, TemplateRef, Component, ChangeDetectionStrategy, RendererFactory2, Injectable, ChangeDetectorRef, Output, ViewChildren, ViewChild, HostListener, ViewContainerRef, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { FormsModule } from '@angular/forms';
5
- import { DragulaService, DragulaModule } from 'ng2-dragula';
6
- import { SkyAffixAutoFitContext, SkyAffixService, SkyOverlayService, SkyAppWindowRef, SkyUIConfigService, SkyAffixModule, SkyOverlayModule } from '@skyux/core';
7
- import { SkyCheckboxModule } from '@skyux/forms';
8
- import { SkyHelpInlineModule, SkyIconModule, SkyTextHighlightModule } from '@skyux/indicators';
9
- import { SkyInlineDeleteModule } from '@skyux/layout';
10
- import { SkyPopoverModule } from '@skyux/popovers';
11
- import { Subject, BehaviorSubject, fromEvent, merge } from 'rxjs';
12
- import { takeUntil, take, map, distinctUntilChanged, takeWhile } from 'rxjs/operators';
13
- import { ListItemModel, getData } from '@skyux/list-builder-common';
14
- import { getStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
15
-
16
- var SkyGridMessageType;
17
- (function (SkyGridMessageType) {
18
- /**
19
- * Selects the multiselect checkboxes for all rows in the grid.
20
- */
21
- SkyGridMessageType[SkyGridMessageType["SelectAll"] = 0] = "SelectAll";
22
- /**
23
- * Clears the multiselect checkboxes for all rows in the grid.
24
- */
25
- SkyGridMessageType[SkyGridMessageType["ClearAll"] = 1] = "ClearAll";
26
- /**
27
- * @internal
28
- */
29
- SkyGridMessageType[SkyGridMessageType["PromptDeleteRow"] = 2] = "PromptDeleteRow";
30
- /**
31
- * @internal
32
- */
33
- SkyGridMessageType[SkyGridMessageType["AbortDeleteRow"] = 3] = "AbortDeleteRow";
34
- })(SkyGridMessageType || (SkyGridMessageType = {}));
35
-
36
- /**
37
- * @internal
38
- */
39
- var SkyGridSelectedRowsSource;
40
- (function (SkyGridSelectedRowsSource) {
41
- SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["CheckboxChange"] = 0] = "CheckboxChange";
42
- SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["ClearAll"] = 1] = "ClearAll";
43
- SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["RowClick"] = 2] = "RowClick";
44
- SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["SelectAll"] = 3] = "SelectAll";
45
- SkyGridSelectedRowsSource[SkyGridSelectedRowsSource["SelectedRowIdsChange"] = 4] = "SelectedRowIdsChange";
46
- })(SkyGridSelectedRowsSource || (SkyGridSelectedRowsSource = {}));
47
-
48
- /**
49
- * Specifies the column information.
50
- */
51
- var SkyGridColumnComponent = /** @class */ (function () {
52
- function SkyGridColumnComponent() {
53
- /**
54
- * Specifies the horizontal alignment of the column's data and header.
55
- * @default 'left'
56
- */
57
- this.alignment = 'left';
58
- /**
59
- * Indicates whether the column sorts the grid when users click the column header.
60
- * @default true
61
- */
62
- this.isSortable = true;
63
- /**
64
- * Specifies a search function to apply for the specific column. By default,
65
- * the column executes a string compare on the column data.
66
- * @default (value, searchText) => value.toString().toLowerCase().indexOf(searchText) !== -1
67
- */
68
- /* tslint:disable-next-line:no-input-rename */
69
- this.searchFunction = this.search;
70
- this.descriptionChanges = new EventEmitter();
71
- this.descriptionModelChanges = new EventEmitter();
72
- this.headingChanges = new EventEmitter();
73
- this.headingModelChanges = new EventEmitter();
74
- this.inlineHelpPopoverModelChanges = new EventEmitter();
75
- }
76
- SkyGridColumnComponent.prototype.ngOnChanges = function (changes) {
77
- if (changes.heading && changes.heading.firstChange === false) {
78
- this.headingChanges.emit(this.heading);
79
- this.headingModelChanges.emit({
80
- value: this.heading,
81
- id: this.id,
82
- field: this.field
83
- });
84
- }
85
- if (changes.description && changes.description.firstChange === false) {
86
- this.descriptionChanges.emit(this.description);
87
- this.descriptionModelChanges.emit({
88
- value: this.description,
89
- id: this.id,
90
- field: this.field
91
- });
92
- }
93
- if (changes.inlineHelpPopover && changes.inlineHelpPopover.firstChange === false) {
94
- this.inlineHelpPopoverModelChanges.emit({
95
- value: this.inlineHelpPopover,
96
- id: this.id,
97
- field: this.field
98
- });
99
- }
100
- };
101
- Object.defineProperty(SkyGridColumnComponent.prototype, "template", {
102
- get: function () {
103
- if (this.templates.length > 0) {
104
- return this.templates.first;
105
- }
106
- return this.templateInput;
107
- },
108
- enumerable: true,
109
- configurable: true
110
- });
111
- SkyGridColumnComponent.prototype.search = function (value, searchText) {
112
- /* tslint:disable:no-null-keyword */
113
- if (value !== undefined && value !== null) {
114
- return value.toString().toLowerCase().indexOf(searchText) !== -1;
115
- }
116
- /* tslint:enable */
117
- return false;
118
- };
119
- __decorate([
120
- Input()
121
- ], SkyGridColumnComponent.prototype, "alignment", void 0);
122
- __decorate([
123
- Input()
124
- ], SkyGridColumnComponent.prototype, "description", void 0);
125
- __decorate([
126
- Input()
127
- ], SkyGridColumnComponent.prototype, "excludeFromHighlighting", void 0);
128
- __decorate([
129
- Input()
130
- ], SkyGridColumnComponent.prototype, "field", void 0);
131
- __decorate([
132
- Input()
133
- ], SkyGridColumnComponent.prototype, "heading", void 0);
134
- __decorate([
135
- Input()
136
- ], SkyGridColumnComponent.prototype, "hidden", void 0);
137
- __decorate([
138
- Input()
139
- ], SkyGridColumnComponent.prototype, "id", void 0);
140
- __decorate([
141
- Input()
142
- ], SkyGridColumnComponent.prototype, "inlineHelpPopover", void 0);
143
- __decorate([
144
- Input()
145
- ], SkyGridColumnComponent.prototype, "isSortable", void 0);
146
- __decorate([
147
- Input()
148
- ], SkyGridColumnComponent.prototype, "locked", void 0);
149
- __decorate([
150
- Input('search')
151
- ], SkyGridColumnComponent.prototype, "searchFunction", void 0);
152
- __decorate([
153
- Input()
154
- ], SkyGridColumnComponent.prototype, "type", void 0);
155
- __decorate([
156
- Input('template')
157
- ], SkyGridColumnComponent.prototype, "templateInput", void 0);
158
- __decorate([
159
- Input()
160
- ], SkyGridColumnComponent.prototype, "width", void 0);
161
- __decorate([
162
- ContentChildren(TemplateRef)
163
- ], SkyGridColumnComponent.prototype, "templates", void 0);
164
- SkyGridColumnComponent = __decorate([
165
- Component({
166
- selector: 'sky-grid-column',
167
- template: '<ng-content></ng-content>',
168
- changeDetection: ChangeDetectionStrategy.OnPush
169
- })
170
- ], SkyGridColumnComponent);
171
- return SkyGridColumnComponent;
172
- }());
173
-
174
- /**
175
- * @internal
176
- */
177
- var SkyGridColumnModel = /** @class */ (function () {
178
- function SkyGridColumnModel(template, data) {
179
- this.isSortable = true;
180
- this.template = template;
181
- if (data) {
182
- this.id = data.id || data.field;
183
- this.type = data.type;
184
- this.field = data.field;
185
- this.heading = data.heading;
186
- this.inlineHelpPopover = data.inlineHelpPopover;
187
- this.width = data.width ? Number(data.width) : undefined;
188
- this.hidden = data.hidden;
189
- this.locked = data.locked;
190
- this.description = data.description;
191
- this.searchFunction = data.searchFunction;
192
- this.isSortable = data.isSortable;
193
- this.excludeFromHighlighting = data.excludeFromHighlighting;
194
- this.alignment = data.alignment;
195
- }
196
- }
197
- return SkyGridColumnModel;
198
- }());
199
-
200
- var GRID_HEADER_DRAGGING_CLASS = 'sky-grid-header-dragging';
201
- var GRID_HEADER_LOCKED_SELECTOR = '.sky-grid-header-locked';
202
- var GRID_HEADER_RESIZE_HANDLE = '.sky-grid-resize-handle';
203
- var GRID_ROW_DELETE_SELECTOR = '.sky-grid-row-delete-heading';
204
- var GRID_MULTISELECT_SELECTOR = '.sky-grid-multiselect-cell';
205
- /**
206
- * @internal
207
- */
208
- var SkyGridAdapterService = /** @class */ (function () {
209
- function SkyGridAdapterService(rendererFactory) {
210
- this.rendererFactory = rendererFactory;
211
- this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
212
- }
213
- SkyGridAdapterService.prototype.initializeDragAndDrop = function (dragulaService, dropCallback) {
214
- var _this = this;
215
- dragulaService.drag.subscribe(function (_a) {
216
- var _b = __read(_a, 2), source = _b[1];
217
- return source.classList.add(GRID_HEADER_DRAGGING_CLASS);
218
- });
219
- dragulaService.dragend.subscribe(function (_a) {
220
- var _b = __read(_a, 2), source = _b[1];
221
- return source.classList.remove(GRID_HEADER_DRAGGING_CLASS);
222
- });
223
- dragulaService.drop.subscribe(function (_a) {
224
- var _b = __read(_a, 3), container = _b[2];
225
- var columnIds = [];
226
- var nodes = container.querySelectorAll("th:not(" + GRID_MULTISELECT_SELECTOR + "):not(" + GRID_ROW_DELETE_SELECTOR + ")");
227
- for (var i = 0; i < nodes.length; i++) {
228
- var el = nodes[i];
229
- var id = el.getAttribute('sky-cmp-id');
230
- columnIds.push(id);
231
- }
232
- dropCallback(columnIds);
233
- });
234
- dragulaService.setOptions('sky-grid-heading', {
235
- moves: function (el, container, handle) {
236
- var columns = container.querySelectorAll('th div');
237
- var isLeftOfLocked = _this.isLeftOfLocked(handle, columns);
238
- return !el.querySelector(GRID_HEADER_LOCKED_SELECTOR)
239
- && handle !== undefined
240
- && !handle.matches(GRID_HEADER_RESIZE_HANDLE)
241
- && !handle.matches(GRID_MULTISELECT_SELECTOR)
242
- && !handle.matches(GRID_ROW_DELETE_SELECTOR)
243
- && !isLeftOfLocked;
244
- },
245
- accepts: function (el, target, source, sibling) {
246
- if (sibling === undefined || !sibling) {
247
- return true;
248
- }
249
- var columns = source.querySelectorAll('th div');
250
- var siblingDiv = sibling.querySelector('div');
251
- var isLeftOfLocked = _this.isLeftOfLocked(siblingDiv, columns);
252
- return ((!sibling.matches(GRID_HEADER_LOCKED_SELECTOR)
253
- && !sibling.matches(GRID_HEADER_RESIZE_HANDLE)))
254
- && !isLeftOfLocked;
255
- }
256
- });
257
- };
258
- SkyGridAdapterService.prototype.getRowHeight = function (el, index) {
259
- return el.nativeElement.querySelectorAll('tbody tr')[index].scrollHeight + 'px';
260
- };
261
- SkyGridAdapterService.prototype.setStyle = function (el, style, value) {
262
- if (el) {
263
- this.renderer.setStyle(el.nativeElement, style, value);
264
- }
265
- };
266
- SkyGridAdapterService.prototype.isLeftOfLocked = function (handle, columns) {
267
- var e_1, _a;
268
- var sourceColumn = handle;
269
- try {
270
- for (var _b = __values(Array.from(columns)), _c = _b.next(); !_c.done; _c = _b.next()) {
271
- var column = _c.value;
272
- if (column.contains(handle)) {
273
- sourceColumn = column;
274
- }
275
- }
276
- }
277
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
278
- finally {
279
- try {
280
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
281
- }
282
- finally { if (e_1) throw e_1.error; }
283
- }
284
- for (var i = (columns.length - 1); i >= 0; i--) {
285
- if (columns[i].classList.contains('sky-grid-header-locked')) {
286
- return true;
287
- }
288
- if (columns[i] === sourceColumn) {
289
- break;
290
- }
291
- }
292
- return false;
293
- };
294
- SkyGridAdapterService.ctorParameters = function () { return [
295
- { type: RendererFactory2 }
296
- ]; };
297
- SkyGridAdapterService = __decorate([
298
- Injectable()
299
- ], SkyGridAdapterService);
300
- return SkyGridAdapterService;
301
- }());
302
-
303
- // tslint:disable:no-null-keyword
304
- // Polyfill for Element.closest().
305
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
306
- // Returns the closest ancestor of the current element (or the current element itself) which
307
- // matches the selectors given in parameter. If there isn't such an ancestor, it returns null.
308
- if (!Element.prototype.closest) {
309
- Element.prototype.closest = function (s) {
310
- var el = this;
311
- /* istanbul ignore if */
312
- if (!document.documentElement.contains(el)) {
313
- return null;
314
- }
315
- do {
316
- if (el.matches(s)) {
317
- return el;
318
- }
319
- el = el.parentElement || el.parentNode;
320
- } while (el !== null && el.nodeType === 1);
321
- return null;
322
- };
323
- }
324
- // Polyfill for Element.matches().
325
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
326
- // Returns true if the element would be selected by the specified selector string.
327
- if (!Element.prototype.matches) {
328
- Element.prototype.matches = Element.prototype.msMatchesSelector
329
- /* istanbul ignore next */ || Element.prototype.webkitMatchesSelector;
330
- }
331
-
332
- var nextId = 0;
333
- var SkyGridComponent = /** @class */ (function () {
334
- function SkyGridComponent(affixService, changeDetector, dragulaService, gridAdapter, overlayService, skyWindow, uiConfigService) {
335
- this.affixService = affixService;
336
- this.changeDetector = changeDetector;
337
- this.dragulaService = dragulaService;
338
- this.gridAdapter = gridAdapter;
339
- this.overlayService = overlayService;
340
- this.skyWindow = skyWindow;
341
- this.uiConfigService = uiConfigService;
342
- /**
343
- * Indicates whether to enable the multiselect feature to display a column of
344
- * checkboxes on the left side of the grid. You can specify a unique ID with
345
- * the `multiselectRowId` property, but multiselect defaults to the `id` property on
346
- * the `data` object. To include options to select and clear all multiselect checkboxes,
347
- * we recommend the [list view grid](https://developer.blackbaud.com/skyux/components/list/grid) component.
348
- * @default false
349
- */
350
- this.enableMultiselect = false;
351
- /**
352
- * Specifies how the grid fits to its parent. The valid options are `width`,
353
- * which fits the grid to the parent's full width, and `scroll`, which allows the grid
354
- * to exceed the parent's width. If the grid does not have enough columns to fill
355
- * the parent's width, it always stretches to the parent's full width.
356
- */
357
- this.fit = 'width';
358
- /**
359
- * Indicates whether to display a toolbar with the grid.
360
- */
361
- this.hasToolbar = false;
362
- /**
363
- * Provides an observable to send commands to the grid.
364
- */
365
- this.messageStream = new Subject();
366
- /**
367
- * Fires when the width of a column changes.
368
- */
369
- this.columnWidthChange = new EventEmitter();
370
- /**
371
- * Fires when the selection of multiselect checkboxes changes.
372
- * Emits an array of IDs for the selected rows based on the `multiselectRowId` property
373
- * that the consumer provides.
374
- */
375
- this.multiselectSelectionChange = new EventEmitter();
376
- /**
377
- * @internal
378
- */
379
- this.rowDeleteCancel = new EventEmitter();
380
- /**
381
- * @internal
382
- */
383
- this.rowDeleteConfirm = new EventEmitter();
384
- /**
385
- * Fires when the columns to display in the grid change or when the order of the columns changes.
386
- * The event emits an array of IDs for the displayed columns that reflects the column order.
387
- */
388
- this.selectedColumnIdsChange = new EventEmitter();
389
- /**
390
- * Fires when the active sort field changes.
391
- */
392
- this.sortFieldChange = new EventEmitter();
393
- this.columnResizeStep = 10;
394
- this.gridId = ++nextId;
395
- this.rowDeleteConfigs = [];
396
- this.maxColWidth = 9999; // This is an arbitrary number, as the input range picker won't work without a value.
397
- this.minColWidth = 50;
398
- this.showResizeBar = false;
399
- this.showTopScroll = false;
400
- this.isDraggingResizeHandle = false;
401
- this.isResized = false;
402
- this.ngUnsubscribe = new Subject();
403
- this.rowDeleteContents = {};
404
- this.subscriptions = [];
405
- this.scrollTriggered = false;
406
- this.selectedColumnIdsSet = false;
407
- this.displayedColumns = new Array();
408
- this.items = new Array();
409
- this.currentSortField = new BehaviorSubject({
410
- fieldSelector: '',
411
- descending: false
412
- });
413
- }
414
- Object.defineProperty(SkyGridComponent.prototype, "selectedColumnIds", {
415
- get: function () {
416
- return this._selectedColumnIds;
417
- },
418
- /**
419
- * Specifies the columns to display in the grid based on the `id` or `field` properties
420
- * of the columns. If no columns are specified, then the grid displays all columns.
421
- */
422
- set: function (value) {
423
- var currentIds = this._selectedColumnIds;
424
- this._selectedColumnIds = value;
425
- if (this.columns) {
426
- this.setDisplayedColumns();
427
- }
428
- // Ensure that the ids have changed.
429
- if (!currentIds ||
430
- !value ||
431
- !this.arraysEqual(value, currentIds)) {
432
- // This variable ensures that we do not set user config options or fire the change event
433
- // on the first time that the columns are set up
434
- if (this.selectedColumnIdsSet) {
435
- this.setUserConfig({
436
- selectedColumnIds: value
437
- });
438
- this.selectedColumnIdsChange.emit(this._selectedColumnIds);
439
- if (this.isResized) {
440
- this.resetTableWidth();
441
- }
442
- }
443
- }
444
- this.selectedColumnIdsSet = true;
445
- },
446
- enumerable: true,
447
- configurable: true
448
- });
449
- Object.defineProperty(SkyGridComponent.prototype, "selectedRowIds", {
450
- get: function () {
451
- return this._selectedRowIds;
452
- },
453
- /**
454
- * Specifies a set of IDs for the rows to select in a multiselect grid.
455
- * The IDs match the `id` properties of the `data` objects.
456
- * Rows with IDs that are not included are de-selected in the grid.
457
- */
458
- set: function (value) {
459
- if (value) {
460
- this._selectedRowIds = value;
461
- this.applySelectedRows();
462
- this.emitSelectedRows(SkyGridSelectedRowsSource.SelectedRowIdsChange);
463
- }
464
- },
465
- enumerable: true,
466
- configurable: true
467
- });
468
- Object.defineProperty(SkyGridComponent.prototype, "tableWidth", {
469
- get: function () {
470
- return this.tableElementRef.nativeElement.offsetWidth;
471
- },
472
- enumerable: true,
473
- configurable: true
474
- });
475
- SkyGridComponent.prototype.ngOnInit = function () {
476
- var _this = this;
477
- this.messageStream
478
- .pipe(takeUntil(this.ngUnsubscribe))
479
- .subscribe(function (message) {
480
- _this.handleIncomingMessages(message);
481
- });
482
- };
483
- SkyGridComponent.prototype.ngAfterContentInit = function () {
484
- var _this = this;
485
- if (this.settingsKey) {
486
- this.applyUserConfig().then(function () {
487
- _this.initColumns();
488
- });
489
- }
490
- else {
491
- this.initColumns();
492
- }
493
- // Setup column drag-and-drop.
494
- this.gridAdapter.initializeDragAndDrop(this.dragulaService, function (selectedColumnIds) {
495
- _this.onHeaderDrop(selectedColumnIds);
496
- });
497
- this.applySelectedRows();
498
- };
499
- SkyGridComponent.prototype.ngAfterViewInit = function () {
500
- this.checkUserColumnWidthsForScroll();
501
- };
502
- SkyGridComponent.prototype.ngOnChanges = function (changes) {
503
- var _this = this;
504
- if (changes.columns && this.columns) {
505
- if (this.selectedColumnIds) {
506
- this.selectedColumnIds = this.selectedColumnIds.filter(function (columnId) { return _this.columns.find(function (column) { return column.id === columnId; }); });
507
- }
508
- this.setDisplayedColumns(true);
509
- }
510
- if (changes.data && this.data) {
511
- this.transformData();
512
- // This set timeout is necessary to ensure the data has rendered in the grid
513
- setTimeout(function () {
514
- // This cleans up any lingering row deletes for items that have been removed.
515
- Object.keys(_this.rowDeleteContents).forEach(function (id) {
516
- if (!_this.data.find(function (item) { return item.id === id; })) {
517
- _this.destroyRowDelete(id);
518
- }
519
- else {
520
- // The rows re-render thus messing up the affixers. We must reaffix them so that things
521
- // continue to render correctly.
522
- var rowElement = _this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + id + '"]');
523
- _this.rowDeleteContents[id].affixer.affixTo(rowElement, {
524
- autoFitContext: SkyAffixAutoFitContext.Viewport,
525
- isSticky: true,
526
- placement: 'above',
527
- verticalAlignment: 'top',
528
- horizontalAlignment: 'left',
529
- enableAutoFit: false
530
- });
531
- }
532
- });
533
- _this.checkUserColumnWidthsForScroll();
534
- });
535
- }
536
- if (changes.sortField) {
537
- this.setSortHeaders();
538
- }
539
- };
540
- SkyGridComponent.prototype.ngOnDestroy = function () {
541
- var _this = this;
542
- this.subscriptions.forEach(function (subscription) {
543
- subscription.unsubscribe();
544
- });
545
- this.multiselectSelectionChange.complete();
546
- this.ngUnsubscribe.next();
547
- this.ngUnsubscribe.complete();
548
- Object.keys(this.rowDeleteContents).forEach(function (id) {
549
- _this.destroyRowDelete(id);
550
- });
551
- };
552
- SkyGridComponent.prototype.onWindowResize = function () {
553
- this.checkUserColumnWidthsForScroll();
554
- };
555
- SkyGridComponent.prototype.getTopScrollWidth = function () {
556
- return this.tableElementRef.nativeElement.scrollWidth;
557
- };
558
- SkyGridComponent.prototype.getTableClassNames = function () {
559
- var classNames = [];
560
- if (this.fit !== 'scroll') {
561
- classNames.push('sky-grid-fit');
562
- }
563
- if (this.hasToolbar) {
564
- classNames.push('sky-grid-has-toolbar');
565
- }
566
- return this.addDelimeter(classNames, ' ');
567
- };
568
- SkyGridComponent.prototype.getTableHeaderClassNames = function (column) {
569
- var classNames = [];
570
- if (column && column.locked) {
571
- classNames.push('sky-grid-header-locked');
572
- }
573
- return this.addDelimeter(classNames, ' ');
574
- };
575
- SkyGridComponent.prototype.getCaretIconNames = function (column) {
576
- var iconNames = [];
577
- this.getSortDirection(column.field).subscribe(function (sortDir) {
578
- if (sortDir === 'asc') {
579
- iconNames.push('caret-up');
580
- }
581
- if (sortDir === 'desc') {
582
- iconNames.push('caret-down');
583
- }
584
- });
585
- return this.addDelimeter(iconNames, ' ');
586
- };
587
- SkyGridComponent.prototype.onKeydown = function (event, column) {
588
- var key = event.key.toLowerCase();
589
- if (key === 'enter' || key === ' ') {
590
- this.sortByColumn(column);
591
- }
592
- };
593
- SkyGridComponent.prototype.sortByColumn = function (column) {
594
- var _this = this;
595
- if (!this.isDraggingResizeHandle && column.isSortable) {
596
- this.currentSortField
597
- .pipe(take(1), map(function (field) {
598
- var selector = {
599
- fieldSelector: column.field,
600
- descending: true
601
- };
602
- if (field && field.fieldSelector === column.field && field.descending) {
603
- selector = {
604
- fieldSelector: column.field,
605
- descending: false
606
- };
607
- }
608
- _this.sortFieldChange.emit(selector);
609
- _this.currentSortField.next(selector);
610
- }))
611
- .subscribe();
612
- }
613
- };
614
- SkyGridComponent.prototype.getSortDirection = function (columnField) {
615
- return this.currentSortField
616
- .pipe(distinctUntilChanged(), map(function (field) {
617
- return field.fieldSelector === columnField ?
618
- (field.descending ? 'desc' : 'asc') : undefined;
619
- }));
620
- };
621
- SkyGridComponent.prototype.getAriaSortDirection = function (column) {
622
- return this.currentSortField
623
- .pipe(distinctUntilChanged(), map(function (field) {
624
- return field.fieldSelector === column.field ?
625
- (field.descending ? 'descending' : 'ascending') : (column.isSortable ? 'none' : undefined);
626
- }));
627
- };
628
- SkyGridComponent.prototype.getCaretVisibility = function (columnField) {
629
- return this.currentSortField
630
- .pipe(distinctUntilChanged(), map(function (field) {
631
- return field.fieldSelector === columnField ? 'visible' : 'hidden';
632
- }));
633
- };
634
- SkyGridComponent.prototype.getHelpInlineClass = function (columnField) {
635
- return this.getCaretVisibility(columnField)
636
- .pipe(map(function (visibility) {
637
- return visibility === 'hidden';
638
- }));
639
- };
640
- SkyGridComponent.prototype.onMultiselectCheckboxChange = function () {
641
- this.emitSelectedRows(SkyGridSelectedRowsSource.CheckboxChange);
642
- };
643
- SkyGridComponent.prototype.updateColumnHeading = function (change) {
644
- var foundColumnModel = this.columns.find(function (column) {
645
- return (change.id !== undefined && change.id === column.id ||
646
- change.field !== undefined && change.field === column.field);
647
- });
648
- /* istanbul ignore else */
649
- if (foundColumnModel) {
650
- foundColumnModel.heading = change.value;
651
- this.changeDetector.markForCheck();
652
- }
653
- };
654
- SkyGridComponent.prototype.updateInlineHelpPopover = function (change) {
655
- var foundColumnModel = this.columns.find(function (column) {
656
- return (change.id !== undefined && change.id === column.id ||
657
- change.field !== undefined && change.field === column.field);
658
- });
659
- /* istanbul ignore else */
660
- if (foundColumnModel) {
661
- foundColumnModel.inlineHelpPopover = change.value;
662
- this.changeDetector.markForCheck();
663
- }
664
- };
665
- SkyGridComponent.prototype.updateColumnDescription = function (change) {
666
- var foundColumnModel = this.columns.find(function (column) {
667
- return (change.id !== undefined && change.id === column.id ||
668
- change.field !== undefined && change.field === column.field);
669
- });
670
- /* istanbul ignore else */
671
- if (foundColumnModel) {
672
- foundColumnModel.description = change.value;
673
- this.changeDetector.markForCheck();
674
- }
675
- };
676
- SkyGridComponent.prototype.onResizeColumnStart = function (event) {
677
- var _this = this;
678
- // If this table hasn't been resized, initialize all the resize widths.
679
- if (!this.isResized) {
680
- this.initColumnWidths();
681
- this.isResized = true;
682
- }
683
- this.initializeResizeColumn(event);
684
- this.isDraggingResizeHandle = true;
685
- this.xPosStart = event.pageX;
686
- this.showResizeBar = true;
687
- // Show visual indicator of where mouse is dragging (resizeBar).
688
- this.changeDetector.detectChanges();
689
- this.setResizeBarPosition(event.pageX);
690
- event.preventDefault();
691
- event.stopPropagation();
692
- var mouseMoveEvent = fromEvent(document, 'mousemove');
693
- var touchMoveEvent = fromEvent(document, 'touchmove');
694
- merge(mouseMoveEvent, touchMoveEvent)
695
- .pipe(takeWhile(function () {
696
- return _this.isDraggingResizeHandle;
697
- }))
698
- .subscribe(function (moveEvent) {
699
- _this.onResizeHandleMove(moveEvent);
700
- });
701
- var mouseUpEvent = fromEvent(document, 'mouseup');
702
- var touchEndEvent = fromEvent(document, 'touchend');
703
- merge(mouseUpEvent, touchEndEvent)
704
- .pipe(takeWhile(function () {
705
- return _this.isDraggingResizeHandle;
706
- }))
707
- .subscribe(function (endEvent) {
708
- _this.onResizeHandleRelease(endEvent);
709
- });
710
- };
711
- SkyGridComponent.prototype.onKeydownResizeCol = function (event) {
712
- // If this table hasn't been resized, initialize all the resize widths.
713
- if (!this.isResized) {
714
- this.initColumnWidths();
715
- this.isResized = true;
716
- }
717
- this.initializeResizeColumn(event);
718
- };
719
- SkyGridComponent.prototype.onInputChangeResizeCol = function (event) {
720
- var input = event.target;
721
- var newValue = Number(input.value);
722
- var deltaX = newValue - this.startColumnWidth;
723
- this.resizeColumnByIndex(this.activeResizeColumnIndex, newValue, deltaX);
724
- var left = input.getBoundingClientRect().left;
725
- this.setResizeBarPosition(left);
726
- };
727
- SkyGridComponent.prototype.onResizeHandleMove = function (event) {
728
- var deltaX = event.pageX - this.xPosStart;
729
- var newColWidth = this.startColumnWidth + deltaX;
730
- if (newColWidth <= this.minColWidth) {
731
- event.stopPropagation();
732
- return;
733
- }
734
- var max = this.getMaxRangeByIndex(this.activeResizeColumnIndex);
735
- if (this.fit === 'width' && newColWidth > max) {
736
- event.stopPropagation();
737
- return;
738
- }
739
- this.setResizeBarPosition(event.pageX);
740
- };
741
- SkyGridComponent.prototype.onResizeHandleBlur = function (event) {
742
- this.showResizeBar = false;
743
- };
744
- SkyGridComponent.prototype.onResizeHandleFocus = function (event) {
745
- this.showResizeBar = true;
746
- this.changeDetector.detectChanges();
747
- var target = event.target;
748
- var left = target.getBoundingClientRect().left;
749
- this.setResizeBarPosition(left);
750
- };
751
- SkyGridComponent.prototype.onResizeHandleRelease = function (event) {
752
- this.showResizeBar = false;
753
- var deltaX = event.pageX - this.xPosStart;
754
- var newColWidth = this.startColumnWidth + deltaX;
755
- this.resizeColumnByIndex(this.activeResizeColumnIndex, newColWidth, deltaX);
756
- this.isDraggingResizeHandle = false;
757
- this.activeResizeColumnIndex = undefined;
758
- event.stopPropagation();
759
- this.changeDetector.markForCheck();
760
- };
761
- SkyGridComponent.prototype.onRowClick = function (event, selectedItem) {
762
- /* istanbul ignore else */
763
- if (this.enableMultiselect) {
764
- if (event.target === event.currentTarget || !this.isInteractiveElement(event)) {
765
- selectedItem.isSelected = !selectedItem.isSelected;
766
- this.changeDetector.markForCheck();
767
- this.emitSelectedRows(SkyGridSelectedRowsSource.RowClick);
768
- }
769
- }
770
- };
771
- SkyGridComponent.prototype.isRowHighlighted = function (id) {
772
- if (this.rowHighlightedId) {
773
- return id === this.rowHighlightedId;
774
- }
775
- return false;
776
- };
777
- SkyGridComponent.prototype.getRowHeight = function (index) {
778
- return this.gridAdapter.getRowHeight(this.tableElementRef, index);
779
- };
780
- SkyGridComponent.prototype.cancelRowDelete = function (id) {
781
- this.rowDeleteConfigs = this.rowDeleteConfigs.filter(function (config) { return config.id !== id; });
782
- this.rowDeleteCancel.emit({ id: id });
783
- this.destroyRowDelete(id);
784
- };
785
- SkyGridComponent.prototype.confirmRowDelete = function (id) {
786
- this.rowDeleteConfigs.find(function (config) { return config.id === id; }).pending = true;
787
- this.rowDeleteConfirm.emit({ id: id });
788
- };
789
- SkyGridComponent.prototype.getRowDeleteItem = function (id) {
790
- return this.rowDeleteConfigs.find(function (rowDelete) { return rowDelete.id === id; });
791
- };
792
- // Prevent touch devices from inadvertently scrolling grid while dragging columns.
793
- SkyGridComponent.prototype.onTouchMove = function (event) {
794
- event.preventDefault();
795
- };
796
- SkyGridComponent.prototype.onTopScroll = function (event) {
797
- /* sanity check */
798
- /* istanbul ignore else */
799
- if (this.tableContainerElementRef) {
800
- if (this.scrollTriggered) {
801
- this.scrollTriggered = false;
802
- this.tableContainerElementRef.nativeElement.scrollLeft =
803
- this.topScrollContainerElementRef.nativeElement.scrollLeft;
804
- }
805
- else {
806
- this.scrollTriggered = true;
807
- }
808
- }
809
- };
810
- SkyGridComponent.prototype.onGridScroll = function (event) {
811
- /* sanity check */
812
- /* istanbul ignore else */
813
- if (this.topScrollContainerElementRef) {
814
- if (this.scrollTriggered) {
815
- this.scrollTriggered = false;
816
- this.topScrollContainerElementRef.nativeElement.scrollLeft =
817
- this.tableContainerElementRef.nativeElement.scrollLeft;
818
- }
819
- else {
820
- this.scrollTriggered = true;
821
- }
822
- }
823
- };
824
- SkyGridComponent.prototype.checkUserColumnWidthsForScroll = function () {
825
- var _this = this;
826
- if (!this.showTopScroll && this.columnElementRefs && this.columnElementRefs.length > 0) {
827
- var columnsWidthTotal_1 = 0;
828
- var windowSize_1 = this.skyWindow.nativeWindow.innerWidth;
829
- this.columnElementRefs.forEach(function (col) {
830
- if (!_this.showTopScroll) {
831
- var computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
832
- var offsetWidth = col.nativeElement.offsetWidth;
833
- var width = Math.max(computedWidth || offsetWidth, _this.minColWidth);
834
- columnsWidthTotal_1 = columnsWidthTotal_1 + width;
835
- if (columnsWidthTotal_1 > windowSize_1) {
836
- _this.showTopScroll = true;
837
- setTimeout(function () {
838
- _this.changeDetector.markForCheck();
839
- });
840
- }
841
- }
842
- });
843
- }
844
- };
845
- SkyGridComponent.prototype.multiselectSelectAll = function () {
846
- for (var i = 0; i < this.items.length; i++) {
847
- this.items[i].isSelected = true;
848
- }
849
- this.changeDetector.markForCheck();
850
- this.emitSelectedRows(SkyGridSelectedRowsSource.SelectAll);
851
- };
852
- SkyGridComponent.prototype.multiselectClearAll = function () {
853
- for (var i = 0; i < this.items.length; i++) {
854
- this.items[i].isSelected = false;
855
- }
856
- this.changeDetector.markForCheck();
857
- this.emitSelectedRows(SkyGridSelectedRowsSource.ClearAll);
858
- };
859
- SkyGridComponent.prototype.handleIncomingMessages = function (message) {
860
- var _this = this;
861
- /* tslint:disable-next-line:switch-default */
862
- switch (message.type) {
863
- case SkyGridMessageType.SelectAll:
864
- this.multiselectSelectAll();
865
- break;
866
- case SkyGridMessageType.ClearAll:
867
- this.multiselectClearAll();
868
- break;
869
- case SkyGridMessageType.PromptDeleteRow:
870
- /* sanity check */
871
- /* istanbul ignore else */
872
- if (message.data && message.data.promptDeleteRow) {
873
- var existingConfig = this.rowDeleteConfigs
874
- .find(function (config) { return config.id === message.data.promptDeleteRow.id; });
875
- if (existingConfig) {
876
- existingConfig.pending = false;
877
- }
878
- else {
879
- this.rowDeleteConfigs.push({ id: message.data.promptDeleteRow.id, pending: false });
880
- var overlay_1 = this.overlayService.create({
881
- enableScroll: true,
882
- showBackdrop: false,
883
- closeOnNavigation: true,
884
- enableClose: false,
885
- enablePointerEvents: true
886
- });
887
- overlay_1.attachTemplate(this.inlineDeleteTemplateRef, { $implicit: this.data.find(function (item) { return item.id === message.data.promptDeleteRow.id; }) });
888
- /**
889
- * We are manually setting the z-index here because overlays will always be on top of
890
- * the omnibar. This manual setting is 1 less than the omnibar's z-index of 1000. We
891
- * discussed changing the overlay service to allow for this but decided against that
892
- * change at this time due to its niche nature.
893
- */
894
- overlay_1.componentRef.instance.zIndex = '999';
895
- setTimeout(function () {
896
- var inlineDeleteRef = _this.inlineDeleteRefs.toArray()
897
- .find(function (elRef) {
898
- return elRef.nativeElement.id === 'row-delete-ref-' + message.data.promptDeleteRow.id;
899
- });
900
- var affixer = _this.affixService.createAffixer(inlineDeleteRef);
901
- var rowElement = _this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + message.data.promptDeleteRow.id + '"]');
902
- affixer.affixTo(rowElement, {
903
- autoFitContext: SkyAffixAutoFitContext.Viewport,
904
- isSticky: true,
905
- placement: 'above',
906
- verticalAlignment: 'top',
907
- horizontalAlignment: 'left',
908
- enableAutoFit: false
909
- });
910
- _this.rowDeleteContents[message.data.promptDeleteRow.id] = {
911
- affixer: affixer,
912
- overlay: overlay_1
913
- };
914
- });
915
- }
916
- }
917
- break;
918
- case SkyGridMessageType.AbortDeleteRow:
919
- /* sanity check */
920
- /* istanbul ignore else */
921
- if (message.data && message.data.abortDeleteRow) {
922
- this.rowDeleteConfigs = this.rowDeleteConfigs.filter(function (config) { return config.id !== message.data.abortDeleteRow.id; });
923
- this.destroyRowDelete(message.data.abortDeleteRow.id);
924
- }
925
- break;
926
- }
927
- this.changeDetector.markForCheck();
928
- };
929
- SkyGridComponent.prototype.onHeaderDrop = function (newColumnIds) {
930
- // update selected columnIds
931
- this.selectedColumnIdsSet = true;
932
- this.selectedColumnIds = newColumnIds;
933
- // mark for check because we are using ChangeDetectionStrategy.onPush
934
- this.changeDetector.markForCheck();
935
- };
936
- SkyGridComponent.prototype.setDisplayedColumns = function (respectHidden) {
937
- var _this = this;
938
- if (respectHidden === void 0) { respectHidden = false; }
939
- if (this.selectedColumnIds !== undefined) {
940
- // setup displayed columns
941
- this.displayedColumns = this.selectedColumnIds
942
- .filter(function (columnId) { return _this.columns.find(function (column) { return column.id === columnId; }); }).map(function (columnId) { return _this.columns.filter(function (column) { return column.id === columnId; })[0]; });
943
- }
944
- else if (respectHidden) {
945
- this.displayedColumns = this.columns.filter(function (column) {
946
- return !column.hidden;
947
- });
948
- }
949
- else {
950
- this.displayedColumns = this.columns;
951
- }
952
- };
953
- SkyGridComponent.prototype.transformData = function () {
954
- // Transform data into object with id and data properties
955
- if (this.data && this.data.length > 0 && this.data[0].id && !this.data[0].data) {
956
- if (this.multiselectRowId) {
957
- this.items = this.getGridDataWithSelectedRows();
958
- }
959
- else {
960
- this.items = this.data.map(function (item) { return new ListItemModel(item.id, item); });
961
- }
962
- }
963
- else {
964
- this.items = this.data;
965
- }
966
- };
967
- SkyGridComponent.prototype.getGridDataWithSelectedRows = function () {
968
- var _this = this;
969
- var selectedRows = this.getSelectedRows();
970
- return this.data.map(function (item) {
971
- var checked;
972
- if (item.hasOwnProperty(_this.multiselectRowId)) {
973
- checked = selectedRows.indexOf(item[_this.multiselectRowId]) > -1;
974
- }
975
- else {
976
- checked = selectedRows.indexOf(item.id) > -1;
977
- }
978
- return new ListItemModel(item.id, item, checked);
979
- });
980
- };
981
- SkyGridComponent.prototype.applySelectedRows = function () {
982
- if (this.items && this.items.length > 0 && this.selectedRowIds) {
983
- for (var i = 0; i < this.items.length; i++) {
984
- this.items[i].isSelected = (this.selectedRowIds.indexOf(this.items[i].id) > -1);
985
- }
986
- this.changeDetector.markForCheck();
987
- }
988
- };
989
- SkyGridComponent.prototype.setSortHeaders = function () {
990
- this.currentSortField.next(this.sortField || { fieldSelector: '', descending: false });
991
- };
992
- SkyGridComponent.prototype.getColumnsFromComponent = function () {
993
- this.columns = this.columnComponents.map(function (columnComponent) {
994
- return new SkyGridColumnModel(columnComponent.template, columnComponent);
995
- });
996
- };
997
- SkyGridComponent.prototype.updateColumns = function () {
998
- var _this = this;
999
- this.getColumnsFromComponent();
1000
- this.setDisplayedColumns(true);
1001
- this.changeDetector.markForCheck();
1002
- // This set timeout is necessary to ensure the columns have rendered in the grid
1003
- setTimeout(function () {
1004
- _this.checkUserColumnWidthsForScroll();
1005
- });
1006
- };
1007
- SkyGridComponent.prototype.resizeColumnByIndex = function (columnIndex, newColWidth, deltaX) {
1008
- var column = this.getColumnModelByIndex(columnIndex);
1009
- // Prevent accidental shrinkage below minimum width.
1010
- if (newColWidth <= this.minColWidth) {
1011
- deltaX = deltaX + this.minColWidth - newColWidth;
1012
- newColWidth = this.minColWidth;
1013
- }
1014
- // fit=width adds/removes width from the last column
1015
- // fit=scroll adds/removes width from the table
1016
- if (this.fit === 'width') {
1017
- var lastColumn = this.getLastDisplayedColumn();
1018
- // Prevent accidental growth that would bump last column off screen.
1019
- var max = this.getMaxRangeByIndex(columnIndex);
1020
- if (newColWidth > max) {
1021
- newColWidth = max;
1022
- deltaX = max - this.startColumnWidth;
1023
- }
1024
- column.width = newColWidth;
1025
- lastColumn.width = lastColumn.width - deltaX;
1026
- this.updateMaxRange();
1027
- }
1028
- else {
1029
- this.gridAdapter.setStyle(this.tableElementRef, 'width', this.tableWidth + deltaX + "px");
1030
- column.width = newColWidth;
1031
- }
1032
- this.changeDetector.detectChanges();
1033
- this.columnWidthChange.emit(this.getColumnWidthModelChange());
1034
- };
1035
- SkyGridComponent.prototype.initColumnWidths = function () {
1036
- var _this = this;
1037
- // Establish table width.
1038
- this.showTopScroll = true;
1039
- // Set column widths based on the width initially given by the browser.
1040
- // computedWidth prevents accidental overflow for browsers with sub-pixel widths.
1041
- this.columnElementRefs.forEach(function (col, index) {
1042
- var computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
1043
- var offsetWidth = col.nativeElement.offsetWidth;
1044
- var width = Math.max(computedWidth /* istanbul ignore next */ || offsetWidth, _this.minColWidth);
1045
- _this.getColumnModelByIndex(index).width = width;
1046
- });
1047
- // 'scroll' tables should be allowed to expand outside of their constraints.
1048
- if (this.fit === 'scroll') {
1049
- this.gridAdapter.setStyle(this.tableElementRef, 'min-width', 'auto');
1050
- }
1051
- // Update max limits for input ranges.
1052
- if (this.fit === 'width') {
1053
- this.updateMaxRange();
1054
- }
1055
- this.changeDetector.detectChanges();
1056
- };
1057
- SkyGridComponent.prototype.getColumnWidthModelChange = function () {
1058
- var columnWidthModelChange = new Array();
1059
- this.columns.forEach(function (column) {
1060
- columnWidthModelChange.push({
1061
- id: column.id,
1062
- field: column.field,
1063
- width: column.width
1064
- });
1065
- });
1066
- return columnWidthModelChange;
1067
- };
1068
- SkyGridComponent.prototype.updateMaxRange = function () {
1069
- var _this = this;
1070
- var leftoverWidth = this.getLastDisplayedColumn().width - this.minColWidth;
1071
- this.displayedColumns.forEach(function (column, index) {
1072
- var newMaxRange = column.width + leftoverWidth;
1073
- var rangeInput = _this.getRangeInputByIndex(index);
1074
- rangeInput.nativeElement.max = newMaxRange;
1075
- rangeInput.nativeElement.setAttribute('aria-valuemax', newMaxRange);
1076
- });
1077
- };
1078
- SkyGridComponent.prototype.initializeResizeColumn = function (event) {
1079
- var clickTarget = event.target;
1080
- this.activeResizeColumnIndex = clickTarget.getAttribute('sky-cmp-index');
1081
- var column = this.getColumnModelByIndex(this.activeResizeColumnIndex);
1082
- this.startColumnWidth = column.width;
1083
- };
1084
- SkyGridComponent.prototype.resetTableWidth = function () {
1085
- var _this = this;
1086
- this.skyWindow.nativeWindow.setTimeout(function () {
1087
- _this.gridAdapter.setStyle(_this.tableElementRef, 'width', "auto");
1088
- _this.changeDetector.detectChanges();
1089
- _this.gridAdapter.setStyle(_this.tableElementRef, 'width', _this.tableWidth + "px");
1090
- _this.changeDetector.detectChanges();
1091
- });
1092
- };
1093
- SkyGridComponent.prototype.getRangeInputByIndex = function (index) {
1094
- return this.columnRangeInputElementRefs.find(function (input) {
1095
- return input.nativeElement.getAttribute('sky-cmp-index') === index.toString();
1096
- });
1097
- };
1098
- SkyGridComponent.prototype.getColumnModelByIndex = function (index) {
1099
- return this.displayedColumns[Number(index)];
1100
- };
1101
- SkyGridComponent.prototype.getMaxRangeByIndex = function (index) {
1102
- var columnElementRef = this.columnElementRefs.find(function (th) {
1103
- return th.nativeElement.getAttribute('sky-cmp-index') === index;
1104
- });
1105
- var rangeInput = columnElementRef.nativeElement.querySelector('.sky-grid-column-input-aria-only');
1106
- return Number(rangeInput.max);
1107
- };
1108
- SkyGridComponent.prototype.getLastDisplayedColumn = function () {
1109
- return this.getColumnModelByIndex(this.displayedColumns.length - 1);
1110
- };
1111
- SkyGridComponent.prototype.addDelimeter = function (text, delimiter) {
1112
- return text.filter(function (val) { return val; }).join(delimiter);
1113
- };
1114
- SkyGridComponent.prototype.destroyRowDelete = function (id) {
1115
- var rowDeleteContents = this.rowDeleteContents[id];
1116
- if (rowDeleteContents) {
1117
- rowDeleteContents.affixer.destroy();
1118
- this.overlayService.close(rowDeleteContents.overlay);
1119
- delete this.rowDeleteContents[id];
1120
- }
1121
- };
1122
- SkyGridComponent.prototype.emitSelectedRows = function (source) {
1123
- var selectedRows = {
1124
- selectedRowIds: this.getSelectedRows(),
1125
- source: source
1126
- };
1127
- this.multiselectSelectionChange.emit(selectedRows);
1128
- };
1129
- SkyGridComponent.prototype.getSelectedRows = function () {
1130
- var _this = this;
1131
- return this.items.filter(function (item) {
1132
- return item.isSelected;
1133
- }).map(function (item) {
1134
- if (item.data.hasOwnProperty(_this.multiselectRowId)) {
1135
- return item.data[_this.multiselectRowId];
1136
- }
1137
- return item.id;
1138
- });
1139
- };
1140
- SkyGridComponent.prototype.isInteractiveElement = function (event) {
1141
- var interactiveElSelectors = "\n a,\n button,\n input,\n label,\n option,\n select,\n textarea,\n details,\n dialog,\n menu,\n menuitem,\n summary";
1142
- return event.target.closest(interactiveElSelectors);
1143
- };
1144
- SkyGridComponent.prototype.setResizeBarPosition = function (xPosition) {
1145
- var parentScroll = this.tableContainerElementRef.nativeElement.scrollLeft;
1146
- var resizeBarX = xPosition - this.tableElementRef.nativeElement.getBoundingClientRect().left - parentScroll;
1147
- this.gridAdapter.setStyle(this.resizeBar, 'left', resizeBarX + 'px');
1148
- };
1149
- SkyGridComponent.prototype.applyUserConfig = function () {
1150
- var _this = this;
1151
- return new Promise(function (resolve) {
1152
- _this.uiConfigService.getConfig(_this.settingsKey)
1153
- .pipe(take(1))
1154
- .subscribe(function (config) {
1155
- /* istanbul ignore else */
1156
- if (config && config.selectedColumnIds) {
1157
- // Remove any columnIds that don't exist in the current data set.
1158
- var filteredColumnIds = config.selectedColumnIds.filter(function (id) { return _this.columns.find(function (column) { return column.id === id; }); });
1159
- _this.selectedColumnIds = filteredColumnIds;
1160
- _this.changeDetector.markForCheck();
1161
- }
1162
- resolve();
1163
- }, function () {
1164
- resolve();
1165
- });
1166
- });
1167
- };
1168
- SkyGridComponent.prototype.setUserConfig = function (config) {
1169
- if (!this.settingsKey) {
1170
- return;
1171
- }
1172
- this.uiConfigService.setConfig(this.settingsKey, config)
1173
- .pipe(takeUntil(this.ngUnsubscribe))
1174
- .subscribe(function () { }, function (err) {
1175
- console.warn('Could not save grid settings.');
1176
- console.warn(err);
1177
- });
1178
- };
1179
- SkyGridComponent.prototype.initColumns = function () {
1180
- var _this = this;
1181
- /* istanbul ignore else */
1182
- if (this.columnComponents.length !== 0 ||
1183
- this.columns !== undefined) {
1184
- /* istanbul ignore else */
1185
- /* sanity check */
1186
- if (this.columnComponents.length > 0) {
1187
- this.getColumnsFromComponent();
1188
- }
1189
- this.transformData();
1190
- this.setDisplayedColumns(true);
1191
- this.changeDetector.markForCheck();
1192
- }
1193
- // Watch for added/removed columns:
1194
- this.subscriptions.push(this.columnComponents.changes.subscribe(function () { return _this.updateColumns(); }));
1195
- // Watch for column heading changes:
1196
- this.columnComponents.forEach(function (comp) {
1197
- _this.subscriptions.push(comp.headingModelChanges
1198
- .subscribe(function (change) {
1199
- _this.updateColumnHeading(change);
1200
- }));
1201
- _this.subscriptions.push(comp.descriptionModelChanges
1202
- .subscribe(function (change) {
1203
- _this.updateColumnDescription(change);
1204
- }));
1205
- _this.subscriptions.push(comp.inlineHelpPopoverModelChanges
1206
- .subscribe(function (change) {
1207
- _this.updateInlineHelpPopover(change);
1208
- }));
1209
- });
1210
- };
1211
- SkyGridComponent.prototype.arraysEqual = function (arrayA, arrayB) {
1212
- return arrayA.length === arrayB.length &&
1213
- arrayA.every(function (value, index) {
1214
- return value === arrayB[index];
1215
- });
1216
- };
1217
- SkyGridComponent.ctorParameters = function () { return [
1218
- { type: SkyAffixService },
1219
- { type: ChangeDetectorRef },
1220
- { type: DragulaService },
1221
- { type: SkyGridAdapterService },
1222
- { type: SkyOverlayService },
1223
- { type: SkyAppWindowRef },
1224
- { type: SkyUIConfigService }
1225
- ]; };
1226
- __decorate([
1227
- Input()
1228
- ], SkyGridComponent.prototype, "columns", void 0);
1229
- __decorate([
1230
- Input()
1231
- ], SkyGridComponent.prototype, "data", void 0);
1232
- __decorate([
1233
- Input()
1234
- ], SkyGridComponent.prototype, "enableMultiselect", void 0);
1235
- __decorate([
1236
- Input()
1237
- ], SkyGridComponent.prototype, "fit", void 0);
1238
- __decorate([
1239
- Input()
1240
- ], SkyGridComponent.prototype, "hasToolbar", void 0);
1241
- __decorate([
1242
- Input()
1243
- ], SkyGridComponent.prototype, "height", void 0);
1244
- __decorate([
1245
- Input()
1246
- ], SkyGridComponent.prototype, "highlightText", void 0);
1247
- __decorate([
1248
- Input()
1249
- ], SkyGridComponent.prototype, "messageStream", void 0);
1250
- __decorate([
1251
- Input()
1252
- ], SkyGridComponent.prototype, "multiselectRowId", void 0);
1253
- __decorate([
1254
- Input()
1255
- ], SkyGridComponent.prototype, "rowHighlightedId", void 0);
1256
- __decorate([
1257
- Input()
1258
- ], SkyGridComponent.prototype, "selectedColumnIds", null);
1259
- __decorate([
1260
- Input()
1261
- ], SkyGridComponent.prototype, "selectedRowIds", null);
1262
- __decorate([
1263
- Input()
1264
- ], SkyGridComponent.prototype, "settingsKey", void 0);
1265
- __decorate([
1266
- Input()
1267
- ], SkyGridComponent.prototype, "sortField", void 0);
1268
- __decorate([
1269
- Input()
1270
- ], SkyGridComponent.prototype, "width", void 0);
1271
- __decorate([
1272
- Output()
1273
- ], SkyGridComponent.prototype, "columnWidthChange", void 0);
1274
- __decorate([
1275
- Output()
1276
- ], SkyGridComponent.prototype, "multiselectSelectionChange", void 0);
1277
- __decorate([
1278
- Output()
1279
- ], SkyGridComponent.prototype, "rowDeleteCancel", void 0);
1280
- __decorate([
1281
- Output()
1282
- ], SkyGridComponent.prototype, "rowDeleteConfirm", void 0);
1283
- __decorate([
1284
- Output()
1285
- ], SkyGridComponent.prototype, "selectedColumnIdsChange", void 0);
1286
- __decorate([
1287
- Output()
1288
- ], SkyGridComponent.prototype, "sortFieldChange", void 0);
1289
- __decorate([
1290
- ContentChildren(SkyGridColumnComponent)
1291
- ], SkyGridComponent.prototype, "columnComponents", void 0);
1292
- __decorate([
1293
- ViewChildren('gridCol')
1294
- ], SkyGridComponent.prototype, "columnElementRefs", void 0);
1295
- __decorate([
1296
- ViewChildren('colSizeRange')
1297
- ], SkyGridComponent.prototype, "columnRangeInputElementRefs", void 0);
1298
- __decorate([
1299
- ViewChildren('inlineDeleteRef')
1300
- ], SkyGridComponent.prototype, "inlineDeleteRefs", void 0);
1301
- __decorate([
1302
- ViewChild('inlineDeleteTemplateRef', { read: TemplateRef })
1303
- ], SkyGridComponent.prototype, "inlineDeleteTemplateRef", void 0);
1304
- __decorate([
1305
- ViewChild('gridContainer')
1306
- ], SkyGridComponent.prototype, "tableContainerElementRef", void 0);
1307
- __decorate([
1308
- ViewChild('gridTable')
1309
- ], SkyGridComponent.prototype, "tableElementRef", void 0);
1310
- __decorate([
1311
- ViewChild('topScrollContainer')
1312
- ], SkyGridComponent.prototype, "topScrollContainerElementRef", void 0);
1313
- __decorate([
1314
- ViewChild('resizeBar')
1315
- ], SkyGridComponent.prototype, "resizeBar", void 0);
1316
- __decorate([
1317
- HostListener('window:resize')
1318
- ], SkyGridComponent.prototype, "onWindowResize", null);
1319
- SkyGridComponent = __decorate([
1320
- Component({
1321
- selector: 'sky-grid',
1322
- template: "<div class=\"sky-grid\">\n <div *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\n class=\"sky-grid-table\"\n [ngClass]=\"getTableClassNames()\"\n #gridTable>\n <thead>\n <tr dragula=\"sky-grid-heading\">\n <th *ngIf=\"enableMultiselect\"\n class=\"sky-grid-heading sky-grid-multiselect-cell sky-grid-header-locked\"\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 *ngFor=\"let column of displayedColumns; let last = last, let i = index\"\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 *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\n class=\"sky-grid-header-text\"\n >{{column.heading?.trim()}}</span>\n <sky-icon\n class=\"sky-grid-heading-sort\"\n [ngClass]=\"'sky-grid-heading-sort-' + (getCaretVisibility(column.field) | async)\"\n [icon]=\"getCaretIconNames(column)\"\n >\n </sky-icon>\n <sky-help-inline *ngIf=\"column.inlineHelpPopover\"\n [ngClass]=\"{\n 'sky-grid-help-inline-sort-hidden' : 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 </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 *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 *ngFor=\"let column of displayedColumns; let last = last; let i = index\"\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]=\"!column.excludeFromHighlighting ? highlightText : undefined\"\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 </sky-grid-cell>\n </td>\n </tr>\n </tbody>\n </table>\n <div *ngIf=\"showResizeBar\"\n aria-hidden=\"true\"\n id=\"sky-grid-resize-bar\"\n tabindex=\"-1\"\n #resizeBar\n >\n </div>\n </div>\n</div>\n\n<ng-template #defaultCellTemplate let-row=\"row\" let-value=\"value\">{{value}}</ng-template>\n\n<ng-template\n let-item\n #inlineDeleteTemplateRef\n>\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",
1323
- viewProviders: [DragulaService],
1324
- providers: [
1325
- SkyGridAdapterService
1326
- ],
1327
- changeDetection: ChangeDetectionStrategy.OnPush,
1328
- 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:0 solid #cdcfd2;padding:0;cursor:pointer;background-color:#fff;overflow:visible;background-clip:padding-box;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;-moz-user-select:none;-ms-user-select:none;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-center .sky-grid-heading-sort,.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-heading-sort{width:14px}.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-help-inline-sort-hidden,.sky-grid-heading.sky-grid-column-alignment-left .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:0 0}.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;background:0 0;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;background:0 0;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;background:0 0;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:0;white-space:nowrap}@-moz-document url-prefix(){.sky-grid-multiselect-row td{border-left:0 solid transparent;border-right:0 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:0}.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}"]
1329
- })
1330
- ], SkyGridComponent);
1331
- return SkyGridComponent;
1332
- }());
1333
-
1334
- /**
1335
- * @internal
1336
- */
1337
- var SkyGridCellComponent = /** @class */ (function () {
1338
- function SkyGridCellComponent() {
1339
- }
1340
- SkyGridCellComponent.prototype.ngOnInit = function () {
1341
- this.container.createEmbeddedView(this.template, this);
1342
- };
1343
- Object.defineProperty(SkyGridCellComponent.prototype, "row", {
1344
- get: function () {
1345
- return this.item.data;
1346
- },
1347
- enumerable: true,
1348
- configurable: true
1349
- });
1350
- Object.defineProperty(SkyGridCellComponent.prototype, "value", {
1351
- get: function () {
1352
- if (this.item.data && (this.fieldSelector || this.columnId)) {
1353
- return getData(this.item.data, this.fieldSelector || this.columnId);
1354
- }
1355
- return undefined;
1356
- },
1357
- enumerable: true,
1358
- configurable: true
1359
- });
1360
- __decorate([
1361
- Input()
1362
- ], SkyGridCellComponent.prototype, "item", void 0);
1363
- __decorate([
1364
- Input()
1365
- ], SkyGridCellComponent.prototype, "columnId", void 0);
1366
- __decorate([
1367
- Input()
1368
- ], SkyGridCellComponent.prototype, "template", void 0);
1369
- __decorate([
1370
- Input()
1371
- ], SkyGridCellComponent.prototype, "fieldSelector", void 0);
1372
- __decorate([
1373
- ViewChild('cell', {
1374
- read: ViewContainerRef,
1375
- static: true
1376
- })
1377
- ], SkyGridCellComponent.prototype, "container", void 0);
1378
- SkyGridCellComponent = __decorate([
1379
- Component({
1380
- selector: 'sky-grid-cell',
1381
- template: '<ng-template #cell></ng-template>',
1382
- changeDetection: ChangeDetectionStrategy.OnPush,
1383
- styles: [":host{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;min-height:35px}"]
1384
- })
1385
- ], SkyGridCellComponent);
1386
- return SkyGridCellComponent;
1387
- }());
1388
-
1389
- var SkyGridsResourcesProvider = /** @class */ (function () {
1390
- function SkyGridsResourcesProvider() {
1391
- this.resources = { "EN-US": { "skyux_grid_multiselect_select_row": "Select row" } };
1392
- }
1393
- SkyGridsResourcesProvider.prototype.getString = function (localeInfo, name) {
1394
- return getStringForLocale(this.resources, localeInfo.locale, name);
1395
- };
1396
- SkyGridsResourcesProvider = __decorate([
1397
- Injectable()
1398
- ], SkyGridsResourcesProvider);
1399
- return SkyGridsResourcesProvider;
1400
- }());
1401
-
1402
- var SkyGridsResourcesModule = /** @class */ (function () {
1403
- function SkyGridsResourcesModule() {
1404
- }
1405
- SkyGridsResourcesModule = __decorate([
1406
- NgModule({
1407
- exports: [
1408
- SkyI18nModule
1409
- ],
1410
- providers: [{
1411
- provide: SKY_LIB_RESOURCES_PROVIDERS,
1412
- useClass: SkyGridsResourcesProvider,
1413
- multi: true
1414
- }]
1415
- })
1416
- ], SkyGridsResourcesModule);
1417
- return SkyGridsResourcesModule;
1418
- }());
1419
-
1420
- var SkyGridModule = /** @class */ (function () {
1421
- function SkyGridModule() {
1422
- }
1423
- SkyGridModule = __decorate([
1424
- NgModule({
1425
- declarations: [
1426
- SkyGridComponent,
1427
- SkyGridColumnComponent,
1428
- SkyGridCellComponent
1429
- ],
1430
- imports: [
1431
- CommonModule,
1432
- DragulaModule,
1433
- FormsModule,
1434
- SkyAffixModule,
1435
- SkyCheckboxModule,
1436
- SkyGridsResourcesModule,
1437
- SkyHelpInlineModule,
1438
- SkyIconModule,
1439
- SkyInlineDeleteModule,
1440
- SkyOverlayModule,
1441
- SkyPopoverModule,
1442
- SkyTextHighlightModule
1443
- ],
1444
- exports: [
1445
- SkyGridComponent,
1446
- SkyGridColumnComponent,
1447
- SkyGridCellComponent
1448
- ],
1449
- providers: [
1450
- SkyAppWindowRef,
1451
- SkyUIConfigService
1452
- ]
1453
- })
1454
- ], SkyGridModule);
1455
- return SkyGridModule;
1456
- }());
1457
-
1458
- /**
1459
- * Generated bundle index. Do not edit.
1460
- */
1461
-
1462
- export { SkyGridColumnComponent, SkyGridColumnModel, SkyGridComponent, SkyGridMessageType, SkyGridModule, SkyGridSelectedRowsSource, SkyGridAdapterService as ɵa, SkyGridCellComponent as ɵb, SkyGridsResourcesModule as ɵc, SkyGridsResourcesProvider as ɵd };
1463
- //# sourceMappingURL=skyux-grids.js.map