@vaadin/grid 23.1.0-alpha3 → 23.1.0-beta2
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/lit.d.ts +2 -0
- package/lit.js +2 -0
- package/package.json +12 -9
- package/src/array-data-provider.js +2 -2
- package/src/lit/column-renderer-directives.d.ts +152 -0
- package/src/lit/column-renderer-directives.js +149 -0
- package/src/lit/renderer-directives.d.ts +62 -0
- package/src/lit/renderer-directives.js +70 -0
- package/src/vaadin-grid-a11y-mixin.js +5 -5
- package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
- package/src/vaadin-grid-active-item-mixin.js +8 -8
- package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
- package/src/vaadin-grid-array-data-provider-mixin.js +4 -4
- package/src/vaadin-grid-column-group.js +57 -53
- package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
- package/src/vaadin-grid-column-reordering-mixin.js +12 -12
- package/src/vaadin-grid-column-resizing-mixin.js +12 -18
- package/src/vaadin-grid-column.d.ts +2 -2
- package/src/vaadin-grid-column.js +39 -28
- package/src/vaadin-grid-data-provider-mixin.d.ts +2 -2
- package/src/vaadin-grid-data-provider-mixin.js +18 -18
- package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
- package/src/vaadin-grid-drag-and-drop-mixin.js +9 -9
- package/src/vaadin-grid-dynamic-columns-mixin.js +23 -24
- package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
- package/src/vaadin-grid-event-context-mixin.js +1 -1
- package/src/vaadin-grid-filter-column.js +1 -1
- package/src/vaadin-grid-filter-mixin.js +4 -6
- package/src/vaadin-grid-filter.d.ts +2 -2
- package/src/vaadin-grid-filter.js +2 -2
- package/src/vaadin-grid-helpers.js +1 -1
- package/src/vaadin-grid-keyboard-navigation-mixin.js +20 -17
- package/src/vaadin-grid-row-details-mixin.d.ts +2 -2
- package/src/vaadin-grid-row-details-mixin.js +4 -6
- package/src/vaadin-grid-scroll-mixin.js +7 -10
- package/src/vaadin-grid-selection-column.d.ts +2 -2
- package/src/vaadin-grid-selection-column.js +8 -8
- package/src/vaadin-grid-selection-mixin.d.ts +1 -1
- package/src/vaadin-grid-selection-mixin.js +2 -2
- package/src/vaadin-grid-sort-column.d.ts +2 -2
- package/src/vaadin-grid-sort-column.js +2 -2
- package/src/vaadin-grid-sort-mixin.js +7 -11
- package/src/vaadin-grid-sorter.d.ts +2 -2
- package/src/vaadin-grid-sorter.js +4 -4
- package/src/vaadin-grid-styles.js +1 -1
- package/src/vaadin-grid-styling-mixin.d.ts +1 -1
- package/src/vaadin-grid-styling-mixin.js +2 -2
- package/src/vaadin-grid-tree-column.js +3 -3
- package/src/vaadin-grid-tree-toggle.d.ts +2 -2
- package/src/vaadin-grid-tree-toggle.js +4 -4
- package/src/vaadin-grid.d.ts +7 -7
- package/src/vaadin-grid.js +50 -45
- package/theme/lumo/vaadin-grid-sorter-styles.js +1 -1
- package/theme/lumo/vaadin-grid-styles.js +2 -2
- package/theme/lumo/vaadin-grid-tree-toggle-styles.js +1 -1
- package/theme/material/vaadin-grid-sorter-styles.js +1 -1
- package/theme/material/vaadin-grid-styles.js +1 -1
- package/theme/material/vaadin-grid-tree-toggle-styles.js +1 -1
|
@@ -42,7 +42,7 @@ export const ItemCache = class ItemCache {
|
|
|
42
42
|
Object.keys(this.pendingRequests).length ||
|
|
43
43
|
Object.keys(this.itemCaches).filter((index) => {
|
|
44
44
|
return this.itemCaches[index].isLoading();
|
|
45
|
-
})[0]
|
|
45
|
+
})[0],
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -113,7 +113,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
113
113
|
*/
|
|
114
114
|
size: {
|
|
115
115
|
type: Number,
|
|
116
|
-
notify: true
|
|
116
|
+
notify: true,
|
|
117
117
|
},
|
|
118
118
|
|
|
119
119
|
/**
|
|
@@ -124,7 +124,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
124
124
|
pageSize: {
|
|
125
125
|
type: Number,
|
|
126
126
|
value: 50,
|
|
127
|
-
observer: '_pageSizeChanged'
|
|
127
|
+
observer: '_pageSizeChanged',
|
|
128
128
|
},
|
|
129
129
|
|
|
130
130
|
/**
|
|
@@ -153,7 +153,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
153
153
|
dataProvider: {
|
|
154
154
|
type: Object,
|
|
155
155
|
notify: true,
|
|
156
|
-
observer: '_dataProviderChanged'
|
|
156
|
+
observer: '_dataProviderChanged',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
/**
|
|
@@ -163,7 +163,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
163
163
|
type: Boolean,
|
|
164
164
|
notify: true,
|
|
165
165
|
readOnly: true,
|
|
166
|
-
reflectToAttribute: true
|
|
166
|
+
reflectToAttribute: true,
|
|
167
167
|
},
|
|
168
168
|
|
|
169
169
|
/**
|
|
@@ -172,10 +172,10 @@ export const DataProviderMixin = (superClass) =>
|
|
|
172
172
|
*/
|
|
173
173
|
_cache: {
|
|
174
174
|
type: Object,
|
|
175
|
-
value
|
|
175
|
+
value() {
|
|
176
176
|
const cache = new ItemCache(this);
|
|
177
177
|
return cache;
|
|
178
|
-
}
|
|
178
|
+
},
|
|
179
179
|
},
|
|
180
180
|
|
|
181
181
|
/**
|
|
@@ -183,7 +183,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
183
183
|
*/
|
|
184
184
|
_hasData: {
|
|
185
185
|
type: Boolean,
|
|
186
|
-
value: false
|
|
186
|
+
value: false,
|
|
187
187
|
},
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -192,7 +192,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
192
192
|
*/
|
|
193
193
|
itemHasChildrenPath: {
|
|
194
194
|
type: String,
|
|
195
|
-
value: 'children'
|
|
195
|
+
value: 'children',
|
|
196
196
|
},
|
|
197
197
|
|
|
198
198
|
/**
|
|
@@ -201,7 +201,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
201
201
|
*/
|
|
202
202
|
itemIdPath: {
|
|
203
203
|
type: String,
|
|
204
|
-
value: null
|
|
204
|
+
value: null,
|
|
205
205
|
},
|
|
206
206
|
|
|
207
207
|
/**
|
|
@@ -211,7 +211,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
211
211
|
expandedItems: {
|
|
212
212
|
type: Object,
|
|
213
213
|
notify: true,
|
|
214
|
-
value: () => []
|
|
214
|
+
value: () => [],
|
|
215
215
|
},
|
|
216
216
|
|
|
217
217
|
/**
|
|
@@ -219,8 +219,8 @@ export const DataProviderMixin = (superClass) =>
|
|
|
219
219
|
*/
|
|
220
220
|
__expandedKeys: {
|
|
221
221
|
type: Object,
|
|
222
|
-
value: () => new Set()
|
|
223
|
-
}
|
|
222
|
+
value: () => new Set(),
|
|
223
|
+
},
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -344,7 +344,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
344
344
|
* @protected
|
|
345
345
|
*/
|
|
346
346
|
_loadPage(page, cache) {
|
|
347
|
-
//
|
|
347
|
+
// Make sure same page isn't requested multiple times.
|
|
348
348
|
if (!cache.pendingRequests[page] && this.dataProvider) {
|
|
349
349
|
this._setLoading(true);
|
|
350
350
|
cache.pendingRequests[page] = true;
|
|
@@ -353,7 +353,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
353
353
|
pageSize: this.pageSize,
|
|
354
354
|
sortOrders: this._mapSorters(),
|
|
355
355
|
filters: this._mapFilters(),
|
|
356
|
-
parentItem: cache.parentItem
|
|
356
|
+
parentItem: cache.parentItem,
|
|
357
357
|
};
|
|
358
358
|
|
|
359
359
|
this.dataProvider(params, (items, size) => {
|
|
@@ -443,7 +443,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
443
443
|
'The <vaadin-grid> needs the total number of items' +
|
|
444
444
|
' in order to display rows. Set the total number of items' +
|
|
445
445
|
' to the `size` property, or provide the total number of items' +
|
|
446
|
-
' in the second argument of the `dataProvider`’s `callback` call.'
|
|
446
|
+
' in the second argument of the `dataProvider`’s `callback` call.',
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
@@ -459,14 +459,14 @@ export const DataProviderMixin = (superClass) =>
|
|
|
459
459
|
this._debouncerCheckSize = Debouncer.debounce(
|
|
460
460
|
this._debouncerCheckSize,
|
|
461
461
|
timeOut.after(2000),
|
|
462
|
-
this._checkSize.bind(this)
|
|
462
|
+
this._checkSize.bind(this),
|
|
463
463
|
);
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
/** @protected */
|
|
467
467
|
_ensureFirstPageLoaded() {
|
|
468
468
|
if (!this._hasData) {
|
|
469
|
-
//
|
|
469
|
+
// Load data before adding rows to make sure they have content when
|
|
470
470
|
// rendered for the first time.
|
|
471
471
|
this._loadPage(0, this._cache);
|
|
472
472
|
}
|
|
@@ -13,7 +13,7 @@ export type GridDropLocation = 'above' | 'on-top' | 'below' | 'empty';
|
|
|
13
13
|
export type GridDropMode = 'between' | 'on-top' | 'on-top-or-between' | 'on-grid';
|
|
14
14
|
|
|
15
15
|
export declare function DragAndDropMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
|
-
base: T
|
|
16
|
+
base: T,
|
|
17
17
|
): T & Constructor<DragAndDropMixinClass<TItem>>;
|
|
18
18
|
|
|
19
19
|
export declare class DragAndDropMixinClass<TItem> {
|
|
@@ -7,14 +7,14 @@ const DropMode = {
|
|
|
7
7
|
BETWEEN: 'between',
|
|
8
8
|
ON_TOP: 'on-top',
|
|
9
9
|
ON_TOP_OR_BETWEEN: 'on-top-or-between',
|
|
10
|
-
ON_GRID: 'on-grid'
|
|
10
|
+
ON_GRID: 'on-grid',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const DropLocation = {
|
|
14
14
|
ON_TOP: 'on-top',
|
|
15
15
|
ABOVE: 'above',
|
|
16
16
|
BELOW: 'below',
|
|
17
|
-
EMPTY: 'empty'
|
|
17
|
+
EMPTY: 'empty',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -79,8 +79,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
79
79
|
|
|
80
80
|
/** @private */
|
|
81
81
|
__dndAutoScrollThreshold: {
|
|
82
|
-
value: 50
|
|
83
|
-
}
|
|
82
|
+
value: 50,
|
|
83
|
+
},
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -162,8 +162,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
162
162
|
detail: {
|
|
163
163
|
draggedItems: rows.map((row) => row._item),
|
|
164
164
|
setDragData: (type, data) => e.dataTransfer.setData(type, data),
|
|
165
|
-
setDraggedItemsCount: (count) => row.setAttribute('dragstart', count)
|
|
166
|
-
}
|
|
165
|
+
setDraggedItemsCount: (count) => row.setAttribute('dragstart', count),
|
|
166
|
+
},
|
|
167
167
|
});
|
|
168
168
|
event.originalEvent = e;
|
|
169
169
|
this.dispatchEvent(event);
|
|
@@ -313,7 +313,7 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
313
313
|
Array.from(e.dataTransfer.types).map((type) => {
|
|
314
314
|
return {
|
|
315
315
|
type,
|
|
316
|
-
data: e.dataTransfer.getData(type)
|
|
316
|
+
data: e.dataTransfer.getData(type),
|
|
317
317
|
};
|
|
318
318
|
});
|
|
319
319
|
|
|
@@ -325,8 +325,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
325
325
|
detail: {
|
|
326
326
|
dropTargetItem: this._dragOverItem,
|
|
327
327
|
dropLocation: this._dropLocation,
|
|
328
|
-
dragData
|
|
329
|
-
}
|
|
328
|
+
dragData,
|
|
329
|
+
},
|
|
330
330
|
});
|
|
331
331
|
event.originalEvent = e;
|
|
332
332
|
this.dispatchEvent(event);
|
|
@@ -8,6 +8,25 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
8
8
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
9
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
10
|
|
|
11
|
+
function arrayEquals(arr1, arr2) {
|
|
12
|
+
if (!arr1 || !arr2 || arr1.length !== arr2.length) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
for (let i = 0, l = arr1.length; i < l; i++) {
|
|
17
|
+
// Check if we have nested arrays
|
|
18
|
+
if (arr1[i] instanceof Array && arr2[i] instanceof Array) {
|
|
19
|
+
// Recurse into the nested arrays
|
|
20
|
+
if (!arrayEquals(arr1[i], arr2[i])) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
} else if (arr1[i] !== arr2[i]) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
11
30
|
/**
|
|
12
31
|
* @polymerMixin
|
|
13
32
|
*/
|
|
@@ -18,7 +37,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
18
37
|
/**
|
|
19
38
|
* @protected
|
|
20
39
|
*/
|
|
21
|
-
_columnTree: Object
|
|
40
|
+
_columnTree: Object,
|
|
22
41
|
};
|
|
23
42
|
}
|
|
24
43
|
|
|
@@ -79,7 +98,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
79
98
|
/** @protected */
|
|
80
99
|
_updateColumnTree() {
|
|
81
100
|
const columnTree = this._getColumnTree();
|
|
82
|
-
if (!
|
|
101
|
+
if (!arrayEquals(columnTree, this._columnTree)) {
|
|
83
102
|
this._columnTree = columnTree;
|
|
84
103
|
}
|
|
85
104
|
}
|
|
@@ -101,33 +120,13 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
101
120
|
this._debouncerCheckImports = Debouncer.debounce(
|
|
102
121
|
this._debouncerCheckImports,
|
|
103
122
|
timeOut.after(2000),
|
|
104
|
-
this._checkImports.bind(this)
|
|
123
|
+
this._checkImports.bind(this),
|
|
105
124
|
);
|
|
106
125
|
|
|
107
126
|
this._ensureFirstPageLoaded();
|
|
108
127
|
});
|
|
109
128
|
}
|
|
110
129
|
|
|
111
|
-
/** @private */
|
|
112
|
-
_arrayEquals(arr1, arr2) {
|
|
113
|
-
if (!arr1 || !arr2 || arr1.length != arr2.length) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
for (let i = 0, l = arr1.length; i < l; i++) {
|
|
118
|
-
// Check if we have nested arrays
|
|
119
|
-
if (arr1[i] instanceof Array && arr2[i] instanceof Array) {
|
|
120
|
-
// recurse into the nested arrays
|
|
121
|
-
if (!this._arrayEquals(arr1[i], arr2[i])) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
} else if (arr1[i] != arr2[i]) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
130
|
/** @protected */
|
|
132
131
|
_checkImports() {
|
|
133
132
|
[
|
|
@@ -137,7 +136,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
137
136
|
'vaadin-grid-tree-toggle',
|
|
138
137
|
'vaadin-grid-selection-column',
|
|
139
138
|
'vaadin-grid-sort-column',
|
|
140
|
-
'vaadin-grid-sorter'
|
|
139
|
+
'vaadin-grid-sorter',
|
|
141
140
|
].forEach((elementName) => {
|
|
142
141
|
const element = this.querySelector(elementName);
|
|
143
142
|
if (element && !(element instanceof PolymerElement)) {
|
|
@@ -18,7 +18,7 @@ export interface GridEventContext<TItem> {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export declare function EventContextMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
21
|
-
base: T
|
|
21
|
+
base: T,
|
|
22
22
|
): T & Constructor<EventContextMixinClass<TItem>>;
|
|
23
23
|
|
|
24
24
|
export declare class EventContextMixinClass<TItem> {
|
|
@@ -41,7 +41,7 @@ export const EventContextMixin = (superClass) =>
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
context.section = ['body', 'header', 'footer', 'details'].filter(
|
|
44
|
-
(section) => cell.getAttribute('part').indexOf(section) > -1
|
|
44
|
+
(section) => cell.getAttribute('part').indexOf(section) > -1,
|
|
45
45
|
)[0];
|
|
46
46
|
|
|
47
47
|
if (cell._column) {
|
|
@@ -14,10 +14,8 @@ export const FilterMixin = (superClass) =>
|
|
|
14
14
|
/** @private */
|
|
15
15
|
_filters: {
|
|
16
16
|
type: Array,
|
|
17
|
-
value:
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
17
|
+
value: () => [],
|
|
18
|
+
},
|
|
21
19
|
};
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -37,7 +35,7 @@ export const FilterMixin = (superClass) =>
|
|
|
37
35
|
|
|
38
36
|
/** @private */
|
|
39
37
|
__removeFilters(filtersToRemove) {
|
|
40
|
-
if (filtersToRemove.length
|
|
38
|
+
if (filtersToRemove.length === 0) {
|
|
41
39
|
return;
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -69,7 +67,7 @@ export const FilterMixin = (superClass) =>
|
|
|
69
67
|
return this._filters.map((filter) => {
|
|
70
68
|
return {
|
|
71
69
|
path: filter.path,
|
|
72
|
-
value: filter.value
|
|
70
|
+
value: filter.value,
|
|
73
71
|
};
|
|
74
72
|
});
|
|
75
73
|
}
|
|
@@ -54,13 +54,13 @@ declare class GridFilter extends HTMLElement {
|
|
|
54
54
|
addEventListener<K extends keyof GridFilterEventMap>(
|
|
55
55
|
type: K,
|
|
56
56
|
listener: (this: GridFilter, ev: GridFilterEventMap[K]) => void,
|
|
57
|
-
options?: boolean | AddEventListenerOptions
|
|
57
|
+
options?: boolean | AddEventListenerOptions,
|
|
58
58
|
): void;
|
|
59
59
|
|
|
60
60
|
removeEventListener<K extends keyof GridFilterEventMap>(
|
|
61
61
|
type: K,
|
|
62
62
|
listener: (this: GridFilter, ev: GridFilterEventMap[K]) => void,
|
|
63
|
-
options?: boolean | EventListenerOptions
|
|
63
|
+
options?: boolean | EventListenerOptions,
|
|
64
64
|
): void;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export function updateColumnOrders(columns, scope, baseOrder) {
|
|
13
13
|
let c = 1;
|
|
14
14
|
columns.forEach((column) => {
|
|
15
|
-
//
|
|
15
|
+
// Avoid multiples of 10 because they introduce and extra zero and
|
|
16
16
|
// causes the underlying calculations for child order goes wrong
|
|
17
17
|
if (c % 10 === 0) {
|
|
18
18
|
c += 1;
|
|
@@ -14,7 +14,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
14
14
|
/** @private */
|
|
15
15
|
_headerFocusable: {
|
|
16
16
|
type: Object,
|
|
17
|
-
observer: '_focusableChanged'
|
|
17
|
+
observer: '_focusableChanged',
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -23,13 +23,13 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
23
23
|
*/
|
|
24
24
|
_itemsFocusable: {
|
|
25
25
|
type: Object,
|
|
26
|
-
observer: '_focusableChanged'
|
|
26
|
+
observer: '_focusableChanged',
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/** @private */
|
|
30
30
|
_footerFocusable: {
|
|
31
31
|
type: Object,
|
|
32
|
-
observer: '_focusableChanged'
|
|
32
|
+
observer: '_focusableChanged',
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/** @private */
|
|
@@ -41,7 +41,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
41
41
|
*/
|
|
42
42
|
_focusedItemIndex: {
|
|
43
43
|
type: Number,
|
|
44
|
-
value: 0
|
|
44
|
+
value: 0,
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
/** @private */
|
|
@@ -64,8 +64,8 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
64
64
|
value: false,
|
|
65
65
|
reflectToAttribute: true,
|
|
66
66
|
readOnly: true,
|
|
67
|
-
observer: '_interactingChanged'
|
|
68
|
-
}
|
|
67
|
+
observer: '_interactingChanged',
|
|
68
|
+
},
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -461,7 +461,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
461
461
|
|
|
462
462
|
return {
|
|
463
463
|
dstRow: [...activeRowGroup.children].find((el) => !el.hidden && el.index === dstRowIndex),
|
|
464
|
-
dstIsRowDetails
|
|
464
|
+
dstIsRowDetails,
|
|
465
465
|
};
|
|
466
466
|
}
|
|
467
467
|
|
|
@@ -511,7 +511,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
511
511
|
const orderedColumnIndex = dstSortedColumnOrders.indexOf(
|
|
512
512
|
dstSortedColumnOrders
|
|
513
513
|
.slice(0)
|
|
514
|
-
.sort((b, a) => Math.abs(b - this._focusedColumnOrder) - Math.abs(a - this._focusedColumnOrder))[0]
|
|
514
|
+
.sort((b, a) => Math.abs(b - this._focusedColumnOrder) - Math.abs(a - this._focusedColumnOrder))[0],
|
|
515
515
|
);
|
|
516
516
|
|
|
517
517
|
// Index of the destination column order
|
|
@@ -591,7 +591,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
591
591
|
this._headerFocusable,
|
|
592
592
|
this._itemsFocusable,
|
|
593
593
|
this._footerFocusable,
|
|
594
|
-
this.$.focusexit
|
|
594
|
+
this.$.focusexit,
|
|
595
595
|
];
|
|
596
596
|
|
|
597
597
|
let index = tabOrder.indexOf(srcElement);
|
|
@@ -617,6 +617,11 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
617
617
|
_onTabKeyDown(e) {
|
|
618
618
|
const focusTarget = this._predictFocusStepTarget(e.composedPath()[0], e.shiftKey ? -1 : 1);
|
|
619
619
|
|
|
620
|
+
// Can be undefined if grid has tabindex
|
|
621
|
+
if (!focusTarget) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
|
|
620
625
|
// Prevent focus-trap logic from intercepting the event.
|
|
621
626
|
e.stopPropagation();
|
|
622
627
|
|
|
@@ -636,7 +641,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
636
641
|
// scrolling. Focus the row for the stored focused item index instead.
|
|
637
642
|
const columnIndex = Array.from(targetRow.children).indexOf(this._itemsFocusable);
|
|
638
643
|
const focusedItemRow = Array.from(this.$.items.children).find(
|
|
639
|
-
(row) => !row.hidden && row.index === this._focusedItemIndex
|
|
644
|
+
(row) => !row.hidden && row.index === this._focusedItemIndex,
|
|
640
645
|
);
|
|
641
646
|
if (focusedItemRow) {
|
|
642
647
|
itemsFocusTarget = focusedItemRow.children[columnIndex];
|
|
@@ -662,9 +667,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
662
667
|
this.dispatchEvent(
|
|
663
668
|
new CustomEvent(isRow ? 'row-activate' : 'cell-activate', {
|
|
664
669
|
detail: {
|
|
665
|
-
model: this.__getRowModel(isRow ? element : element.parentElement)
|
|
666
|
-
}
|
|
667
|
-
})
|
|
670
|
+
model: this.__getRowModel(isRow ? element : element.parentElement),
|
|
671
|
+
},
|
|
672
|
+
}),
|
|
668
673
|
);
|
|
669
674
|
}
|
|
670
675
|
}
|
|
@@ -734,9 +739,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
734
739
|
if (cell) {
|
|
735
740
|
// Fire a public event for cell.
|
|
736
741
|
const context = this.getEventContext(e);
|
|
737
|
-
cell.dispatchEvent(
|
|
738
|
-
new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context: context } })
|
|
739
|
-
);
|
|
742
|
+
cell.dispatchEvent(new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context } }));
|
|
740
743
|
}
|
|
741
744
|
}
|
|
742
745
|
|
|
@@ -920,7 +923,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
920
923
|
return {
|
|
921
924
|
section,
|
|
922
925
|
row,
|
|
923
|
-
cell
|
|
926
|
+
cell,
|
|
924
927
|
};
|
|
925
928
|
}
|
|
926
929
|
|
|
@@ -9,11 +9,11 @@ import { Grid, GridItemModel } from './vaadin-grid.js';
|
|
|
9
9
|
export type GridRowDetailsRenderer<TItem> = (
|
|
10
10
|
root: HTMLElement,
|
|
11
11
|
grid?: Grid<TItem>,
|
|
12
|
-
model?: GridItemModel<TItem
|
|
12
|
+
model?: GridItemModel<TItem>,
|
|
13
13
|
) => void;
|
|
14
14
|
|
|
15
15
|
export declare function RowDetailsMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
|
-
base: T
|
|
16
|
+
base: T,
|
|
17
17
|
): T & Constructor<RowDetailsMixinClass<TItem>>;
|
|
18
18
|
|
|
19
19
|
export declare class RowDetailsMixinClass<TItem> {
|
|
@@ -17,9 +17,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
17
17
|
*/
|
|
18
18
|
detailsOpenedItems: {
|
|
19
19
|
type: Array,
|
|
20
|
-
value:
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
20
|
+
value: () => [],
|
|
23
21
|
},
|
|
24
22
|
|
|
25
23
|
/**
|
|
@@ -45,15 +43,15 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
45
43
|
* @protected
|
|
46
44
|
*/
|
|
47
45
|
_detailsCells: {
|
|
48
|
-
type: Array
|
|
49
|
-
}
|
|
46
|
+
type: Array,
|
|
47
|
+
},
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
static get observers() {
|
|
54
52
|
return [
|
|
55
53
|
'_detailsOpenedItemsChanged(detailsOpenedItems.*, rowDetailsRenderer)',
|
|
56
|
-
'_rowDetailsRendererChanged(rowDetailsRenderer)'
|
|
54
|
+
'_rowDetailsRendererChanged(rowDetailsRenderer)',
|
|
57
55
|
];
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -8,7 +8,7 @@ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
|
8
8
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
9
9
|
|
|
10
10
|
const timeouts = {
|
|
11
|
-
SCROLLING: 500
|
|
11
|
+
SCROLLING: 500,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -24,7 +24,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
24
24
|
*/
|
|
25
25
|
_frozenCells: {
|
|
26
26
|
type: Array,
|
|
27
|
-
value: () => []
|
|
27
|
+
value: () => [],
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -33,11 +33,11 @@ export const ScrollMixin = (superClass) =>
|
|
|
33
33
|
*/
|
|
34
34
|
_frozenToEndCells: {
|
|
35
35
|
type: Array,
|
|
36
|
-
value: () => []
|
|
36
|
+
value: () => [],
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
/** @private */
|
|
40
|
-
_rowWithFocusedElement: Element
|
|
40
|
+
_rowWithFocusedElement: Element,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -63,9 +63,6 @@ export const ScrollMixin = (superClass) =>
|
|
|
63
63
|
ready() {
|
|
64
64
|
super.ready();
|
|
65
65
|
|
|
66
|
-
// Preserve accessor to the legacy scrolling functionality
|
|
67
|
-
this.$.outerscroller = document.createElement('div');
|
|
68
|
-
|
|
69
66
|
this.scrollTarget = this.$.table;
|
|
70
67
|
|
|
71
68
|
this.$.items.addEventListener('focusin', (e) => {
|
|
@@ -183,7 +180,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
183
180
|
const value = overflow.trim();
|
|
184
181
|
if (value.length > 0 && this.getAttribute('overflow') !== value) {
|
|
185
182
|
this.setAttribute('overflow', value);
|
|
186
|
-
} else if (value.length
|
|
183
|
+
} else if (value.length === 0 && this.hasAttribute('overflow')) {
|
|
187
184
|
this.removeAttribute('overflow');
|
|
188
185
|
}
|
|
189
186
|
});
|
|
@@ -192,7 +189,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
192
189
|
/** @protected */
|
|
193
190
|
_frozenCellsChanged() {
|
|
194
191
|
this._debouncerCacheElements = Debouncer.debounce(this._debouncerCacheElements, microTask, () => {
|
|
195
|
-
Array.from(this.shadowRoot.querySelectorAll('[part~="cell"]')).forEach(
|
|
192
|
+
Array.from(this.shadowRoot.querySelectorAll('[part~="cell"]')).forEach((cell) => {
|
|
196
193
|
cell.style.transform = '';
|
|
197
194
|
});
|
|
198
195
|
this._frozenCells = Array.prototype.slice.call(this.$.table.querySelectorAll('[frozen]'));
|
|
@@ -271,7 +268,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
271
268
|
// Only update the --_grid-horizontal-scroll-position custom property when navigating
|
|
272
269
|
// on row focus mode to avoid performance issues.
|
|
273
270
|
if (this.hasAttribute('navigating') && this.__rowFocusMode) {
|
|
274
|
-
this.$.table.style.setProperty('--_grid-horizontal-scroll-position', -x
|
|
271
|
+
this.$.table.style.setProperty('--_grid-horizontal-scroll-position', `${-x}px`);
|
|
275
272
|
}
|
|
276
273
|
}
|
|
277
274
|
};
|
|
@@ -57,13 +57,13 @@ declare class GridSelectionColumn<TItem = GridDefaultItem> extends GridColumn<TI
|
|
|
57
57
|
addEventListener<K extends keyof GridSelectionColumnEventMap>(
|
|
58
58
|
type: K,
|
|
59
59
|
listener: (this: GridSelectionColumn<TItem>, ev: GridSelectionColumnEventMap[K]) => void,
|
|
60
|
-
options?: boolean | AddEventListenerOptions
|
|
60
|
+
options?: boolean | AddEventListenerOptions,
|
|
61
61
|
): void;
|
|
62
62
|
|
|
63
63
|
removeEventListener<K extends keyof GridSelectionColumnEventMap>(
|
|
64
64
|
type: K,
|
|
65
65
|
listener: (this: GridSelectionColumn<TItem>, ev: GridSelectionColumnEventMap[K]) => void,
|
|
66
|
-
options?: boolean | EventListenerOptions
|
|
66
|
+
options?: boolean | EventListenerOptions,
|
|
67
67
|
): void;
|
|
68
68
|
}
|
|
69
69
|
|