@skyux/grids 5.7.2 → 6.0.0-beta.2
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.
- package/esm2020/index.mjs +20 -0
- package/esm2020/lib/modules/grid/grid-adapter.service.mjs +84 -0
- package/esm2020/lib/modules/grid/grid-cell.component.mjs +41 -0
- package/esm2020/lib/modules/grid/grid-column.component.mjs +116 -0
- package/esm2020/lib/modules/grid/grid-column.model.mjs +25 -0
- package/esm2020/lib/modules/grid/grid.component.mjs +1025 -0
- package/esm2020/lib/modules/grid/grid.module.mjs +71 -0
- package/esm2020/lib/modules/grid/types/grid-column-alignment.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-column-description-model-change.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-column-heading-model-change.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-column-inline-help-popover-model-change.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-column-width-model-change.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-message-type.mjs +20 -0
- package/esm2020/lib/modules/grid/types/grid-message.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-row-delete-cancel-args.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-row-delete-config.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-row-delete-confirm-args.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-row-delete-contents.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-selected-rows-model-change.mjs +2 -0
- package/esm2020/lib/modules/grid/types/grid-selected-rows-source.mjs +12 -0
- package/esm2020/lib/modules/grid/types/grid-ui-config.mjs +2 -0
- package/esm2020/lib/modules/shared/sky-grids-resources.module.mjs +45 -0
- package/esm2020/skyux-grids.mjs +5 -0
- package/fesm2015/{skyux-grids.js → skyux-grids.mjs} +23 -35
- package/fesm2015/skyux-grids.mjs.map +1 -0
- package/fesm2020/skyux-grids.mjs +1422 -0
- package/fesm2020/skyux-grids.mjs.map +1 -0
- package/package.json +33 -17
- package/bundles/skyux-grids.umd.js +0 -1853
- package/esm2015/index.js +0 -20
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/grid/grid-adapter.service.js +0 -84
- package/esm2015/lib/modules/grid/grid-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/grid/grid-cell.component.js +0 -46
- package/esm2015/lib/modules/grid/grid-cell.component.js.map +0 -1
- package/esm2015/lib/modules/grid/grid-column.component.js +0 -116
- package/esm2015/lib/modules/grid/grid-column.component.js.map +0 -1
- package/esm2015/lib/modules/grid/grid-column.model.js +0 -25
- package/esm2015/lib/modules/grid/grid-column.model.js.map +0 -1
- package/esm2015/lib/modules/grid/grid.component.js +0 -1032
- package/esm2015/lib/modules/grid/grid.component.js.map +0 -1
- package/esm2015/lib/modules/grid/grid.module.js +0 -71
- package/esm2015/lib/modules/grid/grid.module.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-column-alignment.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-column-alignment.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-column-description-model-change.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-column-description-model-change.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-column-heading-model-change.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-column-heading-model-change.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-column-inline-help-popover-model-change.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-column-inline-help-popover-model-change.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-column-width-model-change.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-column-width-model-change.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-message-type.js +0 -20
- package/esm2015/lib/modules/grid/types/grid-message-type.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-message.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-message.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-row-delete-cancel-args.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-row-delete-cancel-args.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-row-delete-config.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-row-delete-config.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-row-delete-confirm-args.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-row-delete-confirm-args.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-row-delete-contents.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-row-delete-contents.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-selected-rows-model-change.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-selected-rows-model-change.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-selected-rows-source.js +0 -12
- package/esm2015/lib/modules/grid/types/grid-selected-rows-source.js.map +0 -1
- package/esm2015/lib/modules/grid/types/grid-ui-config.js +0 -2
- package/esm2015/lib/modules/grid/types/grid-ui-config.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-grids-resources.module.js +0 -45
- package/esm2015/lib/modules/shared/sky-grids-resources.module.js.map +0 -1
- package/esm2015/skyux-grids.js +0 -5
- package/esm2015/skyux-grids.js.map +0 -1
- package/fesm2015/skyux-grids.js.map +0 -1
|
@@ -1,1032 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, HostListener, Input, Output, QueryList, TemplateRef, ViewChild, ViewChildren, } from '@angular/core';
|
|
2
|
-
import { SkyAffixAutoFitContext, SkyAffixService, SkyAppWindowRef, SkyOverlayService, SkyUIConfigService, } from '@skyux/core';
|
|
3
|
-
import { ListItemModel, ListSortFieldSelectorModel, } from '@skyux/list-builder-common';
|
|
4
|
-
import { DragulaService } from 'ng2-dragula';
|
|
5
|
-
import { BehaviorSubject, Subject, fromEvent, merge, } from 'rxjs';
|
|
6
|
-
import { distinctUntilChanged, map, take, takeUntil, takeWhile, } from 'rxjs/operators';
|
|
7
|
-
import { SkyGridAdapterService } from './grid-adapter.service';
|
|
8
|
-
import { SkyGridColumnComponent } from './grid-column.component';
|
|
9
|
-
import { SkyGridColumnModel } from './grid-column.model';
|
|
10
|
-
import { SkyGridMessageType } from './types/grid-message-type';
|
|
11
|
-
import { SkyGridSelectedRowsSource } from './types/grid-selected-rows-source';
|
|
12
|
-
import * as i0 from "@angular/core";
|
|
13
|
-
import * as i1 from "@skyux/core";
|
|
14
|
-
import * as i2 from "ng2-dragula";
|
|
15
|
-
import * as i3 from "./grid-adapter.service";
|
|
16
|
-
import * as i4 from "@skyux/indicators";
|
|
17
|
-
import * as i5 from "@skyux/forms";
|
|
18
|
-
import * as i6 from "./grid-cell.component";
|
|
19
|
-
import * as i7 from "@skyux/layout";
|
|
20
|
-
import * as i8 from "@angular/common";
|
|
21
|
-
import * as i9 from "@skyux/popovers";
|
|
22
|
-
import * as i10 from "@angular/forms";
|
|
23
|
-
import * as i11 from "@skyux/i18n";
|
|
24
|
-
let nextId = 0;
|
|
25
|
-
export class SkyGridComponent {
|
|
26
|
-
constructor(affixService, changeDetector, dragulaService, gridAdapter, overlayService, skyWindow, uiConfigService) {
|
|
27
|
-
this.affixService = affixService;
|
|
28
|
-
this.changeDetector = changeDetector;
|
|
29
|
-
this.dragulaService = dragulaService;
|
|
30
|
-
this.gridAdapter = gridAdapter;
|
|
31
|
-
this.overlayService = overlayService;
|
|
32
|
-
this.skyWindow = skyWindow;
|
|
33
|
-
this.uiConfigService = uiConfigService;
|
|
34
|
-
/**
|
|
35
|
-
* Indicates whether to enable the multiselect feature to display a column of
|
|
36
|
-
* checkboxes on the left side of the grid. You can specify a unique ID with
|
|
37
|
-
* the `multiselectRowId` property, but multiselect defaults to the `id` property on
|
|
38
|
-
* the `data` object.
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
this.enableMultiselect = false;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies how the grid fits to its parent. The valid options are `width`,
|
|
44
|
-
* which fits the grid to the parent's full width, and `scroll`, which allows the grid
|
|
45
|
-
* to exceed the parent's width. If the grid does not have enough columns to fill
|
|
46
|
-
* the parent's width, it always stretches to the parent's full width.
|
|
47
|
-
* @default "width"
|
|
48
|
-
*/
|
|
49
|
-
this.fit = 'width';
|
|
50
|
-
/**
|
|
51
|
-
* Indicates whether to display a toolbar with the grid.
|
|
52
|
-
*/
|
|
53
|
-
this.hasToolbar = false;
|
|
54
|
-
/**
|
|
55
|
-
* Provides an observable to send commands to the grid.
|
|
56
|
-
*/
|
|
57
|
-
this.messageStream = new Subject();
|
|
58
|
-
/**
|
|
59
|
-
* Fires when the width of a column changes.
|
|
60
|
-
*/
|
|
61
|
-
this.columnWidthChange = new EventEmitter();
|
|
62
|
-
/**
|
|
63
|
-
* Fires when the selection of multiselect checkboxes changes.
|
|
64
|
-
* Emits an array of IDs for the selected rows based on the `multiselectRowId` property
|
|
65
|
-
* that the consumer provides.
|
|
66
|
-
*/
|
|
67
|
-
this.multiselectSelectionChange = new EventEmitter();
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
this.rowDeleteCancel = new EventEmitter();
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
this.rowDeleteConfirm = new EventEmitter();
|
|
76
|
-
/**
|
|
77
|
-
* Fires when the columns to display in the grid change or when the order of the columns changes.
|
|
78
|
-
* The event emits an array of IDs for the displayed columns that reflects the column order.
|
|
79
|
-
*/
|
|
80
|
-
this.selectedColumnIdsChange = new EventEmitter();
|
|
81
|
-
/**
|
|
82
|
-
* Fires when the active sort field changes.
|
|
83
|
-
*/
|
|
84
|
-
this.sortFieldChange = new EventEmitter();
|
|
85
|
-
this.columnResizeStep = 10;
|
|
86
|
-
this.gridId = ++nextId;
|
|
87
|
-
this.rowDeleteConfigs = [];
|
|
88
|
-
this.maxColWidth = 9999; // This is an arbitrary number, as the input range picker won't work without a value.
|
|
89
|
-
this.minColWidth = 50;
|
|
90
|
-
this.showResizeBar = false;
|
|
91
|
-
this.showTopScroll = false;
|
|
92
|
-
this.isDraggingResizeHandle = false;
|
|
93
|
-
this.isResized = false;
|
|
94
|
-
this.ngUnsubscribe = new Subject();
|
|
95
|
-
this.rowDeleteContents = {};
|
|
96
|
-
this.subscriptions = [];
|
|
97
|
-
this.scrollTriggered = false;
|
|
98
|
-
this.selectedColumnIdsSet = false;
|
|
99
|
-
this.displayedColumns = new Array();
|
|
100
|
-
this.items = new Array();
|
|
101
|
-
this.currentSortField = new BehaviorSubject({
|
|
102
|
-
fieldSelector: '',
|
|
103
|
-
descending: false,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Specifies columns and column properties for the grid.
|
|
108
|
-
*/
|
|
109
|
-
set columns(newColumns) {
|
|
110
|
-
const oldColumns = this.columns;
|
|
111
|
-
this._columns = newColumns;
|
|
112
|
-
if (oldColumns) {
|
|
113
|
-
this.transferColumnWidths(oldColumns, this.columns);
|
|
114
|
-
this.isResized = false;
|
|
115
|
-
this.setDisplayedColumns(true);
|
|
116
|
-
}
|
|
117
|
-
this.changeDetector.markForCheck();
|
|
118
|
-
}
|
|
119
|
-
get columns() {
|
|
120
|
-
return this._columns;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Specifies the columns to display in the grid based on the `id` or `field` properties
|
|
124
|
-
* of the columns. If no columns are specified, then the grid displays all columns.
|
|
125
|
-
*/
|
|
126
|
-
set selectedColumnIds(value) {
|
|
127
|
-
const currentIds = this._selectedColumnIds;
|
|
128
|
-
this._selectedColumnIds = value;
|
|
129
|
-
if (this.columns) {
|
|
130
|
-
this.setDisplayedColumns();
|
|
131
|
-
}
|
|
132
|
-
// Ensure that the ids have changed.
|
|
133
|
-
if (!currentIds || !value || !this.arraysEqual(value, currentIds)) {
|
|
134
|
-
// This variable ensures that we do not set user config options or fire the change event
|
|
135
|
-
// on the first time that the columns are set up
|
|
136
|
-
if (this.selectedColumnIdsSet) {
|
|
137
|
-
this.setUserConfig({
|
|
138
|
-
selectedColumnIds: value,
|
|
139
|
-
});
|
|
140
|
-
this.selectedColumnIdsChange.emit(this._selectedColumnIds);
|
|
141
|
-
if (this.isResized) {
|
|
142
|
-
this.resetTableWidth();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
this.selectedColumnIdsSet = true;
|
|
147
|
-
}
|
|
148
|
-
get selectedColumnIds() {
|
|
149
|
-
return this._selectedColumnIds;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Specifies a set of IDs for the rows to select in a multiselect grid.
|
|
153
|
-
* The IDs match the `id` properties of the `data` objects.
|
|
154
|
-
* Rows with IDs that are not included are de-selected in the grid.
|
|
155
|
-
*/
|
|
156
|
-
set selectedRowIds(value) {
|
|
157
|
-
if (value) {
|
|
158
|
-
this._selectedRowIds = value;
|
|
159
|
-
this.applySelectedRows();
|
|
160
|
-
this.emitSelectedRows(SkyGridSelectedRowsSource.SelectedRowIdsChange);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
get selectedRowIds() {
|
|
164
|
-
return this._selectedRowIds;
|
|
165
|
-
}
|
|
166
|
-
get tableWidth() {
|
|
167
|
-
return this.tableElementRef.nativeElement.offsetWidth;
|
|
168
|
-
}
|
|
169
|
-
ngOnInit() {
|
|
170
|
-
this.messageStream
|
|
171
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
172
|
-
.subscribe((message) => {
|
|
173
|
-
this.handleIncomingMessages(message);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
ngAfterContentInit() {
|
|
177
|
-
if (this.settingsKey) {
|
|
178
|
-
this.applyUserConfig().then(() => {
|
|
179
|
-
this.initColumns();
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
this.initColumns();
|
|
184
|
-
}
|
|
185
|
-
// Setup column drag-and-drop.
|
|
186
|
-
this.gridAdapter.initializeDragAndDrop(this.dragulaService, (selectedColumnIds) => {
|
|
187
|
-
this.onHeaderDrop(selectedColumnIds);
|
|
188
|
-
});
|
|
189
|
-
this.applySelectedRows();
|
|
190
|
-
}
|
|
191
|
-
ngAfterViewInit() {
|
|
192
|
-
this.checkUserColumnWidthsForScroll();
|
|
193
|
-
}
|
|
194
|
-
ngOnChanges(changes) {
|
|
195
|
-
if (changes.columns && this.columns) {
|
|
196
|
-
if (this.selectedColumnIds) {
|
|
197
|
-
this.selectedColumnIds = this.selectedColumnIds.filter((columnId) => {
|
|
198
|
-
return this.columns.find((column) => column.id === columnId);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
this.setDisplayedColumns(true);
|
|
202
|
-
}
|
|
203
|
-
if (changes.data && this.data) {
|
|
204
|
-
this.transformData();
|
|
205
|
-
// This set timeout is necessary to ensure the data has rendered in the grid
|
|
206
|
-
setTimeout(() => {
|
|
207
|
-
// This cleans up any lingering row deletes for items that have been removed.
|
|
208
|
-
Object.keys(this.rowDeleteContents).forEach((id) => {
|
|
209
|
-
if (!this.data.find((item) => item.id === id)) {
|
|
210
|
-
this.destroyRowDelete(id);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
// The rows re-render thus messing up the affixers. We must reaffix them so that things
|
|
214
|
-
// continue to render correctly.
|
|
215
|
-
const rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + id + '"]');
|
|
216
|
-
this.rowDeleteContents[id].affixer.affixTo(rowElement, {
|
|
217
|
-
autoFitContext: SkyAffixAutoFitContext.Viewport,
|
|
218
|
-
isSticky: true,
|
|
219
|
-
placement: 'above',
|
|
220
|
-
verticalAlignment: 'top',
|
|
221
|
-
horizontalAlignment: 'left',
|
|
222
|
-
enableAutoFit: false,
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
this.checkUserColumnWidthsForScroll();
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
if (changes.sortField) {
|
|
230
|
-
this.setSortHeaders();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
ngOnDestroy() {
|
|
234
|
-
this.subscriptions.forEach((subscription) => {
|
|
235
|
-
subscription.unsubscribe();
|
|
236
|
-
});
|
|
237
|
-
this.multiselectSelectionChange.complete();
|
|
238
|
-
this.ngUnsubscribe.next();
|
|
239
|
-
this.ngUnsubscribe.complete();
|
|
240
|
-
Object.keys(this.rowDeleteContents).forEach((id) => {
|
|
241
|
-
this.destroyRowDelete(id);
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
onWindowResize() {
|
|
245
|
-
this.checkUserColumnWidthsForScroll();
|
|
246
|
-
}
|
|
247
|
-
getTopScrollWidth() {
|
|
248
|
-
return this.tableElementRef.nativeElement.scrollWidth;
|
|
249
|
-
}
|
|
250
|
-
getTableClassNames() {
|
|
251
|
-
const classNames = [];
|
|
252
|
-
if (this.fit !== 'scroll') {
|
|
253
|
-
classNames.push('sky-grid-fit');
|
|
254
|
-
}
|
|
255
|
-
if (this.hasToolbar) {
|
|
256
|
-
classNames.push('sky-grid-has-toolbar');
|
|
257
|
-
}
|
|
258
|
-
return this.addDelimeter(classNames, ' ');
|
|
259
|
-
}
|
|
260
|
-
getTableHeaderClassNames(column) {
|
|
261
|
-
const classNames = [];
|
|
262
|
-
if (column && column.locked) {
|
|
263
|
-
classNames.push('sky-grid-header-locked');
|
|
264
|
-
}
|
|
265
|
-
return this.addDelimeter(classNames, ' ');
|
|
266
|
-
}
|
|
267
|
-
getCaretIconNames(column) {
|
|
268
|
-
const iconNames = [];
|
|
269
|
-
this.getSortDirection(column.field).subscribe((sortDir) => {
|
|
270
|
-
if (sortDir === 'asc') {
|
|
271
|
-
iconNames.push('caret-up');
|
|
272
|
-
}
|
|
273
|
-
if (sortDir === 'desc') {
|
|
274
|
-
iconNames.push('caret-down');
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
return this.addDelimeter(iconNames, ' ');
|
|
278
|
-
}
|
|
279
|
-
onKeydown(event, column) {
|
|
280
|
-
const key = event.key.toLowerCase();
|
|
281
|
-
if (key === 'enter' || key === ' ') {
|
|
282
|
-
this.sortByColumn(column);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
sortByColumn(column) {
|
|
286
|
-
if (!this.isDraggingResizeHandle && column.isSortable) {
|
|
287
|
-
this.currentSortField
|
|
288
|
-
.pipe(take(1), map((field) => {
|
|
289
|
-
let selector = {
|
|
290
|
-
fieldSelector: column.field,
|
|
291
|
-
descending: true,
|
|
292
|
-
};
|
|
293
|
-
if (field &&
|
|
294
|
-
field.fieldSelector === column.field &&
|
|
295
|
-
field.descending) {
|
|
296
|
-
selector = {
|
|
297
|
-
fieldSelector: column.field,
|
|
298
|
-
descending: false,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
this.sortFieldChange.emit(selector);
|
|
302
|
-
this.currentSortField.next(selector);
|
|
303
|
-
}))
|
|
304
|
-
.subscribe();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
getSortDirection(columnField) {
|
|
308
|
-
return this.currentSortField.pipe(distinctUntilChanged(), map((field) => {
|
|
309
|
-
return field.fieldSelector === columnField
|
|
310
|
-
? field.descending
|
|
311
|
-
? 'desc'
|
|
312
|
-
: 'asc'
|
|
313
|
-
: undefined;
|
|
314
|
-
}));
|
|
315
|
-
}
|
|
316
|
-
getAriaSortDirection(column) {
|
|
317
|
-
return this.currentSortField.pipe(distinctUntilChanged(), map((field) => {
|
|
318
|
-
return field.fieldSelector === column.field
|
|
319
|
-
? field.descending
|
|
320
|
-
? 'descending'
|
|
321
|
-
: 'ascending'
|
|
322
|
-
: column.isSortable
|
|
323
|
-
? 'none'
|
|
324
|
-
: undefined;
|
|
325
|
-
}));
|
|
326
|
-
}
|
|
327
|
-
getCaretVisibility(columnField) {
|
|
328
|
-
return this.currentSortField.pipe(distinctUntilChanged(), map((field) => {
|
|
329
|
-
return field.fieldSelector === columnField ? 'visible' : 'hidden';
|
|
330
|
-
}));
|
|
331
|
-
}
|
|
332
|
-
getHelpInlineClass(columnField) {
|
|
333
|
-
return this.getCaretVisibility(columnField).pipe(map((visibility) => {
|
|
334
|
-
return visibility === 'hidden';
|
|
335
|
-
}));
|
|
336
|
-
}
|
|
337
|
-
onMultiselectCheckboxChange() {
|
|
338
|
-
this.emitSelectedRows(SkyGridSelectedRowsSource.CheckboxChange);
|
|
339
|
-
}
|
|
340
|
-
updateColumnHeading(change) {
|
|
341
|
-
const foundColumnModel = this.columns.find((column) => {
|
|
342
|
-
return ((change.id !== undefined && change.id === column.id) ||
|
|
343
|
-
(change.field !== undefined && change.field === column.field));
|
|
344
|
-
});
|
|
345
|
-
/* istanbul ignore else */
|
|
346
|
-
if (foundColumnModel) {
|
|
347
|
-
foundColumnModel.heading = change.value;
|
|
348
|
-
this.changeDetector.markForCheck();
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
updateInlineHelpPopover(change) {
|
|
352
|
-
const foundColumnModel = this.columns.find((column) => {
|
|
353
|
-
return ((change.id !== undefined && change.id === column.id) ||
|
|
354
|
-
(change.field !== undefined && change.field === column.field));
|
|
355
|
-
});
|
|
356
|
-
/* istanbul ignore else */
|
|
357
|
-
if (foundColumnModel) {
|
|
358
|
-
foundColumnModel.inlineHelpPopover = change.value;
|
|
359
|
-
this.changeDetector.markForCheck();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
updateColumnDescription(change) {
|
|
363
|
-
const foundColumnModel = this.columns.find((column) => {
|
|
364
|
-
return ((change.id !== undefined && change.id === column.id) ||
|
|
365
|
-
(change.field !== undefined && change.field === column.field));
|
|
366
|
-
});
|
|
367
|
-
/* istanbul ignore else */
|
|
368
|
-
if (foundColumnModel) {
|
|
369
|
-
foundColumnModel.description = change.value;
|
|
370
|
-
this.changeDetector.markForCheck();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
onResizeColumnStart(event) {
|
|
374
|
-
// If this table hasn't been resized, initialize all the resize widths.
|
|
375
|
-
if (!this.isResized) {
|
|
376
|
-
this.initColumnWidths();
|
|
377
|
-
this.isResized = true;
|
|
378
|
-
}
|
|
379
|
-
this.initializeResizeColumn(event);
|
|
380
|
-
this.isDraggingResizeHandle = true;
|
|
381
|
-
this.xPosStart = event.pageX;
|
|
382
|
-
this.showResizeBar = true;
|
|
383
|
-
// Show visual indicator of where mouse is dragging (resizeBar).
|
|
384
|
-
this.changeDetector.detectChanges();
|
|
385
|
-
this.setResizeBarPosition(event.pageX);
|
|
386
|
-
event.preventDefault();
|
|
387
|
-
event.stopPropagation();
|
|
388
|
-
const mouseMoveEvent = fromEvent(document, 'mousemove');
|
|
389
|
-
const touchMoveEvent = fromEvent(document, 'touchmove');
|
|
390
|
-
merge(mouseMoveEvent, touchMoveEvent)
|
|
391
|
-
.pipe(takeWhile(() => {
|
|
392
|
-
return this.isDraggingResizeHandle;
|
|
393
|
-
}))
|
|
394
|
-
.subscribe((moveEvent) => {
|
|
395
|
-
this.onResizeHandleMove(moveEvent);
|
|
396
|
-
});
|
|
397
|
-
const mouseUpEvent = fromEvent(document, 'mouseup');
|
|
398
|
-
const touchEndEvent = fromEvent(document, 'touchend');
|
|
399
|
-
merge(mouseUpEvent, touchEndEvent)
|
|
400
|
-
.pipe(takeWhile(() => {
|
|
401
|
-
return this.isDraggingResizeHandle;
|
|
402
|
-
}))
|
|
403
|
-
.subscribe((endEvent) => {
|
|
404
|
-
this.onResizeHandleRelease(endEvent);
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
onKeydownResizeCol(event) {
|
|
408
|
-
// If this table hasn't been resized, initialize all the resize widths.
|
|
409
|
-
if (!this.isResized) {
|
|
410
|
-
this.initColumnWidths();
|
|
411
|
-
this.isResized = true;
|
|
412
|
-
}
|
|
413
|
-
this.initializeResizeColumn(event);
|
|
414
|
-
}
|
|
415
|
-
onInputChangeResizeCol(event) {
|
|
416
|
-
const input = event.target;
|
|
417
|
-
const newValue = Number(input.value);
|
|
418
|
-
const deltaX = newValue - this.startColumnWidth;
|
|
419
|
-
this.resizeColumnByIndex(this.activeResizeColumnIndex, newValue, deltaX);
|
|
420
|
-
const left = input.getBoundingClientRect().left;
|
|
421
|
-
this.setResizeBarPosition(left);
|
|
422
|
-
}
|
|
423
|
-
onResizeHandleMove(event) {
|
|
424
|
-
const deltaX = event.pageX - this.xPosStart;
|
|
425
|
-
const newColWidth = this.startColumnWidth + deltaX;
|
|
426
|
-
if (newColWidth <= this.minColWidth) {
|
|
427
|
-
event.stopPropagation();
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
const max = this.getMaxRangeByIndex(this.activeResizeColumnIndex);
|
|
431
|
-
if (this.fit === 'width' && newColWidth > max) {
|
|
432
|
-
event.stopPropagation();
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
this.setResizeBarPosition(event.pageX);
|
|
436
|
-
}
|
|
437
|
-
onResizeHandleBlur(event) {
|
|
438
|
-
this.showResizeBar = false;
|
|
439
|
-
}
|
|
440
|
-
onResizeHandleFocus(event) {
|
|
441
|
-
this.showResizeBar = true;
|
|
442
|
-
this.changeDetector.detectChanges();
|
|
443
|
-
const target = event.target;
|
|
444
|
-
const left = target.getBoundingClientRect().left;
|
|
445
|
-
this.setResizeBarPosition(left);
|
|
446
|
-
}
|
|
447
|
-
onResizeHandleRelease(event) {
|
|
448
|
-
this.showResizeBar = false;
|
|
449
|
-
const deltaX = event.pageX - this.xPosStart;
|
|
450
|
-
const newColWidth = this.startColumnWidth + deltaX;
|
|
451
|
-
this.resizeColumnByIndex(this.activeResizeColumnIndex, newColWidth, deltaX);
|
|
452
|
-
this.isDraggingResizeHandle = false;
|
|
453
|
-
this.activeResizeColumnIndex = undefined;
|
|
454
|
-
event.stopPropagation();
|
|
455
|
-
this.changeDetector.markForCheck();
|
|
456
|
-
}
|
|
457
|
-
onRowClick(event, selectedItem) {
|
|
458
|
-
/* istanbul ignore else */
|
|
459
|
-
if (this.enableMultiselect) {
|
|
460
|
-
if (event.target === event.currentTarget ||
|
|
461
|
-
!this.isInteractiveElement(event)) {
|
|
462
|
-
selectedItem.isSelected = !selectedItem.isSelected;
|
|
463
|
-
this.changeDetector.markForCheck();
|
|
464
|
-
this.emitSelectedRows(SkyGridSelectedRowsSource.RowClick);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
isRowHighlighted(id) {
|
|
469
|
-
if (this.rowHighlightedId) {
|
|
470
|
-
return id === this.rowHighlightedId;
|
|
471
|
-
}
|
|
472
|
-
return false;
|
|
473
|
-
}
|
|
474
|
-
getRowHeight(index) {
|
|
475
|
-
return this.gridAdapter.getRowHeight(this.tableElementRef, index);
|
|
476
|
-
}
|
|
477
|
-
cancelRowDelete(id) {
|
|
478
|
-
this.rowDeleteConfigs = this.rowDeleteConfigs.filter((config) => config.id !== id);
|
|
479
|
-
this.rowDeleteCancel.emit({ id: id });
|
|
480
|
-
this.destroyRowDelete(id);
|
|
481
|
-
}
|
|
482
|
-
confirmRowDelete(id) {
|
|
483
|
-
this.rowDeleteConfigs.find((config) => config.id === id).pending = true;
|
|
484
|
-
this.rowDeleteConfirm.emit({ id: id });
|
|
485
|
-
}
|
|
486
|
-
getRowDeleteItem(id) {
|
|
487
|
-
return this.rowDeleteConfigs.find((rowDelete) => rowDelete.id === id);
|
|
488
|
-
}
|
|
489
|
-
// Prevent touch devices from inadvertently scrolling grid while dragging columns.
|
|
490
|
-
onTouchMove(event) {
|
|
491
|
-
event.preventDefault();
|
|
492
|
-
}
|
|
493
|
-
onTopScroll(event) {
|
|
494
|
-
/* sanity check */
|
|
495
|
-
/* istanbul ignore else */
|
|
496
|
-
if (this.tableContainerElementRef) {
|
|
497
|
-
if (this.scrollTriggered) {
|
|
498
|
-
this.scrollTriggered = false;
|
|
499
|
-
this.tableContainerElementRef.nativeElement.scrollLeft =
|
|
500
|
-
this.topScrollContainerElementRef.nativeElement.scrollLeft;
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
this.scrollTriggered = true;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
onGridScroll(event) {
|
|
508
|
-
/* sanity check */
|
|
509
|
-
/* istanbul ignore else */
|
|
510
|
-
if (this.topScrollContainerElementRef) {
|
|
511
|
-
if (this.scrollTriggered) {
|
|
512
|
-
this.scrollTriggered = false;
|
|
513
|
-
this.topScrollContainerElementRef.nativeElement.scrollLeft =
|
|
514
|
-
this.tableContainerElementRef.nativeElement.scrollLeft;
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
this.scrollTriggered = true;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
checkUserColumnWidthsForScroll() {
|
|
522
|
-
if (!this.showTopScroll &&
|
|
523
|
-
this.columnElementRefs &&
|
|
524
|
-
this.columnElementRefs.length > 0) {
|
|
525
|
-
let columnsWidthTotal = 0;
|
|
526
|
-
const windowSize = this.skyWindow.nativeWindow.innerWidth;
|
|
527
|
-
this.columnElementRefs.forEach((col) => {
|
|
528
|
-
if (!this.showTopScroll) {
|
|
529
|
-
const computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
|
|
530
|
-
const offsetWidth = col.nativeElement.offsetWidth;
|
|
531
|
-
const width = Math.max(computedWidth || offsetWidth, this.minColWidth);
|
|
532
|
-
columnsWidthTotal = columnsWidthTotal + width;
|
|
533
|
-
if (columnsWidthTotal > windowSize) {
|
|
534
|
-
this.showTopScroll = true;
|
|
535
|
-
setTimeout(() => {
|
|
536
|
-
this.changeDetector.markForCheck();
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
multiselectSelectAll() {
|
|
544
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
545
|
-
this.items[i].isSelected = true;
|
|
546
|
-
}
|
|
547
|
-
this.changeDetector.markForCheck();
|
|
548
|
-
this.emitSelectedRows(SkyGridSelectedRowsSource.SelectAll);
|
|
549
|
-
}
|
|
550
|
-
multiselectClearAll() {
|
|
551
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
552
|
-
this.items[i].isSelected = false;
|
|
553
|
-
}
|
|
554
|
-
this.changeDetector.markForCheck();
|
|
555
|
-
this.emitSelectedRows(SkyGridSelectedRowsSource.ClearAll);
|
|
556
|
-
}
|
|
557
|
-
handleIncomingMessages(message) {
|
|
558
|
-
/* tslint:disable-next-line:switch-default */
|
|
559
|
-
switch (message.type) {
|
|
560
|
-
case SkyGridMessageType.SelectAll:
|
|
561
|
-
this.multiselectSelectAll();
|
|
562
|
-
break;
|
|
563
|
-
case SkyGridMessageType.ClearAll:
|
|
564
|
-
this.multiselectClearAll();
|
|
565
|
-
break;
|
|
566
|
-
case SkyGridMessageType.PromptDeleteRow:
|
|
567
|
-
/* sanity check */
|
|
568
|
-
/* istanbul ignore else */
|
|
569
|
-
if (message.data && message.data.promptDeleteRow) {
|
|
570
|
-
const existingConfig = this.rowDeleteConfigs.find((config) => config.id === message.data.promptDeleteRow.id);
|
|
571
|
-
if (existingConfig) {
|
|
572
|
-
existingConfig.pending = false;
|
|
573
|
-
}
|
|
574
|
-
else {
|
|
575
|
-
this.rowDeleteConfigs.push({
|
|
576
|
-
id: message.data.promptDeleteRow.id,
|
|
577
|
-
pending: false,
|
|
578
|
-
});
|
|
579
|
-
const overlay = this.overlayService.create({
|
|
580
|
-
enableScroll: true,
|
|
581
|
-
showBackdrop: false,
|
|
582
|
-
closeOnNavigation: true,
|
|
583
|
-
enableClose: false,
|
|
584
|
-
enablePointerEvents: true,
|
|
585
|
-
});
|
|
586
|
-
overlay.attachTemplate(this.inlineDeleteTemplateRef, {
|
|
587
|
-
$implicit: this.data.find((item) => item.id === message.data.promptDeleteRow.id),
|
|
588
|
-
});
|
|
589
|
-
/**
|
|
590
|
-
* We are manually setting the z-index here because overlays will always be on top of
|
|
591
|
-
* the omnibar. This manual setting is 1 less than the omnibar's z-index of 1000. We
|
|
592
|
-
* discussed changing the overlay service to allow for this but decided against that
|
|
593
|
-
* change at this time due to its niche nature.
|
|
594
|
-
*/
|
|
595
|
-
overlay.componentRef.instance.zIndex = '999';
|
|
596
|
-
setTimeout(() => {
|
|
597
|
-
const inlineDeleteRef = this.inlineDeleteRefs
|
|
598
|
-
.toArray()
|
|
599
|
-
.find((elRef) => {
|
|
600
|
-
return (elRef.nativeElement.id ===
|
|
601
|
-
'row-delete-ref-' + message.data.promptDeleteRow.id);
|
|
602
|
-
});
|
|
603
|
-
const affixer = this.affixService.createAffixer(inlineDeleteRef);
|
|
604
|
-
const rowElement = this.tableElementRef.nativeElement.querySelector('[sky-cmp-id="' + message.data.promptDeleteRow.id + '"]');
|
|
605
|
-
affixer.affixTo(rowElement, {
|
|
606
|
-
autoFitContext: SkyAffixAutoFitContext.Viewport,
|
|
607
|
-
isSticky: true,
|
|
608
|
-
placement: 'above',
|
|
609
|
-
verticalAlignment: 'top',
|
|
610
|
-
horizontalAlignment: 'left',
|
|
611
|
-
enableAutoFit: false,
|
|
612
|
-
});
|
|
613
|
-
this.rowDeleteContents[message.data.promptDeleteRow.id] = {
|
|
614
|
-
affixer: affixer,
|
|
615
|
-
overlay: overlay,
|
|
616
|
-
};
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
break;
|
|
621
|
-
case SkyGridMessageType.AbortDeleteRow:
|
|
622
|
-
/* sanity check */
|
|
623
|
-
/* istanbul ignore else */
|
|
624
|
-
if (message.data && message.data.abortDeleteRow) {
|
|
625
|
-
this.rowDeleteConfigs = this.rowDeleteConfigs.filter((config) => config.id !== message.data.abortDeleteRow.id);
|
|
626
|
-
this.destroyRowDelete(message.data.abortDeleteRow.id);
|
|
627
|
-
}
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
630
|
-
this.changeDetector.markForCheck();
|
|
631
|
-
}
|
|
632
|
-
onHeaderDrop(newColumnIds) {
|
|
633
|
-
// update selected columnIds
|
|
634
|
-
this.selectedColumnIdsSet = true;
|
|
635
|
-
this.selectedColumnIds = newColumnIds;
|
|
636
|
-
// mark for check because we are using ChangeDetectionStrategy.onPush
|
|
637
|
-
this.changeDetector.markForCheck();
|
|
638
|
-
}
|
|
639
|
-
setDisplayedColumns(respectHidden = false) {
|
|
640
|
-
/* sanity check */
|
|
641
|
-
/* istanbul ignore else */
|
|
642
|
-
if (this.columns) {
|
|
643
|
-
if (this.selectedColumnIds !== undefined) {
|
|
644
|
-
// setup displayed columns
|
|
645
|
-
this.displayedColumns = this.selectedColumnIds
|
|
646
|
-
.filter((columnId) => {
|
|
647
|
-
return this.columns.find((column) => column.id === columnId);
|
|
648
|
-
})
|
|
649
|
-
.map((columnId) => {
|
|
650
|
-
return this.columns.filter((column) => column.id === columnId)[0];
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
else if (respectHidden) {
|
|
654
|
-
this.displayedColumns = this.columns.filter((column) => {
|
|
655
|
-
return !column.hidden;
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
this.displayedColumns = this.columns;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
transformData() {
|
|
664
|
-
// Transform data into object with id and data properties
|
|
665
|
-
if (this.data &&
|
|
666
|
-
this.data.length > 0 &&
|
|
667
|
-
this.data[0].id &&
|
|
668
|
-
!this.data[0].data) {
|
|
669
|
-
if (this.multiselectRowId) {
|
|
670
|
-
this.items = this.getGridDataWithSelectedRows();
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
this.items = this.data.map((item) => new ListItemModel(item.id, item));
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
else {
|
|
677
|
-
this.items = this.data;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
getGridDataWithSelectedRows() {
|
|
681
|
-
const selectedRows = this.getSelectedRows();
|
|
682
|
-
return this.data.map((item) => {
|
|
683
|
-
let checked;
|
|
684
|
-
if (Object.prototype.hasOwnProperty.call(item, this.multiselectRowId)) {
|
|
685
|
-
checked = selectedRows.indexOf(item[this.multiselectRowId]) > -1;
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
checked = selectedRows.indexOf(item.id) > -1;
|
|
689
|
-
}
|
|
690
|
-
return new ListItemModel(item.id, item, checked);
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
applySelectedRows() {
|
|
694
|
-
if (this.items && this.items.length > 0 && this.selectedRowIds) {
|
|
695
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
696
|
-
this.items[i].isSelected =
|
|
697
|
-
this.selectedRowIds.indexOf(this.items[i].id) > -1;
|
|
698
|
-
}
|
|
699
|
-
this.changeDetector.markForCheck();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
setSortHeaders() {
|
|
703
|
-
this.currentSortField.next(this.sortField || { fieldSelector: '', descending: false });
|
|
704
|
-
}
|
|
705
|
-
getColumnsFromComponent() {
|
|
706
|
-
this.columns = this.columnComponents.map((columnComponent) => {
|
|
707
|
-
return new SkyGridColumnModel(columnComponent.template, columnComponent);
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
updateColumns() {
|
|
711
|
-
this.getColumnsFromComponent();
|
|
712
|
-
// This set timeout is necessary to ensure the columns have rendered in the grid
|
|
713
|
-
setTimeout(() => {
|
|
714
|
-
this.checkUserColumnWidthsForScroll();
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
resizeColumnByIndex(columnIndex, newColWidth, deltaX) {
|
|
718
|
-
const column = this.getColumnModelByIndex(columnIndex);
|
|
719
|
-
// Prevent accidental shrinkage below minimum width.
|
|
720
|
-
if (newColWidth <= this.minColWidth) {
|
|
721
|
-
deltaX = deltaX + this.minColWidth - newColWidth;
|
|
722
|
-
newColWidth = this.minColWidth;
|
|
723
|
-
}
|
|
724
|
-
// fit=width adds/removes width from the last column
|
|
725
|
-
// fit=scroll adds/removes width from the table
|
|
726
|
-
if (this.fit === 'width') {
|
|
727
|
-
const lastColumn = this.getLastDisplayedColumn();
|
|
728
|
-
// Prevent accidental growth that would bump last column off screen.
|
|
729
|
-
const max = this.getMaxRangeByIndex(columnIndex);
|
|
730
|
-
if (newColWidth > max) {
|
|
731
|
-
newColWidth = max;
|
|
732
|
-
deltaX = max - this.startColumnWidth;
|
|
733
|
-
}
|
|
734
|
-
column.width = newColWidth;
|
|
735
|
-
lastColumn.width = lastColumn.width - deltaX;
|
|
736
|
-
this.updateMaxRange();
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
this.gridAdapter.setStyle(this.tableElementRef, 'width', `${this.tableWidth + deltaX}px`);
|
|
740
|
-
column.width = newColWidth;
|
|
741
|
-
}
|
|
742
|
-
this.changeDetector.detectChanges();
|
|
743
|
-
this.columnWidthChange.emit(this.getColumnWidthModelChange());
|
|
744
|
-
}
|
|
745
|
-
initColumnWidths() {
|
|
746
|
-
// Establish table width.
|
|
747
|
-
this.showTopScroll = true;
|
|
748
|
-
// Set column widths based on the width initially given by the browser.
|
|
749
|
-
// computedWidth prevents accidental overflow for browsers with sub-pixel widths.
|
|
750
|
-
this.columnElementRefs.forEach((col, index) => {
|
|
751
|
-
const computedWidth = parseFloat(window.getComputedStyle(col.nativeElement).width);
|
|
752
|
-
const offsetWidth = col.nativeElement.offsetWidth;
|
|
753
|
-
/* istanbul ignore next */
|
|
754
|
-
this.getColumnModelByIndex(index).width = Math.max(computedWidth || offsetWidth, this.minColWidth);
|
|
755
|
-
});
|
|
756
|
-
// 'scroll' tables should be allowed to expand outside of their constraints.
|
|
757
|
-
if (this.fit === 'scroll') {
|
|
758
|
-
this.gridAdapter.setStyle(this.tableElementRef, 'min-width', 'auto');
|
|
759
|
-
}
|
|
760
|
-
// Update max limits for input ranges.
|
|
761
|
-
if (this.fit === 'width') {
|
|
762
|
-
this.updateMaxRange();
|
|
763
|
-
}
|
|
764
|
-
this.changeDetector.detectChanges();
|
|
765
|
-
}
|
|
766
|
-
transferColumnWidths(oldColumns, newColumns) {
|
|
767
|
-
/* sanity check */
|
|
768
|
-
/* istanbul ignore else */
|
|
769
|
-
if (oldColumns && newColumns) {
|
|
770
|
-
for (const oldColumn of oldColumns) {
|
|
771
|
-
if (oldColumn.width) {
|
|
772
|
-
const matchingColumn = newColumns.find((newColumn) => oldColumn.id === newColumn.id);
|
|
773
|
-
if (matchingColumn && !matchingColumn.width) {
|
|
774
|
-
matchingColumn.width = oldColumn.width;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
this.changeDetector.markForCheck();
|
|
780
|
-
}
|
|
781
|
-
getColumnWidthModelChange() {
|
|
782
|
-
const columnWidthModelChange = new Array();
|
|
783
|
-
this.columns.forEach((column) => {
|
|
784
|
-
columnWidthModelChange.push({
|
|
785
|
-
id: column.id,
|
|
786
|
-
field: column.field,
|
|
787
|
-
width: column.width,
|
|
788
|
-
});
|
|
789
|
-
});
|
|
790
|
-
return columnWidthModelChange;
|
|
791
|
-
}
|
|
792
|
-
updateMaxRange() {
|
|
793
|
-
const leftoverWidth = this.getLastDisplayedColumn().width - this.minColWidth;
|
|
794
|
-
this.displayedColumns.forEach((column, index) => {
|
|
795
|
-
const newMaxRange = column.width + leftoverWidth;
|
|
796
|
-
const rangeInput = this.getRangeInputByIndex(index);
|
|
797
|
-
rangeInput.nativeElement.max = newMaxRange;
|
|
798
|
-
rangeInput.nativeElement.setAttribute('aria-valuemax', newMaxRange);
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
initializeResizeColumn(event) {
|
|
802
|
-
const clickTarget = event.target;
|
|
803
|
-
this.activeResizeColumnIndex = clickTarget.getAttribute('sky-cmp-index');
|
|
804
|
-
const column = this.getColumnModelByIndex(this.activeResizeColumnIndex);
|
|
805
|
-
this.startColumnWidth = column.width;
|
|
806
|
-
}
|
|
807
|
-
resetTableWidth() {
|
|
808
|
-
this.skyWindow.nativeWindow.setTimeout(() => {
|
|
809
|
-
this.gridAdapter.setStyle(this.tableElementRef, 'width', `auto`);
|
|
810
|
-
this.changeDetector.detectChanges();
|
|
811
|
-
this.gridAdapter.setStyle(this.tableElementRef, 'width', `${this.tableWidth}px`);
|
|
812
|
-
this.changeDetector.detectChanges();
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
getRangeInputByIndex(index) {
|
|
816
|
-
return this.columnRangeInputElementRefs.find((input) => input.nativeElement.getAttribute('sky-cmp-index') === index.toString());
|
|
817
|
-
}
|
|
818
|
-
getColumnModelByIndex(index) {
|
|
819
|
-
return this.displayedColumns[Number(index)];
|
|
820
|
-
}
|
|
821
|
-
getMaxRangeByIndex(index) {
|
|
822
|
-
const columnElementRef = this.columnElementRefs.find((th) => th.nativeElement.getAttribute('sky-cmp-index') === index);
|
|
823
|
-
const rangeInput = columnElementRef.nativeElement.querySelector('.sky-grid-column-input-aria-only');
|
|
824
|
-
return Number(rangeInput.max);
|
|
825
|
-
}
|
|
826
|
-
getLastDisplayedColumn() {
|
|
827
|
-
return this.getColumnModelByIndex(this.displayedColumns.length - 1);
|
|
828
|
-
}
|
|
829
|
-
addDelimeter(text, delimiter) {
|
|
830
|
-
return text.filter((val) => val).join(delimiter);
|
|
831
|
-
}
|
|
832
|
-
destroyRowDelete(id) {
|
|
833
|
-
const rowDeleteContents = this.rowDeleteContents[id];
|
|
834
|
-
/* istanbul ignore else */
|
|
835
|
-
if (rowDeleteContents) {
|
|
836
|
-
rowDeleteContents.affixer.destroy();
|
|
837
|
-
this.overlayService.close(rowDeleteContents.overlay);
|
|
838
|
-
delete this.rowDeleteContents[id];
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
emitSelectedRows(source) {
|
|
842
|
-
const selectedRows = {
|
|
843
|
-
selectedRowIds: this.getSelectedRows(),
|
|
844
|
-
source: source,
|
|
845
|
-
};
|
|
846
|
-
this.multiselectSelectionChange.emit(selectedRows);
|
|
847
|
-
}
|
|
848
|
-
getSelectedRows() {
|
|
849
|
-
return this.items
|
|
850
|
-
.filter((item) => {
|
|
851
|
-
return item.isSelected;
|
|
852
|
-
})
|
|
853
|
-
.map((item) => {
|
|
854
|
-
if (Object.prototype.hasOwnProperty.call(item.data, this.multiselectRowId)) {
|
|
855
|
-
return item.data[this.multiselectRowId];
|
|
856
|
-
}
|
|
857
|
-
return item.id;
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
isInteractiveElement(event) {
|
|
861
|
-
const interactiveElSelectors = `
|
|
862
|
-
a,
|
|
863
|
-
button,
|
|
864
|
-
input,
|
|
865
|
-
label,
|
|
866
|
-
option,
|
|
867
|
-
select,
|
|
868
|
-
textarea,
|
|
869
|
-
details,
|
|
870
|
-
dialog,
|
|
871
|
-
menu,
|
|
872
|
-
menuitem,
|
|
873
|
-
summary`;
|
|
874
|
-
return event.target.closest(interactiveElSelectors);
|
|
875
|
-
}
|
|
876
|
-
setResizeBarPosition(xPosition) {
|
|
877
|
-
const parentScroll = this.tableContainerElementRef.nativeElement.scrollLeft;
|
|
878
|
-
const resizeBarX = xPosition -
|
|
879
|
-
this.tableElementRef.nativeElement.getBoundingClientRect().left -
|
|
880
|
-
parentScroll;
|
|
881
|
-
this.gridAdapter.setStyle(this.resizeBar, 'left', resizeBarX + 'px');
|
|
882
|
-
}
|
|
883
|
-
applyUserConfig() {
|
|
884
|
-
return new Promise((resolve) => {
|
|
885
|
-
this.uiConfigService
|
|
886
|
-
.getConfig(this.settingsKey)
|
|
887
|
-
.pipe(take(1))
|
|
888
|
-
.subscribe((config) => {
|
|
889
|
-
/* istanbul ignore else */
|
|
890
|
-
if (config && config.selectedColumnIds) {
|
|
891
|
-
// Remove any columnIds that don't exist in the current data set.
|
|
892
|
-
this.selectedColumnIds = config.selectedColumnIds.filter((id) => this.columns.find((column) => column.id === id));
|
|
893
|
-
this.changeDetector.markForCheck();
|
|
894
|
-
}
|
|
895
|
-
resolve();
|
|
896
|
-
}, () => {
|
|
897
|
-
resolve();
|
|
898
|
-
});
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
setUserConfig(config) {
|
|
902
|
-
if (!this.settingsKey) {
|
|
903
|
-
return;
|
|
904
|
-
}
|
|
905
|
-
this.uiConfigService
|
|
906
|
-
.setConfig(this.settingsKey, config)
|
|
907
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
908
|
-
.subscribe(
|
|
909
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
910
|
-
() => { }, (err) => {
|
|
911
|
-
console.warn('Could not save grid settings.');
|
|
912
|
-
console.warn(err);
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
initColumns() {
|
|
916
|
-
/* istanbul ignore else */
|
|
917
|
-
if (this.columnComponents.length !== 0 || this.columns !== undefined) {
|
|
918
|
-
/* istanbul ignore else */
|
|
919
|
-
/* sanity check */
|
|
920
|
-
if (this.columnComponents.length > 0) {
|
|
921
|
-
this.getColumnsFromComponent();
|
|
922
|
-
}
|
|
923
|
-
this.transformData();
|
|
924
|
-
this.setDisplayedColumns(true);
|
|
925
|
-
this.changeDetector.markForCheck();
|
|
926
|
-
}
|
|
927
|
-
// Watch for added/removed columns:
|
|
928
|
-
this.subscriptions.push(this.columnComponents.changes.subscribe(() => this.updateColumns()));
|
|
929
|
-
// Watch for column heading changes:
|
|
930
|
-
this.columnComponents.forEach((comp) => {
|
|
931
|
-
this.subscriptions.push(comp.headingModelChanges.subscribe((change) => {
|
|
932
|
-
this.updateColumnHeading(change);
|
|
933
|
-
}));
|
|
934
|
-
this.subscriptions.push(comp.descriptionModelChanges.subscribe((change) => {
|
|
935
|
-
this.updateColumnDescription(change);
|
|
936
|
-
}));
|
|
937
|
-
this.subscriptions.push(comp.inlineHelpPopoverModelChanges.subscribe((change) => {
|
|
938
|
-
this.updateInlineHelpPopover(change);
|
|
939
|
-
}));
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
arraysEqual(arrayA, arrayB) {
|
|
943
|
-
return (arrayA.length === arrayB.length &&
|
|
944
|
-
arrayA.every((value, index) => value === arrayB[index]));
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
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: i3.SkyGridAdapterService }, { token: i1.SkyOverlayService }, { token: i1.SkyAppWindowRef }, { token: i1.SkyUIConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
948
|
-
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: i6.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 });
|
|
949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyGridComponent, decorators: [{
|
|
950
|
-
type: Component,
|
|
951
|
-
args: [{
|
|
952
|
-
selector: 'sky-grid',
|
|
953
|
-
templateUrl: './grid.component.html',
|
|
954
|
-
styleUrls: ['./grid.component.scss'],
|
|
955
|
-
viewProviders: [DragulaService],
|
|
956
|
-
providers: [SkyGridAdapterService],
|
|
957
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
958
|
-
}]
|
|
959
|
-
}], ctorParameters: function () { return [{ type: i1.SkyAffixService }, { type: i0.ChangeDetectorRef }, { type: i2.DragulaService }, { type: i3.SkyGridAdapterService }, { type: i1.SkyOverlayService }, { type: i1.SkyAppWindowRef }, { type: i1.SkyUIConfigService }]; }, propDecorators: { columns: [{
|
|
960
|
-
type: Input
|
|
961
|
-
}], data: [{
|
|
962
|
-
type: Input
|
|
963
|
-
}], enableMultiselect: [{
|
|
964
|
-
type: Input
|
|
965
|
-
}], fit: [{
|
|
966
|
-
type: Input
|
|
967
|
-
}], hasToolbar: [{
|
|
968
|
-
type: Input
|
|
969
|
-
}], height: [{
|
|
970
|
-
type: Input
|
|
971
|
-
}], highlightText: [{
|
|
972
|
-
type: Input
|
|
973
|
-
}], messageStream: [{
|
|
974
|
-
type: Input
|
|
975
|
-
}], multiselectRowId: [{
|
|
976
|
-
type: Input
|
|
977
|
-
}], rowHighlightedId: [{
|
|
978
|
-
type: Input
|
|
979
|
-
}], selectedColumnIds: [{
|
|
980
|
-
type: Input
|
|
981
|
-
}], selectedRowIds: [{
|
|
982
|
-
type: Input
|
|
983
|
-
}], settingsKey: [{
|
|
984
|
-
type: Input
|
|
985
|
-
}], sortField: [{
|
|
986
|
-
type: Input
|
|
987
|
-
}], width: [{
|
|
988
|
-
type: Input
|
|
989
|
-
}], columnWidthChange: [{
|
|
990
|
-
type: Output
|
|
991
|
-
}], multiselectSelectionChange: [{
|
|
992
|
-
type: Output
|
|
993
|
-
}], rowDeleteCancel: [{
|
|
994
|
-
type: Output
|
|
995
|
-
}], rowDeleteConfirm: [{
|
|
996
|
-
type: Output
|
|
997
|
-
}], selectedColumnIdsChange: [{
|
|
998
|
-
type: Output
|
|
999
|
-
}], sortFieldChange: [{
|
|
1000
|
-
type: Output
|
|
1001
|
-
}], columnComponents: [{
|
|
1002
|
-
type: ContentChildren,
|
|
1003
|
-
args: [SkyGridColumnComponent]
|
|
1004
|
-
}], columnElementRefs: [{
|
|
1005
|
-
type: ViewChildren,
|
|
1006
|
-
args: ['gridCol']
|
|
1007
|
-
}], columnRangeInputElementRefs: [{
|
|
1008
|
-
type: ViewChildren,
|
|
1009
|
-
args: ['colSizeRange']
|
|
1010
|
-
}], inlineDeleteRefs: [{
|
|
1011
|
-
type: ViewChildren,
|
|
1012
|
-
args: ['inlineDeleteRef']
|
|
1013
|
-
}], inlineDeleteTemplateRef: [{
|
|
1014
|
-
type: ViewChild,
|
|
1015
|
-
args: ['inlineDeleteTemplateRef', { read: TemplateRef }]
|
|
1016
|
-
}], tableContainerElementRef: [{
|
|
1017
|
-
type: ViewChild,
|
|
1018
|
-
args: ['gridContainer']
|
|
1019
|
-
}], tableElementRef: [{
|
|
1020
|
-
type: ViewChild,
|
|
1021
|
-
args: ['gridTable']
|
|
1022
|
-
}], topScrollContainerElementRef: [{
|
|
1023
|
-
type: ViewChild,
|
|
1024
|
-
args: ['topScrollContainer']
|
|
1025
|
-
}], resizeBar: [{
|
|
1026
|
-
type: ViewChild,
|
|
1027
|
-
args: ['resizeBar']
|
|
1028
|
-
}], onWindowResize: [{
|
|
1029
|
-
type: HostListener,
|
|
1030
|
-
args: ['window:resize']
|
|
1031
|
-
}] } });
|
|
1032
|
-
//# sourceMappingURL=grid.component.js.map
|