@vaadin/grid 23.3.0-alpha5 → 23.3.0-alpha7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/vaadin-grid-data-provider-mixin.js +1 -0
- package/src/vaadin-grid-styles.js +9 -0
- package/src/vaadin-grid-styling-mixin.js +1 -0
- package/src/vaadin-grid.d.ts +43 -25
- package/src/vaadin-grid.js +30 -25
- package/theme/lumo/vaadin-grid.js +0 -7
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.3.0-
|
|
3
|
+
"version": "23.3.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
48
|
"@polymer/polymer": "^3.0.0",
|
|
49
|
-
"@vaadin/checkbox": "23.3.0-
|
|
50
|
-
"@vaadin/component-base": "23.3.0-
|
|
51
|
-
"@vaadin/lit-renderer": "23.3.0-
|
|
52
|
-
"@vaadin/text-field": "23.3.0-
|
|
53
|
-
"@vaadin/vaadin-lumo-styles": "23.3.0-
|
|
54
|
-
"@vaadin/vaadin-material-styles": "23.3.0-
|
|
55
|
-
"@vaadin/vaadin-themable-mixin": "23.3.0-
|
|
49
|
+
"@vaadin/checkbox": "23.3.0-alpha7",
|
|
50
|
+
"@vaadin/component-base": "23.3.0-alpha7",
|
|
51
|
+
"@vaadin/lit-renderer": "23.3.0-alpha7",
|
|
52
|
+
"@vaadin/text-field": "23.3.0-alpha7",
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha7",
|
|
54
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha7",
|
|
55
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@esm-bundle/chai": "^4.3.4",
|
|
59
|
-
"@vaadin/polymer-legacy-adapter": "23.3.0-
|
|
59
|
+
"@vaadin/polymer-legacy-adapter": "23.3.0-alpha7",
|
|
60
60
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
61
61
|
"lit": "^2.0.0",
|
|
62
62
|
"sinon": "^13.0.2"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"web-types.json",
|
|
66
66
|
"web-types.lit.json"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "db2561dc65b5770978e95f00fdca218591d449a0"
|
|
69
69
|
}
|
|
@@ -116,6 +116,7 @@ registerStyles(
|
|
|
116
116
|
width: 100%;
|
|
117
117
|
box-sizing: border-box;
|
|
118
118
|
margin: 0;
|
|
119
|
+
pointer-events: none;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
[part~='row'][loading] [part~='body-cell'] ::slotted(vaadin-grid-cell-content) {
|
|
@@ -169,6 +170,10 @@ registerStyles(
|
|
|
169
170
|
text-overflow: ellipsis;
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
[part~='cell'] {
|
|
174
|
+
pointer-events: initial;
|
|
175
|
+
}
|
|
176
|
+
|
|
172
177
|
[hidden] {
|
|
173
178
|
display: none !important;
|
|
174
179
|
}
|
|
@@ -248,6 +253,10 @@ registerStyles(
|
|
|
248
253
|
transform: none;
|
|
249
254
|
}
|
|
250
255
|
|
|
256
|
+
[first-frozen-to-end] {
|
|
257
|
+
margin-inline-start: auto;
|
|
258
|
+
}
|
|
259
|
+
|
|
251
260
|
/* Hide resize handle if scrolled to end */
|
|
252
261
|
:host(:not([overflow~='end'])) [first-frozen-to-end] [part~='resize-handle'] {
|
|
253
262
|
display: none;
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -86,6 +86,11 @@ export type GridColumnReorderEvent<TItem> = CustomEvent<{ columns: Array<GridCol
|
|
|
86
86
|
*/
|
|
87
87
|
export type GridColumnResizeEvent<TItem> = CustomEvent<{ resizedColumn: GridColumn<TItem> }>;
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Fired when the `dataProvider` property changes.
|
|
91
|
+
*/
|
|
92
|
+
export type GridDataProviderChangedEvent<TItem> = CustomEvent<{ value: GridDataProvider<TItem> }>;
|
|
93
|
+
|
|
89
94
|
/**
|
|
90
95
|
* Fired when the `expandedItems` property changes.
|
|
91
96
|
*/
|
|
@@ -119,6 +124,11 @@ export type GridLoadingChangedEvent = CustomEvent<{ value: boolean }>;
|
|
|
119
124
|
*/
|
|
120
125
|
export type GridSelectedItemsChangedEvent<TItem> = CustomEvent<{ value: TItem[] }>;
|
|
121
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Fired when the `size` property changes.
|
|
129
|
+
*/
|
|
130
|
+
export type GridSizeChangedEvent = CustomEvent<{ value: number }>;
|
|
131
|
+
|
|
122
132
|
export interface GridCustomEventMap<TItem> {
|
|
123
133
|
'active-item-changed': GridActiveItemChangedEvent<TItem>;
|
|
124
134
|
|
|
@@ -130,6 +140,8 @@ export interface GridCustomEventMap<TItem> {
|
|
|
130
140
|
|
|
131
141
|
'column-resize': GridColumnResizeEvent<TItem>;
|
|
132
142
|
|
|
143
|
+
'data-provider-changed': GridDataProviderChangedEvent<TItem>;
|
|
144
|
+
|
|
133
145
|
'expanded-items-changed': GridExpandedItemsChangedEvent<TItem>;
|
|
134
146
|
|
|
135
147
|
'grid-dragstart': GridDragStartEvent<TItem>;
|
|
@@ -141,6 +153,8 @@ export interface GridCustomEventMap<TItem> {
|
|
|
141
153
|
'loading-changed': GridLoadingChangedEvent;
|
|
142
154
|
|
|
143
155
|
'selected-items-changed': GridSelectedItemsChangedEvent<TItem>;
|
|
156
|
+
|
|
157
|
+
'size-changed': GridSizeChangedEvent;
|
|
144
158
|
}
|
|
145
159
|
|
|
146
160
|
export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEventMap<TItem> {}
|
|
@@ -299,31 +313,33 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
299
313
|
*
|
|
300
314
|
* The following state attributes are available for styling:
|
|
301
315
|
*
|
|
302
|
-
* Attribute
|
|
303
|
-
*
|
|
304
|
-
* `loading`
|
|
305
|
-
* `interacting`
|
|
306
|
-
* `navigating`
|
|
307
|
-
* `overflow`
|
|
308
|
-
* `reordering`
|
|
309
|
-
* `dragover`
|
|
310
|
-
* `dragging-rows`
|
|
311
|
-
* `reorder-status`
|
|
312
|
-
* `frozen`
|
|
313
|
-
* `
|
|
314
|
-
* `
|
|
315
|
-
* `
|
|
316
|
-
* `
|
|
317
|
-
* `
|
|
318
|
-
* `
|
|
319
|
-
* `
|
|
320
|
-
* `
|
|
321
|
-
* `
|
|
322
|
-
* `
|
|
323
|
-
* `
|
|
324
|
-
* `
|
|
325
|
-
* `
|
|
326
|
-
* `
|
|
316
|
+
* Attribute | Description | Part name
|
|
317
|
+
* -----------------------|---------------------------------------------------------------------------------------------------|-----------
|
|
318
|
+
* `loading` | Set when the grid is loading data from data provider | :host
|
|
319
|
+
* `interacting` | Keyboard navigation in interaction mode | :host
|
|
320
|
+
* `navigating` | Keyboard navigation in navigation mode | :host
|
|
321
|
+
* `overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host
|
|
322
|
+
* `reordering` | Set when the grid's columns are being reordered | :host
|
|
323
|
+
* `dragover` | Set when the grid (not a specific row) is dragged over | :host
|
|
324
|
+
* `dragging-rows` | Set when grid rows are dragged | :host
|
|
325
|
+
* `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
|
|
326
|
+
* `frozen` | Frozen cell | cell
|
|
327
|
+
* `frozen-to-end` | Cell frozen to end | cell
|
|
328
|
+
* `last-frozen` | Last frozen cell | cell
|
|
329
|
+
* `first-frozen-to-end` | First cell frozen to end | cell
|
|
330
|
+
* `first-column` | First visible cell on a row | cell
|
|
331
|
+
* `last-column` | Last visible cell on a row | cell
|
|
332
|
+
* `selected` | Selected row | row
|
|
333
|
+
* `expanded` | Expanded row | row
|
|
334
|
+
* `details-opened` | Row with details open | row
|
|
335
|
+
* `loading` | Row that is waiting for data from data provider | row
|
|
336
|
+
* `odd` | Odd row | row
|
|
337
|
+
* `first` | The first body row | row
|
|
338
|
+
* `last` | The last body row | row
|
|
339
|
+
* `dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row
|
|
340
|
+
* `dragover` | Set when the row is dragged over | row
|
|
341
|
+
* `drag-disabled` | Set to a row that isn't available for dragging | row
|
|
342
|
+
* `drop-disabled` | Set to a row that can't be dropped on top of | row
|
|
327
343
|
*
|
|
328
344
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
329
345
|
*
|
|
@@ -332,12 +348,14 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
332
348
|
* @fires {CustomEvent} cell-focus - Fired when a cell is focused with click or keyboard navigation.
|
|
333
349
|
* @fires {CustomEvent} column-reorder - Fired when the columns in the grid are reordered.
|
|
334
350
|
* @fires {CustomEvent} column-resize - Fired when the grid column resize is finished.
|
|
351
|
+
* @fires {CustomEvent} data-provider-changed - Fired when the `dataProvider` property changes.
|
|
335
352
|
* @fires {CustomEvent} expanded-items-changed - Fired when the `expandedItems` property changes.
|
|
336
353
|
* @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
|
|
337
354
|
* @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
|
|
338
355
|
* @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
|
|
339
356
|
* @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
|
|
340
357
|
* @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
|
|
358
|
+
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
341
359
|
*/
|
|
342
360
|
declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
343
361
|
/**
|
package/src/vaadin-grid.js
CHANGED
|
@@ -186,31 +186,33 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
|
|
|
186
186
|
*
|
|
187
187
|
* The following state attributes are available for styling:
|
|
188
188
|
*
|
|
189
|
-
* Attribute
|
|
190
|
-
*
|
|
191
|
-
* `loading`
|
|
192
|
-
* `interacting`
|
|
193
|
-
* `navigating`
|
|
194
|
-
* `overflow`
|
|
195
|
-
* `reordering`
|
|
196
|
-
* `dragover`
|
|
197
|
-
* `dragging-rows`
|
|
198
|
-
* `reorder-status`
|
|
199
|
-
* `frozen`
|
|
200
|
-
* `
|
|
201
|
-
* `
|
|
202
|
-
* `
|
|
203
|
-
* `
|
|
204
|
-
* `
|
|
205
|
-
* `
|
|
206
|
-
* `
|
|
207
|
-
* `
|
|
208
|
-
* `
|
|
209
|
-
* `
|
|
210
|
-
* `
|
|
211
|
-
* `
|
|
212
|
-
* `
|
|
213
|
-
* `
|
|
189
|
+
* Attribute | Description | Part name
|
|
190
|
+
* ----------------------|---------------------------------------------------------------------------------------------------|-----------
|
|
191
|
+
* `loading` | Set when the grid is loading data from data provider | :host
|
|
192
|
+
* `interacting` | Keyboard navigation in interaction mode | :host
|
|
193
|
+
* `navigating` | Keyboard navigation in navigation mode | :host
|
|
194
|
+
* `overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host
|
|
195
|
+
* `reordering` | Set when the grid's columns are being reordered | :host
|
|
196
|
+
* `dragover` | Set when the grid (not a specific row) is dragged over | :host
|
|
197
|
+
* `dragging-rows` | Set when grid rows are dragged | :host
|
|
198
|
+
* `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
|
|
199
|
+
* `frozen` | Frozen cell | cell
|
|
200
|
+
* `frozen-to-end` | Cell frozen to end | cell
|
|
201
|
+
* `last-frozen` | Last frozen cell | cell
|
|
202
|
+
* `first-frozen-to-end` | First cell frozen to end | cell
|
|
203
|
+
* `first-column` | First visible cell on a row | cell
|
|
204
|
+
* `last-column` | Last visible cell on a row | cell
|
|
205
|
+
* `selected` | Selected row | row
|
|
206
|
+
* `expanded` | Expanded row | row
|
|
207
|
+
* `details-opened` | Row with details open | row
|
|
208
|
+
* `loading` | Row that is waiting for data from data provider | row
|
|
209
|
+
* `odd` | Odd row | row
|
|
210
|
+
* `first` | The first body row | row
|
|
211
|
+
* `last` | The last body row | row
|
|
212
|
+
* `dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row
|
|
213
|
+
* `dragover` | Set when the row is dragged over | row
|
|
214
|
+
* `drag-disabled` | Set to a row that isn't available for dragging | row
|
|
215
|
+
* `drop-disabled` | Set to a row that can't be dropped on top of | row
|
|
214
216
|
*
|
|
215
217
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
216
218
|
*
|
|
@@ -219,12 +221,14 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
|
|
|
219
221
|
* @fires {CustomEvent} cell-focus - Fired when a cell is focused with click or keyboard navigation.
|
|
220
222
|
* @fires {CustomEvent} column-reorder - Fired when the columns in the grid are reordered.
|
|
221
223
|
* @fires {CustomEvent} column-resize - Fired when the grid column resize is finished.
|
|
224
|
+
* @fires {CustomEvent} data-provider-changed - Fired when the `dataProvider` property changes.
|
|
222
225
|
* @fires {CustomEvent} expanded-items-changed - Fired when the `expandedItems` property changes.
|
|
223
226
|
* @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
|
|
224
227
|
* @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
|
|
225
228
|
* @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
|
|
226
229
|
* @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
|
|
227
230
|
* @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
|
|
231
|
+
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
228
232
|
*
|
|
229
233
|
* @extends HTMLElement
|
|
230
234
|
* @mixes ElementMixin
|
|
@@ -947,6 +951,7 @@ class Grid extends ElementMixin(
|
|
|
947
951
|
this.generateCellClassNames();
|
|
948
952
|
}
|
|
949
953
|
|
|
954
|
+
/** @private */
|
|
950
955
|
__updateFooterPositioning() {
|
|
951
956
|
// TODO: fixed in Firefox 99, remove when we can drop Firefox ESR 91 support
|
|
952
957
|
if (this._firefox && parseFloat(navigator.userAgent.match(/Firefox\/(\d{2,3}.\d)/)[1]) < 99) {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
7
|
-
import '@vaadin/checkbox/theme/lumo/vaadin-checkbox.js';
|
|
8
1
|
import './vaadin-grid-styles.js';
|
|
9
2
|
import '../../src/vaadin-grid.js';
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "23.3.0-
|
|
4
|
+
"version": "23.3.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-grid-column",
|
|
11
|
-
"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/23.3.0-
|
|
11
|
+
"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/23.3.0-alpha7/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "resizable",
|
|
@@ -765,7 +765,7 @@
|
|
|
765
765
|
},
|
|
766
766
|
{
|
|
767
767
|
"name": "vaadin-grid-selection-column",
|
|
768
|
-
"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 items=\"[[items]]\">\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/23.3.0-
|
|
768
|
+
"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 items=\"[[items]]\">\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/23.3.0-alpha7/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
769
769
|
"attributes": [
|
|
770
770
|
{
|
|
771
771
|
"name": "resizable",
|
|
@@ -1780,7 +1780,7 @@
|
|
|
1780
1780
|
},
|
|
1781
1781
|
{
|
|
1782
1782
|
"name": "vaadin-grid",
|
|
1783
|
-
"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/23.3.0-alpha5/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\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/23.3.0-alpha5/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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`last-frozen` | Last frozen cell | 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 drag of a row is starting. The value is a number when multiple rows are dragged | 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/custom-theme/styling-components) documentation.",
|
|
1783
|
+
"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/23.3.0-alpha7/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\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/23.3.0-alpha7/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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/custom-theme/styling-components) documentation.",
|
|
1784
1784
|
"attributes": [
|
|
1785
1785
|
{
|
|
1786
1786
|
"name": "size",
|
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": "23.3.0-
|
|
4
|
+
"version": "23.3.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-grid-column",
|
|
19
|
-
"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/23.3.0-
|
|
19
|
+
"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/23.3.0-alpha7/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
},
|
|
304
304
|
{
|
|
305
305
|
"name": "vaadin-grid-selection-column",
|
|
306
|
-
"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 items=\"[[items]]\">\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/23.3.0-
|
|
306
|
+
"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 items=\"[[items]]\">\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/23.3.0-alpha7/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
|
|
307
307
|
"extension": true,
|
|
308
308
|
"attributes": [
|
|
309
309
|
{
|
|
@@ -702,7 +702,7 @@
|
|
|
702
702
|
},
|
|
703
703
|
{
|
|
704
704
|
"name": "vaadin-grid",
|
|
705
|
-
"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/23.3.0-alpha5/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\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/23.3.0-alpha5/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha5/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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`last-frozen` | Last frozen cell | 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 drag of a row is starting. The value is a number when multiple rows are dragged | 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/custom-theme/styling-components) documentation.",
|
|
705
|
+
"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/23.3.0-alpha7/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.html` bundle.\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/23.3.0-alpha7/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha7/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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/custom-theme/styling-components) documentation.",
|
|
706
706
|
"extension": true,
|
|
707
707
|
"attributes": [
|
|
708
708
|
{
|