@vaadin/grid 24.7.0-alpha4 → 24.7.0-alpha6
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/package.json +11 -11
- package/src/vaadin-grid-column-auto-width-mixin.d.ts +17 -0
- package/src/vaadin-grid-column-auto-width-mixin.js +307 -0
- package/src/vaadin-grid-data-provider-mixin.js +1 -1
- package/src/vaadin-grid-drag-and-drop-mixin.js +33 -3
- package/src/vaadin-grid-mixin.d.ts +3 -5
- package/src/vaadin-grid-mixin.js +17 -237
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
48
|
"@polymer/polymer": "^3.0.0",
|
|
49
|
-
"@vaadin/a11y-base": "24.7.0-
|
|
50
|
-
"@vaadin/checkbox": "24.7.0-
|
|
51
|
-
"@vaadin/component-base": "24.7.0-
|
|
52
|
-
"@vaadin/lit-renderer": "24.7.0-
|
|
53
|
-
"@vaadin/text-field": "24.7.0-
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
55
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
56
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
49
|
+
"@vaadin/a11y-base": "24.7.0-alpha6",
|
|
50
|
+
"@vaadin/checkbox": "24.7.0-alpha6",
|
|
51
|
+
"@vaadin/component-base": "24.7.0-alpha6",
|
|
52
|
+
"@vaadin/lit-renderer": "24.7.0-alpha6",
|
|
53
|
+
"@vaadin/text-field": "24.7.0-alpha6",
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha6",
|
|
55
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha6",
|
|
56
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha6",
|
|
57
57
|
"lit": "^3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
60
|
+
"@vaadin/chai-plugins": "24.7.0-alpha6",
|
|
61
61
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
62
62
|
"sinon": "^18.0.0"
|
|
63
63
|
},
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"web-types.json",
|
|
66
66
|
"web-types.lit.json"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6255a512997a648da91fed37de4d5000809eaebf"
|
|
69
69
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
|
|
8
|
+
export declare function ColumnAutoWidthMixin<T extends Constructor<HTMLElement>>(
|
|
9
|
+
base: T,
|
|
10
|
+
): Constructor<ColumnAutoWidthMixinClass> & T;
|
|
11
|
+
|
|
12
|
+
export declare class ColumnAutoWidthMixinClass {
|
|
13
|
+
/**
|
|
14
|
+
* Updates the `width` of all columns which have `autoWidth` set to `true`.
|
|
15
|
+
*/
|
|
16
|
+
recalculateColumnWidths(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { isElementHidden } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A mixin providing grid column auto-width functionality.
|
|
10
|
+
*
|
|
11
|
+
* @polymerMixin
|
|
12
|
+
*/
|
|
13
|
+
export const ColumnAutoWidthMixin = (superClass) =>
|
|
14
|
+
class extends superClass {
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
/** @private */
|
|
18
|
+
__pendingRecalculateColumnWidths: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
value: true,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static get observers() {
|
|
26
|
+
return [
|
|
27
|
+
'__dataProviderChangedAutoWidth(dataProvider)',
|
|
28
|
+
'__columnTreeChangedAutoWidth(_columnTree)',
|
|
29
|
+
'__flatSizeChangedAutoWidth(_flatSize)',
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.addEventListener('animationend', this.__onAnimationEndAutoWidth);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @private */
|
|
39
|
+
__onAnimationEndAutoWidth(e) {
|
|
40
|
+
if (e.animationName.indexOf('vaadin-grid-appear') === 0) {
|
|
41
|
+
this.__tryToRecalculateColumnWidthsIfPending();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @private */
|
|
46
|
+
__dataProviderChangedAutoWidth(_dataProvider) {
|
|
47
|
+
if (this.__hasHadRenderedRowsForColumnWidthCalculation) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Recalculate column widths when the data provider changes if the grid has not yet had any rendered rows
|
|
51
|
+
// during previous column width calculations
|
|
52
|
+
this.recalculateColumnWidths();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @private */
|
|
56
|
+
__columnTreeChangedAutoWidth(_columnTree) {
|
|
57
|
+
// Column tree changed, recalculate column widths
|
|
58
|
+
queueMicrotask(() => this.recalculateColumnWidths());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** @private */
|
|
62
|
+
__flatSizeChangedAutoWidth() {
|
|
63
|
+
// Flat size changed, recalculate column widths if pending (asynchronously, to allow grid to render row elements first)
|
|
64
|
+
requestAnimationFrame(() => this.__tryToRecalculateColumnWidthsIfPending());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @protected
|
|
69
|
+
* @override
|
|
70
|
+
*/
|
|
71
|
+
_onDataProviderPageLoaded() {
|
|
72
|
+
super._onDataProviderPageLoaded();
|
|
73
|
+
// Data provider page loaded, recalculate column widths if there's a pending recalculation
|
|
74
|
+
this.__tryToRecalculateColumnWidthsIfPending();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @protected
|
|
79
|
+
* @override
|
|
80
|
+
*/
|
|
81
|
+
_updateFrozenColumn() {
|
|
82
|
+
super._updateFrozenColumn();
|
|
83
|
+
// Frozen columns updated, recalculate column widths if there's a pending recalculation
|
|
84
|
+
this.__tryToRecalculateColumnWidthsIfPending();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** @private */
|
|
88
|
+
__getIntrinsicWidth(col) {
|
|
89
|
+
if (!this.__intrinsicWidthCache.has(col)) {
|
|
90
|
+
this.__calculateAndCacheIntrinsicWidths([col]);
|
|
91
|
+
}
|
|
92
|
+
return this.__intrinsicWidthCache.get(col);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @private */
|
|
96
|
+
__getDistributedWidth(col, innerColumn) {
|
|
97
|
+
if (col == null || col === this) {
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const columnWidth = Math.max(
|
|
102
|
+
this.__getIntrinsicWidth(col),
|
|
103
|
+
this.__getDistributedWidth((col.assignedSlot || col).parentElement, col),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// We're processing a regular grid-column and not a grid-column-group
|
|
107
|
+
if (!innerColumn) {
|
|
108
|
+
return columnWidth;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// At the end, the width of each vaadin-grid-column-group is determined by the sum of the width of its children.
|
|
112
|
+
// Here we determine how much space the vaadin-grid-column-group actually needs to render properly and then we distribute that space
|
|
113
|
+
// to its children, so when we actually do the summation it will be rendered properly.
|
|
114
|
+
// Check out vaadin-grid-column-group:_updateFlexAndWidth
|
|
115
|
+
const columnGroup = col;
|
|
116
|
+
const columnGroupWidth = columnWidth;
|
|
117
|
+
const sumOfWidthOfAllChildColumns = columnGroup._visibleChildColumns
|
|
118
|
+
.map((col) => this.__getIntrinsicWidth(col))
|
|
119
|
+
.reduce((sum, curr) => sum + curr, 0);
|
|
120
|
+
|
|
121
|
+
const extraNecessarySpaceForGridColumnGroup = Math.max(0, columnGroupWidth - sumOfWidthOfAllChildColumns);
|
|
122
|
+
|
|
123
|
+
// The distribution of the extra necessary space is done according to the intrinsic width of each child column.
|
|
124
|
+
// Lets say we need 100 pixels of extra space for the grid-column-group to render properly
|
|
125
|
+
// it has two grid-column children, |100px|300px| in total 400px
|
|
126
|
+
// the first column gets 25px of the additional space (100/400)*100 = 25
|
|
127
|
+
// the second column gets the 75px of the additional space (300/400)*100 = 75
|
|
128
|
+
const proportionOfExtraSpace = this.__getIntrinsicWidth(innerColumn) / sumOfWidthOfAllChildColumns;
|
|
129
|
+
const shareOfInnerColumnFromNecessaryExtraSpace = proportionOfExtraSpace * extraNecessarySpaceForGridColumnGroup;
|
|
130
|
+
|
|
131
|
+
return this.__getIntrinsicWidth(innerColumn) + shareOfInnerColumnFromNecessaryExtraSpace;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @param {!Array<!GridColumn>} cols the columns to auto size based on their content width
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
_recalculateColumnWidths() {
|
|
139
|
+
// Flush to make sure DOM is up-to-date when measuring the column widths
|
|
140
|
+
this.__virtualizer.flush();
|
|
141
|
+
[...this.$.header.children, ...this.$.footer.children].forEach((row) => {
|
|
142
|
+
if (row.__debounceUpdateHeaderFooterRowVisibility) {
|
|
143
|
+
row.__debounceUpdateHeaderFooterRowVisibility.flush();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
this.__hasHadRenderedRowsForColumnWidthCalculation ||= this._getRenderedRows().length > 0;
|
|
148
|
+
|
|
149
|
+
this.__intrinsicWidthCache = new Map();
|
|
150
|
+
// Cache the viewport rows to avoid unnecessary reflows while measuring the column widths
|
|
151
|
+
const fvi = this._firstVisibleIndex;
|
|
152
|
+
const lvi = this._lastVisibleIndex;
|
|
153
|
+
this.__viewportRowsCache = this._getRenderedRows().filter((row) => row.index >= fvi && row.index <= lvi);
|
|
154
|
+
|
|
155
|
+
// Pre-cache the intrinsic width of each column
|
|
156
|
+
const cols = this.__getAutoWidthColumns();
|
|
157
|
+
this.__calculateAndCacheIntrinsicWidths(cols);
|
|
158
|
+
|
|
159
|
+
cols.forEach((col) => {
|
|
160
|
+
col.width = `${this.__getDistributedWidth(col)}px`;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Toggles the cell content for the given column to use or not use auto width.
|
|
166
|
+
*
|
|
167
|
+
* While content for all the column cells uses auto width (instead of the default 100%),
|
|
168
|
+
* their offsetWidth can be used to calculate the collective intrinsic width of the column.
|
|
169
|
+
*
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
__setVisibleCellContentAutoWidth(col, autoWidth) {
|
|
173
|
+
col._allCells
|
|
174
|
+
.filter((cell) => {
|
|
175
|
+
if (this.$.items.contains(cell)) {
|
|
176
|
+
return this.__viewportRowsCache.includes(cell.parentElement);
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
})
|
|
180
|
+
.forEach((cell) => {
|
|
181
|
+
cell.__measuringAutoWidth = autoWidth;
|
|
182
|
+
|
|
183
|
+
if (cell.__measuringAutoWidth) {
|
|
184
|
+
// Store the original inline width of the cell to restore it later
|
|
185
|
+
cell.__originalWidth = cell.style.width;
|
|
186
|
+
// Prepare the cell for having its intrinsic width measured
|
|
187
|
+
cell.style.width = 'auto';
|
|
188
|
+
cell.style.position = 'absolute';
|
|
189
|
+
} else {
|
|
190
|
+
// Restore the original width
|
|
191
|
+
cell.style.width = cell.__originalWidth;
|
|
192
|
+
delete cell.__originalWidth;
|
|
193
|
+
cell.style.position = '';
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (autoWidth) {
|
|
198
|
+
this.$.scroller.setAttribute('measuring-auto-width', '');
|
|
199
|
+
} else {
|
|
200
|
+
this.$.scroller.removeAttribute('measuring-auto-width');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns the maximum intrinsic width of the cell content in the given column.
|
|
206
|
+
* Only cells which are marked for measuring auto width are considered.
|
|
207
|
+
*
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
__getAutoWidthCellsMaxWidth(col) {
|
|
211
|
+
// Note: _allCells only contains cells which are currently rendered in DOM
|
|
212
|
+
return col._allCells.reduce((width, cell) => {
|
|
213
|
+
// Add 1px buffer to the offset width to avoid too narrow columns (sub-pixel rendering)
|
|
214
|
+
return cell.__measuringAutoWidth ? Math.max(width, cell.offsetWidth + 1) : width;
|
|
215
|
+
}, 0);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Calculates and caches the intrinsic width of each given column.
|
|
220
|
+
*
|
|
221
|
+
* @private
|
|
222
|
+
*/
|
|
223
|
+
__calculateAndCacheIntrinsicWidths(cols) {
|
|
224
|
+
// Make all the columns use auto width at once before measuring to
|
|
225
|
+
// avoid reflows in between the measurements
|
|
226
|
+
cols.forEach((col) => this.__setVisibleCellContentAutoWidth(col, true));
|
|
227
|
+
// Measure and cache
|
|
228
|
+
cols.forEach((col) => {
|
|
229
|
+
const width = this.__getAutoWidthCellsMaxWidth(col);
|
|
230
|
+
this.__intrinsicWidthCache.set(col, width);
|
|
231
|
+
});
|
|
232
|
+
// Reset the columns to use 100% width
|
|
233
|
+
cols.forEach((col) => this.__setVisibleCellContentAutoWidth(col, false));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Updates the `width` of all columns which have `autoWidth` set to `true`.
|
|
238
|
+
*/
|
|
239
|
+
recalculateColumnWidths() {
|
|
240
|
+
if (!this.__isReadyForColumnWidthCalculation()) {
|
|
241
|
+
this.__pendingRecalculateColumnWidths = true;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this._recalculateColumnWidths();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* This internal method should be called whenever a condition that may have prevented
|
|
249
|
+
* previous column width calculation is resolved.
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
__tryToRecalculateColumnWidthsIfPending() {
|
|
253
|
+
if (!this.__pendingRecalculateColumnWidths) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.__pendingRecalculateColumnWidths = false;
|
|
257
|
+
this.recalculateColumnWidths();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** @private */
|
|
261
|
+
__getAutoWidthColumns() {
|
|
262
|
+
return this._getColumns().filter((col) => !col.hidden && col.autoWidth);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Returns true if the grid is ready for column width calculation, false otherwise.
|
|
267
|
+
* @private
|
|
268
|
+
*/
|
|
269
|
+
__isReadyForColumnWidthCalculation() {
|
|
270
|
+
if (!this._columnTree) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const undefinedCols = this.__getAutoWidthColumns().filter((col) => !customElements.get(col.localName));
|
|
275
|
+
if (undefinedCols.length) {
|
|
276
|
+
// Some of the columns are not defined yet, wait for them to be defined before measuring
|
|
277
|
+
Promise.all(undefinedCols.map((col) => customElements.whenDefined(col.localName))).then(() => {
|
|
278
|
+
this.__tryToRecalculateColumnWidthsIfPending();
|
|
279
|
+
});
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Delay recalculation if any rows are missing an index.
|
|
284
|
+
// This can happen during the grid's initialization if the recalculation is triggered
|
|
285
|
+
// as a result of the data provider responding synchronously to a page request created
|
|
286
|
+
// in the middle of the virtualizer update loop. In this case, rows after the one that
|
|
287
|
+
// triggered the page request may not have an index property yet. The lack of index
|
|
288
|
+
// prevents _onDataProviderPageReceived from requesting children for these rows,
|
|
289
|
+
// resulting in loading state being set to false and the recalculation beginning
|
|
290
|
+
// before all the data is loaded. Note, rows without index get updated in later iterations
|
|
291
|
+
// of the virtualizer update loop, ensuring the grid eventually reaches a stable state.
|
|
292
|
+
const hasRowsWithUndefinedIndex = [...this.$.items.children].some((row) => row.index === undefined);
|
|
293
|
+
|
|
294
|
+
const debouncingHiddenChanged = this._debouncerHiddenChanged && this._debouncerHiddenChanged.isActive();
|
|
295
|
+
|
|
296
|
+
const debouncingUpdateFrozenColumn =
|
|
297
|
+
this.__debounceUpdateFrozenColumn && this.__debounceUpdateFrozenColumn.isActive();
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
!this._dataProviderController.isLoading() &&
|
|
301
|
+
!hasRowsWithUndefinedIndex &&
|
|
302
|
+
!isElementHidden(this) &&
|
|
303
|
+
!debouncingHiddenChanged &&
|
|
304
|
+
!debouncingUpdateFrozenColumn
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
@@ -384,7 +384,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
384
384
|
*/
|
|
385
385
|
clearCache() {
|
|
386
386
|
this._dataProviderController.clearCache();
|
|
387
|
-
this._dataProviderController.rootCache.size = this.size;
|
|
387
|
+
this._dataProviderController.rootCache.size = this.size || 0;
|
|
388
388
|
this._dataProviderController.recalculateFlatSize();
|
|
389
389
|
this._hasData = false;
|
|
390
390
|
this.__updateVisibleRows();
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { isChrome, isSafari } from '@vaadin/component-base/src/browser-utils.js';
|
|
6
7
|
import {
|
|
7
8
|
iterateChildren,
|
|
8
9
|
iterateRowCells,
|
|
@@ -234,6 +235,9 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
234
235
|
|
|
235
236
|
/** @private */
|
|
236
237
|
_onDragLeave(e) {
|
|
238
|
+
if (!this.dropMode) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
237
241
|
e.stopPropagation();
|
|
238
242
|
this._clearDragStyles();
|
|
239
243
|
}
|
|
@@ -315,17 +319,43 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
315
319
|
* issues. To mitigate these issues, we hide the scroller element
|
|
316
320
|
* when drag starts to remove it from the drag image.
|
|
317
321
|
*
|
|
322
|
+
* Grids with fewer rows also have issues on Chromium and Safari
|
|
323
|
+
* where the drag image is not properly clipped and may include
|
|
324
|
+
* content outside the grid. Temporary inline styles are applied
|
|
325
|
+
* to mitigate this issue.
|
|
326
|
+
*
|
|
318
327
|
* Related issues:
|
|
319
328
|
* - https://github.com/vaadin/web-components/issues/7985
|
|
320
329
|
* - https://issues.chromium.org/issues/383356871
|
|
330
|
+
* - https://github.com/vaadin/web-components/issues/8386
|
|
321
331
|
*
|
|
322
332
|
* @private
|
|
323
333
|
*/
|
|
324
334
|
__onDocumentDragStart(e) {
|
|
325
|
-
if (e.target.contains(this)
|
|
326
|
-
|
|
335
|
+
if (e.target.contains(this)) {
|
|
336
|
+
// Record the original inline styles to restore them later
|
|
337
|
+
const elements = [e.target, this.$.items, this.$.scroller];
|
|
338
|
+
const originalInlineStyles = elements.map((element) => element.style.cssText);
|
|
339
|
+
|
|
340
|
+
// With a large number of rows, hide the scroller
|
|
341
|
+
if (this.$.table.scrollHeight > 20000) {
|
|
342
|
+
this.$.scroller.style.display = 'none';
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Workaround content outside the grid ending up in the drag image on Chromium
|
|
346
|
+
if (isChrome) {
|
|
347
|
+
e.target.style.willChange = 'transform';
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Workaround text content outside the grid ending up in the drag image on Safari
|
|
351
|
+
if (isSafari) {
|
|
352
|
+
this.$.items.style.flexShrink = 1;
|
|
353
|
+
}
|
|
354
|
+
|
|
327
355
|
requestAnimationFrame(() => {
|
|
328
|
-
|
|
356
|
+
elements.forEach((element, index) => {
|
|
357
|
+
element.style.cssText = originalInlineStyles[index];
|
|
358
|
+
});
|
|
329
359
|
});
|
|
330
360
|
}
|
|
331
361
|
}
|
|
@@ -9,6 +9,7 @@ import type { A11yMixinClass } from './vaadin-grid-a11y-mixin.js';
|
|
|
9
9
|
import type { ActiveItemMixinClass } from './vaadin-grid-active-item-mixin.js';
|
|
10
10
|
import type { ArrayDataProviderMixinClass } from './vaadin-grid-array-data-provider-mixin.js';
|
|
11
11
|
import type { GridBodyRenderer, GridColumn, GridHeaderFooterRenderer } from './vaadin-grid-column.js';
|
|
12
|
+
import type { ColumnAutoWidthMixinClass } from './vaadin-grid-column-auto-width-mixin.js';
|
|
12
13
|
import type { ColumnReorderingMixinClass } from './vaadin-grid-column-reordering-mixin.js';
|
|
13
14
|
import type {
|
|
14
15
|
DataProviderMixinClass,
|
|
@@ -172,6 +173,7 @@ export declare function GridMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
|
172
173
|
base: T,
|
|
173
174
|
): Constructor<A11yMixinClass> &
|
|
174
175
|
Constructor<ActiveItemMixinClass<TItem>> &
|
|
176
|
+
Constructor<ColumnAutoWidthMixinClass> &
|
|
175
177
|
Constructor<ArrayDataProviderMixinClass<TItem>> &
|
|
176
178
|
Constructor<ColumnReorderingMixinClass> &
|
|
177
179
|
Constructor<DataProviderMixinClass<TItem>> &
|
|
@@ -191,6 +193,7 @@ export interface GridMixinClass<TItem>
|
|
|
191
193
|
A11yMixinClass,
|
|
192
194
|
ActiveItemMixinClass<TItem>,
|
|
193
195
|
ArrayDataProviderMixinClass<TItem>,
|
|
196
|
+
ColumnAutoWidthMixinClass,
|
|
194
197
|
DataProviderMixinClass<TItem>,
|
|
195
198
|
RowDetailsMixinClass<TItem>,
|
|
196
199
|
ScrollMixinClass,
|
|
@@ -209,11 +212,6 @@ export interface GridMixinClass<TItem>
|
|
|
209
212
|
*/
|
|
210
213
|
allRowsVisible: boolean;
|
|
211
214
|
|
|
212
|
-
/**
|
|
213
|
-
* Updates the `width` of all columns which have `autoWidth` set to `true`.
|
|
214
|
-
*/
|
|
215
|
-
recalculateColumnWidths(): void;
|
|
216
|
-
|
|
217
215
|
/**
|
|
218
216
|
* Requests an update for the content of cells.
|
|
219
217
|
*
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { isElementHidden } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
7
6
|
import { TabindexMixin } from '@vaadin/a11y-base/src/tabindex-mixin.js';
|
|
8
7
|
import { animationFrame, microTask } from '@vaadin/component-base/src/async.js';
|
|
9
8
|
import {
|
|
@@ -24,6 +23,7 @@ import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
|
|
|
24
23
|
import { A11yMixin } from './vaadin-grid-a11y-mixin.js';
|
|
25
24
|
import { ActiveItemMixin } from './vaadin-grid-active-item-mixin.js';
|
|
26
25
|
import { ArrayDataProviderMixin } from './vaadin-grid-array-data-provider-mixin.js';
|
|
26
|
+
import { ColumnAutoWidthMixin } from './vaadin-grid-column-auto-width-mixin.js';
|
|
27
27
|
import { ColumnReorderingMixin } from './vaadin-grid-column-reordering-mixin.js';
|
|
28
28
|
import { ColumnResizingMixin } from './vaadin-grid-column-resizing-mixin.js';
|
|
29
29
|
import { DataProviderMixin } from './vaadin-grid-data-provider-mixin.js';
|
|
@@ -67,20 +67,22 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
|
|
|
67
67
|
* @mixes DragAndDropMixin
|
|
68
68
|
*/
|
|
69
69
|
export const GridMixin = (superClass) =>
|
|
70
|
-
class extends
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
class extends ColumnAutoWidthMixin(
|
|
71
|
+
ArrayDataProviderMixin(
|
|
72
|
+
DataProviderMixin(
|
|
73
|
+
DynamicColumnsMixin(
|
|
74
|
+
ActiveItemMixin(
|
|
75
|
+
ScrollMixin(
|
|
76
|
+
SelectionMixin(
|
|
77
|
+
SortMixin(
|
|
78
|
+
RowDetailsMixin(
|
|
79
|
+
KeyboardNavigationMixin(
|
|
80
|
+
A11yMixin(
|
|
81
|
+
FilterMixin(
|
|
82
|
+
ColumnReorderingMixin(
|
|
83
|
+
ColumnResizingMixin(
|
|
84
|
+
EventContextMixin(DragAndDropMixin(StylingMixin(TabindexMixin(superClass)))),
|
|
85
|
+
),
|
|
84
86
|
),
|
|
85
87
|
),
|
|
86
88
|
),
|
|
@@ -144,12 +146,6 @@ export const GridMixin = (superClass) =>
|
|
|
144
146
|
reflectToAttribute: true,
|
|
145
147
|
},
|
|
146
148
|
|
|
147
|
-
/** @private */
|
|
148
|
-
__pendingRecalculateColumnWidths: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
value: true,
|
|
151
|
-
},
|
|
152
|
-
|
|
153
149
|
/** @private */
|
|
154
150
|
isAttached: {
|
|
155
151
|
value: false,
|
|
@@ -201,7 +197,6 @@ export const GridMixin = (superClass) =>
|
|
|
201
197
|
connectedCallback() {
|
|
202
198
|
super.connectedCallback();
|
|
203
199
|
this.isAttached = true;
|
|
204
|
-
this.recalculateColumnWidths();
|
|
205
200
|
}
|
|
206
201
|
|
|
207
202
|
/** @protected */
|
|
@@ -273,7 +268,6 @@ export const GridMixin = (superClass) =>
|
|
|
273
268
|
new ResizeObserver(() =>
|
|
274
269
|
setTimeout(() => {
|
|
275
270
|
this.__updateColumnsBodyContentHidden();
|
|
276
|
-
this.__tryToRecalculateColumnWidthsIfPending();
|
|
277
271
|
}),
|
|
278
272
|
).observe(this.$.table);
|
|
279
273
|
|
|
@@ -352,217 +346,6 @@ export const GridMixin = (superClass) =>
|
|
|
352
346
|
}
|
|
353
347
|
}
|
|
354
348
|
|
|
355
|
-
/** @private */
|
|
356
|
-
__getIntrinsicWidth(col) {
|
|
357
|
-
if (!this.__intrinsicWidthCache.has(col)) {
|
|
358
|
-
this.__calculateAndCacheIntrinsicWidths([col]);
|
|
359
|
-
}
|
|
360
|
-
return this.__intrinsicWidthCache.get(col);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/** @private */
|
|
364
|
-
__getDistributedWidth(col, innerColumn) {
|
|
365
|
-
if (col == null || col === this) {
|
|
366
|
-
return 0;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const columnWidth = Math.max(
|
|
370
|
-
this.__getIntrinsicWidth(col),
|
|
371
|
-
this.__getDistributedWidth((col.assignedSlot || col).parentElement, col),
|
|
372
|
-
);
|
|
373
|
-
|
|
374
|
-
// We're processing a regular grid-column and not a grid-column-group
|
|
375
|
-
if (!innerColumn) {
|
|
376
|
-
return columnWidth;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// At the end, the width of each vaadin-grid-column-group is determined by the sum of the width of its children.
|
|
380
|
-
// Here we determine how much space the vaadin-grid-column-group actually needs to render properly and then we distribute that space
|
|
381
|
-
// to its children, so when we actually do the summation it will be rendered properly.
|
|
382
|
-
// Check out vaadin-grid-column-group:_updateFlexAndWidth
|
|
383
|
-
const columnGroup = col;
|
|
384
|
-
const columnGroupWidth = columnWidth;
|
|
385
|
-
const sumOfWidthOfAllChildColumns = columnGroup._visibleChildColumns
|
|
386
|
-
.map((col) => this.__getIntrinsicWidth(col))
|
|
387
|
-
.reduce((sum, curr) => sum + curr, 0);
|
|
388
|
-
|
|
389
|
-
const extraNecessarySpaceForGridColumnGroup = Math.max(0, columnGroupWidth - sumOfWidthOfAllChildColumns);
|
|
390
|
-
|
|
391
|
-
// The distribution of the extra necessary space is done according to the intrinsic width of each child column.
|
|
392
|
-
// Lets say we need 100 pixels of extra space for the grid-column-group to render properly
|
|
393
|
-
// it has two grid-column children, |100px|300px| in total 400px
|
|
394
|
-
// the first column gets 25px of the additional space (100/400)*100 = 25
|
|
395
|
-
// the second column gets the 75px of the additional space (300/400)*100 = 75
|
|
396
|
-
const proportionOfExtraSpace = this.__getIntrinsicWidth(innerColumn) / sumOfWidthOfAllChildColumns;
|
|
397
|
-
const shareOfInnerColumnFromNecessaryExtraSpace = proportionOfExtraSpace * extraNecessarySpaceForGridColumnGroup;
|
|
398
|
-
|
|
399
|
-
return this.__getIntrinsicWidth(innerColumn) + shareOfInnerColumnFromNecessaryExtraSpace;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* @param {!Array<!GridColumn>} cols the columns to auto size based on their content width
|
|
404
|
-
* @private
|
|
405
|
-
*/
|
|
406
|
-
_recalculateColumnWidths(cols) {
|
|
407
|
-
// Flush to make sure DOM is up-to-date when measuring the column widths
|
|
408
|
-
this.__virtualizer.flush();
|
|
409
|
-
[...this.$.header.children, ...this.$.footer.children].forEach((row) => {
|
|
410
|
-
if (row.__debounceUpdateHeaderFooterRowVisibility) {
|
|
411
|
-
row.__debounceUpdateHeaderFooterRowVisibility.flush();
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
// Flush to account for any changes to the visibility of the columns
|
|
416
|
-
if (this._debouncerHiddenChanged) {
|
|
417
|
-
this._debouncerHiddenChanged.flush();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
this.__intrinsicWidthCache = new Map();
|
|
421
|
-
// Cache the viewport rows to avoid unnecessary reflows while measuring the column widths
|
|
422
|
-
const fvi = this._firstVisibleIndex;
|
|
423
|
-
const lvi = this._lastVisibleIndex;
|
|
424
|
-
this.__viewportRowsCache = this._getRenderedRows().filter((row) => row.index >= fvi && row.index <= lvi);
|
|
425
|
-
|
|
426
|
-
// Pre-cache the intrinsic width of each column
|
|
427
|
-
this.__calculateAndCacheIntrinsicWidths(cols);
|
|
428
|
-
|
|
429
|
-
cols.forEach((col) => {
|
|
430
|
-
col.width = `${this.__getDistributedWidth(col)}px`;
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Toggles the cell content for the given column to use or not use auto width.
|
|
436
|
-
*
|
|
437
|
-
* While content for all the column cells uses auto width (instead of the default 100%),
|
|
438
|
-
* their offsetWidth can be used to calculate the collective intrinsic width of the column.
|
|
439
|
-
*
|
|
440
|
-
* @private
|
|
441
|
-
*/
|
|
442
|
-
__setVisibleCellContentAutoWidth(col, autoWidth) {
|
|
443
|
-
col._allCells
|
|
444
|
-
.filter((cell) => {
|
|
445
|
-
if (this.$.items.contains(cell)) {
|
|
446
|
-
return this.__viewportRowsCache.includes(cell.parentElement);
|
|
447
|
-
}
|
|
448
|
-
return true;
|
|
449
|
-
})
|
|
450
|
-
.forEach((cell) => {
|
|
451
|
-
cell.__measuringAutoWidth = autoWidth;
|
|
452
|
-
|
|
453
|
-
if (cell.__measuringAutoWidth) {
|
|
454
|
-
// Store the original inline width of the cell to restore it later
|
|
455
|
-
cell.__originalWidth = cell.style.width;
|
|
456
|
-
// Prepare the cell for having its intrinsic width measured
|
|
457
|
-
cell.style.width = 'auto';
|
|
458
|
-
cell.style.position = 'absolute';
|
|
459
|
-
} else {
|
|
460
|
-
// Restore the original width
|
|
461
|
-
cell.style.width = cell.__originalWidth;
|
|
462
|
-
delete cell.__originalWidth;
|
|
463
|
-
cell.style.position = '';
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
if (autoWidth) {
|
|
468
|
-
this.$.scroller.setAttribute('measuring-auto-width', '');
|
|
469
|
-
} else {
|
|
470
|
-
this.$.scroller.removeAttribute('measuring-auto-width');
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Returns the maximum intrinsic width of the cell content in the given column.
|
|
476
|
-
* Only cells which are marked for measuring auto width are considered.
|
|
477
|
-
*
|
|
478
|
-
* @private
|
|
479
|
-
*/
|
|
480
|
-
__getAutoWidthCellsMaxWidth(col) {
|
|
481
|
-
// Note: _allCells only contains cells which are currently rendered in DOM
|
|
482
|
-
return col._allCells.reduce((width, cell) => {
|
|
483
|
-
// Add 1px buffer to the offset width to avoid too narrow columns (sub-pixel rendering)
|
|
484
|
-
return cell.__measuringAutoWidth ? Math.max(width, cell.offsetWidth + 1) : width;
|
|
485
|
-
}, 0);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Calculates and caches the intrinsic width of each given column.
|
|
490
|
-
*
|
|
491
|
-
* @private
|
|
492
|
-
*/
|
|
493
|
-
__calculateAndCacheIntrinsicWidths(cols) {
|
|
494
|
-
// Make all the columns use auto width at once before measuring to
|
|
495
|
-
// avoid reflows in between the measurements
|
|
496
|
-
cols.forEach((col) => this.__setVisibleCellContentAutoWidth(col, true));
|
|
497
|
-
// Measure and cache
|
|
498
|
-
cols.forEach((col) => {
|
|
499
|
-
const width = this.__getAutoWidthCellsMaxWidth(col);
|
|
500
|
-
this.__intrinsicWidthCache.set(col, width);
|
|
501
|
-
});
|
|
502
|
-
// Reset the columns to use 100% width
|
|
503
|
-
cols.forEach((col) => this.__setVisibleCellContentAutoWidth(col, false));
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Updates the `width` of all columns which have `autoWidth` set to `true`.
|
|
508
|
-
*/
|
|
509
|
-
recalculateColumnWidths() {
|
|
510
|
-
if (!this._columnTree) {
|
|
511
|
-
return; // No columns
|
|
512
|
-
}
|
|
513
|
-
if (isElementHidden(this) || this._dataProviderController.isLoading()) {
|
|
514
|
-
this.__pendingRecalculateColumnWidths = true;
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
const cols = this._getColumns().filter((col) => !col.hidden && col.autoWidth);
|
|
518
|
-
|
|
519
|
-
const undefinedCols = cols.filter((col) => !customElements.get(col.localName));
|
|
520
|
-
if (undefinedCols.length) {
|
|
521
|
-
// Some of the columns are not defined yet, wait for them to be defined before measuring
|
|
522
|
-
Promise.all(undefinedCols.map((col) => customElements.whenDefined(col.localName))).then(() => {
|
|
523
|
-
this._recalculateColumnWidths(cols);
|
|
524
|
-
});
|
|
525
|
-
} else {
|
|
526
|
-
this._recalculateColumnWidths(cols);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/** @private */
|
|
531
|
-
__tryToRecalculateColumnWidthsIfPending() {
|
|
532
|
-
if (!this.__pendingRecalculateColumnWidths || isElementHidden(this) || this._dataProviderController.isLoading()) {
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// Delay recalculation if any rows are missing an index.
|
|
537
|
-
// This can happen during the grid's initialization if the recalculation is triggered
|
|
538
|
-
// as a result of the data provider responding synchronously to a page request created
|
|
539
|
-
// in the middle of the virtualizer update loop. In this case, rows after the one that
|
|
540
|
-
// triggered the page request may not have an index property yet. The lack of index
|
|
541
|
-
// prevents _onDataProviderPageReceived from requesting children for these rows,
|
|
542
|
-
// resulting in loading state being set to false and the recalculation beginning
|
|
543
|
-
// before all the data is loaded. Note, rows without index get updated in later iterations
|
|
544
|
-
// of the virtualizer update loop, ensuring the grid eventually reaches a stable state.
|
|
545
|
-
const hasRowsWithUndefinedIndex = [...this.$.items.children].some((row) => row.index === undefined);
|
|
546
|
-
if (hasRowsWithUndefinedIndex) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
const hasRowsWithClientHeight = [...this.$.items.children].some((row) => row.clientHeight > 0);
|
|
551
|
-
if (hasRowsWithClientHeight) {
|
|
552
|
-
this.__pendingRecalculateColumnWidths = false;
|
|
553
|
-
this.recalculateColumnWidths();
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* @protected
|
|
559
|
-
* @override
|
|
560
|
-
*/
|
|
561
|
-
_onDataProviderPageLoaded() {
|
|
562
|
-
super._onDataProviderPageLoaded();
|
|
563
|
-
this.__tryToRecalculateColumnWidthsIfPending();
|
|
564
|
-
}
|
|
565
|
-
|
|
566
349
|
/** @private */
|
|
567
350
|
_createScrollerRows(count) {
|
|
568
351
|
const rows = [];
|
|
@@ -590,7 +373,6 @@ export const GridMixin = (superClass) =>
|
|
|
590
373
|
animationFrame,
|
|
591
374
|
() => {
|
|
592
375
|
this._afterScroll();
|
|
593
|
-
this.__tryToRecalculateColumnWidthsIfPending();
|
|
594
376
|
},
|
|
595
377
|
);
|
|
596
378
|
return rows;
|
|
@@ -876,7 +658,6 @@ export const GridMixin = (superClass) =>
|
|
|
876
658
|
/** @private */
|
|
877
659
|
_columnTreeChanged(columnTree) {
|
|
878
660
|
this._renderColumnTree(columnTree);
|
|
879
|
-
this.recalculateColumnWidths();
|
|
880
661
|
this.__updateColumnsBodyContentHidden();
|
|
881
662
|
}
|
|
882
663
|
|
|
@@ -1015,7 +796,6 @@ export const GridMixin = (superClass) =>
|
|
|
1015
796
|
// ShadyCSS applies scoping suffixes to animation names
|
|
1016
797
|
if (e.animationName.indexOf('vaadin-grid-appear') === 0) {
|
|
1017
798
|
e.stopPropagation();
|
|
1018
|
-
this.__tryToRecalculateColumnWidthsIfPending();
|
|
1019
799
|
|
|
1020
800
|
// Ensure header and footer have tabbable elements
|
|
1021
801
|
this._resetKeyboardNavigation();
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha6",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
240
|
"name": "vaadin-grid-column",
|
|
241
|
-
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
241
|
+
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
242
242
|
"attributes": [
|
|
243
243
|
{
|
|
244
244
|
"name": "resizable",
|
|
@@ -951,7 +951,7 @@
|
|
|
951
951
|
},
|
|
952
952
|
{
|
|
953
953
|
"name": "vaadin-grid-selection-column",
|
|
954
|
-
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
954
|
+
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
955
955
|
"attributes": [
|
|
956
956
|
{
|
|
957
957
|
"name": "resizable",
|
|
@@ -2152,7 +2152,7 @@
|
|
|
2152
2152
|
},
|
|
2153
2153
|
{
|
|
2154
2154
|
"name": "vaadin-grid",
|
|
2155
|
-
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
2155
|
+
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
2156
2156
|
"attributes": [
|
|
2157
2157
|
{
|
|
2158
2158
|
"name": "accessible-name",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha6",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "vaadin-grid-column",
|
|
103
|
-
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
103
|
+
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
104
104
|
"extension": true,
|
|
105
105
|
"attributes": [
|
|
106
106
|
{
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
"name": "vaadin-grid-selection-column",
|
|
369
|
-
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
369
|
+
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
370
370
|
"extension": true,
|
|
371
371
|
"attributes": [
|
|
372
372
|
{
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
},
|
|
829
829
|
{
|
|
830
830
|
"name": "vaadin-grid",
|
|
831
|
-
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
831
|
+
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha6/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
832
832
|
"extension": true,
|
|
833
833
|
"attributes": [
|
|
834
834
|
{
|