@vaadin/grid 25.3.0-alpha5 → 25.3.0-alpha7

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.
@@ -1723,6 +1723,33 @@
1723
1723
  }
1724
1724
  ]
1725
1725
  },
1726
+ {
1727
+ "kind": "javascript-module",
1728
+ "path": "src/vaadin-grid-column-rendering-mixin.js",
1729
+ "declarations": [
1730
+ {
1731
+ "kind": "mixin",
1732
+ "description": "A mixin providing rendering of rows based on the column tree.",
1733
+ "name": "ColumnRenderingMixin",
1734
+ "members": [],
1735
+ "parameters": [
1736
+ {
1737
+ "name": "superClass"
1738
+ }
1739
+ ]
1740
+ }
1741
+ ],
1742
+ "exports": [
1743
+ {
1744
+ "kind": "js",
1745
+ "name": "ColumnRenderingMixin",
1746
+ "declaration": {
1747
+ "name": "ColumnRenderingMixin",
1748
+ "module": "src/vaadin-grid-column-rendering-mixin.js"
1749
+ }
1750
+ }
1751
+ ]
1752
+ },
1726
1753
  {
1727
1754
  "kind": "javascript-module",
1728
1755
  "path": "src/vaadin-grid-column-reordering-mixin.js",
@@ -4739,6 +4766,10 @@
4739
4766
  "name": "DynamicColumnsMixin",
4740
4767
  "module": "src/vaadin-grid-dynamic-columns-mixin.js"
4741
4768
  },
