@vaadin/grid 23.3.26 → 23.4.0-alpha1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "23.3.26",
3
+ "version": "23.4.0-alpha1",
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.26",
50
- "@vaadin/component-base": "~23.3.26",
51
- "@vaadin/lit-renderer": "~23.3.26",
52
- "@vaadin/text-field": "~23.3.26",
53
- "@vaadin/vaadin-lumo-styles": "~23.3.26",
54
- "@vaadin/vaadin-material-styles": "~23.3.26",
55
- "@vaadin/vaadin-themable-mixin": "~23.3.26"
49
+ "@vaadin/checkbox": "23.4.0-alpha1",
50
+ "@vaadin/component-base": "23.4.0-alpha1",
51
+ "@vaadin/lit-renderer": "23.4.0-alpha1",
52
+ "@vaadin/text-field": "23.4.0-alpha1",
53
+ "@vaadin/vaadin-lumo-styles": "23.4.0-alpha1",
54
+ "@vaadin/vaadin-material-styles": "23.4.0-alpha1",
55
+ "@vaadin/vaadin-themable-mixin": "23.4.0-alpha1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@esm-bundle/chai": "^4.3.4",
59
- "@vaadin/polymer-legacy-adapter": "~23.3.26",
59
+ "@vaadin/polymer-legacy-adapter": "23.4.0-alpha1",
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": "92afe21fdcd4a773ccd99ae03413096399873ba7"
68
+ "gitHead": "a7cdbab591c62ee8dbc0e91fee877fbbf4b92bad"
69
69
  }
@@ -662,7 +662,7 @@ export const KeyboardNavigationMixin = (superClass) =>
662
662
  // If the target focusable is tied to a column that is not visible,
663
663
  // find the first visible column and update the target in order to
664
664
  // prevent scrolling to the start of the row.
