@vaadin/grid 25.0.0-beta2 → 25.0.0-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/styles/vaadin-grid-base-styles.js +14 -15
- package/src/styles/vaadin-grid-tree-toggle-base-styles.js +9 -1
- package/src/vaadin-grid-a11y-mixin.js +29 -28
- package/src/vaadin-grid-column-group-mixin.js +2 -2
- package/src/vaadin-grid-mixin.js +49 -36
- package/src/vaadin-grid-row-details-mixin.js +1 -2
- package/src/vaadin-grid-sort-mixin.js +1 -1
- package/src/vaadin-grid.d.ts +6 -0
- package/src/vaadin-grid.js +6 -0
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,24 +44,24 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
47
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
48
|
-
"@vaadin/checkbox": "25.0.0-
|
|
49
|
-
"@vaadin/component-base": "25.0.0-
|
|
50
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
51
|
-
"@vaadin/text-field": "25.0.0-
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
47
|
+
"@vaadin/a11y-base": "25.0.0-beta4",
|
|
48
|
+
"@vaadin/checkbox": "25.0.0-beta4",
|
|
49
|
+
"@vaadin/component-base": "25.0.0-beta4",
|
|
50
|
+
"@vaadin/lit-renderer": "25.0.0-beta4",
|
|
51
|
+
"@vaadin/text-field": "25.0.0-beta4",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-beta4",
|
|
53
53
|
"lit": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
57
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
56
|
+
"@vaadin/chai-plugins": "25.0.0-beta4",
|
|
57
|
+
"@vaadin/test-runner-commands": "25.0.0-beta4",
|
|
58
58
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
59
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
59
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-beta4",
|
|
60
60
|
"sinon": "^21.0.0"
|
|
61
61
|
},
|
|
62
62
|
"web-types": [
|
|
63
63
|
"web-types.json",
|
|
64
64
|
"web-types.lit.json"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "707c30af7ed0afacc13c0afb27d047b043160d1f"
|
|
67
67
|
}
|
|
@@ -16,16 +16,15 @@ export const gridStyles = css`
|
|
|
16
16
|
align-self: stretch;
|
|
17
17
|
position: relative;
|
|
18
18
|
box-sizing: border-box;
|
|
19
|
+
overflow: hidden;
|
|
19
20
|
-webkit-tap-highlight-color: transparent;
|
|
20
21
|
background: var(--vaadin-grid-background, var(--vaadin-background-color));
|
|
21
|
-
border: var(--
|
|
22
|
+
border: var(--vaadin-grid-border-width, 1px) solid var(--_border-color);
|
|
22
23
|
cursor: default;
|
|
23
24
|
--_border-color: var(--vaadin-grid-border-color, var(--vaadin-border-color-secondary));
|
|
24
|
-
--_border-width: 0;
|
|
25
25
|
--_row-border-width: var(--vaadin-grid-row-border-width, 1px);
|
|
26
26
|
--_column-border-width: var(--vaadin-grid-column-border-width, 0px);
|
|
27
|
-
border-radius: var(--
|
|
28
|
-
--_border-radius: 0;
|
|
27
|
+
border-radius: var(--vaadin-grid-border-radius, var(--vaadin-radius-m));
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
:host([hidden]),
|
|
@@ -39,9 +38,9 @@ export const gridStyles = css`
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
/* Variant: No outer border */
|
|
42
|
-
:host(
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
:host([theme~='no-border']) {
|
|
42
|
+
border-width: 0;
|
|
43
|
+
border-radius: 0;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
:host([all-rows-visible]) {
|
|
@@ -49,11 +48,11 @@ export const gridStyles = css`
|
|
|
49
48
|
align-self: flex-start;
|
|
50
49
|
min-height: auto;
|
|
51
50
|
flex-grow: 0;
|
|
51
|
+
flex-shrink: 0;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
#scroller {
|
|
55
55
|
contain: layout;
|
|
56
|
-
border-radius: calc(var(--_border-radius) - var(--_border-width));
|
|
57
56
|
position: relative;
|
|
58
57
|
display: flex;
|
|
59
58
|
width: 100%;
|
|
@@ -204,7 +203,7 @@ export const gridStyles = css`
|
|
|
204
203
|
border-top: 0;
|
|
205
204
|
}
|
|
206
205
|
|
|
207
|
-
table
|
|
206
|
+
table[has-header] [part~='first-row-cell'] {
|
|
208
207
|
border-top: var(--_row-border-width) solid var(--_border-color);
|
|
209
208
|
}
|
|
210
209
|
|
|
@@ -257,7 +256,7 @@ export const gridStyles = css`
|
|
|
257
256
|
--_top-opaque: 1;
|
|
258
257
|
}
|
|
259
258
|
|
|
260
|
-
table
|
|
259
|
+
table[has-footer] [part~='last-row-cell']:not([part~='details-opened-row-cell']) {
|
|
261
260
|
border-bottom: var(--_row-border-width) solid var(--_border-color);
|
|
262
261
|
--_bottom: 0;
|
|
263
262
|
}
|
|
@@ -529,7 +528,7 @@ export const gridStyles = css`
|
|
|
529
528
|
top: 0;
|
|
530
529
|
}
|
|
531
530
|
|
|
532
|
-
table
|
|
531
|
+
table[has-header] [part~='first-row-cell']::after {
|
|
533
532
|
top: calc(var(--_row-border-width) * -1);
|
|
534
533
|
}
|
|
535
534
|
|
|
@@ -541,7 +540,7 @@ export const gridStyles = css`
|
|
|
541
540
|
}
|
|
542
541
|
|
|
543
542
|
#header [part~='row']:last-child::after,
|
|
544
|
-
table
|
|
543
|
+
table[has-footer] [part*='last-row']::after {
|
|
545
544
|
bottom: calc(var(--_row-border-width) * -1);
|
|
546
545
|
}
|
|
547
546
|
|
|
@@ -571,7 +570,7 @@ export const gridStyles = css`
|
|
|
571
570
|
/* Drag'n'drop styles */
|
|
572
571
|
:host([dragover]) {
|
|
573
572
|
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
574
|
-
outline-offset: calc(var(--
|
|
573
|
+
outline-offset: calc(var(--vaadin-grid-border-width, 1px) * -1);
|
|
575
574
|
}
|
|
576
575
|
|
|
577
576
|
[part~='row'][dragover] {
|
|
@@ -588,7 +587,7 @@ export const gridStyles = css`
|
|
|
588
587
|
}
|
|
589
588
|
|
|
590
589
|
[part~='row']:not([part*='first-row'])[dragover='above']::after,
|
|
591
|
-
table
|
|
590
|
+
table[has-header] [part*='first-row'][dragover='above']::after {
|
|
592
591
|
top: calc(var(--vaadin-focus-ring-width) / -2);
|
|
593
592
|
}
|
|
594
593
|
|
|
@@ -598,7 +597,7 @@ export const gridStyles = css`
|
|
|
598
597
|
}
|
|
599
598
|
|
|
600
599
|
[part~='row']:not([part*='last-row'])[dragover='below']::after,
|
|
601
|
-
table
|
|
600
|
+
table[has-footer] [part*='last-row'][dragover='below']::after {
|
|
602
601
|
bottom: calc(var(--vaadin-focus-ring-width) / -2);
|
|
603
602
|
}
|
|
604
603
|
|
|
@@ -8,7 +8,7 @@ import { css } from 'lit';
|
|
|
8
8
|
|
|
9
9
|
export const gridTreeToggleStyles = css`
|
|
10
10
|
:host {
|
|
11
|
-
display: flex;
|
|
11
|
+
display: inline-flex;
|
|
12
12
|
max-width: 100%;
|
|
13
13
|
pointer-events: none;
|
|
14
14
|
}
|
|
@@ -35,6 +35,13 @@ export const gridTreeToggleStyles = css`
|
|
|
35
35
|
width: calc(var(--_level, 0) * var(--vaadin-grid-tree-toggle-level-offset, 16px));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/* Baseline alignment */
|
|
39
|
+
#level-spacer::before {
|
|
40
|
+
content: '\\2003' / '';
|
|
41
|
+
display: inline-block;
|
|
42
|
+
width: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
[part='toggle'] {
|
|
39
46
|
margin-inline-end: var(--vaadin-gap-s);
|
|
40
47
|
}
|
|
@@ -66,6 +73,7 @@ export const gridTreeToggleStyles = css`
|
|
|
66
73
|
display: block;
|
|
67
74
|
overflow: hidden;
|
|
68
75
|
text-overflow: ellipsis;
|
|
76
|
+
flex: 1;
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
@media (forced-colors: active) {
|
|
@@ -22,73 +22,74 @@ export const A11yMixin = (superClass) =>
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
static get observers() {
|
|
25
|
-
return ['
|
|
25
|
+
return ['__a11yUpdateGridSize(size, _columnTree, __emptyState)'];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** @private */
|
|
29
|
-
|
|
29
|
+
__a11yGetHeaderRowCount(_columnTree) {
|
|
30
30
|
return _columnTree.filter((level) =>
|
|
31
31
|
level.some((col) => col.headerRenderer || (col.path && col.header !== null) || col.header),
|
|
32
32
|
).length;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** @private */
|
|
36
|
-
|
|
36
|
+
__a11yGetFooterRowCount(_columnTree) {
|
|
37
37
|
return _columnTree.filter((level) => level.some((col) => col.footerRenderer)).length;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/** @private */
|
|
41
|
-
|
|
41
|
+
__a11yUpdateGridSize(size, _columnTree, emptyState) {
|
|
42
42
|
if (size === undefined || _columnTree === undefined) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const headerRowsCount = this.
|
|
47
|
-
const footerRowsCount = this.
|
|
46
|
+
const headerRowsCount = this.__a11yGetHeaderRowCount(_columnTree);
|
|
47
|
+
const footerRowsCount = this.__a11yGetFooterRowCount(_columnTree);
|
|
48
48
|
const bodyRowsCount = emptyState ? 1 : size;
|
|
49
49
|
const rowsCount = bodyRowsCount + headerRowsCount + footerRowsCount;
|
|
50
50
|
|
|
51
51
|
this.$.table.setAttribute('aria-rowcount', rowsCount);
|
|
52
52
|
|
|
53
53
|
const bodyColumns = _columnTree[_columnTree.length - 1];
|
|
54
|
+
|
|
54
55
|
// If no header and footer rows while the empty state is active, count as one column
|
|
55
56
|
// Otherwise, use the number of body columns, if present
|
|
56
57
|
const columnsCount = emptyState ? 1 : (rowsCount && bodyColumns && bodyColumns.length) || 0;
|
|
57
58
|
this.$.table.setAttribute('aria-colcount', columnsCount);
|
|
58
59
|
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
60
|
+
this.__a11yUpdateHeaderRows();
|
|
61
|
+
this.__a11yUpdateFooterRows();
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
/** @
|
|
64
|
-
|
|
64
|
+
/** @private */
|
|
65
|
+
__a11yUpdateHeaderRows() {
|
|
65
66
|
iterateChildren(this.$.header, (headerRow, index) => {
|
|
66
67
|
headerRow.setAttribute('aria-rowindex', index + 1);
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
/** @
|
|
71
|
-
|
|
71
|
+
/** @private */
|
|
72
|
+
__a11yUpdateFooterRows() {
|
|
72
73
|
iterateChildren(this.$.footer, (footerRow, index) => {
|
|
73
|
-
footerRow.setAttribute('aria-rowindex', this.
|
|
74
|
+
footerRow.setAttribute('aria-rowindex', this.__a11yGetHeaderRowCount(this._columnTree) + this.size + index + 1);
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* @param {!HTMLElement} row
|
|
79
80
|
* @param {number} index
|
|
80
|
-
* @
|
|
81
|
+
* @private
|
|
81
82
|
*/
|
|
82
|
-
|
|
83
|
-
row.setAttribute('aria-rowindex', index + this.
|
|
83
|
+
__a11yUpdateRowRowindex(row) {
|
|
84
|
+
row.setAttribute('aria-rowindex', row.index + this.__a11yGetHeaderRowCount(this._columnTree) + 1);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
88
|
* @param {!HTMLElement} row
|
|
88
89
|
* @param {boolean} selected
|
|
89
|
-
* @
|
|
90
|
+
* @private
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
__a11yUpdateRowSelected(row, selected) {
|
|
92
93
|
// Jaws reads selection only for rows, NVDA only for cells
|
|
93
94
|
row.setAttribute('aria-selected', Boolean(selected));
|
|
94
95
|
iterateRowCells(row, (cell) => {
|
|
@@ -98,9 +99,9 @@ export const A11yMixin = (superClass) =>
|
|
|
98
99
|
|
|
99
100
|
/**
|
|
100
101
|
* @param {!HTMLElement} row
|
|
101
|
-
* @
|
|
102
|
+
* @private
|
|
102
103
|
*/
|
|
103
|
-
|
|
104
|
+
__a11yUpdateRowExpanded(row) {
|
|
104
105
|
const toggleCell = findTreeToggleCell(row);
|
|
105
106
|
if (this.__isRowExpandable(row)) {
|
|
106
107
|
row.setAttribute('aria-expanded', 'false');
|
|
@@ -123,9 +124,9 @@ export const A11yMixin = (superClass) =>
|
|
|
123
124
|
/**
|
|
124
125
|
* @param {!HTMLElement} row
|
|
125
126
|
* @param {number} level
|
|
126
|
-
* @
|
|
127
|
+
* @private
|
|
127
128
|
*/
|
|
128
|
-
|
|
129
|
+
__a11yUpdateRowLevel(row, level) {
|
|
129
130
|
// Set level for the expandable rows itself, and all the nested rows.
|
|
130
131
|
if (level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row)) {
|
|
131
132
|
row.setAttribute('aria-level', level + 1);
|
|
@@ -137,9 +138,9 @@ export const A11yMixin = (superClass) =>
|
|
|
137
138
|
/**
|
|
138
139
|
* @param {!HTMLElement} row
|
|
139
140
|
* @param {!HTMLElement} detailsCell
|
|
140
|
-
* @
|
|
141
|
+
* @private
|
|
141
142
|
*/
|
|
142
|
-
|
|
143
|
+
__a11ySetRowDetailsCell(row, detailsCell) {
|
|
143
144
|
iterateRowCells(row, (cell) => {
|
|
144
145
|
if (cell !== detailsCell) {
|
|
145
146
|
cell.setAttribute('aria-controls', detailsCell.id);
|
|
@@ -150,14 +151,14 @@ export const A11yMixin = (superClass) =>
|
|
|
150
151
|
/**
|
|
151
152
|
* @param {!HTMLElement} cell
|
|
152
153
|
* @param {number} colspan
|
|
153
|
-
* @
|
|
154
|
+
* @private
|
|
154
155
|
*/
|
|
155
|
-
|
|
156
|
+
__a11yUpdateCellColspan(cell, colspan) {
|
|
156
157
|
cell.setAttribute('aria-colspan', Number(colspan));
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
/** @
|
|
160
|
-
|
|
160
|
+
/** @private */
|
|
161
|
+
__a11yUpdateSorters() {
|
|
161
162
|
Array.from(this.querySelectorAll('vaadin-grid-sorter')).forEach((sorter) => {
|
|
162
163
|
let cellContent = sorter.parentNode;
|
|
163
164
|
while (cellContent && cellContent.localName !== 'vaadin-grid-cell-content') {
|
|
@@ -314,13 +314,13 @@ export const GridColumnGroupMixin = (superClass) =>
|
|
|
314
314
|
if (headerCell) {
|
|
315
315
|
headerCell.setAttribute('colspan', colSpan);
|
|
316
316
|
if (this._grid) {
|
|
317
|
-
this._grid.
|
|
317
|
+
this._grid.__a11yUpdateCellColspan(headerCell, colSpan);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
if (footerCell) {
|
|
321
321
|
footerCell.setAttribute('colspan', colSpan);
|
|
322
322
|
if (this._grid) {
|
|
323
|
-
this._grid.
|
|
323
|
+
this._grid.__a11yUpdateCellColspan(footerCell, colSpan);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
}
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
iterateRowCells,
|
|
29
29
|
updateBooleanRowStates,
|
|
30
30
|
updateCellsPart,
|
|
31
|
+
updatePart,
|
|
31
32
|
updateState,
|
|
32
33
|
} from './vaadin-grid-helpers.js';
|
|
33
34
|
import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js';
|
|
@@ -532,7 +533,7 @@ export const GridMixin = (superClass) =>
|
|
|
532
533
|
row.appendChild(detailsCell);
|
|
533
534
|
// Cache the details cell reference
|
|
534
535
|
row.__detailsCell = detailsCell;
|
|
535
|
-
this.
|
|
536
|
+
this.__a11ySetRowDetailsCell(row, detailsCell);
|
|
536
537
|
detailsCell._vacant = false;
|
|
537
538
|
}
|
|
538
539
|
|
|
@@ -639,9 +640,19 @@ export const GridMixin = (superClass) =>
|
|
|
639
640
|
row.hidden = !visibleRowCells.length;
|
|
640
641
|
}
|
|
641
642
|
|
|
643
|
+
if (row.parentElement === this.$.header) {
|
|
644
|
+
this.$.table.toggleAttribute('has-header', this.$.header.querySelector('tr:not([hidden])'));
|
|
645
|
+
this.__updateHeaderFooterRowParts('header');
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (row.parentElement === this.$.footer) {
|
|
649
|
+
this.$.table.toggleAttribute('has-footer', this.$.footer.querySelector('tr:not([hidden])'));
|
|
650
|
+
this.__updateHeaderFooterRowParts('footer');
|
|
651
|
+
}
|
|
652
|
+
|
|
642
653
|
// Make sure the section has a tabbable element
|
|
643
654
|
this._resetKeyboardNavigation();
|
|
644
|
-
this.
|
|
655
|
+
this.__a11yUpdateGridSize(this.size, this._columnTree, this.__emptyState);
|
|
645
656
|
}
|
|
646
657
|
|
|
647
658
|
/** @private */
|
|
@@ -653,11 +664,6 @@ export const GridMixin = (superClass) =>
|
|
|
653
664
|
}
|
|
654
665
|
|
|
655
666
|
row.index = index;
|
|
656
|
-
|
|
657
|
-
this._updateRowOrderParts(row, index);
|
|
658
|
-
|
|
659
|
-
this._a11yUpdateRowRowindex(row, index);
|
|
660
|
-
|
|
661
667
|
this.__ensureRowItem(row);
|
|
662
668
|
this.__ensureRowHierarchy(row);
|
|
663
669
|
this.__updateRow(row);
|
|
@@ -670,17 +676,17 @@ export const GridMixin = (superClass) =>
|
|
|
670
676
|
}
|
|
671
677
|
|
|
672
678
|
/** @private */
|
|
673
|
-
|
|
679
|
+
__updateRowOrderParts(row) {
|
|
674
680
|
updateBooleanRowStates(row, {
|
|
675
|
-
first: index === 0,
|
|
676
|
-
last: index === this._flatSize - 1,
|
|
677
|
-
odd: index % 2 !== 0,
|
|
678
|
-
even: index % 2 === 0,
|
|
681
|
+
first: row.index === 0,
|
|
682
|
+
last: row.index === this._flatSize - 1,
|
|
683
|
+
odd: row.index % 2 !== 0,
|
|
684
|
+
even: row.index % 2 === 0,
|
|
679
685
|
});
|
|
680
686
|
}
|
|
681
687
|
|
|
682
688
|
/** @private */
|
|
683
|
-
|
|
689
|
+
__updateRowStateParts(row, { item, expanded, selected, detailsOpened }) {
|
|
684
690
|
updateBooleanRowStates(row, {
|
|
685
691
|
expanded,
|
|
686
692
|
collapsed: this.__isRowExpandable(row),
|
|
@@ -702,22 +708,18 @@ export const GridMixin = (superClass) =>
|
|
|
702
708
|
_renderColumnTree(columnTree) {
|
|
703
709
|
iterateChildren(this.$.items, (row) => {
|
|
704
710
|
this.__initRow(row, columnTree[columnTree.length - 1], 'body', false, true);
|
|
705
|
-
|
|
706
|
-
const model = this.__getRowModel(row);
|
|
707
|
-
this._updateRowOrderParts(row);
|
|
708
|
-
this._updateRowStateParts(row, model);
|
|
709
|
-
this._filterDragAndDrop(row, model);
|
|
711
|
+
this.__updateRow(row);
|
|
710
712
|
});
|
|
711
713
|
|
|
712
714
|
while (this.$.header.children.length < columnTree.length) {
|
|
713
715
|
const headerRow = document.createElement('tr');
|
|
714
|
-
headerRow.setAttribute('part', 'row');
|
|
716
|
+
headerRow.setAttribute('part', 'row header-row');
|
|
715
717
|
headerRow.setAttribute('role', 'row');
|
|
716
718
|
headerRow.setAttribute('tabindex', '-1');
|
|
717
719
|
this.$.header.appendChild(headerRow);
|
|
718
720
|
|
|
719
721
|
const footerRow = document.createElement('tr');
|
|
720
|
-
footerRow.setAttribute('part', 'row');
|
|
722
|
+
footerRow.setAttribute('part', 'row footer-row');
|
|
721
723
|
footerRow.setAttribute('role', 'row');
|
|
722
724
|
footerRow.setAttribute('tabindex', '-1');
|
|
723
725
|
this.$.footer.appendChild(footerRow);
|
|
@@ -727,36 +729,44 @@ export const GridMixin = (superClass) =>
|
|
|
727
729
|
this.$.footer.removeChild(this.$.footer.firstElementChild);
|
|
728
730
|
}
|
|
729
731
|
|
|
730
|
-
iterateChildren(this.$.header, (headerRow, index
|
|
732
|
+
iterateChildren(this.$.header, (headerRow, index) => {
|
|
731
733
|
this.__initRow(headerRow, columnTree[index], 'header', index === columnTree.length - 1);
|
|
732
|
-
|
|
733
|
-
const cells = getBodyRowCells(headerRow);
|
|
734
|
-
updateCellsPart(cells, 'first-header-row-cell', index === 0);
|
|
735
|
-
updateCellsPart(cells, 'last-header-row-cell', index === rows.length - 1);
|
|
736
734
|
});
|
|
737
735
|
|
|
738
|
-
iterateChildren(this.$.footer, (footerRow, index
|
|
736
|
+
iterateChildren(this.$.footer, (footerRow, index) => {
|
|
739
737
|
this.__initRow(footerRow, columnTree[columnTree.length - 1 - index], 'footer', index === 0);
|
|
740
|
-
|
|
741
|
-
const cells = getBodyRowCells(footerRow);
|
|
742
|
-
updateCellsPart(cells, 'first-footer-row-cell', index === 0);
|
|
743
|
-
updateCellsPart(cells, 'last-footer-row-cell', index === rows.length - 1);
|
|
744
738
|
});
|
|
745
739
|
|
|
746
740
|
// Sizer rows
|
|
747
741
|
this.__initRow(this.$.sizer, columnTree[columnTree.length - 1]);
|
|
748
742
|
|
|
743
|
+
this.__updateHeaderFooterRowParts('header');
|
|
744
|
+
this.__updateHeaderFooterRowParts('footer');
|
|
749
745
|
this._resizeHandler();
|
|
750
746
|
this._frozenCellsChanged();
|
|
751
747
|
this._updateFirstAndLastColumn();
|
|
752
748
|
this._resetKeyboardNavigation();
|
|
753
|
-
this.
|
|
754
|
-
this.
|
|
749
|
+
this.__a11yUpdateHeaderRows();
|
|
750
|
+
this.__a11yUpdateFooterRows();
|
|
755
751
|
this.generateCellClassNames();
|
|
756
752
|
this.generateCellPartNames();
|
|
757
753
|
this.__updateHeaderAndFooter();
|
|
758
754
|
}
|
|
759
755
|
|
|
756
|
+
/** @private */
|
|
757
|
+
__updateHeaderFooterRowParts(section) {
|
|
758
|
+
const visibleRows = [...this.$[section].querySelectorAll('tr:not([hidden])')];
|
|
759
|
+
[...this.$[section].children].forEach((row) => {
|
|
760
|
+
updatePart(row, row === visibleRows.at(0), `first-${section}-row`);
|
|
761
|
+
updatePart(row, row === visibleRows.at(-1), `last-${section}-row`);
|
|
762
|
+
|
|
763
|
+
getBodyRowCells(row).forEach((cell) => {
|
|
764
|
+
updatePart(cell, row === visibleRows.at(0), `first-${section}-row-cell`);
|
|
765
|
+
updatePart(cell, row === visibleRows.at(-1), `last-${section}-row-cell`);
|
|
766
|
+
});
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
760
770
|
/**
|
|
761
771
|
* @param {!HTMLElement} row
|
|
762
772
|
* @param {boolean} loading
|
|
@@ -783,6 +793,9 @@ export const GridMixin = (superClass) =>
|
|
|
783
793
|
* @private
|
|
784
794
|
*/
|
|
785
795
|
__updateRow(row) {
|
|
796
|
+
this.__a11yUpdateRowRowindex(row);
|
|
797
|
+
this.__updateRowOrderParts(row);
|
|
798
|
+
|
|
786
799
|
const item = this.__getRowItem(row);
|
|
787
800
|
if (item) {
|
|
788
801
|
this.__updateRowLoading(row, false);
|
|
@@ -796,10 +809,10 @@ export const GridMixin = (superClass) =>
|
|
|
796
809
|
|
|
797
810
|
this._toggleDetailsCell(row, model.detailsOpened);
|
|
798
811
|
|
|
799
|
-
this.
|
|
800
|
-
this.
|
|
812
|
+
this.__a11yUpdateRowLevel(row, model.level);
|
|
813
|
+
this.__a11yUpdateRowSelected(row, model.selected);
|
|
801
814
|
|
|
802
|
-
this.
|
|
815
|
+
this.__updateRowStateParts(row, model);
|
|
803
816
|
|
|
804
817
|
this._generateCellClassNames(row, model);
|
|
805
818
|
this._generateCellPartNames(row, model);
|
|
@@ -818,7 +831,7 @@ export const GridMixin = (superClass) =>
|
|
|
818
831
|
|
|
819
832
|
this._updateDetailsCellHeight(row);
|
|
820
833
|
|
|
821
|
-
this.
|
|
834
|
+
this.__a11yUpdateRowExpanded(row, model.expanded);
|
|
822
835
|
}
|
|
823
836
|
|
|
824
837
|
/** @private */
|
|
@@ -82,8 +82,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
82
82
|
iterateChildren(this.$.items, (row) => {
|
|
83
83
|
if (!row.querySelector('[part~=details-cell]')) {
|
|
84
84
|
this.__initRow(row, this._columnTree[this._columnTree.length - 1]);
|
|
85
|
-
|
|
86
|
-
this._toggleDetailsCell(row, isDetailsOpened);
|
|
85
|
+
this.__updateRow(row);
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
88
|
}
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -157,6 +157,8 @@ export type GridDefaultItem = any;
|
|
|
157
157
|
* ---------------------------|----------------
|
|
158
158
|
* `row` | Row in the internal table
|
|
159
159
|
* `body-row` | Body row in the internal table
|
|
160
|
+
* `header-row` | Header row in the internal table
|
|
161
|
+
* `footer-row` | Footer row in the internal table
|
|
160
162
|
* `collapsed-row` | Collapsed row
|
|
161
163
|
* `expanded-row` | Expanded row
|
|
162
164
|
* `selected-row` | Selected row
|
|
@@ -165,7 +167,11 @@ export type GridDefaultItem = any;
|
|
|
165
167
|
* `odd-row` | Odd row
|
|
166
168
|
* `even-row` | Even row
|
|
167
169
|
* `first-row` | The first body row
|
|
170
|
+
* `first-header-row` | The first header row
|
|
171
|
+
* `first-footer-row` | The first footer row
|
|
168
172
|
* `last-row` | The last body row
|
|
173
|
+
* `last-header-row` | The last header row
|
|
174
|
+
* `last-footer-row` | The last footer row
|
|
169
175
|
* `dragstart-row` | Set on the row for one frame when drag is starting.
|
|
170
176
|
* `dragover-above-row` | Set on the row when the a row is dragged over above
|
|
171
177
|
* `dragover-below-row` | Set on the row when the a row is dragged over below
|
package/src/vaadin-grid.js
CHANGED
|
@@ -158,6 +158,8 @@ import { GridMixin } from './vaadin-grid-mixin.js';
|
|
|
158
158
|
* ---------------------------|----------------
|
|
159
159
|
* `row` | Row in the internal table
|
|
160
160
|
* `body-row` | Body row in the internal table
|
|
161
|
+
* `header-row` | Header row in the internal table
|
|
162
|
+
* `footer-row` | Footer row in the internal table
|
|
161
163
|
* `collapsed-row` | Collapsed row
|
|
162
164
|
* `expanded-row` | Expanded row
|
|
163
165
|
* `selected-row` | Selected row
|
|
@@ -166,7 +168,11 @@ import { GridMixin } from './vaadin-grid-mixin.js';
|
|
|
166
168
|
* `odd-row` | Odd row
|
|
167
169
|
* `even-row` | Even row
|
|
168
170
|
* `first-row` | The first body row
|
|
171
|
+
* `first-header-row` | The first header row
|
|
172
|
+
* `first-footer-row` | The first footer row
|
|
169
173
|
* `last-row` | The last body row
|
|
174
|
+
* `last-header-row` | The last header row
|
|
175
|
+
* `last-footer-row` | The last footer row
|
|
170
176
|
* `dragstart-row` | Set on the row for one frame when drag is starting.
|
|
171
177
|
* `dragover-above-row` | Set on the row when the a row is dragged over above
|
|
172
178
|
* `dragover-below-row` | Set on the row when the a row is dragged over below
|
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.0.0-
|
|
4
|
+
"version": "25.0.0-beta4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
240
|
"name": "vaadin-grid-column",
|
|
241
|
-
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-
|
|
241
|
+
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
242
242
|
"attributes": [
|
|
243
243
|
{
|
|
244
244
|
"name": "resizable",
|
|
@@ -951,7 +951,7 @@
|
|
|
951
951
|
},
|
|
952
952
|
{
|
|
953
953
|
"name": "vaadin-grid-selection-column",
|
|
954
|
-
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\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.0.0-
|
|
954
|
+
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\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.0.0-beta4/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
955
955
|
"attributes": [
|
|
956
956
|
{
|
|
957
957
|
"name": "resizable",
|
|
@@ -2152,7 +2152,7 @@
|
|
|
2152
2152
|
},
|
|
2153
2153
|
{
|
|
2154
2154
|
"name": "vaadin-grid",
|
|
2155
|
-
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/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.0.0-beta2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/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.0.0-beta2/#/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.0.0-beta2/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
2155
|
+
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/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.0.0-beta4/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/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.0.0-beta4/#/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.0.0-beta4/#/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.",
|
|
2156
2156
|
"attributes": [
|
|
2157
2157
|
{
|
|
2158
2158
|
"name": "accessible-name",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-beta4",
|
|
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.0.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.0.0-beta4/#/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.0.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.0.0-beta4/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
370
370
|
"extension": true,
|
|
371
371
|
"attributes": [
|
|
372
372
|
{
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
},
|
|
829
829
|
{
|
|
830
830
|
"name": "vaadin-grid",
|
|
831
|
-
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/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.0.0-beta2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta2/#/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.0.0-beta2/#/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.0.0-beta2/#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
831
|
+
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/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.0.0-beta4/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta4/#/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.0.0-beta4/#/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.0.0-beta4/#/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.",
|
|
832
832
|
"extension": true,
|
|
833
833
|
"attributes": [
|
|
834
834
|
{
|