@vaadin/grid 25.3.0-alpha3 → 25.3.0-alpha5
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/custom-elements.json +1 -1
- package/package.json +12 -12
- package/src/styles/vaadin-grid-base-styles.js +7 -0
- package/src/vaadin-grid-drag-and-drop-mixin.js +14 -2
- package/src/vaadin-grid-mixin.js +51 -51
- package/src/vaadin-grid-selection-column-base-mixin.js +35 -19
- package/src/vaadin-grid.d.ts +10 -0
- package/src/vaadin-grid.js +6 -1
- package/web-types.json +5 -5
- package/web-types.lit.json +5 -5
package/custom-elements.json
CHANGED
|
@@ -7954,7 +7954,7 @@
|
|
|
7954
7954
|
"type": {
|
|
7955
7955
|
"text": "Object"
|
|
7956
7956
|
},
|
|
7957
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
7957
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
7958
7958
|
"attribute": "i18n",
|
|
7959
7959
|
"return": {
|
|
7960
7960
|
"type": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
49
|
-
"@vaadin/checkbox": "25.3.0-
|
|
50
|
-
"@vaadin/component-base": "25.3.0-
|
|
51
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
52
|
-
"@vaadin/text-field": "25.3.0-
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
48
|
+
"@vaadin/a11y-base": "25.3.0-alpha5",
|
|
49
|
+
"@vaadin/checkbox": "25.3.0-alpha5",
|
|
50
|
+
"@vaadin/component-base": "25.3.0-alpha5",
|
|
51
|
+
"@vaadin/lit-renderer": "25.3.0-alpha5",
|
|
52
|
+
"@vaadin/text-field": "25.3.0-alpha5",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha5",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/aura": "25.3.0-
|
|
58
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
59
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
57
|
+
"@vaadin/aura": "25.3.0-alpha5",
|
|
58
|
+
"@vaadin/chai-plugins": "25.3.0-alpha5",
|
|
59
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha5",
|
|
60
60
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
61
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
61
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha5",
|
|
62
62
|
"sinon": "^22.0.0"
|
|
63
63
|
},
|
|
64
64
|
"customElements": "custom-elements.json",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"web-types.json",
|
|
67
67
|
"web-types.lit.json"
|
|
68
68
|
],
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0be2142cd8b95a562d58735033f947f7109103ab"
|
|
70
70
|
}
|
|
@@ -597,6 +597,13 @@ export const gridStyles = css`
|
|
|
597
597
|
outline-offset: calc(var(--vaadin-grid-border-width, 1px) * -1);
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
+
/* Styles applied to draggable cell content; see _filterDragAndDrop in vaadin-grid-drag-and-drop-mixin.js. */
|
|
601
|
+
::slotted(vaadin-grid-cell-content[draggable-source]) {
|
|
602
|
+
-webkit-user-drag: element;
|
|
603
|
+
-webkit-user-select: none;
|
|
604
|
+
user-select: none;
|
|
605
|
+
}
|
|
606
|
+
|
|
600
607
|
.row[dragover] {
|
|
601
608
|
z-index: 100 !important;
|
|
602
609
|
}
|
|
@@ -481,11 +481,23 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
481
481
|
const dragDisabled = !this.rowsDraggable || loading || (this.dragFilter && !this.dragFilter(model));
|
|
482
482
|
const dropDisabled = !this.dropMode || loading || (this.dropFilter && !this.dropFilter(model));
|
|
483
483
|
|
|
484
|
+
// Chromium computes an empty accessible name for cells whose content
|
|
485
|
+
// element has the `draggable` attribute when the accessibility tree is
|
|
486
|
+
// built (https://issues.chromium.org/issues/534049472,
|
|
487
|
+
// https://github.com/vaadin/web-components/issues/11726). Blink maps
|
|
488
|
+
// `draggable="true"` to the `-webkit-user-drag: element` and
|
|
489
|
+
// `user-select: none` styles, and the accessible-name bug is keyed to the
|
|
490
|
+
// attribute, not the styles. So on Chromium, mark the draggable cell
|
|
491
|
+
// content with the `draggable-source` attribute, which applies the
|
|
492
|
+
// equivalent styles from the grid styles, instead of the `draggable`
|
|
493
|
+
// attribute. This can be removed once the Chromium issue is fixed.
|
|
494
|
+
const draggableAttribute = isChrome ? 'draggable-source' : 'draggable';
|
|
495
|
+
|
|
484
496
|
iterateRowCells(row, (cell) => {
|
|
485
497
|
if (dragDisabled) {
|
|
486
|
-
cell._content.removeAttribute(
|
|
498
|
+
cell._content.removeAttribute(draggableAttribute);
|
|
487
499
|
} else {
|
|
488
|
-
cell._content.setAttribute(
|
|
500
|
+
cell._content.setAttribute(draggableAttribute, true);
|
|
489
501
|
}
|
|
490
502
|
});
|
|
491
503
|
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { TabindexMixin } from '@vaadin/a11y-base/src/tabindex-mixin.js';
|
|
7
7
|
import { microTask } from '@vaadin/component-base/src/async.js';
|
|
8
|
-
import { isAndroid,
|
|
8
|
+
import { isAndroid, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
9
9
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
10
|
import { setTouchAction } from '@vaadin/component-base/src/gestures.js';
|
|
11
11
|
import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
|
|
@@ -158,6 +158,15 @@ export const GridMixin = (superClass) =>
|
|
|
158
158
|
return lastVisibleItem ? lastVisibleItem.index : undefined;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
constructor() {
|
|
162
|
+
super();
|
|
163
|
+
|
|
164
|
+
this.__onCellMouseEnter = this.__onCellMouseEnter.bind(this);
|
|
165
|
+
this.__onCellMouseLeave = this.__onCellMouseLeave.bind(this);
|
|
166
|
+
this.__onCellMouseDown = this.__onCellMouseDown.bind(this);
|
|
167
|
+
this.__onCellKeyDown = this.__onCellKeyDown.bind(this);
|
|
168
|
+
}
|
|
169
|
+
|
|
161
170
|
/** @protected */
|
|
162
171
|
connectedCallback() {
|
|
163
172
|
super.connectedCallback();
|
|
@@ -235,6 +244,13 @@ export const GridMixin = (superClass) =>
|
|
|
235
244
|
// otherwise be triggered by this logic because it reads the row height
|
|
236
245
|
// right after updating the rows' content.
|
|
237
246
|
__disableHeightPlaceholder: true,
|
|
247
|
+
// The virtualizer amortizes scroller height updates to avoid reflows while
|
|
248
|
+
// scrolling. In `allRowsVisible` mode the grid has no scrolling and its
|
|
249
|
+
// height must track the content exactly, so tell the virtualizer to always
|
|
250
|
+
// apply the scroller height. Otherwise the items container can be left at a
|
|
251
|
+
// stale, too-small height and clip rows when the grid grows (e.g. when
|
|
252
|
+
// expanding a tree grid from a small size).
|
|
253
|
+
__alwaysUpdateScrollerSize: () => this.allRowsVisible,
|
|
238
254
|
});
|
|
239
255
|
|
|
240
256
|
this._tooltipController = new TooltipController(this);
|
|
@@ -351,6 +367,36 @@ export const GridMixin = (superClass) =>
|
|
|
351
367
|
return rows;
|
|
352
368
|
}
|
|
353
369
|
|
|
370
|
+
/** @private */
|
|
371
|
+
__onCellKeyDown(event) {
|
|
372
|
+
const cell = event.currentTarget;
|
|
373
|
+
cell._column?.__onCellKeyDown?.(event);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** @private */
|
|
377
|
+
__onCellMouseEnter(event) {
|
|
378
|
+
// For now we only support tooltip on desktop
|
|
379
|
+
if (!isAndroid && !isIOS && !this.$.scroller.hasAttribute('scrolling')) {
|
|
380
|
+
this._showTooltip(event);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** @private */
|
|
385
|
+
__onCellMouseLeave() {
|
|
386
|
+
// For now we only support tooltip on desktop
|
|
387
|
+
if (!isAndroid && !isIOS) {
|
|
388
|
+
this._hideTooltip();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** @private */
|
|
393
|
+
__onCellMouseDown() {
|
|
394
|
+
// For now we only support tooltip on desktop
|
|
395
|
+
if (!isAndroid && !isIOS) {
|
|
396
|
+
this._hideTooltip(true);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
354
400
|
/** @private */
|
|
355
401
|
_createCell(tagName, column) {
|
|
356
402
|
const contentId = (this._contentIndex = this._contentIndex + 1 || 0);
|
|
@@ -363,22 +409,10 @@ export const GridMixin = (superClass) =>
|
|
|
363
409
|
cell.id = slotName.replace('-content-', '-');
|
|
364
410
|
cell.setAttribute('role', tagName === 'td' ? 'gridcell' : 'columnheader');
|
|
365
411
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
this._showTooltip(event);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
cell.addEventListener('mouseleave', () => {
|
|
375
|
-
this._hideTooltip();
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
cell.addEventListener('mousedown', () => {
|
|
379
|
-
this._hideTooltip(true);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
412
|
+
cell.addEventListener('mouseenter', this.__onCellMouseEnter);
|
|
413
|
+
cell.addEventListener('mouseleave', this.__onCellMouseLeave);
|
|
414
|
+
cell.addEventListener('mousedown', this.__onCellMouseDown);
|
|
415
|
+
cell.addEventListener('keydown', this.__onCellKeyDown);
|
|
382
416
|
|
|
383
417
|
const slot = document.createElement('slot');
|
|
384
418
|
slot.setAttribute('name', slotName);
|
|
@@ -403,34 +437,6 @@ export const GridMixin = (superClass) =>
|
|
|
403
437
|
|
|
404
438
|
cell._content = cellContent;
|
|
405
439
|
|
|
406
|
-
// With native Shadow DOM, mousedown on slotted element does not focus
|
|
407
|
-
// focusable slot wrapper, that is why cells are not focused with
|
|
408
|
-
// mousedown. Workaround: listen for mousedown and focus manually.
|
|
409
|
-
cellContent.addEventListener('mousedown', () => {
|
|
410
|
-
if (isChrome) {
|
|
411
|
-
// Chrome bug: focusing before mouseup prevents text selection, see http://crbug.com/771903
|
|
412
|
-
const mouseUpListener = (event) => {
|
|
413
|
-
// If focus is on element within the cell content - respect it, do not change
|
|
414
|
-
const contentContainsFocusedElement = cellContent.contains(this.getRootNode().activeElement);
|
|
415
|
-
// Only focus if mouse is released on cell content itself
|
|
416
|
-
const mouseUpWithinCell = event.composedPath().includes(cellContent);
|
|
417
|
-
if (!contentContainsFocusedElement && mouseUpWithinCell) {
|
|
418
|
-
cell.focus({ preventScroll: true });
|
|
419
|
-
}
|
|
420
|
-
document.removeEventListener('mouseup', mouseUpListener, true);
|
|
421
|
-
};
|
|
422
|
-
document.addEventListener('mouseup', mouseUpListener, true);
|
|
423
|
-
} else {
|
|
424
|
-
// Focus on mouseup, on the other hand, removes selection on Safari.
|
|
425
|
-
// Watch out sync focus removal issue, only async focus works here.
|
|
426
|
-
setTimeout(() => {
|
|
427
|
-
if (!cellContent.contains(this.getRootNode().activeElement)) {
|
|
428
|
-
cell.focus({ preventScroll: true });
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
|
|
434
440
|
return cell;
|
|
435
441
|
}
|
|
436
442
|
|
|
@@ -469,9 +475,6 @@ export const GridMixin = (superClass) =>
|
|
|
469
475
|
cell = column._cells.find((cell) => cell._vacant);
|
|
470
476
|
if (!cell) {
|
|
471
477
|
cell = this._createCell('td', column);
|
|
472
|
-
if (column._onCellKeyDown) {
|
|
473
|
-
cell.addEventListener('keydown', column._onCellKeyDown.bind(column));
|
|
474
|
-
}
|
|
475
478
|
column._cells.push(cell);
|
|
476
479
|
}
|
|
477
480
|
updatePart(cell, 'cell', true);
|
|
@@ -520,9 +523,6 @@ export const GridMixin = (superClass) =>
|
|
|
520
523
|
cell = column[`_${section}Cell`];
|
|
521
524
|
if (!cell) {
|
|
522
525
|
cell = this._createCell(tagName);
|
|
523
|
-
if (column._onCellKeyDown) {
|
|
524
|
-
cell.addEventListener('keydown', column._onCellKeyDown.bind(column));
|
|
525
|
-
}
|
|
526
526
|
}
|
|
527
527
|
cell._column = column;
|
|
528
528
|
row.appendChild(cell);
|
|
@@ -107,12 +107,12 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
107
107
|
|
|
108
108
|
constructor() {
|
|
109
109
|
super();
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
110
|
+
this.__onCellContentTrack = this.__onCellContentTrack.bind(this);
|
|
111
|
+
this.__onCellContentClick = this.__onCellContentClick.bind(this);
|
|
112
|
+
this.__onCellContentMouseDown = this.__onCellContentMouseDown.bind(this);
|
|
113
113
|
this.__onGridInteraction = this.__onGridInteraction.bind(this);
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
114
|
+
this.__onGridActiveItemChanged = this.__onGridActiveItemChanged.bind(this);
|
|
115
|
+
this.__onGridTouchStart = this.__onGridTouchStart.bind(this);
|
|
116
116
|
this.__onSelectRowCheckboxChange = this.__onSelectRowCheckboxChange.bind(this);
|
|
117
117
|
this.__onSelectAllCheckboxChange = this.__onSelectAllCheckboxChange.bind(this);
|
|
118
118
|
}
|
|
@@ -124,8 +124,8 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
124
124
|
this._grid.addEventListener('keyup', this.__onGridInteraction);
|
|
125
125
|
this._grid.addEventListener('keydown', this.__onGridInteraction, { capture: true });
|
|
126
126
|
this._grid.addEventListener('mousedown', this.__onGridInteraction);
|
|
127
|
-
this._grid.addEventListener('active-item-changed', this.
|
|
128
|
-
this._grid.addEventListener('touchstart', this.
|
|
127
|
+
this._grid.addEventListener('active-item-changed', this.__onGridActiveItemChanged);
|
|
128
|
+
this._grid.addEventListener('touchstart', this.__onGridTouchStart);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -136,8 +136,8 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
136
136
|
this._grid.removeEventListener('keyup', this.__onGridInteraction);
|
|
137
137
|
this._grid.removeEventListener('keydown', this.__onGridInteraction, { capture: true });
|
|
138
138
|
this._grid.removeEventListener('mousedown', this.__onGridInteraction);
|
|
139
|
-
this._grid.removeEventListener('active-item-changed', this.
|
|
140
|
-
this._grid.removeEventListener('touchstart', this.
|
|
139
|
+
this._grid.removeEventListener('active-item-changed', this.__onGridActiveItemChanged);
|
|
140
|
+
this._grid.removeEventListener('touchstart', this.__onGridTouchStart);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -155,12 +155,28 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
155
155
|
root.appendChild(checkbox);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
const { selectAll, selectAllUnavailable } = this._grid.__effectiveI18n;
|
|
159
|
+
checkbox.accessibleName = selectAll;
|
|
159
160
|
|
|
160
161
|
const checked = this.__isChecked(this.selectAll, this._indeterminate);
|
|
161
162
|
checkbox.checked = checked;
|
|
162
163
|
checkbox.indeterminate = this._indeterminate;
|
|
163
164
|
checkbox.style.visibility = this._selectAllHidden ? 'hidden' : '';
|
|
165
|
+
|
|
166
|
+
// When the Select All checkbox is hidden, the header cell would otherwise
|
|
167
|
+
// be announced as blank. Render a screen-reader-only label into the cell
|
|
168
|
+
// so that screen readers announce the `selectAllUnavailable` text.
|
|
169
|
+
let label = this._headerCell.querySelector(':scope > .sr-only');
|
|
170
|
+
if (this._selectAllHidden && selectAllUnavailable) {
|
|
171
|
+
if (!label) {
|
|
172
|
+
label = document.createElement('span');
|
|
173
|
+
label.classList.add('sr-only');
|
|
174
|
+
this._headerCell.appendChild(label);
|
|
175
|
+
}
|
|
176
|
+
label.textContent = selectAllUnavailable;
|
|
177
|
+
} else if (label) {
|
|
178
|
+
label.remove();
|
|
179
|
+
}
|
|
164
180
|
}
|
|
165
181
|
|
|
166
182
|
/**
|
|
@@ -174,10 +190,10 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
174
190
|
checkbox = document.createElement('vaadin-checkbox');
|
|
175
191
|
checkbox.addEventListener('change', this.__onSelectRowCheckboxChange);
|
|
176
192
|
root.appendChild(checkbox);
|
|
177
|
-
addListener(root, 'track', this.
|
|
193
|
+
addListener(root, 'track', this.__onCellContentTrack);
|
|
178
194
|
setTouchAction(root, 'pinch-zoom');
|
|
179
|
-
root.addEventListener('mousedown', this.
|
|
180
|
-
root.addEventListener('click', this.
|
|
195
|
+
root.addEventListener('mousedown', this.__onCellContentMouseDown);
|
|
196
|
+
root.addEventListener('click', this.__onCellContentClick);
|
|
181
197
|
}
|
|
182
198
|
|
|
183
199
|
this.__updateSelectRowAccessibleName(checkbox, root);
|
|
@@ -254,7 +270,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
254
270
|
}
|
|
255
271
|
|
|
256
272
|
/** @private */
|
|
257
|
-
|
|
273
|
+
__onCellContentTrack(event) {
|
|
258
274
|
if (!this.dragSelect) {
|
|
259
275
|
return;
|
|
260
276
|
}
|
|
@@ -290,7 +306,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
290
306
|
}
|
|
291
307
|
|
|
292
308
|
/** @private */
|
|
293
|
-
|
|
309
|
+
__onCellContentMouseDown(e) {
|
|
294
310
|
if (this.dragSelect) {
|
|
295
311
|
// Prevent text selection when starting to drag
|
|
296
312
|
e.preventDefault();
|
|
@@ -298,7 +314,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
298
314
|
}
|
|
299
315
|
|
|
300
316
|
/** @private */
|
|
301
|
-
|
|
317
|
+
__onGridTouchStart(e) {
|
|
302
318
|
if (e.touches.length > 1) {
|
|
303
319
|
this.__multiTouchActive = true;
|
|
304
320
|
// Cancel in-progress drag-select on multi-touch (e.g. pinch-zoom)
|
|
@@ -310,7 +326,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
310
326
|
}
|
|
311
327
|
|
|
312
328
|
/** @private */
|
|
313
|
-
|
|
329
|
+
__onCellContentClick(e) {
|
|
314
330
|
if (this.__dragStartIndex !== undefined) {
|
|
315
331
|
// Stop the click event if drag was enabled. This click event should
|
|
316
332
|
// only occur if drag started and stopped on the same item. In that case
|
|
@@ -322,7 +338,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
322
338
|
}
|
|
323
339
|
|
|
324
340
|
/** @private */
|
|
325
|
-
|
|
341
|
+
__onCellKeyDown(e) {
|
|
326
342
|
const target = e.composedPath()[0];
|
|
327
343
|
// Toggle on Space without having to enter interaction mode first
|
|
328
344
|
if (e.keyCode !== 32) {
|
|
@@ -341,7 +357,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
341
357
|
}
|
|
342
358
|
|
|
343
359
|
/** @private */
|
|
344
|
-
|
|
360
|
+
__onGridActiveItemChanged(e) {
|
|
345
361
|
const activeItem = e.detail.value;
|
|
346
362
|
if (this.autoSelect) {
|
|
347
363
|
const item = activeItem || this.__previousActiveItem;
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export interface GridI18n {
|
|
|
21
21
|
*/
|
|
22
22
|
selectAll?: string;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The accessible name announced for the selection column header cell when the
|
|
26
|
+
* Select All checkbox is hidden (e.g. a data provider is used or conditional
|
|
27
|
+
* selection is enabled), rendered as a screen-reader-only label in the cell.
|
|
28
|
+
*/
|
|
29
|
+
selectAllUnavailable?: string;
|
|
30
|
+
|
|
24
31
|
/**
|
|
25
32
|
* The accessible name (aria-label) template for the Select Row checkbox in
|
|
26
33
|
* each selection column body cell. The `{rowHeader}` placeholder is replaced with
|
|
@@ -299,6 +306,9 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
299
306
|
* // Accessible name (aria-label) for the select all checkbox in the
|
|
300
307
|
* // selection column header cell.
|
|
301
308
|
* selectAll: 'Select All',
|
|
309
|
+
* // Screen-reader-only label announced for the selection column header cell
|
|
310
|
+
* // when the Select All checkbox is hidden (data provider or conditional selection).
|
|
311
|
+
* selectAllUnavailable: 'Select All unavailable',
|
|
302
312
|
* // Accessible name (aria-label) for the select row checkbox in each
|
|
303
313
|
* // selection column body cell. The `{rowHeader}` placeholder is replaced with the
|
|
304
314
|
* // row header cell text content or row index if there is no row header column.
|
package/src/vaadin-grid.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import './vaadin-grid-column.js';
|
|
7
7
|
import { html, LitElement } from 'lit';
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
|
+
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
|
|
9
10
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
12
|
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
@@ -17,6 +18,7 @@ import { GridMixin } from './vaadin-grid-mixin.js';
|
|
|
17
18
|
|
|
18
19
|
const DEFAULT_I18N = {
|
|
19
20
|
selectAll: 'Select All',
|
|
21
|
+
selectAllUnavailable: 'Select All unavailable',
|
|
20
22
|
selectRow: 'Select Row {rowHeader}',
|
|
21
23
|
sorter: 'Sort by {column}',
|
|
22
24
|
};
|
|
@@ -281,7 +283,7 @@ class Grid extends GridMixin(I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(L
|
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
static get styles() {
|
|
284
|
-
return gridStyles;
|
|
286
|
+
return [gridStyles, screenReaderOnly];
|
|
285
287
|
}
|
|
286
288
|
|
|
287
289
|
static get defaultI18n() {
|
|
@@ -300,6 +302,9 @@ class Grid extends GridMixin(I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(L
|
|
|
300
302
|
* // Accessible name (aria-label) for the select all checkbox in the
|
|
301
303
|
* // selection column header cell.
|
|
302
304
|
* selectAll: 'Select All',
|
|
305
|
+
* // Screen-reader-only label announced for the selection column header cell
|
|
306
|
+
* // when the Select All checkbox is hidden (data provider or conditional selection).
|
|
307
|
+
* selectAllUnavailable: 'Select All unavailable',
|
|
303
308
|
* // Accessible name (aria-label) for the select row checkbox in each
|
|
304
309
|
* // selection column body cell. The `{rowHeader}` placeholder is replaced with the
|
|
305
310
|
* // row header cell text content or row index if there is no row header column.
|
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": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha5",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
"name": "vaadin-grid-column",
|
|
217
|
-
"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/25.3.0-
|
|
217
|
+
"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/25.3.0-alpha5/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
218
218
|
"attributes": [
|
|
219
219
|
{
|
|
220
220
|
"name": "auto-width",
|
|
@@ -855,7 +855,7 @@
|
|
|
855
855
|
},
|
|
856
856
|
{
|
|
857
857
|
"name": "vaadin-grid-selection-column",
|
|
858
|
-
"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>\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/25.3.0-
|
|
858
|
+
"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>\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/25.3.0-alpha5/#/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__",
|
|
859
859
|
"attributes": [
|
|
860
860
|
{
|
|
861
861
|
"name": "auto-select",
|
|
@@ -1952,7 +1952,7 @@
|
|
|
1952
1952
|
},
|
|
1953
1953
|
{
|
|
1954
1954
|
"name": "vaadin-grid",
|
|
1955
|
-
"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/25.3.0-alpha3/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/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.js` entrypoint.\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/25.3.0-alpha3/#/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/25.3.0-alpha3/#/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`header-row` | Header row in the internal table\n`footer-row` | Footer 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`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer 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.",
|
|
1955
|
+
"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/25.3.0-alpha5/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/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.js` entrypoint.\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/25.3.0-alpha5/#/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/25.3.0-alpha5/#/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`header-row` | Header row in the internal table\n`footer-row` | Footer 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`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer 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.",
|
|
1956
1956
|
"attributes": [
|
|
1957
1957
|
{
|
|
1958
1958
|
"name": "accessible-name",
|
|
@@ -2221,7 +2221,7 @@
|
|
|
2221
2221
|
},
|
|
2222
2222
|
{
|
|
2223
2223
|
"name": "i18n",
|
|
2224
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
2224
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
2225
2225
|
"value": {
|
|
2226
2226
|
"type": [
|
|
2227
2227
|
"Object"
|
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": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha5",
|
|
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/25.3.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/25.3.0-alpha5/#/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>\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/25.3.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>\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/25.3.0-alpha5/#/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
|
{
|
|
@@ -835,7 +835,7 @@
|
|
|
835
835
|
},
|
|
836
836
|
{
|
|
837
837
|
"name": "vaadin-grid",
|
|
838
|
-
"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/25.3.0-alpha3/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha3/#/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.js` entrypoint.\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/25.3.0-alpha3/#/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/25.3.0-alpha3/#/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`header-row` | Header row in the internal table\n`footer-row` | Footer 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`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer 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.",
|
|
838
|
+
"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/25.3.0-alpha5/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/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.js` entrypoint.\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/25.3.0-alpha5/#/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/25.3.0-alpha5/#/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`header-row` | Header row in the internal table\n`footer-row` | Footer 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`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer 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.",
|
|
839
839
|
"extension": true,
|
|
840
840
|
"attributes": [
|
|
841
841
|
{
|
|
@@ -931,7 +931,7 @@
|
|
|
931
931
|
},
|
|
932
932
|
{
|
|
933
933
|
"name": ".i18n",
|
|
934
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
934
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
935
935
|
"value": {
|
|
936
936
|
"kind": "expression"
|
|
937
937
|
}
|