665
- if (focusStepTarget && focusStepTarget._column && !this.__isColumnInViewport(focusStepTarget._column)) {
665
+ if (focusStepTarget && !this.__isHorizontallyInViewport(focusStepTarget)) {
666
666
  const firstVisibleColumn = this._getColumnsInOrder().find((column) => this.__isColumnInViewport(column));
667
667
  if (firstVisibleColumn) {
668
668
  if (focusStepTarget === this._headerFocusable) {
@@ -688,9 +688,14 @@ export const KeyboardNavigationMixin = (superClass) =>
688
688
  // Assume frozen columns to always be inside the viewport
689
689
  return true;
690
690
  }
691
+ return this.__isHorizontallyInViewport(column._sizerCell);
692
+ }
693
+
694
+ /** @private */
695
+ __isHorizontallyInViewport(element) {
691
696
  return (
692
- column._sizerCell.offsetLeft + column._sizerCell.offsetWidth >= this._scrollLeft &&
693
- column._sizerCell.offsetLeft <= this._scrollLeft + this.clientWidth
697
+ element.offsetLeft + element.offsetWidth >= this._scrollLeft &&
698
+ element.offsetLeft <= this._scrollLeft + this.clientWidth
694
699
  );
695
700
  }
696
701
 
@@ -153,6 +153,13 @@ export const RowDetailsMixin = (superClass) =>
153
153
  return;
154
154
  }
155
155
 
156
+ this.__updateDetailsRowPadding(row, cell);
157
+ // Ensure the row has correct padding after frame (the resize observer might miss it)
158
+ requestAnimationFrame(() => this.__updateDetailsRowPadding(row, cell));
159
+ }
160
+
161
+ /** @private */
162
+ __updateDetailsRowPadding(row, cell) {
156
163
  if (cell.hidden) {
157
164
  row.style.removeProperty('padding-bottom');
158
165
  } else {
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { Constructor } from '@open-wc/dedupe-mixin';
7
+
8
+ export declare function GridSelectionColumnBaseMixin<TItem, T extends Constructor<HTMLElement>>(
9
+ base: T,
10
+ ): Constructor<GridSelectionColumnBaseMixinClass<TItem>> & T;
11
+
12
+ /**
13
+ * A mixin that provides basic functionality for the
14
+ * `<vaadin-grid-selection-column>`. This includes properties, cell rendering,
15
+ * and overridable methods for handling changes to the selection state.
16
+ *
17
+ * **NOTE**: This mixin is re-used by the Flow component, and as such must not
18
+ * implement any selection state updates for the column element or the grid.
19
+ * Web component-specific selection state updates must be implemented in the
20
+ * `<vaadin-grid-selection-column>` itself, by overriding the protected methods
21
+ * provided by this mixin.
22
+ *
23
+ * @polymerMixin
24
+ */
25
+ export declare class GridSelectionColumnBaseMixinClass<TItem> {
26
+ /**
27
+ * When true, all the items are selected.
28
+ * @attr {boolean} select-all
29
+ */
30
+ selectAll: boolean;
31
+
32
+ /**
33
+ * When true, the active gets automatically selected.
34
+ * @attr {boolean} auto-select
35
+ */
36
+ autoSelect: boolean;
37
+
38
+ /**
39
+ * When true, rows can be selected by dragging over the selection column.
40
+ * @attr {boolean} drag-select
41
+ */
42
+ dragSelect: boolean;
43
+
44
+ /**
45
+ * Override to handle the user selecting all items.
46
+ */
47
+ protected _selectAll(): void;
48
+
49
+ /**
50
+ * Override to handle the user deselecting all items.
51
+ */
52
+ protected _deselectAll(): void;
53
+
54
+ /**
55
+ * Override to handle the user selecting an item.
56
+ */
57
+ protected _selectItem(item: TItem): void;
58
+
59
+ /**
60
+ * Override to handle the user deselecting an item.
61
+ */
62
+ protected _deselectItem(item: TItem): void;
63
+ }
@@ -0,0 +1,342 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { addListener } from '@vaadin/component-base/src/gestures.js';
7
+
8
+ /**
9
+ * A mixin that provides basic functionality for the
10
+ * `<vaadin-grid-selection-column>`. This includes properties, cell rendering,
11
+ * and overridable methods for handling changes to the selection state.
12
+ *
13
+ * **NOTE**: This mixin is re-used by the Flow component, and as such must not
14
+ * implement any selection state updates for the column element or the grid.
15
+ * Web component-specific selection state updates must be implemented in the
16
+ * `<vaadin-grid-selection-column>` itself, by overriding the protected methods
17
+ * provided by this mixin.
18
+ *
19
+ * @polymerMixin
20
+ */
21
+ export const GridSelectionColumnBaseMixin = (superClass) =>
22
+ class GridSelectionColumnBaseMixin extends superClass {
23
+ static get properties() {
24
+ return {
25
+ /**
26
+ * Width of the cells for this column.
27
+ */
28
+ width: {
29
+ type: String,
30
+ value: '58px',
31
+ },
32
+
33
+ /**
34
+ * Flex grow ratio for the cell widths. When set to 0, cell width is fixed.
35
+ * @attr {number} flex-grow
36
+ * @type {number}
37
+ */
38
+ flexGrow: {
39
+ type: Number,
40
+ value: 0,
41
+ },
42
+
43
+ /**
44
+ * When true, all the items are selected.
45
+ * @attr {boolean} select-all
46
+ * @type {boolean}
47
+ */
48
+ selectAll: {
49
+ type: Boolean,
50
+ value: false,
51
+ notify: true,
52
+ },
53
+
54
+ /**
55
+ * When true, the active gets automatically selected.
56
+ * @attr {boolean} auto-select
57
+ * @type {boolean}
58
+ */
59
+ autoSelect: {
60
+ type: Boolean,
61
+ value: false,
62
+ },
63
+
64
+ /**
65
+ * When true, rows can be selected by dragging over the selection column.
66
+ * @attr {boolean} drag-select
67
+ * @type {boolean}
68
+ */
69
+ dragSelect: {
70
+ type: Boolean,
71
+ value: false,
72
+ },
73
+
74
+ /** @protected */
75
+ _indeterminate: Boolean,
76
+
77
+ /** @protected */
78
+ _selectAllHidden: Boolean,
79
+ };
80
+ }
81
+
82
+ static get observers() {
83
+ return [
84
+ '_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header, selectAll, _indeterminate, _selectAllHidden)',
85
+ ];
86
+ }
87
+
88
+ /**
89
+ * Renders the Select All checkbox to the header cell.
90
+ *
91
+ * @override
92
+ */
93
+ _defaultHeaderRenderer(root, _column) {
94
+ let checkbox = root.firstElementChild;
95
+ if (!checkbox) {
96
+ checkbox = document.createElement('vaadin-checkbox');
97
+ checkbox.setAttribute('aria-label', 'Select All');
98
+ checkbox.classList.add('vaadin-grid-select-all-checkbox');
99
+ root.appendChild(checkbox);
100
+ // Add listener after appending, so we can skip the initial change event
101
+ checkbox.addEventListener('checked-changed', this.__onSelectAllCheckedChanged.bind(this));
102
+ }
103
+
104
+ const checked = this.__isChecked(this.selectAll, this._indeterminate);
105
+ checkbox.__rendererChecked = checked;
106
+ checkbox.checked = checked;
107
+ checkbox.hidden = this._selectAllHidden;
108
+ checkbox.indeterminate = this._indeterminate;
109
+ }
110
+
111
+ /**
112
+ * Renders the Select Row checkbox to the body cell.
113
+ *
114
+ * @override
115
+ */
116
+ _defaultRenderer(root, _column, { item, selected }) {
117
+ let checkbox = root.firstElementChild;
118
+ if (!checkbox) {
119
+ checkbox = document.createElement('vaadin-checkbox');
120
+ checkbox.setAttribute('aria-label', 'Select Row');
121
+ root.appendChild(checkbox);
122
+ // Add listener after appending, so we can skip the initial change event
123
+ checkbox.addEventListener('checked-changed', this.__onSelectRowCheckedChanged.bind(this));
124
+ addListener(root, 'track', this.__onCellTrack.bind(this));
125
+ root.addEventListener('mousedown', this.__onCellMouseDown.bind(this));
126
+ root.addEventListener('click', this.__onCellClick.bind(this));
127
+ }
128
+
129
+ checkbox.__item = item;
130
+ checkbox.__rendererChecked = selected;
131
+ checkbox.checked = selected;
132
+ }
133
+
134
+ /**
135
+ * Updates the select all state when the Select All checkbox is switched.
136
+ * The listener handles only user-fired events.
137
+ *
138
+ * @private
139
+ */
140
+ __onSelectAllCheckedChanged(e) {
141
+ // Skip if the state is changed by the renderer.
142
+ if (e.target.checked === e.target.__rendererChecked) {
143
+ return;
144
+ }
145
+
146
+ if (this._indeterminate || e.target.checked) {
147
+ this._selectAll();
148
+ } else {
149
+ this._deselectAll();
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Selects or deselects the row when the Select Row checkbox is switched.
155
+ * The listener handles only user-fired events.
156
+ *
157
+ * @private
158
+ */
159
+ __onSelectRowCheckedChanged(e) {
160
+ // Skip if the state is changed by the renderer.
161
+ if (e.target.checked === e.target.__rendererChecked) {
162
+ return;
163
+ }
164
+
165
+ if (e.target.checked) {
166
+ this._selectItem(e.target.__item);
167
+ } else {
168
+ this._deselectItem(e.target.__item);
169
+ }
170
+ }
171
+
172
+ /** @private */
173
+ __onCellTrack(event) {
174
+ if (!this.dragSelect) {
175
+ return;
176
+ }
177
+ this.__dragCurrentY = event.detail.y;
178
+ this.__dragDy = event.detail.dy;
179
+ if (event.detail.state === 'start') {
180
+ const renderedRows = this._grid._getVisibleRows();
181
+ // Get the row where the drag started
182
+ const dragStartRow = renderedRows.find((row) => row.contains(event.currentTarget.assignedSlot));
183
+ // Whether to select or deselect the items on drag
184
+ this.__dragSelect = !this._grid._isSelected(dragStartRow._item);
185
+ // Store the index of the row where the drag started
186
+ this.__dragStartIndex = dragStartRow.index;
187
+ // Store the item of the row where the drag started
188
+ this.__dragStartItem = dragStartRow._item;
189
+ // Start the auto scroller
190
+ this.__dragAutoScroller();
191
+ } else if (event.detail.state === 'end') {
192
+ // If drag start and end stays within the same item, then toggle its state
193
+ if (this.__dragStartItem) {
194
+ if (this.__dragSelect) {
195
+ this._grid.selectItem(this.__dragStartItem);
196
+ } else {
197
+ this._grid.deselectItem(this.__dragStartItem);
198
+ }
199
+ }
200
+ // Clear drag state after timeout, which allows preventing the
201
+ // subsequent click event if drag started and ended on the same item
202
+ setTimeout(() => {
203
+ this.__dragStartIndex = undefined;
204
+ });
205
+ }
206
+ }
207
+
208
+ /** @private */
209
+ __onCellMouseDown(e) {
210
+ if (this.dragSelect) {
211
+ // Prevent text selection when starting to drag
212
+ e.preventDefault();
213
+ }
214
+ }
215
+
216
+ /** @private */
217
+ __onCellClick(e) {
218
+ if (this.__dragStartIndex !== undefined) {
219
+ // Stop the click event if drag was enabled. This click event should
220
+ // only occur if drag started and stopped on the same item. In that case
221
+ // the selection state has already been toggled on drag end, and we
222
+ // don't want to toggle it again from clicking the checkbox or changing
223
+ // the active item.
224
+ e.preventDefault();
225
+ }
226
+ }
227
+
228
+ /** @private */
229
+ __dragAutoScroller() {
230
+ if (this.__dragStartIndex === undefined) {
231
+ return;
232
+ }
233
+ // Get the row being hovered over
234
+ const renderedRows = this._grid._getVisibleRows();
235
+ const hoveredRow = renderedRows.find((row) => {
236
+ const rowRect = row.getBoundingClientRect();
237
+ return this.__dragCurrentY >= rowRect.top && this.__dragCurrentY <= rowRect.bottom;
238
+ });
239
+
240
+ // Get the index of the row being hovered over or the first/last
241
+ // visible row if hovering outside the grid
242
+ let hoveredIndex = hoveredRow ? hoveredRow.index : undefined;
243
+ const scrollableArea = this.__getScrollableArea();
244
+ if (this.__dragCurrentY < scrollableArea.top) {
245
+ hoveredIndex = this._grid._firstVisibleIndex;
246
+ } else if (this.__dragCurrentY > scrollableArea.bottom) {
247
+ hoveredIndex = this._grid._lastVisibleIndex;
248
+ }
249
+
250
+ if (hoveredIndex !== undefined) {
251
+ // Select all items between the start and the current row
252
+ renderedRows.forEach((row) => {
253
+ if (
254
+ (hoveredIndex > this.__dragStartIndex && row.index >= this.__dragStartIndex && row.index <= hoveredIndex) ||
255
+ (hoveredIndex < this.__dragStartIndex && row.index <= this.__dragStartIndex && row.index >= hoveredIndex)
256
+ ) {
257
+ if (this.__dragSelect) {
258
+ this._grid.selectItem(row._item);
259
+ } else {
260
+ this._grid.deselectItem(row._item);
261
+ }
262
+ this.__dragStartItem = undefined;
263
+ }
264
+ });
265
+ }
266
+
267
+ // Start scrolling in the top/bottom 15% of the scrollable area
268
+ const scrollTriggerArea = scrollableArea.height * 0.15;
269
+ // Maximum number of pixels to scroll per iteration
270
+ const maxScrollAmount = 10;
271
+
272
+ if (this.__dragDy < 0 && this.__dragCurrentY < scrollableArea.top + scrollTriggerArea) {
273
+ const dy = scrollableArea.top + scrollTriggerArea - this.__dragCurrentY;
274
+ const percentage = Math.min(1, dy / scrollTriggerArea);
275
+ this._grid.$.table.scrollTop -= percentage * maxScrollAmount;
276
+ }
277
+ if (this.__dragDy > 0 && this.__dragCurrentY > scrollableArea.bottom - scrollTriggerArea) {
278
+ const dy = this.__dragCurrentY - (scrollableArea.bottom - scrollTriggerArea);
279
+ const percentage = Math.min(1, dy / scrollTriggerArea);
280
+ this._grid.$.table.scrollTop += percentage * maxScrollAmount;
281
+ }
282
+
283
+ // Schedule the next auto scroll
284
+ setTimeout(() => this.__dragAutoScroller(), 10);
285
+ }
286
+
287
+ /**
288
+ * Gets the scrollable area of the grid as a bounding client rect. The
289
+ * scrollable area is the bounding rect of the grid minus the header and
290
+ * footer.
291
+ *
292
+ * @private
293
+ */
294
+ __getScrollableArea() {
295
+ const gridRect = this._grid.$.table.getBoundingClientRect();
296
+ const headerRect = this._grid.$.header.getBoundingClientRect();
297
+ const footerRect = this._grid.$.footer.getBoundingClientRect();
298
+
299
+ return {
300
+ top: gridRect.top + headerRect.height,
301
+ bottom: gridRect.bottom - footerRect.height,
302
+ left: gridRect.left,
303
+ right: gridRect.right,
304
+ height: gridRect.height - headerRect.height - footerRect.height,
305
+ width: gridRect.width,
306
+ };
307
+ }
308
+
309
+ /**
310
+ * Override to handle the user selecting all items.
311
+ * @protected
312
+ */
313
+ _selectAll() {}
314
+
315
+ /**
316
+ * Override to handle the user deselecting all items.
317
+ * @protected
318
+ */
319
+ _deselectAll() {}
320
+
321
+ /**
322
+ * Override to handle the user selecting an item.
323
+ * @param {Object} item the item to select
324
+ * @protected
325
+ */
326
+ _selectItem(_item) {}
327
+
328
+ /**
329
+ * Override to handle the user deselecting an item.
330
+ * @param {Object} item the item to deselect
331
+ * @protected
332
+ */
333
+ _deselectItem(_item) {}
334
+
335
+ /**
336
+ * IOS needs indeterminate + checked at the same time
337
+ * @private
338
+ */
339
+ __isChecked(selectAll, indeterminate) {
340
+ return indeterminate || selectAll;
341
+ }
342
+ };
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { GridDefaultItem } from './vaadin-grid.js';
7
7
  import { GridColumn } from './vaadin-grid-column.js';
8
+ import type { GridSelectionColumnBaseMixinClass } from './vaadin-grid-selection-column-base-mixin.js';
8
9
 
9
10
  /**
10
11
  * Fired when the `selectAll` property changes.
@@ -42,18 +43,6 @@ export interface GridSelectionColumnEventMap extends HTMLElementEventMap, GridSe
42
43
  * @fires {CustomEvent} select-all-changed - Fired when the `selectAll` property changes.
43
44
  */
44
45
  declare class GridSelectionColumn<TItem = GridDefaultItem> extends GridColumn<TItem> {
45
- /**
46
- * When true, all the items are selected.
47
- * @attr {boolean} select-all
48
- */
49
- selectAll: boolean;
50
-
51
- /**
52
- * When true, the active gets automatically selected.
53
- * @attr {boolean} auto-select
54
- */
55
- autoSelect: boolean;
56
-
57
46
  addEventListener<K extends keyof GridSelectionColumnEventMap>(
58
47
  type: K,
59
48
  listener: (this: GridSelectionColumn<TItem>, ev: GridSelectionColumnEventMap[K]) => void,
@@ -67,6 +56,8 @@ declare class GridSelectionColumn<TItem = GridDefaultItem> extends GridColumn<TI
67
56
  ): void;
68
57
  }
69
58
 
59
+ interface GridSelectionColumn<TItem = GridDefaultItem> extends GridSelectionColumnBaseMixinClass<TItem> {}
60
+
70
61
  declare global {
71
62
  interface HTMLElementTagNameMap {
72
63
  'vaadin-grid-selection-column': GridSelectionColumn<GridDefaultItem>;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import '@vaadin/checkbox/src/vaadin-checkbox.js';
7
7
  import { GridColumn } from './vaadin-grid-column.js';
8
+ import { GridSelectionColumnBaseMixin } from './vaadin-grid-selection-column-base-mixin.js';
8
9
 
9
10
  /**
10
11
  * `<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`
@@ -28,74 +29,27 @@ import { GridColumn } from './vaadin-grid-column.js';
28
29
  *
29
30
  * __The default content can also be overridden__
30
31
  *
32
+ * @mixes GridSelectionColumnBaseMixin
31
33
  * @fires {CustomEvent} select-all-changed - Fired when the `selectAll` property changes.
32
34
  */
33
- class GridSelectionColumn extends GridColumn {
35
+ class GridSelectionColumn extends GridSelectionColumnBaseMixin(GridColumn) {
34
36
  static get is() {
35
37
  return 'vaadin-grid-selection-column';
36
38
  }
37
39
 
38
40
  static get properties() {
39
41
  return {
40
- /**
41
- * Width of the cells for this column.
42
- */
43
- width: {
44
- type: String,
45
- value: '58px',
46
- },
47
-
48
- /**
49
- * Flex grow ratio for the cell widths. When set to 0, cell width is fixed.
50
- * @attr {number} flex-grow
51
- * @type {number}
52
- */
53
- flexGrow: {
54
- type: Number,
55
- value: 0,
56
- },
57
-
58
- /**
59
- * When true, all the items are selected.
60
- * @attr {boolean} select-all
61
- * @type {boolean}
62
- */
63
- selectAll: {
64
- type: Boolean,
65
- value: false,
66
- notify: true,
67
- },
68
-
69
- /**
70
- * When true, the active gets automatically selected.
71
- * @attr {boolean} auto-select
72
- * @type {boolean}
73
- */
74
- autoSelect: {
75
- type: Boolean,
76
- value: false,
77
- },
78
-
79
- /** @private */
80
- __indeterminate: Boolean,
81
-
82
42
  /**
83
43
  * The previous state of activeItem. When activeItem turns to `null`,
84
44
  * previousActiveItem will have an Object with just unselected activeItem
85
45
  * @private
86
46
  */
87
47
  __previousActiveItem: Object,
88
-
89
- /** @private */
90
- __selectAllHidden: Boolean,
91
48
  };
92
49
  }
93
50
 
94
51
  static get observers() {
95
- return [
96
- '__onSelectAllChanged(selectAll)',
97
- '_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header, selectAll, __indeterminate, __selectAllHidden)',
98
- ];
52
+ return ['__onSelectAllChanged(selectAll)'];
99
53
  }
100
54
 
101
55
  constructor() {
@@ -127,47 +81,6 @@ class GridSelectionColumn extends GridColumn {
127
81
  }
128
82
  }
129
83
 
130
- /**
131
- * Renders the Select All checkbox to the header cell.
132
- *
133
- * @override
134
- */
135
- _defaultHeaderRenderer(root, _column) {
136
- let checkbox = root.firstElementChild;
137
- if (!checkbox) {
138
- checkbox = document.createElement('vaadin-checkbox');
139
- checkbox.setAttribute('aria-label', 'Select All');
140
- checkbox.classList.add('vaadin-grid-select-all-checkbox');
141
- checkbox.addEventListener('checked-changed', this.__onSelectAllCheckedChanged.bind(this));
142
- root.appendChild(checkbox);
143
- }
144
-
145
- const checked = this.__isChecked(this.selectAll, this.__indeterminate);
146
- checkbox.__rendererChecked = checked;
147
- checkbox.checked = checked;
148
- checkbox.hidden = this.__selectAllHidden;
149
- checkbox.indeterminate = this.__indeterminate;
150
- }
151
-
152
- /**
153
- * Renders the Select Row checkbox to the body cell.
154
- *
155
- * @override
156
- */
157
- _defaultRenderer(root, _column, { item, selected }) {
158
- let checkbox = root.firstElementChild;
159
- if (!checkbox) {
160
- checkbox = document.createElement('vaadin-checkbox');
161
- checkbox.setAttribute('aria-label', 'Select Row');
162
- checkbox.addEventListener('checked-changed', this.__onSelectRowCheckedChanged.bind(this));
163
- root.appendChild(checkbox);
164
- }
165
-
166
- checkbox.__item = item;
167
- checkbox.__rendererChecked = selected;
168
- checkbox.checked = selected;
169
- }
170
-
171
84
  /** @private */
172
85
  __onSelectAllChanged(selectAll) {
173
86
  if (selectAll === undefined || !this._grid) {
@@ -203,45 +116,49 @@ class GridSelectionColumn extends GridColumn {
203
116
  }
204
117
 
205
118
  /**
206
- * Enables or disables the Select All mode once the Select All checkbox is switched.
207
- * The listener handles only user-fired events.
119
+ * Override a method from `GridSelectionColumnBaseMixin` to handle the user
120
+ * selecting all items.
208
121
  *
209
- * @private
122
+ * @protected
123
+ * @override
210
124
  */
211
- __onSelectAllCheckedChanged(e) {
212
- // Skip if the state is changed by the renderer.
213
- if (e.target.checked === e.target.__rendererChecked) {
214
- return;
215
- }
216
-
217
- this.selectAll = this.__indeterminate || e.target.checked;
125
+ _selectAll() {
126
+ this.selectAll = true;
218
127
  }
219
128
 
220
129
  /**
221
- * Selects or deselects the row once the Select Row checkbox is switched.
222
- * The listener handles only user-fired events.
130
+ * Override a method from `GridSelectionColumnBaseMixin` to handle the user
131
+ * deselecting all items.
223
132
  *
224
- * @private
133
+ * @protected
134
+ * @override
225
135
  */
226
- __onSelectRowCheckedChanged(e) {
227
- // Skip if the state is changed by the renderer.
228
- if (e.target.checked === e.target.__rendererChecked) {
229
- return;
230
- }
136
+ _deselectAll() {
137
+ this.selectAll = false;
138
+ }
231
139
 
232
- if (e.target.checked) {
233
- this._grid.selectItem(e.target.__item);
234
- } else {
235
- this._grid.deselectItem(e.target.__item);
236
- }
140
+ /**
141
+ * Override a method from `GridSelectionColumnBaseMixin` to handle the user
142
+ * selecting an item.
143
+ *
144
+ * @param {Object} item the item to select
145
+ * @protected
146
+ * @override
147
+ */
148
+ _selectItem(item) {
149
+ this._grid.selectItem(item);
237
150
  }
238
151
 
239
152
  /**
240
- * IOS needs indeterminate + checked at the same time
241
- * @private
153
+ * Override a method from `GridSelectionColumnBaseMixin` to handle the user
154
+ * deselecting an item.
155
+ *
156
+ * @param {Object} item the item to deselect
157
+ * @protected
158
+ * @override
242
159
  */
243
- __isChecked(selectAll, indeterminate) {
244
- return indeterminate || selectAll;
160
+ _deselectItem(item) {
161
+ this._grid.deselectItem(item);
245
162
  }
246
163
 
247
164
  /** @private */
@@ -268,13 +185,13 @@ class GridSelectionColumn extends GridColumn {
268
185
  this.__withFilteredItemsArray((items) => {
269
186
  if (!this._grid.selectedItems.length) {
270
187
  this.selectAll = false;
271
- this.__indeterminate = false;
188
+ this._indeterminate = false;
272
189
  } else if (this.__arrayContains(this._grid.selectedItems, items)) {
273
190
  this.selectAll = true;
274
- this.__indeterminate = false;
191
+ this._indeterminate = false;
275
192
  } else {
276
193
  this.selectAll = false;
277
- this.__indeterminate = true;
194
+ this._indeterminate = true;
278
195
  }
279
196
  });
280
197
  }
@@ -283,7 +200,7 @@ class GridSelectionColumn extends GridColumn {
283
200
 
284
201
  /** @private */
285
202
  __onDataProviderChanged() {
286
- this.__selectAllHidden = !Array.isArray(this._grid.items);
203
+ this._selectAllHidden = !Array.isArray(this._grid.items);
287
204
  }
288
205
 
289
206
  /**
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.26",
4
+ "version": "23.4.0-alpha1",
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.26/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<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.4.0-alpha1/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "resizable",
@@ -765,70 +765,8 @@
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.26/#/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__",
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.4.0-alpha1/#/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
- {
771
- "name": "resizable",
772
- "description": "When set to true, the column is user-resizable.",
773
- "value": {
774
- "type": [
775
- "boolean",
776
- "null",
777
- "undefined"
778
- ]
779
- }
780
- },
781
- {
782
- "name": "frozen",
783
- "description": "When true, the column is frozen. When a column inside of a column group is frozen,\nall of the sibling columns inside the group will get frozen also.",
784
- "value": {
785
- "type": [
786
- "boolean"
787
- ]
788
- }
789
- },
790
- {
791
- "name": "frozen-to-end",
792
- "description": "When true, the column is frozen to end of grid.\n\nWhen a column inside of a column group is frozen to end, all of the sibling columns\ninside the group will get frozen to end also.\n\nColumn can not be set as `frozen` and `frozenToEnd` at the same time.",
793
- "value": {
794
- "type": [
795
- "boolean"
796
- ]
797
- }
798
- },
799
- {
800
- "name": "hidden",
801
- "description": "When set to true, the cells for this column are hidden.",
802
- "value": {
803
- "type": [
804
- "boolean",
805
- "null",
806
- "undefined"
807
- ]
808
- }
809
- },
810
- {
811
- "name": "header",
812
- "description": "Text content to display in the header cell of the column.",
813
- "value": {
814
- "type": [
815
- "string",
816
- "null",
817
- "undefined"
818
- ]
819
- }
820
- },
821
- {
822
- "name": "text-align",
823
- "description": "Aligns the columns cell content horizontally.\nSupported values: \"start\", \"center\" and \"end\".",
824
- "value": {
825
- "type": [
826
- "GridColumnTextAlign",
827
- "null",
828
- "undefined"
829
- ]
830
- }
831
- },
832
770
  {
833
771
  "name": "width",
834
772
  "description": "Width of the cells for this column.",
@@ -850,19 +788,8 @@
850
788
  }
851
789
  },
852
790
  {
853
- "name": "path",
854
- "description": "Path to an item sub-property whose value gets displayed in the column body cells.\nThe property name is also shown in the column header if an explicit header or renderer isn't defined.",
855
- "value": {
856
- "type": [
857
- "string",
858
- "null",
859
- "undefined"
860
- ]
861
- }
862
- },
863
- {
864
- "name": "auto-width",
865
- "description": "Automatically sets the width of the column based on the column contents when this is set to `true`.\n\nFor performance reasons the column width is calculated automatically only once when the grid items\nare rendered for the first time and the calculation only considers the rows which are currently\nrendered in DOM (a bit more than what is currently visible). If the grid is scrolled, or the cell\ncontent changes, the column width might not match the contents anymore.\n\nHidden columns are ignored in the calculation and their widths are not automatically updated when\nyou show a column that was initially hidden.\n\nYou can manually trigger the auto sizing behavior again by calling `grid.recalculateColumnWidths()`.\n\nThe column width may still grow larger when `flexGrow` is not 0.",
791
+ "name": "select-all",
792
+ "description": "When true, all the items are selected.",
866
793
  "value": {
867
794
  "type": [
868
795
  "boolean"
@@ -870,8 +797,8 @@
870
797
  }
871
798
  },
872
799
  {
873
- "name": "select-all",
874
- "description": "When true, all the items are selected.",
800
+ "name": "auto-select",
801
+ "description": "When true, the active gets automatically selected.",
875
802
  "value": {
876
803
  "type": [
877
804
  "boolean"
@@ -879,8 +806,8 @@
879
806
  }
880
807
  },
881
808
  {
882
- "name": "auto-select",
883
- "description": "When true, the active gets automatically selected.",
809
+ "name": "drag-select",
810
+ "description": "When true, rows can be selected by dragging over the selection column.",
884
811
  "value": {
885
812
  "type": [
886
813
  "boolean"
@@ -901,90 +828,6 @@
901
828
  ],
902
829
  "js": {
903
830
  "properties": [
904
- {
905
- "name": "resizable",
906
- "description": "When set to true, the column is user-resizable.",
907
- "value": {
908
- "type": [
909
- "boolean",
910
- "null",
911
- "undefined"
912
- ]
913
- }
914
- },
915
- {
916
- "name": "frozen",
917
- "description": "When true, the column is frozen. When a column inside of a column group is frozen,\nall of the sibling columns inside the group will get frozen also.",
918
- "value": {
919
- "type": [
920
- "boolean"
921
- ]
922
- }
923
- },
924
- {
925
- "name": "frozenToEnd",
926
- "description": "When true, the column is frozen to end of grid.\n\nWhen a column inside of a column group is frozen to end, all of the sibling columns\ninside the group will get frozen to end also.\n\nColumn can not be set as `frozen` and `frozenToEnd` at the same time.",
927
- "value": {
928
- "type": [
929
- "boolean"
930
- ]
931
- }
932
- },
933
- {
934
- "name": "hidden",
935
- "description": "When set to true, the cells for this column are hidden.",
936
- "value": {
937
- "type": [
938
- "boolean",
939
- "null",
940
- "undefined"
941
- ]
942
- }
943
- },
944
- {
945
- "name": "header",
946
- "description": "Text content to display in the header cell of the column.",
947
- "value": {
948
- "type": [
949
- "string",
950
- "null",
951
- "undefined"
952
- ]
953
- }
954
- },
955
- {
956
- "name": "textAlign",
957
- "description": "Aligns the columns cell content horizontally.\nSupported values: \"start\", \"center\" and \"end\".",
958
- "value": {
959
- "type": [
960
- "GridColumnTextAlign",
961
- "null",
962
- "undefined"
963
- ]
964
- }
965
- },
966
- {
967
- "name": "headerRenderer",
968
- "description": "Custom function for rendering the header content.\nReceives two arguments:\n\n- `root` The header cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.",
969
- "value": {
970
- "type": [
971
- "GridHeaderFooterRenderer",
972
- "null",
973
- "undefined"
974
- ]
975
- }
976
- },
977
- {
978
- "name": "footerRenderer",
979
- "description": "Custom function for rendering the footer content.\nReceives two arguments:\n\n- `root` The footer cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.",
980
- "value": {
981
- "type": [
982
- "GridHeaderFooterRenderer",
983
- "null",
984
- "undefined"
985
- ]
986
- }
987
- },
988
831
  {
989
832
  "name": "width",
990
833
  "description": "Width of the cells for this column.",
@@ -1006,30 +849,8 @@
1006
849
  }
1007
850
  },
1008
851
  {
1009
- "name": "renderer",
1010
- "description": "Custom function for rendering the cell content.\nReceives three arguments:\n\n- `root` The cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.\n- `model` The object with the properties related with\n the rendered item, contains:\n - `model.index` The index of the item.\n - `model.item` The item.\n - `model.expanded` Sublevel toggle state.\n - `model.level` Level of the tree represented with a horizontal offset of the toggle button.\n - `model.selected` Selected state.\n - `model.detailsOpened` Details opened state.",
1011
- "value": {
1012
- "type": [
1013
- "GridBodyRenderer",
1014
- "null",
1015
- "undefined"
1016
- ]
1017
- }
1018
- },
1019
- {
1020
- "name": "path",
1021
- "description": "Path to an item sub-property whose value gets displayed in the column body cells.\nThe property name is also shown in the column header if an explicit header or renderer isn't defined.",
1022
- "value": {
1023
- "type": [
1024
- "string",
1025
- "null",
1026
- "undefined"
1027
- ]
1028
- }
1029
- },
1030
- {
1031
- "name": "autoWidth",
1032
- "description": "Automatically sets the width of the column based on the column contents when this is set to `true`.\n\nFor performance reasons the column width is calculated automatically only once when the grid items\nare rendered for the first time and the calculation only considers the rows which are currently\nrendered in DOM (a bit more than what is currently visible). If the grid is scrolled, or the cell\ncontent changes, the column width might not match the contents anymore.\n\nHidden columns are ignored in the calculation and their widths are not automatically updated when\nyou show a column that was initially hidden.\n\nYou can manually trigger the auto sizing behavior again by calling `grid.recalculateColumnWidths()`.\n\nThe column width may still grow larger when `flexGrow` is not 0.",
852
+ "name": "selectAll",
853
+ "description": "When true, all the items are selected.",
1033
854
  "value": {
1034
855
  "type": [
1035
856
  "boolean"
@@ -1037,8 +858,8 @@
1037
858
  }
1038
859
  },
1039
860
  {
1040
- "name": "selectAll",
1041
- "description": "When true, all the items are selected.",
861
+ "name": "autoSelect",
862
+ "description": "When true, the active gets automatically selected.",
1042
863
  "value": {
1043
864
  "type": [
1044
865
  "boolean"
@@ -1046,8 +867,8 @@
1046
867
  }
1047
868
  },
1048
869
  {
1049
- "name": "autoSelect",
1050
- "description": "When true, the active gets automatically selected.",
870
+ "name": "dragSelect",
871
+ "description": "When true, rows can be selected by dragging over the selection column.",
1051
872
  "value": {
1052
873
  "type": [
1053
874
  "boolean"
@@ -1780,7 +1601,7 @@
1780
1601
  },
1781
1602
  {
1782
1603
  "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.26/#/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.26/#/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.26/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/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.26/#/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.26/#/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.",
1604
+ "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.4.0-alpha1/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.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.4.0-alpha1/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/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
1605
  "attributes": [
1785
1606
  {
1786
1607
  "name": "size",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/grid",
4
- "version": "23.3.26",
4
+ "version": "23.4.0-alpha1",
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.26/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<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.4.0-alpha1/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -303,44 +303,9 @@
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.26/#/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__",
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.4.0-alpha1/#/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
- {
310
- "name": "?resizable",
311
- "description": "When set to true, the column is user-resizable.",
312
- "value": {
313
- "kind": "expression"
314
- }
315
- },
316
- {
317
- "name": "?frozen",
318
- "description": "When true, the column is frozen. When a column inside of a column group is frozen,\nall of the sibling columns inside the group will get frozen also.",
319
- "value": {
320
- "kind": "expression"
321
- }
322
- },
323
- {
324
- "name": "?frozenToEnd",
325
- "description": "When true, the column is frozen to end of grid.\n\nWhen a column inside of a column group is frozen to end, all of the sibling columns\ninside the group will get frozen to end also.\n\nColumn can not be set as `frozen` and `frozenToEnd` at the same time.",
326
- "value": {
327
- "kind": "expression"
328
- }
329
- },
330
- {
331
- "name": "?hidden",
332
- "description": "When set to true, the cells for this column are hidden.",
333
- "value": {
334
- "kind": "expression"
335
- }
336
- },
337
- {
338
- "name": "?autoWidth",
339
- "description": "Automatically sets the width of the column based on the column contents when this is set to `true`.\n\nFor performance reasons the column width is calculated automatically only once when the grid items\nare rendered for the first time and the calculation only considers the rows which are currently\nrendered in DOM (a bit more than what is currently visible). If the grid is scrolled, or the cell\ncontent changes, the column width might not match the contents anymore.\n\nHidden columns are ignored in the calculation and their widths are not automatically updated when\nyou show a column that was initially hidden.\n\nYou can manually trigger the auto sizing behavior again by calling `grid.recalculateColumnWidths()`.\n\nThe column width may still grow larger when `flexGrow` is not 0.",
340
- "value": {
341
- "kind": "expression"
342
- }
343
- },
344
309
  {
345
310
  "name": "?selectAll",
346
311
  "description": "When true, all the items are selected.",
@@ -356,29 +321,8 @@
356
321
  }
357
322
  },
358
323
  {
359
- "name": ".header",
360
- "description": "Text content to display in the header cell of the column.",
361
- "value": {
362
- "kind": "expression"
363
- }
364
- },
365
- {
366
- "name": ".textAlign",
367
- "description": "Aligns the columns cell content horizontally.\nSupported values: \"start\", \"center\" and \"end\".",
368
- "value": {
369
- "kind": "expression"
370
- }
371
- },
372
- {
373
- "name": ".headerRenderer",
374
- "description": "Custom function for rendering the header content.\nReceives two arguments:\n\n- `root` The header cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.",
375
- "value": {
376
- "kind": "expression"
377
- }
378
- },
379
- {
380
- "name": ".footerRenderer",
381
- "description": "Custom function for rendering the footer content.\nReceives two arguments:\n\n- `root` The footer cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.",
324
+ "name": "?dragSelect",
325
+ "description": "When true, rows can be selected by dragging over the selection column.",
382
326
  "value": {
383
327
  "kind": "expression"
384
328
  }
@@ -397,20 +341,6 @@
397
341
  "kind": "expression"
398
342
  }
399
343
  },
400
- {
401
- "name": ".renderer",
402
- "description": "Custom function for rendering the cell content.\nReceives three arguments:\n\n- `root` The cell content DOM element. Append your content to it.\n- `column` The `<vaadin-grid-column>` element.\n- `model` The object with the properties related with\n the rendered item, contains:\n - `model.index` The index of the item.\n - `model.item` The item.\n - `model.expanded` Sublevel toggle state.\n - `model.level` Level of the tree represented with a horizontal offset of the toggle button.\n - `model.selected` Selected state.\n - `model.detailsOpened` Details opened state.",
403
- "value": {
404
- "kind": "expression"
405
- }
406
- },
407
- {
408
- "name": ".path",
409
- "description": "Path to an item sub-property whose value gets displayed in the column body cells.\nThe property name is also shown in the column header if an explicit header or renderer isn't defined.",
410
- "value": {
411
- "kind": "expression"
412
- }
413
- },
414
344
  {
415
345
  "name": "@select-all-changed",
416
346
  "description": "Fired when the `selectAll` property changes.",
@@ -702,7 +632,7 @@
702
632
  },
703
633
  {
704
634
  "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.26/#/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.26/#/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.26/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.26/#/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.26/#/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.26/#/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.",
635
+ "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.4.0-alpha1/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.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.4.0-alpha1/#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/23.4.0-alpha1/#/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
636
  "extension": true,
707
637
  "attributes": [
708
638
  {