@vaadin/grid 25.3.2 → 25.4.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 +53 -27
- package/package.json +12 -12
- package/src/styles/vaadin-grid-base-styles.js +4 -0
- package/src/vaadin-grid-body-rendering-mixin.js +32 -0
- package/src/vaadin-grid-data-provider-mixin.d.ts +0 -15
- package/src/vaadin-grid-data-provider-mixin.js +0 -42
- package/src/vaadin-grid-header-footer-rendering-mixin.js +4 -4
- package/src/vaadin-grid-mixin.js +24 -55
- package/src/vaadin-grid-row-details-mixin.js +5 -0
- package/src/vaadin-grid-scroll-mixin.d.ts +15 -0
- package/src/vaadin-grid-scroll-mixin.js +42 -0
- package/src/vaadin-grid.d.ts +4 -2
- package/src/vaadin-grid.js +4 -2
- package/web-types.json +7 -6
- package/web-types.lit.json +5 -5
package/custom-elements.json
CHANGED
|
@@ -295,6 +295,33 @@
|
|
|
295
295
|
}
|
|
296
296
|
]
|
|
297
297
|
},
|
|
298
|
+
{
|
|
299
|
+
"kind": "javascript-module",
|
|
300
|
+
"path": "src/vaadin-grid-body-rendering-mixin.js",
|
|
301
|
+
"declarations": [
|
|
302
|
+
{
|
|
303
|
+
"kind": "mixin",
|
|
304
|
+
"description": "A mixin providing rendering of body rows.",
|
|
305
|
+
"name": "BodyRenderingMixin",
|
|
306
|
+
"members": [],
|
|
307
|
+
"parameters": [
|
|
308
|
+
{
|
|
309
|
+
"name": "superClass"
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"exports": [
|
|
315
|
+
{
|
|
316
|
+
"kind": "js",
|
|
317
|
+
"name": "BodyRenderingMixin",
|
|
318
|
+
"declaration": {
|
|
319
|
+
"name": "BodyRenderingMixin",
|
|
320
|
+
"module": "src/vaadin-grid-body-rendering-mixin.js"
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
298
325
|
{
|
|
299
326
|
"kind": "javascript-module",
|
|
300
327
|
"path": "src/vaadin-grid-column-auto-width-mixin.js",
|
|
@@ -2401,20 +2428,6 @@
|
|
|
2401
2428
|
"description": "Number of items fetched at a time from the dataprovider.",
|
|
2402
2429
|
"attribute": "page-size"
|
|
2403
2430
|
},
|
|
2404
|
-
{
|
|
2405
|
-
"kind": "method",
|
|
2406
|
-
"name": "scrollToIndex",
|
|
2407
|
-
"parameters": [
|
|
2408
|
-
{
|
|
2409
|
-
"name": "indexes",
|
|
2410
|
-
"description": "Row indexes to scroll to",
|
|
2411
|
-
"type": {
|
|
2412
|
-
"text": "...number"
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
],
|
|
2416
|
-
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level."
|
|
2417
|
-
},
|
|
2418
2431
|
{
|
|
2419
2432
|
"kind": "field",
|
|
2420
2433
|
"name": "size",
|
|
@@ -4425,8 +4438,8 @@
|
|
|
4425
4438
|
],
|
|
4426
4439
|
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level.",
|
|
4427
4440
|
"inheritedFrom": {
|
|
4428
|
-
"name": "
|
|
4429
|
-
"module": "src/vaadin-grid-
|
|
4441
|
+
"name": "ScrollMixin",
|
|
4442
|
+
"module": "src/vaadin-grid-scroll-mixin.js"
|
|
4430
4443
|
}
|
|
4431
4444
|
},
|
|
4432
4445
|
{
|
|
@@ -4777,6 +4790,10 @@
|
|
|
4777
4790
|
"name": "HeaderFooterRenderingMixin",
|
|
4778
4791
|
"module": "src/vaadin-grid-header-footer-rendering-mixin.js"
|
|
4779
4792
|
},
|
|
4793
|
+
{
|
|
4794
|
+
"name": "BodyRenderingMixin",
|
|
4795
|
+
"module": "src/vaadin-grid-body-rendering-mixin.js"
|
|
4796
|
+
},
|
|
4780
4797
|
{
|
|
4781
4798
|
"name": "ActiveItemMixin",
|
|
4782
4799
|
"module": "src/vaadin-grid-active-item-mixin.js"
|
|
@@ -5032,6 +5049,20 @@
|
|
|
5032
5049
|
}
|
|
5033
5050
|
],
|
|
5034
5051
|
"description": "Scrolls horizontally so that the column becomes visible in the viewport.\n\nThe column can be specified either by its index (among visible columns\nin visual order) or by the column element itself."
|
|
5052
|
+
},
|
|
5053
|
+
{
|
|
5054
|
+
"kind": "method",
|
|
5055
|
+
"name": "scrollToIndex",
|
|
5056
|
+
"parameters": [
|
|
5057
|
+
{
|
|
5058
|
+
"name": "indexes",
|
|
5059
|
+
"description": "Row indexes to scroll to",
|
|
5060
|
+
"type": {
|
|
5061
|
+
"text": "...number"
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
],
|
|
5065
|
+
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level."
|
|
5035
5066
|
}
|
|
5036
5067
|
],
|
|
5037
5068
|
"attributes": [
|
|
@@ -8004,15 +8035,10 @@
|
|
|
8004
8035
|
"name": "i18n",
|
|
8005
8036
|
"privacy": "public",
|
|
8006
8037
|
"type": {
|
|
8007
|
-
"text": "Object"
|
|
8038
|
+
"text": "Object | undefined"
|
|
8008
8039
|
},
|
|
8009
|
-
"description": "The object used to localize this component. To change the default\nlocalization,
|
|
8040
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
8010
8041
|
"attribute": "i18n",
|
|
8011
|
-
"return": {
|
|
8012
|
-
"type": {
|
|
8013
|
-
"text": "!GridI18n"
|
|
8014
|
-
}
|
|
8015
|
-
},
|
|
8016
8042
|
"inheritedFrom": {
|
|
8017
8043
|
"name": "I18nMixin",
|
|
8018
8044
|
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
@@ -8240,8 +8266,8 @@
|
|
|
8240
8266
|
],
|
|
8241
8267
|
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level.",
|
|
8242
8268
|
"inheritedFrom": {
|
|
8243
|
-
"name": "
|
|
8244
|
-
"module": "src/vaadin-grid-
|
|
8269
|
+
"name": "ScrollMixin",
|
|
8270
|
+
"module": "src/vaadin-grid-scroll-mixin.js"
|
|
8245
8271
|
}
|
|
8246
8272
|
},
|
|
8247
8273
|
{
|
|
@@ -8557,9 +8583,9 @@
|
|
|
8557
8583
|
{
|
|
8558
8584
|
"name": "i18n",
|
|
8559
8585
|
"type": {
|
|
8560
|
-
"text": "Object"
|
|
8586
|
+
"text": "Object | undefined"
|
|
8561
8587
|
},
|
|
8562
|
-
"description": "The object used to localize this component. To change the default\nlocalization,
|
|
8588
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
8563
8589
|
"fieldName": "i18n",
|
|
8564
8590
|
"inheritedFrom": {
|
|
8565
8591
|
"name": "I18nMixin",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.4.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": "
|
|
49
|
-
"@vaadin/checkbox": "
|
|
50
|
-
"@vaadin/component-base": "
|
|
51
|
-
"@vaadin/lit-renderer": "
|
|
52
|
-
"@vaadin/text-field": "
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
48
|
+
"@vaadin/a11y-base": "25.4.0-alpha2",
|
|
49
|
+
"@vaadin/checkbox": "25.4.0-alpha2",
|
|
50
|
+
"@vaadin/component-base": "25.4.0-alpha2",
|
|
51
|
+
"@vaadin/lit-renderer": "25.4.0-alpha2",
|
|
52
|
+
"@vaadin/text-field": "25.4.0-alpha2",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha2",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/aura": "
|
|
58
|
-
"@vaadin/chai-plugins": "
|
|
59
|
-
"@vaadin/test-runner-commands": "
|
|
57
|
+
"@vaadin/aura": "25.4.0-alpha2",
|
|
58
|
+
"@vaadin/chai-plugins": "25.4.0-alpha2",
|
|
59
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha2",
|
|
60
60
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
61
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
61
|
+
"@vaadin/vaadin-lumo-styles": "25.4.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": "213f8b55112558d2f976d8730fe44370ca868333"
|
|
70
70
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2026 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, render } from 'lit';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A mixin providing rendering of body rows.
|
|
10
|
+
*/
|
|
11
|
+
export const BodyRenderingMixin = (superClass) =>
|
|
12
|
+
class BodyRenderingMixin extends superClass {
|
|
13
|
+
/** @private */
|
|
14
|
+
__createBodyRow() {
|
|
15
|
+
const renderRoot = document.createDocumentFragment();
|
|
16
|
+
render(this.#bodyRowTemplate(), renderRoot, { host: this });
|
|
17
|
+
|
|
18
|
+
const row = renderRoot.firstElementChild;
|
|
19
|
+
row.__renderRoot = renderRoot;
|
|
20
|
+
return row;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** @private */
|
|
24
|
+
__renderBodyRow(row) {
|
|
25
|
+
const item = this.__getRowItem(row);
|
|
26
|
+
render(this.#bodyRowTemplate({ item }), row.__renderRoot, { host: this });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#bodyRowTemplate = ({ item } = {}) => {
|
|
30
|
+
return html`<tr role="row" tabindex="-1" part="row body-row" class="row body-row" ?loading="${!item}"></tr>`;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -116,19 +116,4 @@ export declare class DataProviderMixinClass<TItem> {
|
|
|
116
116
|
* Clears the cached pages and reloads data from dataprovider when needed.
|
|
117
117
|
*/
|
|
118
118
|
clearCache(): void;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
122
|
-
* not always the same for any particular item. For example, sorting or filtering
|
|
123
|
-
* items can affect the row index related to an item.
|
|
124
|
-
*
|
|
125
|
-
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
126
|
-
* The grid will first try to scroll to the item at the first index on the top level.
|
|
127
|
-
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
128
|
-
* item at the second index within the children of the expanded first item, and so on.
|
|
129
|
-
* Each given index points to a child of the item at the previous index.
|
|
130
|
-
*
|
|
131
|
-
* Using `Infinity` as an index will point to the last item on the level.
|
|
132
|
-
*/
|
|
133
|
-
scrollToIndex(...indexes: number[]): void;
|
|
134
119
|
}
|
|
@@ -393,46 +393,4 @@ export const DataProviderMixin = (superClass) =>
|
|
|
393
393
|
_itemsEqual(item1, item2) {
|
|
394
394
|
return this.getItemId(item1) === this.getItemId(item2);
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
399
|
-
* not always the same for any particular item. For example, sorting or filtering
|
|
400
|
-
* items can affect the row index related to an item.
|
|
401
|
-
*
|
|
402
|
-
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
403
|
-
* The grid will first try to scroll to the item at the first index on the top level.
|
|
404
|
-
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
405
|
-
* item at the second index within the children of the expanded first item, and so on.
|
|
406
|
-
* Each given index points to a child of the item at the previous index.
|
|
407
|
-
*
|
|
408
|
-
* Using `Infinity` as an index will point to the last item on the level.
|
|
409
|
-
*
|
|
410
|
-
* @param indexes {...number} Row indexes to scroll to
|
|
411
|
-
*/
|
|
412
|
-
scrollToIndex(...indexes) {
|
|
413
|
-
if (!this.__virtualizer || !this.clientHeight || !this._columnTree) {
|
|
414
|
-
this.__pendingScrollToIndexes = indexes;
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
// Synchronous data provider may cause changes to the cache on scroll without
|
|
418
|
-
// ending up in a loading state. Try scrolling to the index until the target
|
|
419
|
-
// index stabilizes.
|
|
420
|
-
let targetIndex;
|
|
421
|
-
while (targetIndex !== (targetIndex = this._dataProviderController.getFlatIndexByPath(indexes))) {
|
|
422
|
-
this._scrollToFlatIndex(targetIndex);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if (this._dataProviderController.isLoading()) {
|
|
426
|
-
this.__pendingScrollToIndexes = indexes;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/** @private */
|
|
431
|
-
__scrollToPendingIndexes() {
|
|
432
|
-
if (this.__pendingScrollToIndexes) {
|
|
433
|
-
const indexes = this.__pendingScrollToIndexes;
|
|
434
|
-
delete this.__pendingScrollToIndexes;
|
|
435
|
-
this.scrollToIndex(...indexes);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
396
|
};
|
|
@@ -95,7 +95,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
|
|
|
95
95
|
|
|
96
96
|
#renderHeader(columnTree) {
|
|
97
97
|
const rows = this.#getRows(columnTree, 'header');
|
|
98
|
-
render(rows.map(this.#
|
|
98
|
+
render(rows.map(this.#headerRowTemplate), this.$.header, { host: this });
|
|
99
99
|
|
|
100
100
|
this.$.table.toggleAttribute('has-header', !!this.$.header.querySelector('tr:not([hidden])'));
|
|
101
101
|
|
|
@@ -110,7 +110,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
#
|
|
113
|
+
#headerRowTemplate = ({ level, cells, isLastRow, isFirstRow, isRowVisible }) => {
|
|
114
114
|
const rowParts = {
|
|
115
115
|
'first-header-row': isFirstRow,
|
|
116
116
|
'last-header-row': isLastRow,
|
|
@@ -178,7 +178,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
|
|
|
178
178
|
|
|
179
179
|
#renderFooter(columnTree) {
|
|
180
180
|
const rows = this.#getRows(columnTree, 'footer');
|
|
181
|
-
render(rows.map(this.#
|
|
181
|
+
render(rows.map(this.#footerRowTemplate), this.$.footer, { host: this });
|
|
182
182
|
|
|
183
183
|
this.$.table.toggleAttribute('has-footer', !!this.$.footer.querySelector('tr:not([hidden])'));
|
|
184
184
|
|
|
@@ -193,7 +193,7 @@ export const HeaderFooterRenderingMixin = (superClass) =>
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
#
|
|
196
|
+
#footerRowTemplate = ({ level, cells, isLastRow, isFirstRow, isRowVisible }) => {
|
|
197
197
|
const rowParts = {
|
|
198
198
|
'first-footer-row': isFirstRow,
|
|
199
199
|
'last-footer-row': isLastRow,
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
|
|
|
12
12
|
import { A11yMixin } from './vaadin-grid-a11y-mixin.js';
|
|
13
13
|
import { ActiveItemMixin } from './vaadin-grid-active-item-mixin.js';
|
|
14
14
|
import { ArrayDataProviderMixin } from './vaadin-grid-array-data-provider-mixin.js';
|
|
15
|
+
import { BodyRenderingMixin } from './vaadin-grid-body-rendering-mixin.js';
|
|
15
16
|
import { ColumnAutoWidthMixin } from './vaadin-grid-column-auto-width-mixin.js';
|
|
16
17
|
import { ColumnReorderingMixin } from './vaadin-grid-column-reordering-mixin.js';
|
|
17
18
|
import { ColumnResizingMixin } from './vaadin-grid-column-resizing-mixin.js';
|
|
@@ -29,7 +30,6 @@ import {
|
|
|
29
30
|
updateBooleanRowStates,
|
|
30
31
|
updateCellsPart,
|
|
31
32
|
updatePart,
|
|
32
|
-
updateState,
|
|
33
33
|
} from './vaadin-grid-helpers.js';
|
|
34
34
|
import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js';
|
|
35
35
|
import { ResizeMixin } from './vaadin-grid-resize-mixin.js';
|
|
@@ -48,18 +48,20 @@ export const GridMixin = (superClass) =>
|
|
|
48
48
|
DataProviderMixin(
|
|
49
49
|
DynamicColumnsMixin(
|
|
50
50
|
HeaderFooterRenderingMixin(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
BodyRenderingMixin(
|
|
52
|
+
ActiveItemMixin(
|
|
53
|
+
ScrollMixin(
|
|
54
|
+
SelectionMixin(
|
|
55
|
+
SortMixin(
|
|
56
|
+
RowDetailsMixin(
|
|
57
|
+
KeyboardNavigationMixin(
|
|
58
|
+
A11yMixin(
|
|
59
|
+
FilterMixin(
|
|
60
|
+
ColumnReorderingMixin(
|
|
61
|
+
ColumnResizingMixin(
|
|
62
|
+
EventContextMixin(
|
|
63
|
+
DragAndDropMixin(StylingMixin(TabindexMixin(ResizeMixin(superClass)))),
|
|
64
|
+
),
|
|
63
65
|
),
|
|
64
66
|
),
|
|
65
67
|
),
|
|
@@ -328,11 +330,7 @@ export const GridMixin = (superClass) =>
|
|
|
328
330
|
__createVirtualizerElements(count) {
|
|
329
331
|
const rows = [];
|
|
330
332
|
for (let i = 0; i < count; i++) {
|
|
331
|
-
const row =
|
|
332
|
-
row.setAttribute('role', 'row');
|
|
333
|
-
row.setAttribute('tabindex', '-1');
|
|
334
|
-
updatePart(row, 'row', true);
|
|
335
|
-
updatePart(row, 'body-row', true);
|
|
333
|
+
const row = this.__createBodyRow();
|
|
336
334
|
if (this._columnTree) {
|
|
337
335
|
this.__initRow(row, this._columnTree[this._columnTree.length - 1], 'body', true);
|
|
338
336
|
}
|
|
@@ -440,6 +438,9 @@ export const GridMixin = (superClass) =>
|
|
|
440
438
|
if (section === 'body') {
|
|
441
439
|
// Clear the cached cell references
|
|
442
440
|
row.__cells = [];
|
|
441
|
+
if (row.__detailsCell) {
|
|
442
|
+
this.__teardownDetailsCell(row.__detailsCell);
|
|
443
|
+
}
|
|
443
444
|
row.__detailsCell = null;
|
|
444
445
|
}
|
|
445
446
|
|
|
@@ -585,12 +586,9 @@ export const GridMixin = (superClass) =>
|
|
|
585
586
|
* @param {boolean} loading
|
|
586
587
|
* @private
|
|
587
588
|
*/
|
|
588
|
-
|
|
589
|
+
__updateRowCellsLoading(row, loading) {
|
|
589
590
|
const cells = getBodyRowCells(row);
|
|
590
591
|
|
|
591
|
-
// Row state attribute
|
|
592
|
-
updateState(row, 'loading', loading);
|
|
593
|
-
|
|
594
592
|
// Cells part attribute
|
|
595
593
|
updateCellsPart(cells, 'loading-row-cell', loading);
|
|
596
594
|
|
|
@@ -605,14 +603,16 @@ export const GridMixin = (superClass) =>
|
|
|
605
603
|
* @private
|
|
606
604
|
*/
|
|
607
605
|
__updateRow(row) {
|
|
606
|
+
this.__renderBodyRow(row);
|
|
607
|
+
|
|
608
608
|
this.__a11yUpdateRowRowindex(row);
|
|
609
609
|
this.__updateRowOrderParts(row);
|
|
610
610
|
|
|
611
611
|
const item = this.__getRowItem(row);
|
|
612
612
|
if (item) {
|
|
613
|
-
this.
|
|
613
|
+
this.__updateRowCellsLoading(row, false);
|
|
614
614
|
} else {
|
|
615
|
-
this.
|
|
615
|
+
this.__updateRowCellsLoading(row, true);
|
|
616
616
|
return;
|
|
617
617
|
}
|
|
618
618
|
|
|
@@ -678,10 +678,6 @@ export const GridMixin = (superClass) =>
|
|
|
678
678
|
if (tooltip?.isConnected) {
|
|
679
679
|
const target = event.target;
|
|
680
680
|
|
|
681
|
-
if (!this.__isCellFullyVisible(target)) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
681
|
this._tooltipController.setTarget(target);
|
|
686
682
|
this._tooltipController.setContext(this.getEventContext(event));
|
|
687
683
|
|
|
@@ -693,33 +689,6 @@ export const GridMixin = (superClass) =>
|
|
|
693
689
|
}
|
|
694
690
|
}
|
|
695
691
|
|
|
696
|
-
/** @private */
|
|
697
|
-
__isCellFullyVisible(cell) {
|
|
698
|
-
if (cell.hasAttribute('frozen') || cell.hasAttribute('frozen-to-end')) {
|
|
699
|
-
// Frozen cells are always fully visible
|
|
700
|
-
return true;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
let { left, right } = this.getBoundingClientRect();
|
|
704
|
-
|
|
705
|
-
const frozen = [...cell.parentNode.children].find((cell) => cell.hasAttribute('last-frozen'));
|
|
706
|
-
if (frozen) {
|
|
707
|
-
const frozenRect = frozen.getBoundingClientRect();
|
|
708
|
-
left = this.__isRTL ? left : frozenRect.right;
|
|
709
|
-
right = this.__isRTL ? frozenRect.left : right;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
const frozenToEnd = [...cell.parentNode.children].find((cell) => cell.hasAttribute('first-frozen-to-end'));
|
|
713
|
-
if (frozenToEnd) {
|
|
714
|
-
const frozenToEndRect = frozenToEnd.getBoundingClientRect();
|
|
715
|
-
left = this.__isRTL ? frozenToEndRect.right : left;
|
|
716
|
-
right = this.__isRTL ? right : frozenToEndRect.left;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
const cellRect = cell.getBoundingClientRect();
|
|
720
|
-
return cellRect.left >= left && cellRect.right <= right;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
692
|
/** @protected */
|
|
724
693
|
_hideTooltip(immediate) {
|
|
725
694
|
this._tooltipController.close(immediate);
|
|
@@ -122,6 +122,11 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
122
122
|
this._detailsCellResizeObserver.observe(cell);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/** @private */
|
|
126
|
+
__teardownDetailsCell(cell) {
|
|
127
|
+
this._detailsCellResizeObserver.unobserve(cell);
|
|
128
|
+
}
|
|
129
|
+
|
|
125
130
|
/**
|
|
126
131
|
* @param {!HTMLElement} row
|
|
127
132
|
* @param {boolean} detailsOpened
|
|
@@ -49,6 +49,21 @@ export declare class ScrollMixinClass {
|
|
|
49
49
|
*/
|
|
50
50
|
columnRendering: ColumnRendering;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
54
|
+
* not always the same for any particular item. For example, sorting or filtering
|
|
55
|
+
* items can affect the row index related to an item.
|
|
56
|
+
*
|
|
57
|
+
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
58
|
+
* The grid will first try to scroll to the item at the first index on the top level.
|
|
59
|
+
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
60
|
+
* item at the second index within the children of the expanded first item, and so on.
|
|
61
|
+
* Each given index points to a child of the item at the previous index.
|
|
62
|
+
*
|
|
63
|
+
* Using `Infinity` as an index will point to the last item on the level.
|
|
64
|
+
*/
|
|
65
|
+
scrollToIndex(...indexes: number[]): void;
|
|
66
|
+
|
|
52
67
|
/**
|
|
53
68
|
* Scroll to a flat index in the grid. The method doesn't take into account
|
|
54
69
|
* the hierarchy of the items.
|
|
@@ -134,6 +134,39 @@ export const ScrollMixin = (superClass) =>
|
|
|
134
134
|
this.addController(this.__overflowController);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
139
|
+
* not always the same for any particular item. For example, sorting or filtering
|
|
140
|
+
* items can affect the row index related to an item.
|
|
141
|
+
*
|
|
142
|
+
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
143
|
+
* The grid will first try to scroll to the item at the first index on the top level.
|
|
144
|
+
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
145
|
+
* item at the second index within the children of the expanded first item, and so on.
|
|
146
|
+
* Each given index points to a child of the item at the previous index.
|
|
147
|
+
*
|
|
148
|
+
* Using `Infinity` as an index will point to the last item on the level.
|
|
149
|
+
*
|
|
150
|
+
* @param indexes {...number} Row indexes to scroll to
|
|
151
|
+
*/
|
|
152
|
+
scrollToIndex(...indexes) {
|
|
153
|
+
if (!this.clientHeight || !this._columnTree) {
|
|
154
|
+
this.__pendingScrollToIndexes = indexes;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Synchronous data provider may cause changes to the cache on scroll without
|
|
158
|
+
// ending up in a loading state. Try scrolling to the index until the target
|
|
159
|
+
// index stabilizes.
|
|
160
|
+
let targetIndex;
|
|
161
|
+
while (targetIndex !== (targetIndex = this._dataProviderController.getFlatIndexByPath(indexes))) {
|
|
162
|
+
this._scrollToFlatIndex(targetIndex);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (this._dataProviderController.isLoading()) {
|
|
166
|
+
this.__pendingScrollToIndexes = indexes;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
137
170
|
/**
|
|
138
171
|
* Scroll to a flat index in the grid. The method doesn't take into account
|
|
139
172
|
* the hierarchy of the items.
|
|
@@ -193,6 +226,15 @@ export const ScrollMixin = (superClass) =>
|
|
|
193
226
|
this.__updateColumnsBodyContentHidden();
|
|
194
227
|
}
|
|
195
228
|
|
|
229
|
+
/** @private */
|
|
230
|
+
__scrollToPendingIndexes() {
|
|
231
|
+
if (this.__pendingScrollToIndexes) {
|
|
232
|
+
const indexes = this.__pendingScrollToIndexes;
|
|
233
|
+
delete this.__pendingScrollToIndexes;
|
|
234
|
+
this.scrollToIndex(...indexes);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
196
238
|
/** @private */
|
|
197
239
|
__scrollToPendingColumn() {
|
|
198
240
|
if (this.__pendingScrollToColumn !== undefined) {
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -319,9 +319,11 @@ export interface GridI18n {
|
|
|
319
319
|
declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
320
320
|
/**
|
|
321
321
|
* The object used to localize this component. To change the default
|
|
322
|
-
* localization,
|
|
322
|
+
* localization, set this to an object that provides all properties, or
|
|
323
323
|
* just the individual properties you want to change.
|
|
324
324
|
*
|
|
325
|
+
* When not set, defaults to `undefined`.
|
|
326
|
+
*
|
|
325
327
|
* The object has the following JSON structure and default values:
|
|
326
328
|
*
|
|
327
329
|
* ```js
|
|
@@ -342,7 +344,7 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
342
344
|
* }
|
|
343
345
|
* ```
|
|
344
346
|
*/
|
|
345
|
-
i18n: GridI18n;
|
|
347
|
+
i18n: GridI18n | undefined;
|
|
346
348
|
|
|
347
349
|
addEventListener<K extends keyof GridEventMap<TItem>>(
|
|
348
350
|
type: K,
|
package/src/vaadin-grid.js
CHANGED
|
@@ -316,9 +316,11 @@ class Grid extends GridMixin(I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(L
|
|
|
316
316
|
|
|
317
317
|
/**
|
|
318
318
|
* The object used to localize this component. To change the default
|
|
319
|
-
* localization,
|
|
319
|
+
* localization, set this to an object that provides all properties, or
|
|
320
320
|
* just the individual properties you want to change.
|
|
321
321
|
*
|
|
322
|
+
* When not set, defaults to `undefined`.
|
|
323
|
+
*
|
|
322
324
|
* The object has the following JSON structure and default values:
|
|
323
325
|
*
|
|
324
326
|
* ```js
|
|
@@ -339,7 +341,7 @@ class Grid extends GridMixin(I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(L
|
|
|
339
341
|
* }
|
|
340
342
|
* ```
|
|
341
343
|
*
|
|
342
|
-
* @
|
|
344
|
+
* @type {GridI18n | undefined}
|
|
343
345
|
*/
|
|
344
346
|
get i18n() {
|
|
345
347
|
return super.i18n;
|
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.
|
|
4
|
+
"version": "25.4.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"name": "vaadin-grid-column",
|
|
206
|
-
"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.
|
|
206
|
+
"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.4.0-alpha2/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
207
207
|
"attributes": [
|
|
208
208
|
{
|
|
209
209
|
"name": "auto-width",
|
|
@@ -820,7 +820,7 @@
|
|
|
820
820
|
},
|
|
821
821
|
{
|
|
822
822
|
"name": "vaadin-grid-selection-column",
|
|
823
|
-
"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.
|
|
823
|
+
"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.4.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__",
|
|
824
824
|
"attributes": [
|
|
825
825
|
{
|
|
826
826
|
"name": "auto-select",
|
|
@@ -1880,7 +1880,7 @@
|
|
|
1880
1880
|
},
|
|
1881
1881
|
{
|
|
1882
1882
|
"name": "vaadin-grid",
|
|
1883
|
-
"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.2/#/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.2/#/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.2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/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.2/#/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.2/#/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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
1883
|
+
"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.4.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.4.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.4.0-alpha2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.4.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.4.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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
1884
1884
|
"attributes": [
|
|
1885
1885
|
{
|
|
1886
1886
|
"name": "accessible-name",
|
|
@@ -2147,10 +2147,11 @@
|
|
|
2147
2147
|
},
|
|
2148
2148
|
{
|
|
2149
2149
|
"name": "i18n",
|
|
2150
|
-
"description": "The object used to localize this component. To change the default\nlocalization,
|
|
2150
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
2151
2151
|
"value": {
|
|
2152
2152
|
"type": [
|
|
2153
|
-
"Object"
|
|
2153
|
+
"Object",
|
|
2154
|
+
"undefined"
|
|
2154
2155
|
]
|
|
2155
2156
|
}
|
|
2156
2157
|
},
|
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.
|
|
4
|
+
"version": "25.4.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.
|
|
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.4.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.
|
|
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.4.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.2/#/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.2/#/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.2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.3.2/#/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.2/#/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.2/#/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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\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.4.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.4.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.4.0-alpha2/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha2/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.4.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.4.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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
839
839
|
"extension": true,
|
|
840
840
|
"attributes": [
|
|
841
841
|
{
|
|
@@ -931,7 +931,7 @@
|
|
|
931
931
|
},
|
|
932
932
|
{
|
|
933
933
|
"name": ".i18n",
|
|
934
|
-
"description": "The object used to localize this component. To change the default\nlocalization,
|
|
934
|
+
"description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // Accessible name (aria-label) for the select all checkbox in the\n // selection column header cell.\n selectAll: 'Select All',\n // Screen-reader-only label announced for the selection column header cell\n // when the Select All checkbox is hidden (data provider or conditional selection).\n selectAllUnavailable: 'Select All unavailable',\n // Accessible name (aria-label) for the select row checkbox in each\n // selection column body cell. The `{rowHeader}` placeholder is replaced with the\n // row header cell text content or row index if there is no row header column.\n selectRow: 'Select Row {rowHeader}',\n // Accessible name (aria-label) for the grid sorters. The `{column}`\n // placeholder is replaced with the sorter text content.\n sorter: 'Sort by {column}',\n}\n```",
|
|
935
935
|
"value": {
|
|
936
936
|
"kind": "expression"
|
|
937
937
|
}
|