@vaadin/grid 25.3.0-alpha1 → 25.3.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +61 -0
- package/package.json +12 -12
- package/src/vaadin-grid-a11y-mixin.js +14 -8
- package/src/vaadin-grid-helpers.js +13 -0
- package/src/vaadin-grid-mixin.js +3 -11
- package/src/vaadin-grid-selection-column-base-mixin.js +31 -2
- package/src/vaadin-grid-sorter-mixin.js +24 -0
- package/src/vaadin-grid-sorter.js +1 -1
- package/src/vaadin-grid.d.ts +53 -1
- package/src/vaadin-grid.js +44 -1
- package/web-types.json +13 -4
- package/web-types.lit.json +11 -4
package/custom-elements.json
CHANGED
|
@@ -3417,6 +3417,24 @@
|
|
|
3417
3417
|
"kind": "javascript-module",
|
|
3418
3418
|
"path": "src/vaadin-grid-helpers.js",
|
|
3419
3419
|
"declarations": [
|
|
3420
|
+
{
|
|
3421
|
+
"kind": "function",
|
|
3422
|
+
"name": "getClosestCell",
|
|
3423
|
+
"parameters": [
|
|
3424
|
+
{
|
|
3425
|
+
"name": "node",
|
|
3426
|
+
"type": {
|
|
3427
|
+
"text": "Node"
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
],
|
|
3431
|
+
"description": "Returns the grid cell that contains the given node, or `undefined` if the\nnode is not inside a cell's content.",
|
|
3432
|
+
"return": {
|
|
3433
|
+
"type": {
|
|
3434
|
+
"text": "HTMLElement | undefined"
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
},
|
|
3420
3438
|
{
|
|
3421
3439
|
"kind": "function",
|
|
3422
3440
|
"name": "getBodyRowCells",
|
|
@@ -3693,6 +3711,14 @@
|
|
|
3693
3711
|
}
|
|
3694
3712
|
],
|
|
3695
3713
|
"exports": [
|
|
3714
|
+
{
|
|
3715
|
+
"kind": "js",
|
|
3716
|
+
"name": "getClosestCell",
|
|
3717
|
+
"declaration": {
|
|
3718
|
+
"name": "getClosestCell",
|
|
3719
|
+
"module": "src/vaadin-grid-helpers.js"
|
|
3720
|
+
}
|
|
3721
|
+
},
|
|
3696
3722
|
{
|
|
3697
3723
|
"kind": "js",
|
|
3698
3724
|
"name": "getBodyRowCells",
|
|
@@ -7921,6 +7947,25 @@
|
|
|
7921
7947
|
"module": "src/vaadin-grid-data-provider-mixin.js"
|
|
7922
7948
|
}
|
|
7923
7949
|
},
|
|
7950
|
+
{
|
|
7951
|
+
"kind": "field",
|
|
7952
|
+
"name": "i18n",
|
|
7953
|
+
"privacy": "public",
|
|
7954
|
+
"type": {
|
|
7955
|
+
"text": "Object"
|
|
7956
|
+
},
|
|
7957
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
7958
|
+
"attribute": "i18n",
|
|
7959
|
+
"return": {
|
|
7960
|
+
"type": {
|
|
7961
|
+
"text": "!GridI18n"
|
|
7962
|
+
}
|
|
7963
|
+
},
|
|
7964
|
+
"inheritedFrom": {
|
|
7965
|
+
"name": "I18nMixin",
|
|
7966
|
+
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
7967
|
+
}
|
|
7968
|
+
},
|
|
7924
7969
|
{
|
|
7925
7970
|
"kind": "field",
|
|
7926
7971
|
"name": "isItemSelectable",
|
|
@@ -8329,6 +8374,10 @@
|
|
|
8329
8374
|
"name": "GridMixin",
|
|
8330
8375
|
"module": "src/vaadin-grid-mixin.js"
|
|
8331
8376
|
},
|
|
8377
|
+
{
|
|
8378
|
+
"name": "I18nMixin",
|
|
8379
|
+
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
8380
|
+
},
|
|
8332
8381
|
{
|
|
8333
8382
|
"name": "ElementMixin",
|
|
8334
8383
|
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
@@ -8485,6 +8534,18 @@
|
|
|
8485
8534
|
"module": "src/vaadin-grid-drag-and-drop-mixin.js"
|
|
8486
8535
|
}
|
|
8487
8536
|
},
|
|
8537
|
+
{
|
|
8538
|
+
"name": "i18n",
|
|
8539
|
+
"type": {
|
|
8540
|
+
"text": "Object"
|
|
8541
|
+
},
|
|
8542
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
8543
|
+
"fieldName": "i18n",
|
|
8544
|
+
"inheritedFrom": {
|
|
8545
|
+
"name": "I18nMixin",
|
|
8546
|
+
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
8547
|
+
}
|
|
8548
|
+
},
|
|
8488
8549
|
{
|
|
8489
8550
|
"name": "is-item-selectable",
|
|
8490
8551
|
"type": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
49
|
-
"@vaadin/checkbox": "25.3.0-
|
|
50
|
-
"@vaadin/component-base": "25.3.0-
|
|
51
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
52
|
-
"@vaadin/text-field": "25.3.0-
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
48
|
+
"@vaadin/a11y-base": "25.3.0-alpha2",
|
|
49
|
+
"@vaadin/checkbox": "25.3.0-alpha2",
|
|
50
|
+
"@vaadin/component-base": "25.3.0-alpha2",
|
|
51
|
+
"@vaadin/lit-renderer": "25.3.0-alpha2",
|
|
52
|
+
"@vaadin/text-field": "25.3.0-alpha2",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha2",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/aura": "25.3.0-
|
|
58
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
59
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
57
|
+
"@vaadin/aura": "25.3.0-alpha2",
|
|
58
|
+
"@vaadin/chai-plugins": "25.3.0-alpha2",
|
|
59
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha2",
|
|
60
60
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
61
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
61
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha2",
|
|
62
62
|
"sinon": "^22.0.0"
|
|
63
63
|
},
|
|
64
64
|
"customElements": "custom-elements.json",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"web-types.json",
|
|
67
67
|
"web-types.lit.json"
|
|
68
68
|
],
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "52eba6153ecf8bfaae44bcb727595e77d90b963c"
|
|
70
70
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { findTreeToggleCell, iterateChildren, iterateRowCells } from './vaadin-grid-helpers.js';
|
|
6
|
+
import { findTreeToggleCell, getClosestCell, iterateChildren, iterateRowCells } from './vaadin-grid-helpers.js';
|
|
7
7
|
|
|
8
8
|
export const A11yMixin = (superClass) =>
|
|
9
9
|
class A11yMixin extends superClass {
|
|
@@ -19,7 +19,15 @@ export const A11yMixin = (superClass) =>
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
static get observers() {
|
|
22
|
-
return ['__a11yUpdateGridSize(size, _columnTree, __emptyState)'];
|
|
22
|
+
return ['__a11yUpdateGridSize(size, _columnTree, __emptyState)', '__a11yI18nChanged(__effectiveI18n)'];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @private */
|
|
26
|
+
__a11yI18nChanged() {
|
|
27
|
+
// Update selection column checkboxes accessible name.
|
|
28
|
+
this.requestContentUpdate();
|
|
29
|
+
// Update sorters accessible name.
|
|
30
|
+
this.__a11yUpdateSorters();
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
/** @private */
|
|
@@ -157,12 +165,10 @@ export const A11yMixin = (superClass) =>
|
|
|
157
165
|
/** @private */
|
|
158
166
|
__a11yUpdateSorters() {
|
|
159
167
|
Array.from(this.querySelectorAll('vaadin-grid-sorter')).forEach((sorter) => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (cellContent?.assignedSlot) {
|
|
165
|
-
const cell = cellContent.assignedSlot.parentNode;
|
|
168
|
+
sorter.__updateAccessibleName?.();
|
|
169
|
+
|
|
170
|
+
const cell = getClosestCell(sorter);
|
|
171
|
+
if (cell) {
|
|
166
172
|
cell.setAttribute(
|
|
167
173
|
'aria-sort',
|
|
168
174
|
{
|
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { microTask } from '@vaadin/component-base/src/async.js';
|
|
7
7
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
8
|
+
import { getClosestElement } from '@vaadin/component-base/src/dom-utils.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the grid cell that contains the given node, or `undefined` if the
|
|
12
|
+
* node is not inside a cell's content.
|
|
13
|
+
*
|
|
14
|
+
* @param {Node} node
|
|
15
|
+
* @return {HTMLElement | undefined}
|
|
16
|
+
*/
|
|
17
|
+
export function getClosestCell(node) {
|
|
18
|
+
const content = getClosestElement('vaadin-grid-cell-content', node);
|
|
19
|
+
return content?.assignedSlot?.parentElement;
|
|
20
|
+
}
|
|
8
21
|
|
|
9
22
|
/**
|
|
10
23
|
* Returns the cells of the given row, excluding the details cell.
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -7,7 +7,6 @@ import { TabindexMixin } from '@vaadin/a11y-base/src/tabindex-mixin.js';
|
|
|
7
7
|
import { microTask } from '@vaadin/component-base/src/async.js';
|
|
8
8
|
import { isAndroid, isChrome, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
9
9
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
|
-
import { getClosestElement } from '@vaadin/component-base/src/dom-utils.js';
|
|
11
10
|
import { setTouchAction } from '@vaadin/component-base/src/gestures.js';
|
|
12
11
|
import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
|
|
13
12
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
@@ -25,6 +24,7 @@ import { EventContextMixin } from './vaadin-grid-event-context-mixin.js';
|
|
|
25
24
|
import { FilterMixin } from './vaadin-grid-filter-mixin.js';
|
|
26
25
|
import {
|
|
27
26
|
getBodyRowCells,
|
|
27
|
+
getClosestCell,
|
|
28
28
|
iterateChildren,
|
|
29
29
|
iterateRowCells,
|
|
30
30
|
updateBooleanRowStates,
|
|
@@ -204,13 +204,7 @@ export const GridMixin = (superClass) =>
|
|
|
204
204
|
|
|
205
205
|
/** @protected */
|
|
206
206
|
_getRowContainingNode(node) {
|
|
207
|
-
|
|
208
|
-
if (!content) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const cell = content.assignedSlot.parentElement;
|
|
213
|
-
return cell.parentElement;
|
|
207
|
+
return getClosestCell(node)?.parentElement;
|
|
214
208
|
}
|
|
215
209
|
|
|
216
210
|
/** @protected */
|
|
@@ -925,9 +919,7 @@ export const GridMixin = (superClass) =>
|
|
|
925
919
|
|
|
926
920
|
/** @protected */
|
|
927
921
|
__updateVisibleRows(start, end) {
|
|
928
|
-
|
|
929
|
-
this.__virtualizer.update(start, end);
|
|
930
|
-
}
|
|
922
|
+
this.__virtualizer?.update(start, end);
|
|
931
923
|
}
|
|
932
924
|
|
|
933
925
|
/** @private */
|
|
@@ -150,12 +150,13 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
150
150
|
let checkbox = root.firstElementChild;
|
|
151
151
|
if (!checkbox) {
|
|
152
152
|
checkbox = document.createElement('vaadin-checkbox');
|
|
153
|
-
checkbox.accessibleName = 'Select All';
|
|
154
153
|
checkbox.classList.add('vaadin-grid-select-all-checkbox');
|
|
155
154
|
checkbox.addEventListener('change', this.__onSelectAllCheckboxChange);
|
|
156
155
|
root.appendChild(checkbox);
|
|
157
156
|
}
|
|
158
157
|
|
|
158
|
+
checkbox.accessibleName = this._grid?.__effectiveI18n?.selectAll;
|
|
159
|
+
|
|
159
160
|
const checked = this.__isChecked(this.selectAll, this._indeterminate);
|
|
160
161
|
checkbox.checked = checked;
|
|
161
162
|
checkbox.indeterminate = this._indeterminate;
|
|
@@ -171,7 +172,6 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
171
172
|
let checkbox = root.firstElementChild;
|
|
172
173
|
if (!checkbox) {
|
|
173
174
|
checkbox = document.createElement('vaadin-checkbox');
|
|
174
|
-
checkbox.accessibleName = 'Select Row';
|
|
175
175
|
checkbox.addEventListener('change', this.__onSelectRowCheckboxChange);
|
|
176
176
|
root.appendChild(checkbox);
|
|
177
177
|
addListener(root, 'track', this.__onCellTrack);
|
|
@@ -180,6 +180,7 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
180
180
|
root.addEventListener('click', this.__onCellClick);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
this.__updateSelectRowAccessibleName(checkbox, root);
|
|
183
184
|
checkbox.__item = item;
|
|
184
185
|
checkbox.checked = selected;
|
|
185
186
|
|
|
@@ -190,6 +191,34 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
|
|
|
190
191
|
checkbox.style.visibility = isHidden ? 'hidden' : '';
|
|
191
192
|
}
|
|
192
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Sets the Select Row checkbox accessible name based on the grid i18n.
|
|
196
|
+
* The `{rowHeader}` placeholder is replaced with the row header cell text content
|
|
197
|
+
* or row index if there is no row header column or it's cell is empty.
|
|
198
|
+
*
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
__updateSelectRowAccessibleName(checkbox, root) {
|
|
202
|
+
const ariaLabel = this._grid?.__effectiveI18n?.selectRow;
|
|
203
|
+
if (!ariaLabel || !ariaLabel.includes('{rowHeader}')) {
|
|
204
|
+
checkbox.accessibleName = ariaLabel;
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Defer reading the row header cell text until all cell renderers of
|
|
209
|
+
// the row have run in the current task, as the selection column may
|
|
210
|
+
// render before the row header column.
|
|
211
|
+
queueMicrotask(() => {
|
|
212
|
+
const row = root.assignedSlot?.parentElement?.__parentRow;
|
|
213
|
+
if (!checkbox.isConnected || !row) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const rowHeaderCell = row.__cells.find((cell) => cell._column?.rowHeader);
|
|
217
|
+
const value = rowHeaderCell?._content?.textContent.trim() || String(row.index + 1);
|
|
218
|
+
checkbox.accessibleName = ariaLabel.replace('{rowHeader}', value);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
193
222
|
/**
|
|
194
223
|
* Updates the select all state when the Select All checkbox is switched.
|
|
195
224
|
* The listener handles only user-fired events.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { getClosestCell } from './vaadin-grid-helpers.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A mixin providing common sorter functionality.
|
|
@@ -51,6 +52,8 @@ export const GridSorterMixin = (superClass) =>
|
|
|
51
52
|
ready() {
|
|
52
53
|
super.ready();
|
|
53
54
|
this.addEventListener('click', this._onClick.bind(this));
|
|
55
|
+
|
|
56
|
+
this.__updateAccessibleName();
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
/** @protected */
|
|
@@ -80,6 +83,27 @@ export const GridSorterMixin = (superClass) =>
|
|
|
80
83
|
this.__dispatchSorterChangedEvenIfPossible();
|
|
81
84
|
}
|
|
82
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Updates the sorter accessible name based on the grid i18n.
|
|
88
|
+
*
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
__updateAccessibleName() {
|
|
92
|
+
// `_grid` is only assigned once the sorter becomes activated.
|
|
93
|
+
// Resolve the grid from the parent cell column as a fallback.
|
|
94
|
+
const grid = this._grid || getClosestCell(this)?.getRootNode().host;
|
|
95
|
+
if (!grid) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const ariaLabel = grid.__effectiveI18n.sorter?.replace('{column}', this.textContent.trim());
|
|
100
|
+
if (ariaLabel) {
|
|
101
|
+
this.setAttribute('aria-label', ariaLabel);
|
|
102
|
+
} else {
|
|
103
|
+
this.removeAttribute('aria-label');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
83
107
|
/** @private */
|
|
84
108
|
__dispatchSorterChangedEvenIfPossible() {
|
|
85
109
|
if (this.path === undefined || this.direction === undefined || !this.isConnected) {
|
|
@@ -67,7 +67,7 @@ class GridSorter extends GridSorterMixin(ThemableMixin(DirMixin(PolylitMixin(Lum
|
|
|
67
67
|
render() {
|
|
68
68
|
return html`
|
|
69
69
|
<div part="content">
|
|
70
|
-
<slot></slot>
|
|
70
|
+
<slot @slotchange="${this.__updateAccessibleName}"></slot>
|
|
71
71
|
</div>
|
|
72
72
|
<div part="indicators">
|
|
73
73
|
<span part="order">${this._getDisplayOrder(this._order)}</span>
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
7
7
|
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
|
+
import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
8
9
|
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
10
11
|
import type { GridEventMap, GridMixinClass } from './vaadin-grid-mixin.js';
|
|
@@ -13,6 +14,27 @@ export * from './vaadin-grid-mixin.js';
|
|
|
13
14
|
|
|
14
15
|
export type GridDefaultItem = any;
|
|
15
16
|
|
|
17
|
+
export interface GridI18n {
|
|
18
|
+
/**
|
|
19
|
+
* The accessible name (aria-label) for the Select All checkbox in the
|
|
20
|
+
* selection column header cell.
|
|
21
|
+
*/
|
|
22
|
+
selectAll?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The accessible name (aria-label) template for the Select Row checkbox in
|
|
26
|
+
* each selection column body cell. The `{rowHeader}` placeholder is replaced with
|
|
27
|
+
* the row header cell text content or row index if there is no row header column.
|
|
28
|
+
*/
|
|
29
|
+
selectRow?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Accessible name (aria-label) for the grid sorters. The `{column}`
|
|
33
|
+
* placeholder is replaced with the sorter text content.
|
|
34
|
+
*/
|
|
35
|
+
sorter?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
/**
|
|
17
39
|
* `<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the
|
|
18
40
|
* the grid can be populated by using renderer callback function.
|
|
@@ -265,6 +287,30 @@ export type GridDefaultItem = any;
|
|
|
265
287
|
* @fires {CustomEvent} item-toggle - Fired when the user selects or deselects an item through the selection column.
|
|
266
288
|
*/
|
|
267
289
|
declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
290
|
+
/**
|
|
291
|
+
* The object used to localize this component. To change the default
|
|
292
|
+
* localization, replace this with an object that provides all properties, or
|
|
293
|
+
* just the individual properties you want to change.
|
|
294
|
+
*
|
|
295
|
+
* The object has the following JSON structure and default values:
|
|
296
|
+
*
|
|
297
|
+
* ```js
|
|
298
|
+
* {
|
|
299
|
+
* // Accessible name (aria-label) for the select all checkbox in the
|
|
300
|
+
* // selection column header cell.
|
|
301
|
+
* selectAll: 'Select All',
|
|
302
|
+
* // Accessible name (aria-label) for the select row checkbox in each
|
|
303
|
+
* // selection column body cell. The `{rowHeader}` placeholder is replaced with the
|
|
304
|
+
* // row header cell text content or row index if there is no row header column.
|
|
305
|
+
* selectRow: 'Select Row {rowHeader}',
|
|
306
|
+
* // Accessible name (aria-label) for the grid sorters. The `{column}`
|
|
307
|
+
* // placeholder is replaced with the sorter text content.
|
|
308
|
+
* sorter: 'Sort by {column}',
|
|
309
|
+
* }
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
i18n: GridI18n;
|
|
313
|
+
|
|
268
314
|
addEventListener<K extends keyof GridEventMap<TItem>>(
|
|
269
315
|
type: K,
|
|
270
316
|
listener: (this: Grid<TItem>, ev: GridEventMap<TItem>[K]) => void,
|
|
@@ -279,7 +325,13 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
279
325
|
}
|
|
280
326
|
|
|
281
327
|
interface Grid<TItem = GridDefaultItem>
|
|
282
|
-
extends
|
|
328
|
+
extends
|
|
329
|
+
DisabledMixinClass,
|
|
330
|
+
ElementMixinClass,
|
|
331
|
+
I18nMixinClass<GridI18n>,
|
|
332
|
+
ThemableMixinClass,
|
|
333
|
+
ThemePropertyMixinClass,
|
|
334
|
+
GridMixinClass<TItem> {}
|
|
283
335
|
|
|
284
336
|
declare global {
|
|
285
337
|
interface HTMLElementTagNameMap {
|
package/src/vaadin-grid.js
CHANGED
|
@@ -8,12 +8,19 @@ import { html, LitElement } from 'lit';
|
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
+
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
11
12
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
13
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
14
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
15
|
import { gridStyles } from './styles/vaadin-grid-base-styles.js';
|
|
15
16
|
import { GridMixin } from './vaadin-grid-mixin.js';
|
|
16
17
|
|
|
18
|
+
const DEFAULT_I18N = {
|
|
19
|
+
selectAll: 'Select All',
|
|
20
|
+
selectRow: 'Select Row {rowHeader}',
|
|
21
|
+
sorter: 'Sort by {column}',
|
|
22
|
+
};
|
|
23
|
+
|
|
17
24
|
/**
|
|
18
25
|
* `<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the
|
|
19
26
|
* the grid can be populated by using renderer callback function.
|
|
@@ -268,7 +275,7 @@ import { GridMixin } from './vaadin-grid-mixin.js';
|
|
|
268
275
|
* @customElement vaadin-grid
|
|
269
276
|
* @extends HTMLElement
|
|
270
277
|
*/
|
|
271
|
-
class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
278
|
+
class Grid extends GridMixin(I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))))) {
|
|
272
279
|
static get is() {
|
|
273
280
|
return 'vaadin-grid';
|
|
274
281
|
}
|
|
@@ -277,6 +284,42 @@ class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjecti
|
|
|
277
284
|
return gridStyles;
|
|
278
285
|
}
|
|
279
286
|
|
|
287
|
+
static get defaultI18n() {
|
|
288
|
+
return DEFAULT_I18N;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* The object used to localize this component. To change the default
|
|
293
|
+
* localization, replace this with an object that provides all properties, or
|
|
294
|
+
* just the individual properties you want to change.
|
|
295
|
+
*
|
|
296
|
+
* The object has the following JSON structure and default values:
|
|
297
|
+
*
|
|
298
|
+
* ```js
|
|
299
|
+
* {
|
|
300
|
+
* // Accessible name (aria-label) for the select all checkbox in the
|
|
301
|
+
* // selection column header cell.
|
|
302
|
+
* selectAll: 'Select All',
|
|
303
|
+
* // Accessible name (aria-label) for the select row checkbox in each
|
|
304
|
+
* // selection column body cell. The `{rowHeader}` placeholder is replaced with the
|
|
305
|
+
* // row header cell text content or row index if there is no row header column.
|
|
306
|
+
* selectRow: 'Select Row {rowHeader}',
|
|
307
|
+
* // Accessible name (aria-label) for the grid sorters. The `{column}`
|
|
308
|
+
* // placeholder is replaced with the sorter text content.
|
|
309
|
+
* sorter: 'Sort by {column}',
|
|
310
|
+
* }
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* @return {!GridI18n}
|
|
314
|
+
*/
|
|
315
|
+
get i18n() {
|
|
316
|
+
return super.i18n;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
set i18n(value) {
|
|
320
|
+
super.i18n = value;
|
|
321
|
+
}
|
|
322
|
+
|
|
280
323
|
/** @protected */
|
|
281
324
|
render() {
|
|
282
325
|
return html`
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
"name": "vaadin-grid-column",
|
|
217
|
-
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
217
|
+
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
218
218
|
"attributes": [
|
|
219
219
|
{
|
|
220
220
|
"name": "auto-width",
|
|
@@ -855,7 +855,7 @@
|
|
|
855
855
|
},
|
|
856
856
|
{
|
|
857
857
|
"name": "vaadin-grid-selection-column",
|
|
858
|
-
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
858
|
+
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/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-alpha1/#/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-alpha1/#/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-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/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-alpha1/#/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-alpha1/#/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-alpha2/#/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-alpha2/#/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-alpha2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/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-alpha2/#/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-alpha2/#/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",
|
|
@@ -2219,6 +2219,15 @@
|
|
|
2219
2219
|
]
|
|
2220
2220
|
}
|
|
2221
2221
|
},
|
|
2222
|
+
{
|
|
2223
|
+
"name": "i18n",
|
|
2224
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
2225
|
+
"value": {
|
|
2226
|
+
"type": [
|
|
2227
|
+
"Object"
|
|
2228
|
+
]
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2222
2231
|
{
|
|
2223
2232
|
"name": "isItemSelectable",
|
|
2224
2233
|
"description": "A function to check whether a specific item in the grid may be\nselected or deselected by the user. Used by the selection column to\nconditionally enable to disable checkboxes for individual items. This\nfunction does not prevent programmatic selection/deselection of\nitems. Changing the function does not modify the currently selected\nitems.\n\nConfiguring this function hides the select all checkbox of the grid\nselection column, which means users can not select or deselect all\nitems anymore, nor do they get feedback on whether all items are\nselected or not.\n\nReceives an item instance and should return a boolean indicating\nwhether users may change the selection state of that item.",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "vaadin-grid-column",
|
|
103
|
-
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
103
|
+
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
104
104
|
"extension": true,
|
|
105
105
|
"attributes": [
|
|
106
106
|
{
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
"name": "vaadin-grid-selection-column",
|
|
369
|
-
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-
|
|
369
|
+
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/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-alpha1/#/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-alpha1/#/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-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha1/#/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-alpha1/#/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-alpha1/#/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-alpha2/#/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-alpha2/#/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-alpha2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha2/#/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-alpha2/#/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-alpha2/#/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
|
{
|
|
@@ -929,6 +929,13 @@
|
|
|
929
929
|
"kind": "expression"
|
|
930
930
|
}
|
|
931
931
|
},
|
|
932
|
+
{
|
|
933
|
+
"name": ".i18n",
|
|
934
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
935
|
+
"value": {
|
|
936
|
+
"kind": "expression"
|
|
937
|
+
}
|
|
938
|
+
},
|
|
932
939
|
{
|
|
933
940
|
"name": ".isItemSelectable",
|
|
934
941
|
"description": "A function to check whether a specific item in the grid may be\nselected or deselected by the user. Used by the selection column to\nconditionally enable to disable checkboxes for individual items. This\nfunction does not prevent programmatic selection/deselection of\nitems. Changing the function does not modify the currently selected\nitems.\n\nConfiguring this function hides the select all checkbox of the grid\nselection column, which means users can not select or deselect all\nitems anymore, nor do they get feedback on whether all items are\nselected or not.\n\nReceives an item instance and should return a boolean indicating\nwhether users may change the selection state of that item.",
|