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