4769
+ {
4770
+ "name": "ColumnRenderingMixin",
4771
+ "module": "src/vaadin-grid-column-rendering-mixin.js"
4772
+ },
4742
4773
  {
4743
4774
  "name": "ActiveItemMixin",
4744
4775
  "module": "src/vaadin-grid-active-item-mixin.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "25.3.0-alpha5",
3
+ "version": "25.3.0-alpha7",
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-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",
48
+ "@vaadin/a11y-base": "25.3.0-alpha7",
49
+ "@vaadin/checkbox": "25.3.0-alpha7",
50
+ "@vaadin/component-base": "25.3.0-alpha7",
51
+ "@vaadin/lit-renderer": "25.3.0-alpha7",
52
+ "@vaadin/text-field": "25.3.0-alpha7",
53
+ "@vaadin/vaadin-themable-mixin": "25.3.0-alpha7",
54
54
  "lit": "^3.0.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@vaadin/aura": "25.3.0-alpha5",
58
- "@vaadin/chai-plugins": "25.3.0-alpha5",
59
- "@vaadin/test-runner-commands": "25.3.0-alpha5",
57
+ "@vaadin/aura": "25.3.0-alpha7",
58
+ "@vaadin/chai-plugins": "25.3.0-alpha7",
59
+ "@vaadin/test-runner-commands": "25.3.0-alpha7",
60
60
  "@vaadin/testing-helpers": "^2.0.0",
61
- "@vaadin/vaadin-lumo-styles": "25.3.0-alpha5",
61
+ "@vaadin/vaadin-lumo-styles": "25.3.0-alpha7",
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": "0be2142cd8b95a562d58735033f947f7109103ab"
69
+ "gitHead": "ae7b9823df5598faebd7a482993029ee489c35ae"
70
70
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html } from 'lit';
7
+ import { AsyncDirective, directive } from 'lit/async-directive.js';
8
+
9
+ /**
10
+ * A directive that manages the `<vaadin-grid-cell-content>` element for a cell.
11
+ */
12
+ class CellContentDirective extends AsyncDirective {
13
+ #cell;
14
+
15
+ update(part, [grid, slotName]) {
16
+ this.#cell = part.parentNode;
17
+ this.#cell._content ??= document.createElement('vaadin-grid-cell-content');
18
+ this.#cell._content.slot = slotName;
19
+
20
+ if (!grid.contains(this.#cell._content)) {
21
+ grid.appendChild(this.#cell._content);
22
+ }
23
+
24
+ return html`<slot name="${slotName}"></slot>`;
25
+ }
26
+
27
+ disconnected() {
28
+ this.#cell._content?.remove();
29
+ }
30
+ }
31
+
32
+ export const cellContent = directive(CellContentDirective);
@@ -137,11 +137,7 @@ export const ColumnAutoWidthMixin = (superClass) =>
137
137
  _recalculateColumnWidths() {
138
138
  // Flush to make sure DOM is up-to-date when measuring the column widths
139
139
  this.__virtualizer.flush();
140
- [...this.$.header.children, ...this.$.footer.children].forEach((row) => {
141
- if (row.__debounceUpdateHeaderFooterRowVisibility) {
142
- row.__debounceUpdateHeaderFooterRowVisibility.flush();
143
- }
144
- });
140
+ this.__renderHeaderFooterDebouncer?.flush();
145
141
 
146
142
  this.__hasHadRenderedRowsForColumnWidthCalculation ||= this._getRenderedRows().length > 0;
147
143
 
@@ -7,7 +7,8 @@ import { animationFrame } from '@vaadin/component-base/src/async.js';
7
7
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
9
  import { get } from '@vaadin/component-base/src/path-utils.js';
10
- import { updateCellState, updatePart } from './vaadin-grid-helpers.js';
10
+ import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
11
+ import { updateCellState } from './vaadin-grid-helpers.js';
11
12
 
12
13
  export const ColumnBaseMixin = (superClass) =>
13
14
  class ColumnBaseMixin extends superClass {
@@ -270,7 +271,7 @@ export const ColumnBaseMixin = (superClass) =>
270
271
  '_onRendererOrBindingChanged(_renderer, _cells, _bodyContentHidden, path)',
271
272
  '_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header)',
272
273
  '_onFooterRendererOrBindingChanged(_footerRenderer, _footerCell)',
273
- '_resizableChanged(resizable, _headerCell)',
274
+ '_resizableChanged(resizable)',
274
275
  '_reorderStatusChanged(_reorderStatus, _headerCell, _footerCell, _cells)',
275
276
  '_hiddenChanged(hidden, _headerCell, _footerCell, _cells)',
276
277
  '_rowHeaderChanged(rowHeader, _cells)',
@@ -302,6 +303,19 @@ export const ColumnBaseMixin = (superClass) =>
302
303
  .filter((cell) => cell);
303
304
  }
304
305
 
306
+ constructor() {
307
+ super();
308
+
309
+ /**
310
+ * A stable unique id assigned once per column instance. Used to build
311
+ * cell content slot names that stay stable across re-renders, so lit
312
+ * can reuse the cell content elements when the column tree changes.
313
+ *
314
+ * @protected
315
+ */
316
+ this._id = generateUniqueId();
317
+ }
318
+
305
319
  /** @protected */
306
320
  connectedCallback() {
307
321
  super.connectedCallback();
@@ -313,7 +327,7 @@ export const ColumnBaseMixin = (superClass) =>
313
327
  return;
314
328
  }
315
329
 
316
- this._allCells.forEach((cell) => {
330
+ this._cells?.forEach((cell) => {
317
331
  if (!cell._content.parentNode) {
318
332
  this._grid.appendChild(cell._content);
319
333
  }
@@ -332,7 +346,7 @@ export const ColumnBaseMixin = (superClass) =>
332
346
  return;
333
347
  }
334
348
 
335
- this._allCells.forEach((cell) => {
349
+ this._cells?.forEach((cell) => {
336
350
  if (cell._content.parentNode) {
337
351
  cell._content.parentNode.removeChild(cell._content);
338
352
  }
@@ -485,27 +499,12 @@ export const ColumnBaseMixin = (superClass) =>
485
499
  }
486
500
 
487
501
  /** @private */
488
- _resizableChanged(resizable, headerCell) {
489
- if (resizable === undefined || headerCell === undefined) {
502
+ _resizableChanged(resizable) {
503
+ if (resizable === undefined || this._grid === undefined) {
490
504
  return;
491
505
  }
492
506
 
493
- if (headerCell) {
494
- [headerCell].concat(this._emptyCells).forEach((cell) => {
495
- if (cell) {
496
- const existingHandle = cell.querySelector('[part~="resize-handle"]');
497
- if (existingHandle) {
498
- cell.removeChild(existingHandle);
499
- }
500
-
501
- if (resizable) {
502
- const handle = document.createElement('div');
503
- updatePart(handle, 'resize-handle', true);
504
- cell.appendChild(handle);
505
- }
506
- }
507
- });
508
- }
507
+ this._grid.__scheduleRenderHeaderFooter?.();
509
508
  }
510
509
 
511
510
  /** @private */
@@ -531,7 +530,7 @@ export const ColumnBaseMixin = (superClass) =>
531
530
 
532
531
  if (!!hidden !== !!this._previousHidden && this._grid) {
533
532
  if (hidden === true) {
534
- this._allCells.forEach((cell) => {
533
+ this._cells?.forEach((cell) => {
535
534
  if (cell._content.parentNode) {
536
535
  cell._content.parentNode.removeChild(cell._content);
537
536
  }
@@ -632,9 +631,8 @@ export const ColumnBaseMixin = (superClass) =>
632
631
  }
633
632
 
634
633
  this.__renderCellsContent(headerRenderer, [headerCell]);
635
- if (this._grid && headerCell.parentElement) {
636
- this._grid.__debounceUpdateHeaderFooterRowVisibility(headerCell.parentElement);
637
- }
634
+
635
+ this._grid?.__scheduleRenderHeaderFooter();
638
636
  }
639
637
 
640
638
  /** @protected */
@@ -689,9 +687,8 @@ export const ColumnBaseMixin = (superClass) =>
689
687
  }
690
688
 
691
689
  this.__renderCellsContent(footerRenderer, [footerCell]);
692
- if (this._grid && footerCell.parentElement) {
693
- this._grid.__debounceUpdateHeaderFooterRowVisibility(footerCell.parentElement);
694
- }
690
+
691
+ this._grid?.__scheduleRenderHeaderFooter();
695
692
  }
696
693
 
697
694
  /** @protected */
@@ -0,0 +1,195 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html, nothing, render } from 'lit';
7
+ import { cache } from 'lit/directives/cache.js';
8
+ import { repeat } from 'lit/directives/repeat.js';
9
+ import { microTask } from '@vaadin/component-base/src/async.js';
10
+ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
11
+ import { cellContent } from './directives/cell-content-directive.js';
12
+
13
+ function isEmptyCell(column, level, columnTree) {
14
+ const isColumnRow = level === columnTree.length - 1;
15
+ return !isColumnRow && column.localName !== 'vaadin-grid-column-group';
16
+ }
17
+
18
+ function isHeaderRowVisible(columns, level, columnTree) {
19
+ return columns.some((column) => {
20
+ if (column.hidden || isEmptyCell(column, level, columnTree)) {
21
+ return false;
22
+ }
23
+
24
+ if (column.headerRenderer) {
25
+ // The column has a header renderer -> row should be visible
26
+ return true;
27
+ }
28
+
29
+ if (column.header === null) {
30
+ // The column header is explicitly set to null -> doesn't block hiding the row
31
+ return false;
32
+ }
33
+
34
+ return column.path || column.header !== undefined;
35
+ });
36
+ }
37
+
38
+ function isFooterRowVisible(columns, level, columnTree) {
39
+ return columns.some((column) => {
40
+ if (column.hidden || isEmptyCell(column, level, columnTree)) {
41
+ return false;
42
+ }
43
+
44
+ return column.footerRenderer;
45
+ });
46
+ }
47
+
48
+ /**
49
+ * A mixin providing rendering of rows based on the column tree.
50
+ */
51
+ export const ColumnRenderingMixin = (superClass) =>
52
+ class ColumnRenderingMixin extends superClass {
53
+ /** @private */
54
+ __scheduleRenderHeaderFooter() {
55
+ this.__renderHeaderFooterDebouncer = Debouncer.debounce(this.__renderHeaderFooterDebouncer, microTask, () => {
56
+ this.__renderHeaderFooter();
57
+ });
58
+ }
59
+
60
+ /** @private */
61
+ __renderHeaderFooter() {
62
+ this.__renderHeaderFooterDebouncer?.cancel();
63
+
64
+ const sortedColumnTree = (this._columnTree ?? []).map((columns) => {
65
+ return columns.toSorted((a, b) => a._order - b._order);
66
+ });
67
+
68
+ sortedColumnTree.flat().forEach((column) => {
69
+ column._emptyCells = [];
70
+ });
71
+
72
+ this.#renderHeader(sortedColumnTree);
73
+ this.#renderFooter(sortedColumnTree);
74
+
75
+ this._resetKeyboardNavigation();
76
+ this.__a11yUpdateGridSize(this.size, this._columnTree, this.__emptyState);
77
+ }
78
+
79
+ #renderHeader(columnTree) {
80
+ render(columnTree.map(this.#renderHeaderRow), this.$.header, { host: this });
81
+
82
+ this.$.table.toggleAttribute('has-header', !!this.$.header.querySelector('tr:not([hidden])'));
83
+ this.__updateHeaderFooterRowParts('header');
84
+
85
+ this.$.header.querySelectorAll('.header-cell').forEach((cell) => {
86
+ const column = cell._column;
87
+ const isColumnRow = cell.parentElement === this.$.header.lastElementChild;
88
+ if (isColumnRow || column.localName === 'vaadin-grid-column-group') {
89
+ column._headerCell = cell;
90
+ } else {
91
+ column._emptyCells.push(cell);
92
+ }
93
+ });
94
+ }
95
+
96
+ #renderHeaderRow = (columns, level, columnTree) => {
97
+ return html`
98
+ <tr
99
+ role="row"
100
+ part="row header-row"
101
+ class="row header-row"
102
+ tabindex="-1"
103
+ ?hidden=${!isHeaderRowVisible(columns, level, columnTree)}
104
+ >
105
+ ${repeat(
106
+ columns,
107
+ (column) => column._id,
108
+ (column) => {
109
+ // `cache` keeps the cell and its rendered content when the
110
+ // column gets hidden, so it can be restored as-is when the
111
+ // column is shown again.
112
+ if (column.hidden) {
113
+ return cache(nothing);
114
+ }
115
+
116
+ return cache(html`
117
+ <th
118
+ role="columnheader"
119
+ part="cell header-cell"
120
+ class="cell header-cell"
121
+ @keydown="${this.__onCellKeyDown}"
122
+ @mousedown=${this.__onCellMouseDown}
123
+ @mouseenter=${this.__onCellMouseEnter}
124
+ @mouseleave=${this.__onCellMouseLeave}
125
+ tabindex="-1"
126
+ ._column=${column}
127
+ >
128
+ ${cellContent(this, `vaadin-grid-header-cell-content-${level}-${column._id}`)}
129
+ ${column.resizable ? html`<div part="resize-handle" class="resize-handle"></div>` : nothing}
130
+ </th>
131
+ `);
132
+ },
133
+ )}
134
+ </tr>
135
+ `;
136
+ };
137
+
138
+ #renderFooter(columnTree) {
139
+ render(columnTree.map(this.#renderFooterRow).toReversed(), this.$.footer, { host: this });
140
+
141
+ this.$.table.toggleAttribute('has-footer', !!this.$.footer.querySelector('tr:not([hidden])'));
142
+ this.__updateHeaderFooterRowParts('footer');
143
+
144
+ this.$.footer.querySelectorAll('.footer-cell').forEach((cell) => {
145
+ const column = cell._column;
146
+ const isColumnRow = cell.parentElement === this.$.footer.firstElementChild;
147
+ if (isColumnRow || column.localName === 'vaadin-grid-column-group') {
148
+ column._footerCell = cell;
149
+ } else {
150
+ column._emptyCells.push(cell);
151
+ }
152
+ });
153
+ }
154
+
155
+ #renderFooterRow = (columns, level, columnTree) => {
156
+ return html`
157
+ <tr
158
+ role="row"
159
+ part="row footer-row"
160
+ class="row footer-row"
161
+ tabindex="-1"
162
+ ?hidden=${!isFooterRowVisible(columns, level, columnTree)}
163
+ >
164
+ ${repeat(
165
+ columns,
166
+ (column) => column._id,
167
+ (column) => {
168
+ // `cache` keeps the cell and its rendered content when the
169
+ // column gets hidden, so it can be restored as-is when the
170
+ // column is shown again.
171
+ if (column.hidden) {
172
+ return cache(nothing);
173
+ }
174
+
175
+ return cache(html`
176
+ <td
177
+ role="gridcell"
178
+ part="cell footer-cell"
179
+ class="cell footer-cell"
180
+ @keydown="${this.__onCellKeyDown}"
181
+ @mousedown=${this.__onCellMouseDown}
182
+ @mouseenter=${this.__onCellMouseEnter}
183
+ @mouseleave=${this.__onCellMouseLeave}
184
+ tabindex="-1"
185
+ ._column=${column}
186
+ >
187
+ ${cellContent(this, `vaadin-grid-footer-cell-content-${level}-${column._id}`)}
188
+ </td>
189
+ `);
190
+ },
191
+ )}
192
+ </tr>
193
+ `;
194
+ };
195
+ };
@@ -203,6 +203,8 @@ export const ColumnReorderingMixin = (superClass) =>
203
203
  for (let i = startIndex; i !== endIndex; i += direction) {
204
204
  this._swapColumnOrders(this._draggedColumn, levelColumnsInOrder[i + direction]);
205
205
  }
206
+
207
+ this.__renderHeaderFooter();
206
208
  }
207
209
 
208
210
  this._updateGhostPosition(e.detail.x, this._touchDevice ? e.detail.y - 50 : e.detail.y);
@@ -434,7 +436,7 @@ export const ColumnReorderingMixin = (superClass) =>
434
436
  }
435
437
 
436
438
  /**
437
- * Swaps column orders and physically reorders cells in all rows.
439
+ * Swaps column orders and reorders cells in all rows.
438
440
  * @param {!GridColumn} column1
439
441
  * @param {!GridColumn} column2
440
442
  * @protected
@@ -444,8 +446,7 @@ export const ColumnReorderingMixin = (superClass) =>
444
446
  [column1._order, column2._order] = [column2._order, column1._order];
445
447
  const [firstColumn, secondColumn] = column1._order < column2._order ? [column1, column2] : [column2, column1];
446
448
 
447
- // Reorder cells in all rows (header, footer, body, sizer)
448
- [...this.$.header.children, ...this.$.footer.children, ...this.$.items.children, this.$.sizer].forEach((row) => {
449
+ [...this.$.items.children, this.$.sizer].forEach((row) => {
449
450
  const cells = getBodyRowCells(row);
450
451
  const firstColumnCells = cells.filter((cell) => firstColumn.contains(cell._column));
451
452
  const secondColumnFirstCell = cells.find((cell) => secondColumn.contains(cell._column));
@@ -456,6 +457,7 @@ export const ColumnReorderingMixin = (superClass) =>
456
457
  }
457
458
  });
458
459
 
460
+ this.__scheduleRenderHeaderFooter();
459
461
  this._debounceUpdateFrozenColumn();
460
462
  this._updateFirstAndLastColumn();
461
463
  }
@@ -4,9 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { TabindexMixin } from '@vaadin/a11y-base/src/tabindex-mixin.js';
7
- import { microTask } from '@vaadin/component-base/src/async.js';
8
7
  import { isAndroid, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
9
- import { Debouncer } from '@vaadin/component-base/src/debounce.js';
10
8
  import { setTouchAction } from '@vaadin/component-base/src/gestures.js';
11
9
  import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
12
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
@@ -15,6 +13,7 @@ import { A11yMixin } from './vaadin-grid-a11y-mixin.js';
15
13
  import { ActiveItemMixin } from './vaadin-grid-active-item-mixin.js';
16
14
  import { ArrayDataProviderMixin } from './vaadin-grid-array-data-provider-mixin.js';
17
15
  import { ColumnAutoWidthMixin } from './vaadin-grid-column-auto-width-mixin.js';
16
+ import { ColumnRenderingMixin } from './vaadin-grid-column-rendering-mixin.js';
18
17
  import { ColumnReorderingMixin } from './vaadin-grid-column-reordering-mixin.js';
19
18
  import { ColumnResizingMixin } from './vaadin-grid-column-resizing-mixin.js';
20
19
  import { DataProviderMixin } from './vaadin-grid-data-provider-mixin.js';
@@ -48,17 +47,21 @@ export const GridMixin = (superClass) =>
48
47
  ArrayDataProviderMixin(
49
48
  DataProviderMixin(
50
49
  DynamicColumnsMixin(
51
- ActiveItemMixin(
52
- ScrollMixin(
53
- SelectionMixin(
54
- SortMixin(
55
- RowDetailsMixin(
56
- KeyboardNavigationMixin(
57
- A11yMixin(
58
- FilterMixin(
59
- ColumnReorderingMixin(
60
- ColumnResizingMixin(
61
- EventContextMixin(DragAndDropMixin(StylingMixin(TabindexMixin(ResizeMixin(superClass))))),
50
+ ColumnRenderingMixin(
51
+ ActiveItemMixin(
52
+ ScrollMixin(
53
+ SelectionMixin(
54
+ SortMixin(
55
+ RowDetailsMixin(
56
+ KeyboardNavigationMixin(
57
+ A11yMixin(
58
+ FilterMixin(
59
+ ColumnReorderingMixin(
60
+ ColumnResizingMixin(
61
+ EventContextMixin(
62
+ DragAndDropMixin(StylingMixin(TabindexMixin(ResizeMixin(superClass)))),
63
+ ),
64
+ ),
62
65
  ),
63
66
  ),
64
67
  ),
@@ -351,7 +354,7 @@ export const GridMixin = (superClass) =>
351
354
  updatePart(row, 'row', true);
352
355
  updatePart(row, 'body-row', true);
353
356
  if (this._columnTree) {
354
- this.__initRow(row, this._columnTree[this._columnTree.length - 1], 'body', false, true);
357
+ this.__initRow(row, this._columnTree[this._columnTree.length - 1], 'body', true);
355
358
  }
356
359
  rows.push(row);
357
360
  }
@@ -444,11 +447,10 @@ export const GridMixin = (superClass) =>
444
447
  * @param {!HTMLTableRowElement} row
445
448
  * @param {!Array<!GridColumn>} columns
446
449
  * @param {?string} section
447
- * @param {boolean} isColumnRow
448
450
  * @param {boolean} noNotify
449
451
  * @private
450
452
  */
451
- __initRow(row, columns, section = 'body', isColumnRow = false, noNotify = false) {
453
+ __initRow(row, columns, section = 'body', noNotify = false) {
452
454
  const contentsFragment = document.createDocumentFragment();
453
455
 
454
456
  iterateRowCells(row, (cell) => {
@@ -516,30 +518,6 @@ export const GridMixin = (superClass) =>
516
518
  if (!noNotify) {
517
519
  column._cells = [...column._cells];
518
520
  }
519
- } else {
520
- // Header & footer
521
- const tagName = section === 'header' ? 'th' : 'td';
522
- if (isColumnRow || column.localName === 'vaadin-grid-column-group') {
523
- cell = column[`_${section}Cell`];
524
- if (!cell) {
525
- cell = this._createCell(tagName);
526
- }
527
- cell._column = column;
528
- row.appendChild(cell);
529
- column[`_${section}Cell`] = cell;
530
- } else {
531
- if (!column._emptyCells) {
532
- column._emptyCells = [];
533
- }
534
- cell = column._emptyCells.find((cell) => cell._vacant) || this._createCell(tagName);
535
- cell._column = column;
536
- row.appendChild(cell);
537
- if (column._emptyCells.indexOf(cell) === -1) {
538
- column._emptyCells.push(cell);
539
- }
540
- }
541
- updatePart(cell, 'cell', true);
542
- updatePart(cell, `${section}-cell`, true);
543
521
  }
544
522
 
545
523
  if (!cell._content.parentElement) {
@@ -549,10 +527,6 @@ export const GridMixin = (superClass) =>
549
527
  cell._column = column;
550
528
  });
551
529
 
552
- if (section !== 'body') {
553
- this.__debounceUpdateHeaderFooterRowVisibility(row);
554
- }
555
-
556
530
  // Might be empty if only cache was used
557
531
  this.appendChild(contentsFragment);
558
532
 
@@ -560,75 +534,6 @@ export const GridMixin = (superClass) =>
560
534
  this._updateFirstAndLastColumnForRow(row);
561
535
  }
562
536
 
563
- /**
564
- * @param {HTMLTableRowElement} row
565
- * @protected
566
- */
567
- __debounceUpdateHeaderFooterRowVisibility(row) {
568
- row.__debounceUpdateHeaderFooterRowVisibility = Debouncer.debounce(
569
- row.__debounceUpdateHeaderFooterRowVisibility,
570
- microTask,
571
- () => this.__updateHeaderFooterRowVisibility(row),
572
- );
573
- }
574
-
575
- /**
576
- * @param {HTMLTableRowElement} row
577
- * @protected
578
- */
579
- __updateHeaderFooterRowVisibility(row) {
580
- if (!row) {
581
- return;
582
- }
583
-
584
- const visibleRowCells = Array.from(row.children).filter((cell) => {
585
- const column = cell._column;
586
- if (column._emptyCells && column._emptyCells.indexOf(cell) > -1) {
587
- // The cell is an "empty cell" -> doesn't block hiding the row
588
- return false;
589
- }
590
- if (row.parentElement === this.$.header) {
591
- if (column.headerRenderer) {
592
- // The cell is the header cell of a column that has a header renderer
593
- // -> row should be visible
594
- return true;
595
- }
596
- if (column.header === null) {
597
- // The column header is explicilty set to null -> doesn't block hiding the row
598
- return false;
599
- }
600
- if (column.path || column.header !== undefined) {
601
- // The column has an explicit non-null header or a path that generates a header
602
- // -> row should be visible
603
- return true;
604
- }
605
- } else if (column.footerRenderer) {
606
- // The cell is the footer cell of a column that has a footer renderer
607
- // -> row should be visible
608
- return true;
609
- }
610
- return false;
611
- });
612
-
613
- if (row.hidden !== !visibleRowCells.length) {
614
- row.hidden = !visibleRowCells.length;
615
- }
616
-
617
- if (row.parentElement === this.$.header) {
618
- this.$.table.toggleAttribute('has-header', this.$.header.querySelector('tr:not([hidden])'));
619
- this.__updateHeaderFooterRowParts('header');
620
- }
621
-
622
- if (row.parentElement === this.$.footer) {
623
- this.$.table.toggleAttribute('has-footer', this.$.footer.querySelector('tr:not([hidden])'));
624
- this.__updateHeaderFooterRowParts('footer');
625
- }
626
-
627
- // Make sure the section has a tabbable element
628
- this._resetKeyboardNavigation();
629
- this.__a11yUpdateGridSize(this.size, this._columnTree, this.__emptyState);
630
- }
631
-
632
537
  /** @private */
633
538
  __updateVirtualizerElement(row, index) {
634
539
  this._preventScrollerRotatingCellFocus(row, index);
@@ -681,43 +586,15 @@ export const GridMixin = (superClass) =>
681
586
  */
682
587
  _renderColumnTree(columnTree) {
683
588
  iterateChildren(this.$.items, (row) => {
684
- this.__initRow(row, columnTree[columnTree.length - 1], 'body', false, true);
589
+ this.__initRow(row, columnTree[columnTree.length - 1], 'body', true);
685
590
  this.__updateRow(row);
686
591
  });
687
592
 
688
- while (this.$.header.children.length < columnTree.length) {
689
- const headerRow = document.createElement('tr');
690
- headerRow.setAttribute('role', 'row');
691
- headerRow.setAttribute('tabindex', '-1');
692
- updatePart(headerRow, 'row', true);
693
- updatePart(headerRow, 'header-row', true);
694
- this.$.header.appendChild(headerRow);
695
-
696
- const footerRow = document.createElement('tr');
697
- footerRow.setAttribute('role', 'row');
698
- footerRow.setAttribute('tabindex', '-1');
699
- updatePart(footerRow, 'row', true);
700
- updatePart(footerRow, 'footer-row', true);
701
- this.$.footer.appendChild(footerRow);
702
- }
703
- while (this.$.header.children.length > columnTree.length) {
704
- this.$.header.removeChild(this.$.header.firstElementChild);
705
- this.$.footer.removeChild(this.$.footer.firstElementChild);
706
- }
707
-
708
- iterateChildren(this.$.header, (headerRow, index) => {
709
- this.__initRow(headerRow, columnTree[index], 'header', index === columnTree.length - 1);
710
- });
711
-
712
- iterateChildren(this.$.footer, (footerRow, index) => {
713
- this.__initRow(footerRow, columnTree[columnTree.length - 1 - index], 'footer', index === 0);
714
- });
593
+ this.__renderHeaderFooter();
715
594
 
716
595
  // Sizer rows
717
596
  this.__initRow(this.$.sizer, columnTree[columnTree.length - 1]);
718
597
 
719
- this.__updateHeaderFooterRowParts('header');
720
- this.__updateHeaderFooterRowParts('footer');
721
598
  this._resizeHandler();
722
599
  this._frozenCellsChanged();
723
600
  this._updateFirstAndLastColumn();
@@ -739,6 +616,8 @@ export const GridMixin = (superClass) =>
739
616
  updatePart(cell, `first-${section}-row-cell`, row === visibleRows.at(0));
740
617
  updatePart(cell, `last-${section}-row-cell`, row === visibleRows.at(-1));
741
618
  });
619
+
620
+ this._updateFirstAndLastColumnForRow(row);
742
621
  });
743
622
  }
744
623
 
@@ -46,16 +46,25 @@ export const GridSortColumnMixin = (superClass) =>
46
46
  */
47
47
  _defaultHeaderRenderer(root, _column) {
48
48
  let sorter = root.firstElementChild;
49
- if (!sorter) {
49
+ const isNewSorter = !sorter;
50
+ if (isNewSorter) {
50
51
  sorter = document.createElement('vaadin-grid-sorter');
51
52
  sorter.addEventListener('direction-changed', this.__boundOnDirectionChanged);
52
- root.appendChild(sorter);
53
53
  }
54
54
 
55
55
  sorter.path = this.path;
56
56
  sorter.__rendererDirection = this.direction;
57
57
  sorter.direction = this.direction;
58
58
  sorter.textContent = this.__getHeader(this.header, this.path);
59
+
60
+ // Append the sorter only after its direction has been set. If the cell
61
+ // content is already connected (as with the declarative header rendering),
62
+ // appending an unconfigured sorter makes it notify its default `null`
63
+ // direction before `__rendererDirection` is set, which would reset the
64
+ // column's direction. See __onDirectionChanged.
65
+ if (isNewSorter) {
66
+ root.appendChild(sorter);
67
+ }
59
68
  }
60
69
 
61
70
  /**
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-alpha5",
4
+ "version": "25.3.0-alpha7",
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-alpha5/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<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-alpha7/#/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-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__",
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-alpha7/#/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-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.",
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-alpha7/#/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-alpha7/#/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-alpha7/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/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-alpha7/#/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-alpha7/#/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",
@@ -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-alpha5",
4
+ "version": "25.3.0-alpha7",
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-alpha5/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<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-alpha7/#/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-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__",
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-alpha7/#/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-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.",
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-alpha7/#/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-alpha7/#/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-alpha7/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha7/#/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-alpha7/#/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-alpha7/#/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
  {