@vaadin/grid 24.0.0-alpha1 → 24.0.0-alpha3
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/all-imports.d.ts +10 -0
- package/all-imports.js +11 -0
- package/package.json +11 -10
- package/src/vaadin-grid-data-provider-mixin.js +10 -0
- package/src/vaadin-grid-drag-and-drop-mixin.js +10 -7
- package/src/vaadin-grid-filter-column.js +0 -1
- package/src/vaadin-grid-filter.d.ts +2 -1
- package/src/vaadin-grid-filter.js +26 -21
- package/src/vaadin-grid-keyboard-navigation-mixin.js +8 -1
- package/src/vaadin-grid-row-details-mixin.d.ts +1 -5
- package/src/vaadin-grid-sort-mixin.d.ts +9 -0
- package/src/vaadin-grid-sort-mixin.js +18 -5
- package/src/vaadin-grid-sorter.d.ts +6 -1
- package/src/vaadin-grid-sorter.js +14 -1
- package/src/vaadin-grid-tree-column.d.ts +0 -7
- package/src/vaadin-grid-tree-column.js +1 -24
- package/src/vaadin-grid.d.ts +39 -22
- package/src/vaadin-grid.js +61 -32
- package/theme/lumo/vaadin-grid-styles.js +11 -11
- package/theme/lumo/vaadin-grid.js +0 -7
- package/web-types.json +22 -26
- package/web-types.lit.json +11 -11
package/all-imports.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './vaadin-grid-column-group.js';
|
|
2
|
+
export * from './vaadin-grid-column.js';
|
|
3
|
+
export * from './vaadin-grid-filter.js';
|
|
4
|
+
export * from './vaadin-grid-filter-column.js';
|
|
5
|
+
export * from './vaadin-grid-selection-column.js';
|
|
6
|
+
export * from './vaadin-grid-sorter.js';
|
|
7
|
+
export * from './vaadin-grid-sort-column.js';
|
|
8
|
+
export * from './vaadin-grid-tree-column.js';
|
|
9
|
+
export * from './vaadin-grid-tree-toggle.js';
|
|
10
|
+
export * from './vaadin-grid.js';
|
package/all-imports.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
import './theme/lumo/all-imports.js';
|
|
2
|
+
|
|
3
|
+
export * from './vaadin-grid-column-group.js';
|
|
4
|
+
export * from './vaadin-grid-column.js';
|
|
5
|
+
export * from './vaadin-grid-filter.js';
|
|
6
|
+
export * from './vaadin-grid-filter-column.js';
|
|
7
|
+
export * from './vaadin-grid-selection-column.js';
|
|
8
|
+
export * from './vaadin-grid-sorter.js';
|
|
9
|
+
export * from './vaadin-grid-sort-column.js';
|
|
10
|
+
export * from './vaadin-grid-tree-column.js';
|
|
11
|
+
export * from './vaadin-grid-tree-toggle.js';
|
|
12
|
+
export * from './vaadin-grid.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"module": "vaadin-grid.js",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
|
+
"all-imports.d.ts",
|
|
23
24
|
"all-imports.js",
|
|
24
25
|
"lit.d.ts",
|
|
25
26
|
"lit.js",
|
|
@@ -45,17 +46,17 @@
|
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
47
48
|
"@polymer/polymer": "^3.0.0",
|
|
48
|
-
"@vaadin/checkbox": "24.0.0-
|
|
49
|
-
"@vaadin/component-base": "24.0.0-
|
|
50
|
-
"@vaadin/lit-renderer": "24.0.0-
|
|
51
|
-
"@vaadin/text-field": "24.0.0-
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
53
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
54
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
49
|
+
"@vaadin/checkbox": "24.0.0-alpha3",
|
|
50
|
+
"@vaadin/component-base": "24.0.0-alpha3",
|
|
51
|
+
"@vaadin/lit-renderer": "24.0.0-alpha3",
|
|
52
|
+
"@vaadin/text-field": "24.0.0-alpha3",
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha3",
|
|
54
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha3",
|
|
55
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha3"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@esm-bundle/chai": "^4.3.4",
|
|
58
|
-
"@vaadin/polymer-legacy-adapter": "24.0.0-
|
|
59
|
+
"@vaadin/polymer-legacy-adapter": "24.0.0-alpha3",
|
|
59
60
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
60
61
|
"lit": "^2.0.0",
|
|
61
62
|
"sinon": "^13.0.2"
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"web-types.json",
|
|
65
66
|
"web-types.lit.json"
|
|
66
67
|
],
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "7a013a3c5a56abd61dd4f7773c6ec77c3541bdf2"
|
|
68
69
|
}
|
|
@@ -193,6 +193,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
193
193
|
itemHasChildrenPath: {
|
|
194
194
|
type: String,
|
|
195
195
|
value: 'children',
|
|
196
|
+
observer: '__itemHasChildrenPathChanged',
|
|
196
197
|
},
|
|
197
198
|
|
|
198
199
|
/**
|
|
@@ -236,6 +237,15 @@ export const DataProviderMixin = (superClass) =>
|
|
|
236
237
|
this._effectiveSize = this._cache.effectiveSize;
|
|
237
238
|
}
|
|
238
239
|
|
|
240
|
+
/** @private */
|
|
241
|
+
__itemHasChildrenPathChanged(value, oldValue) {
|
|
242
|
+
if (!oldValue && value === 'children') {
|
|
243
|
+
// Avoid an unnecessary content update on init.
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.requestContentUpdate();
|
|
247
|
+
}
|
|
248
|
+
|
|
239
249
|
/**
|
|
240
250
|
* @param {number} index
|
|
241
251
|
* @param {HTMLElement} el
|
|
@@ -154,13 +154,14 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
154
154
|
// Set the default transfer data
|
|
155
155
|
e.dataTransfer.setData('text', this.__formatDefaultTransferData(rows));
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
this._updateRowState(row, 'dragstart', rows.length > 1 ? `${rows.length}` : '');
|
|
158
158
|
this.style.setProperty('--_grid-drag-start-x', `${e.clientX - rowRect.left + 20}px`);
|
|
159
159
|
this.style.setProperty('--_grid-drag-start-y', `${e.clientY - rowRect.top + 10}px`);
|
|
160
160
|
|
|
161
161
|
requestAnimationFrame(() => {
|
|
162
|
-
|
|
163
|
-
this.
|
|
162
|
+
this._updateRowState(row, 'dragstart', null);
|
|
163
|
+
this.style.setProperty('--_grid-drag-start-x', '');
|
|
164
|
+
this.style.setProperty('--_grid-drag-start-y', '');
|
|
164
165
|
});
|
|
165
166
|
|
|
166
167
|
const event = new CustomEvent('grid-dragstart', {
|
|
@@ -252,7 +253,7 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
252
253
|
} else if (row) {
|
|
253
254
|
this._dragOverItem = row._item;
|
|
254
255
|
if (row.getAttribute('dragover') !== this._dropLocation) {
|
|
255
|
-
|
|
256
|
+
this._updateRowState(row, 'dragover', this._dropLocation, true);
|
|
256
257
|
}
|
|
257
258
|
} else {
|
|
258
259
|
this._clearDragStyles();
|
|
@@ -306,7 +307,9 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
306
307
|
/** @protected */
|
|
307
308
|
_clearDragStyles() {
|
|
308
309
|
this.removeAttribute('dragover');
|
|
309
|
-
Array.from(this.$.items.children).forEach((row) =>
|
|
310
|
+
Array.from(this.$.items.children).forEach((row) => {
|
|
311
|
+
this._updateRowState(row, 'dragover', null, true);
|
|
312
|
+
});
|
|
310
313
|
}
|
|
311
314
|
|
|
312
315
|
/** @private */
|
|
@@ -395,8 +398,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
395
398
|
}
|
|
396
399
|
});
|
|
397
400
|
|
|
398
|
-
|
|
399
|
-
|
|
401
|
+
this._updateRowState(row, 'drag-disabled', !!dragDisabled);
|
|
402
|
+
this._updateRowState(row, 'drop-disabled', !!dropDisabled);
|
|
400
403
|
}
|
|
401
404
|
|
|
402
405
|
/**
|
|
@@ -60,7 +60,6 @@ class GridFilterColumn extends GridColumn {
|
|
|
60
60
|
if (!filter) {
|
|
61
61
|
filter = document.createElement('vaadin-grid-filter');
|
|
62
62
|
textField = document.createElement('vaadin-text-field');
|
|
63
|
-
textField.setAttribute('slot', 'filter');
|
|
64
63
|
textField.setAttribute('theme', 'small');
|
|
65
64
|
textField.setAttribute('style', 'max-width: 100%;');
|
|
66
65
|
textField.setAttribute('focus-target', '');
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Fired when the `value` property changes.
|
|
@@ -40,7 +41,7 @@ export interface GridFilterEventMap extends HTMLElementEventMap, GridFilterCusto
|
|
|
40
41
|
*
|
|
41
42
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
42
43
|
*/
|
|
43
|
-
declare class GridFilter extends HTMLElement {
|
|
44
|
+
declare class GridFilter extends ControllerMixin(HTMLElement) {
|
|
44
45
|
/**
|
|
45
46
|
* JS Path of the property in the item used for filtering the data.
|
|
46
47
|
*/
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
8
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
10
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
11
|
+
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* `<vaadin-grid-filter>` is a helper element for the `<vaadin-grid>` that provides out-of-the-box UI controls,
|
|
@@ -35,7 +37,7 @@ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
|
35
37
|
*
|
|
36
38
|
* @extends HTMLElement
|
|
37
39
|
*/
|
|
38
|
-
class GridFilter extends
|
|
40
|
+
class GridFilter extends ControllerMixin(PolymerElement) {
|
|
39
41
|
static get template() {
|
|
40
42
|
return html`
|
|
41
43
|
<style>
|
|
@@ -44,14 +46,12 @@ class GridFilter extends class extends PolymerElement {} {
|
|
|
44
46
|
max-width: 100%;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
::slotted(*) {
|
|
48
50
|
width: 100%;
|
|
49
51
|
box-sizing: border-box;
|
|
50
52
|
}
|
|
51
53
|
</style>
|
|
52
|
-
<slot
|
|
53
|
-
<vaadin-text-field id="filter" value="{{value}}"></vaadin-text-field>
|
|
54
|
-
</slot>
|
|
54
|
+
<slot></slot>
|
|
55
55
|
`;
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -75,39 +75,42 @@ class GridFilter extends class extends PolymerElement {} {
|
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
/** @private */
|
|
78
|
-
|
|
78
|
+
_textField: {
|
|
79
|
+
type: Object,
|
|
80
|
+
},
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
/** @protected */
|
|
83
|
-
connectedCallback() {
|
|
84
|
-
super.connectedCallback();
|
|
85
|
-
this._connected = true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
84
|
static get observers() {
|
|
89
|
-
return ['_filterChanged(path, value,
|
|
85
|
+
return ['_filterChanged(path, value, _textField)'];
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
/** @protected */
|
|
93
89
|
ready() {
|
|
94
90
|
super.ready();
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
this._filterController = new SlotController(this, '', 'vaadin-text-field', {
|
|
93
|
+
initializer: (field) => {
|
|
94
|
+
field.addEventListener('value-changed', (e) => {
|
|
95
|
+
this.value = e.detail.value;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
this._textField = field;
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
this.addController(this._filterController);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
/** @private */
|
|
104
|
-
_filterChanged(path, value,
|
|
105
|
-
if (path === undefined || value === undefined || !
|
|
105
|
+
_filterChanged(path, value, textField) {
|
|
106
|
+
if (path === undefined || value === undefined || !textField) {
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
109
|
if (this._previousValue === undefined && value === '') {
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
112
|
+
|
|
113
|
+
textField.value = value;
|
|
111
114
|
this._previousValue = value;
|
|
112
115
|
|
|
113
116
|
this._debouncerFilterChanged = Debouncer.debounce(this._debouncerFilterChanged, timeOut.after(200), () => {
|
|
@@ -116,7 +119,9 @@ class GridFilter extends class extends PolymerElement {} {
|
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
focus() {
|
|
119
|
-
this
|
|
122
|
+
if (this._textField) {
|
|
123
|
+
this._textField.focus();
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
127
|
|
|
@@ -732,7 +732,14 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
732
732
|
const cell = e.composedPath()[0];
|
|
733
733
|
if (cell._content && cell._content.firstElementChild) {
|
|
734
734
|
const wasNavigating = this.hasAttribute('navigating');
|
|
735
|
-
cell._content.firstElementChild.
|
|
735
|
+
cell._content.firstElementChild.dispatchEvent(
|
|
736
|
+
new MouseEvent('click', {
|
|
737
|
+
shiftKey: e.shiftKey,
|
|
738
|
+
bubbles: true,
|
|
739
|
+
composed: true,
|
|
740
|
+
cancelable: true,
|
|
741
|
+
}),
|
|
742
|
+
);
|
|
736
743
|
this.toggleAttribute('navigating', wasNavigating);
|
|
737
744
|
}
|
|
738
745
|
}
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { Grid, GridItemModel } from './vaadin-grid.js';
|
|
8
8
|
|
|
9
|
-
export type GridRowDetailsRenderer<TItem> = (
|
|
10
|
-
root: HTMLElement,
|
|
11
|
-
grid?: Grid<TItem>,
|
|
12
|
-
model?: GridItemModel<TItem>,
|
|
13
|
-
) => void;
|
|
9
|
+
export type GridRowDetailsRenderer<TItem> = (root: HTMLElement, grid: Grid<TItem>, model: GridItemModel<TItem>) => void;
|
|
14
10
|
|
|
15
11
|
export declare function RowDetailsMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
12
|
base: T,
|
|
@@ -36,4 +36,13 @@ export declare class SortMixinClass {
|
|
|
36
36
|
* @attr {string} multi-sort-priority
|
|
37
37
|
*/
|
|
38
38
|
multiSortPriority: 'append' | 'prepend';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* When `true`, Shift-clicking an unsorted column's sorter adds it to the multi-sort.
|
|
42
|
+
* Shift + Space does the same action via keyboard. This property has precedence over the
|
|
43
|
+
* `multiSort` property. If `multiSortOnShiftClick` is true, the multiSort property is effectively ignored.
|
|
44
|
+
*
|
|
45
|
+
* @attr {boolean} multi-sort-on-shift-click
|
|
46
|
+
*/
|
|
47
|
+
multiSortOnShiftClick: boolean;
|
|
39
48
|
}
|
|
@@ -42,6 +42,19 @@ export const SortMixin = (superClass) =>
|
|
|
42
42
|
value: () => defaultMultiSortPriority,
|
|
43
43
|
},
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* When `true`, Shift-clicking an unsorted column's sorter adds it to the multi-sort.
|
|
47
|
+
* Shift + Space does the same action via keyboard. This property has precedence over the
|
|
48
|
+
* `multiSort` property. If `multiSortOnShiftClick` is true, the multiSort property is effectively ignored.
|
|
49
|
+
*
|
|
50
|
+
* @attr {boolean} multi-sort-on-shift-click
|
|
51
|
+
* @type {boolean}
|
|
52
|
+
*/
|
|
53
|
+
multiSortOnShiftClick: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
value: false,
|
|
56
|
+
},
|
|
57
|
+
|
|
45
58
|
/**
|
|
46
59
|
* @type {!Array<!GridSorterDefinition>}
|
|
47
60
|
* @protected
|
|
@@ -81,7 +94,7 @@ export const SortMixin = (superClass) =>
|
|
|
81
94
|
const sorter = e.target;
|
|
82
95
|
e.stopPropagation();
|
|
83
96
|
sorter._grid = this;
|
|
84
|
-
this.__updateSorter(sorter);
|
|
97
|
+
this.__updateSorter(sorter, e.detail.shiftClick);
|
|
85
98
|
this.__applySorters();
|
|
86
99
|
}
|
|
87
100
|
|
|
@@ -126,22 +139,22 @@ export const SortMixin = (superClass) =>
|
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
/** @private */
|
|
129
|
-
__updateSorter(sorter) {
|
|
142
|
+
__updateSorter(sorter, shiftClick) {
|
|
130
143
|
if (!sorter.direction && this._sorters.indexOf(sorter) === -1) {
|
|
131
144
|
return;
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
sorter._order = null;
|
|
135
148
|
|
|
136
|
-
if (this.multiSort) {
|
|
149
|
+
if ((this.multiSort && !this.multiSortOnShiftClick) || (this.multiSortOnShiftClick && shiftClick)) {
|
|
137
150
|
if (this.multiSortPriority === 'append') {
|
|
138
151
|
this.__appendSorter(sorter);
|
|
139
152
|
} else {
|
|
140
153
|
this.__prependSorter(sorter);
|
|
141
154
|
}
|
|
142
|
-
} else if (sorter.direction) {
|
|
155
|
+
} else if (sorter.direction || this.multiSortOnShiftClick) {
|
|
143
156
|
const otherSorters = this._sorters.filter((s) => s !== sorter);
|
|
144
|
-
this._sorters = [sorter];
|
|
157
|
+
this._sorters = sorter.direction ? [sorter] : [];
|
|
145
158
|
otherSorters.forEach((sorter) => {
|
|
146
159
|
sorter._order = null;
|
|
147
160
|
sorter.direction = null;
|
|
@@ -8,13 +8,18 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
8
8
|
|
|
9
9
|
export type GridSorterDirection = 'asc' | 'desc' | null;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Fired when the `path` or `direction` property changes.
|
|
13
|
+
*/
|
|
14
|
+
export type GridSorterChangedEvent = CustomEvent<{ shiftClick: boolean }>;
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* Fired when the `direction` property changes.
|
|
13
18
|
*/
|
|
14
19
|
export type GridSorterDirectionChangedEvent = CustomEvent<{ value: GridSorterDirection }>;
|
|
15
20
|
|
|
16
21
|
export interface GridSorterCustomEventMap {
|
|
17
|
-
'sorter-changed':
|
|
22
|
+
'sorter-changed': GridSorterChangedEvent;
|
|
18
23
|
|
|
19
24
|
'direction-changed': GridSorterDirectionChangedEvent;
|
|
20
25
|
}
|
|
@@ -153,6 +153,12 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
153
153
|
type: Boolean,
|
|
154
154
|
observer: '__isConnectedChanged',
|
|
155
155
|
},
|
|
156
|
+
|
|
157
|
+
/** @private */
|
|
158
|
+
_shiftClick: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
value: false,
|
|
161
|
+
},
|
|
156
162
|
};
|
|
157
163
|
}
|
|
158
164
|
|
|
@@ -202,7 +208,13 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
202
208
|
return;
|
|
203
209
|
}
|
|
204
210
|
|
|
205
|
-
this.dispatchEvent(
|
|
211
|
+
this.dispatchEvent(
|
|
212
|
+
new CustomEvent('sorter-changed', {
|
|
213
|
+
detail: { shiftClick: this._shiftClick },
|
|
214
|
+
bubbles: true,
|
|
215
|
+
composed: true,
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
206
218
|
}
|
|
207
219
|
|
|
208
220
|
/** @private */
|
|
@@ -219,6 +231,7 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
219
231
|
}
|
|
220
232
|
|
|
221
233
|
e.preventDefault();
|
|
234
|
+
this._shiftClick = e.shiftKey;
|
|
222
235
|
if (this.direction === 'asc') {
|
|
223
236
|
this.direction = 'desc';
|
|
224
237
|
} else if (this.direction === 'desc') {
|
|
@@ -24,13 +24,6 @@ declare class GridTreeColumn<TItem = GridDefaultItem> extends GridColumn<TItem>
|
|
|
24
24
|
* JS Path of the property in the item used as text content for the tree toggle.
|
|
25
25
|
*/
|
|
26
26
|
path: string | null | undefined;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* JS Path of the property in the item that indicates whether the item has child items.
|
|
30
|
-
* @attr {string} item-has-children-path
|
|
31
|
-
* @deprecated Use `grid.itemHasChildrenPath` instead.
|
|
32
|
-
*/
|
|
33
|
-
itemHasChildrenPath: string | null | undefined;
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
declare global {
|
|
@@ -30,21 +30,11 @@ class GridTreeColumn extends GridColumn {
|
|
|
30
30
|
* JS Path of the property in the item used as text content for the tree toggle.
|
|
31
31
|
*/
|
|
32
32
|
path: String,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* JS Path of the property in the item that indicates whether the item has child items.
|
|
36
|
-
* @attr {string} item-has-children-path
|
|
37
|
-
* @deprecated Use `grid.itemHasChildrenPath` instead.
|
|
38
|
-
*/
|
|
39
|
-
itemHasChildrenPath: {
|
|
40
|
-
type: String,
|
|
41
|
-
observer: '_itemHasChildrenPathChanged',
|
|
42
|
-
},
|
|
43
33
|
};
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
static get observers() {
|
|
47
|
-
return ['_onRendererOrBindingChanged(_renderer, _cells, _cells.*, path
|
|
37
|
+
return ['_onRendererOrBindingChanged(_renderer, _cells, _cells.*, path)'];
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
constructor() {
|
|
@@ -85,19 +75,6 @@ class GridTreeColumn extends GridColumn {
|
|
|
85
75
|
return this.__defaultRenderer;
|
|
86
76
|
}
|
|
87
77
|
|
|
88
|
-
/** @private */
|
|
89
|
-
_itemHasChildrenPathChanged(itemHasChildrenPath) {
|
|
90
|
-
if (itemHasChildrenPath) {
|
|
91
|
-
console.warn(
|
|
92
|
-
`WARNING: Since Vaadin 23, itemHasChildrenPath on <vaadin-grid-tree-column> is deprecated. Please set this property on the <vaadin-grid> instead.`,
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
if (this._grid) {
|
|
96
|
-
this._grid.itemHasChildrenPath = itemHasChildrenPath;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
78
|
/**
|
|
102
79
|
* Expands or collapses the row once the tree toggle is switched.
|
|
103
80
|
* The listener handles only user-fired events.
|
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> {}
|
|
@@ -285,17 +299,29 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
285
299
|
*
|
|
286
300
|
* The following shadow DOM parts are available for styling:
|
|
287
301
|
*
|
|
288
|
-
* Part name
|
|
289
|
-
*
|
|
290
|
-
* `row`
|
|
291
|
-
* `
|
|
292
|
-
* `
|
|
293
|
-
* `
|
|
294
|
-
* `
|
|
295
|
-
* `
|
|
296
|
-
* `
|
|
297
|
-
* `
|
|
298
|
-
* `
|
|
302
|
+
* Part name | Description
|
|
303
|
+
* -----------------------|----------------
|
|
304
|
+
* `row` | Row in the internal table
|
|
305
|
+
* `expanded-row` | Expanded row
|
|
306
|
+
* `selected-row` | Selected row
|
|
307
|
+
* `details-opened-row` | Row with details open
|
|
308
|
+
* `odd-row` | Odd row
|
|
309
|
+
* `first-row` | The first body row
|
|
310
|
+
* `last-row` | The last body row
|
|
311
|
+
* `dragstart-row` | Set on the row for one frame when drag is starting. The value is a number when multiple rows are dragged
|
|
312
|
+
* `dragover-above-row` | Set on the row when the a row is dragged over above
|
|
313
|
+
* `dragover-below-row` | Set on the row when the a row is dragged over below
|
|
314
|
+
* `dragover-on-top-row` | Set on the row when the a row is dragged over on top
|
|
315
|
+
* `drag-disabled-row` | Set to a row that isn't available for dragging
|
|
316
|
+
* `drop-disabled-row` | Set to a row that can't be dropped on top of
|
|
317
|
+
* `cell` | Cell in the internal table
|
|
318
|
+
* `header-cell` | Header cell in the internal table
|
|
319
|
+
* `body-cell` | Body cell in the internal table
|
|
320
|
+
* `footer-cell` | Footer cell in the internal table
|
|
321
|
+
* `details-cell` | Row details cell in the internal table
|
|
322
|
+
* `focused-cell` | Focused cell in the internal table
|
|
323
|
+
* `resize-handle` | Handle for resizing the columns
|
|
324
|
+
* `reorder-ghost` | Ghost element of the header cell being dragged
|
|
299
325
|
*
|
|
300
326
|
* The following state attributes are available for styling:
|
|
301
327
|
*
|
|
@@ -332,12 +358,14 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
332
358
|
* @fires {CustomEvent} cell-focus - Fired when a cell is focused with click or keyboard navigation.
|
|
333
359
|
* @fires {CustomEvent} column-reorder - Fired when the columns in the grid are reordered.
|
|
334
360
|
* @fires {CustomEvent} column-resize - Fired when the grid column resize is finished.
|
|
361
|
+
* @fires {CustomEvent} data-provider-changed - Fired when the `dataProvider` property changes.
|
|
335
362
|
* @fires {CustomEvent} expanded-items-changed - Fired when the `expandedItems` property changes.
|
|
336
363
|
* @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
|
|
337
364
|
* @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
|
|
338
365
|
* @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
|
|
339
366
|
* @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
|
|
340
367
|
* @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
|
|
368
|
+
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
341
369
|
*/
|
|
342
370
|
declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
343
371
|
/**
|
|
@@ -367,17 +395,6 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
367
395
|
*/
|
|
368
396
|
requestContentUpdate(): void;
|
|
369
397
|
|
|
370
|
-
/**
|
|
371
|
-
* Updates the computed metrics and positioning of internal grid parts
|
|
372
|
-
* (row/details cell positioning etc). Needs to be invoked whenever the sizing of grid
|
|
373
|
-
* content changes asynchronously to ensure consistent appearance (e.g. when a
|
|
374
|
-
* contained image whose bounds aren't known beforehand finishes loading).
|
|
375
|
-
*
|
|
376
|
-
* @deprecated Since Vaadin 22, `notifyResize()` is deprecated. The component uses a
|
|
377
|
-
* ResizeObserver internally and doesn't need to be explicitly notified of resizes.
|
|
378
|
-
*/
|
|
379
|
-
notifyResize(): void;
|
|
380
|
-
|
|
381
398
|
addEventListener<K extends keyof GridEventMap<TItem>>(
|
|
382
399
|
type: K,
|
|
383
400
|
listener: (this: Grid<TItem>, ev: GridEventMap<TItem>[K]) => void,
|
package/src/vaadin-grid.js
CHANGED
|
@@ -9,6 +9,7 @@ import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
|
9
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
10
|
import { isAndroid, isChrome, isFirefox, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
11
11
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
|
+
import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
12
13
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
13
14
|
import { TabindexMixin } from '@vaadin/component-base/src/tabindex-mixin.js';
|
|
14
15
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
@@ -172,17 +173,29 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
|
|
|
172
173
|
*
|
|
173
174
|
* The following shadow DOM parts are available for styling:
|
|
174
175
|
*
|
|
175
|
-
* Part name
|
|
176
|
-
*
|
|
177
|
-
* `row`
|
|
178
|
-
* `
|
|
179
|
-
* `
|
|
180
|
-
* `
|
|
181
|
-
* `
|
|
182
|
-
* `
|
|
183
|
-
* `
|
|
184
|
-
* `
|
|
185
|
-
* `
|
|
176
|
+
* Part name | Description
|
|
177
|
+
* -----------------------|----------------
|
|
178
|
+
* `row` | Row in the internal table
|
|
179
|
+
* `expanded-row` | Expanded row
|
|
180
|
+
* `selected-row` | Selected row
|
|
181
|
+
* `details-opened-row` | Row with details open
|
|
182
|
+
* `odd-row` | Odd row
|
|
183
|
+
* `first-row` | The first body row
|
|
184
|
+
* `last-row` | The last body row
|
|
185
|
+
* `dragstart-row` | Set on the row for one frame when drag is starting. The value is a number when multiple rows are dragged
|
|
186
|
+
* `dragover-above-row` | Set on the row when the a row is dragged over above
|
|
187
|
+
* `dragover-below-row` | Set on the row when the a row is dragged over below
|
|
188
|
+
* `dragover-on-top-row` | Set on the row when the a row is dragged over on top
|
|
189
|
+
* `drag-disabled-row` | Set to a row that isn't available for dragging
|
|
190
|
+
* `drop-disabled-row` | Set to a row that can't be dropped on top of
|
|
191
|
+
* `cell` | Cell in the internal table
|
|
192
|
+
* `header-cell` | Header cell in the internal table
|
|
193
|
+
* `body-cell` | Body cell in the internal table
|
|
194
|
+
* `footer-cell` | Footer cell in the internal table
|
|
195
|
+
* `details-cell` | Row details cell in the internal table
|
|
196
|
+
* `focused-cell` | Focused cell in the internal table
|
|
197
|
+
* `resize-handle` | Handle for resizing the columns
|
|
198
|
+
* `reorder-ghost` | Ghost element of the header cell being dragged
|
|
186
199
|
*
|
|
187
200
|
* The following state attributes are available for styling:
|
|
188
201
|
*
|
|
@@ -219,12 +232,14 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
|
|
|
219
232
|
* @fires {CustomEvent} cell-focus - Fired when a cell is focused with click or keyboard navigation.
|
|
220
233
|
* @fires {CustomEvent} column-reorder - Fired when the columns in the grid are reordered.
|
|
221
234
|
* @fires {CustomEvent} column-resize - Fired when the grid column resize is finished.
|
|
235
|
+
* @fires {CustomEvent} data-provider-changed - Fired when the `dataProvider` property changes.
|
|
222
236
|
* @fires {CustomEvent} expanded-items-changed - Fired when the `expandedItems` property changes.
|
|
223
237
|
* @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
|
|
224
238
|
* @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
|
|
225
239
|
* @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
|
|
226
240
|
* @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
|
|
227
241
|
* @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
|
|
242
|
+
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
228
243
|
*
|
|
229
244
|
* @extends HTMLElement
|
|
230
245
|
* @mixes ElementMixin
|
|
@@ -886,9 +901,9 @@ class Grid extends ElementMixin(
|
|
|
886
901
|
return;
|
|
887
902
|
}
|
|
888
903
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
904
|
+
this._updateRowState(row, 'first', index === 0);
|
|
905
|
+
this._updateRowState(row, 'last', index === this._effectiveSize - 1);
|
|
906
|
+
this._updateRowState(row, 'odd', index % 2);
|
|
892
907
|
this._a11yUpdateRowRowindex(row, index);
|
|
893
908
|
this._getItem(index, row);
|
|
894
909
|
}
|
|
@@ -973,9 +988,9 @@ class Grid extends ElementMixin(
|
|
|
973
988
|
this._a11yUpdateRowLevel(row, model.level);
|
|
974
989
|
this._a11yUpdateRowSelected(row, model.selected);
|
|
975
990
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
991
|
+
this._updateRowState(row, 'expanded', model.expanded);
|
|
992
|
+
this._updateRowState(row, 'selected', model.selected);
|
|
993
|
+
this._updateRowState(row, 'details-opened', model.detailsOpened);
|
|
979
994
|
|
|
980
995
|
this._generateCellClassNames(row, model);
|
|
981
996
|
this._filterDragAndDrop(row, model);
|
|
@@ -992,6 +1007,35 @@ class Grid extends ElementMixin(
|
|
|
992
1007
|
this._a11yUpdateRowExpanded(row, model.expanded);
|
|
993
1008
|
}
|
|
994
1009
|
|
|
1010
|
+
/**
|
|
1011
|
+
* @param {!HTMLElement} row
|
|
1012
|
+
* @param {string} state
|
|
1013
|
+
* @param {boolean | string | null | undefined} value
|
|
1014
|
+
* @param {boolean} partWithValue
|
|
1015
|
+
* @protected
|
|
1016
|
+
*/
|
|
1017
|
+
_updateRowState(row, state, value, partWithValue) {
|
|
1018
|
+
switch (typeof value) {
|
|
1019
|
+
case 'boolean':
|
|
1020
|
+
row.toggleAttribute(state, value);
|
|
1021
|
+
break;
|
|
1022
|
+
case 'string':
|
|
1023
|
+
row.setAttribute(state, value);
|
|
1024
|
+
break;
|
|
1025
|
+
default:
|
|
1026
|
+
// Value set to null / undefined
|
|
1027
|
+
row.removeAttribute(state);
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
const part = partWithValue ? `${state}-${value}-row` : `${state}-row`;
|
|
1032
|
+
if (value || value === '') {
|
|
1033
|
+
addValueToAttribute(row, 'part', part);
|
|
1034
|
+
} else {
|
|
1035
|
+
removeValueFromAttribute(row, 'part', part);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
995
1039
|
/** @private */
|
|
996
1040
|
_resizeHandler() {
|
|
997
1041
|
this._updateDetailsCellHeights();
|
|
@@ -1088,21 +1132,6 @@ class Grid extends ElementMixin(
|
|
|
1088
1132
|
this.__virtualizer.update(start, end);
|
|
1089
1133
|
}
|
|
1090
1134
|
}
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Updates the computed metrics and positioning of internal grid parts
|
|
1094
|
-
* (row/details cell positioning etc). Needs to be invoked whenever the sizing of grid
|
|
1095
|
-
* content changes asynchronously to ensure consistent appearance (e.g. when a
|
|
1096
|
-
* contained image whose bounds aren't known beforehand finishes loading).
|
|
1097
|
-
*
|
|
1098
|
-
* @deprecated Since Vaadin 22, `notifyResize()` is deprecated. The component uses a
|
|
1099
|
-
* ResizeObserver internally and doesn't need to be explicitly notified of resizes.
|
|
1100
|
-
*/
|
|
1101
|
-
notifyResize() {
|
|
1102
|
-
console.warn(
|
|
1103
|
-
`WARNING: Since Vaadin 22, notifyResize() is deprecated. The component uses a ResizeObserver internally and doesn't need to be explicitly notified of resizes.`,
|
|
1104
|
-
);
|
|
1105
|
-
}
|
|
1106
1135
|
}
|
|
1107
1136
|
|
|
1108
1137
|
customElements.define(Grid.is, Grid);
|
|
@@ -57,7 +57,7 @@ registerStyles(
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/* Hide first body row top border */
|
|
60
|
-
:host(:not([theme~='no-row-borders'])) [part
|
|
60
|
+
:host(:not([theme~='no-row-borders'])) [part~='row'][first] [part~='cell']:not([part~='details-cell']) {
|
|
61
61
|
border-top: 0;
|
|
62
62
|
min-height: calc(var(--lumo-size-m) - var(--_lumo-grid-border-width));
|
|
63
63
|
}
|
|
@@ -207,42 +207,42 @@ registerStyles(
|
|
|
207
207
|
font-weight: 400;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
[part
|
|
210
|
+
[part~='row']:only-child [part~='header-cell'] {
|
|
211
211
|
min-height: var(--lumo-size-xl);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/* Header borders */
|
|
215
215
|
|
|
216
216
|
/* Hide first header row top border */
|
|
217
|
-
:host(:not([theme~='no-row-borders'])) [part
|
|
217
|
+
:host(:not([theme~='no-row-borders'])) [part~='row']:first-child [part~='header-cell'] {
|
|
218
218
|
border-top: 0;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
[part
|
|
221
|
+
[part~='row']:last-child [part~='header-cell'] {
|
|
222
222
|
border-bottom: var(--_lumo-grid-border-width) solid transparent;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
:host(:not([theme~='no-row-borders'])) [part
|
|
225
|
+
:host(:not([theme~='no-row-borders'])) [part~='row']:last-child [part~='header-cell'] {
|
|
226
226
|
border-bottom-color: var(--_lumo-grid-secondary-border-color);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/* Overflow uses a stronger border color */
|
|
230
|
-
:host([overflow~='top']) [part
|
|
230
|
+
:host([overflow~='top']) [part~='row']:last-child [part~='header-cell'] {
|
|
231
231
|
border-bottom-color: var(--_lumo-grid-border-color);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/* Footer borders */
|
|
235
235
|
|
|
236
|
-
[part
|
|
236
|
+
[part~='row']:first-child [part~='footer-cell'] {
|
|
237
237
|
border-top: var(--_lumo-grid-border-width) solid transparent;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
:host(:not([theme~='no-row-borders'])) [part
|
|
240
|
+
:host(:not([theme~='no-row-borders'])) [part~='row']:first-child [part~='footer-cell'] {
|
|
241
241
|
border-top-color: var(--_lumo-grid-secondary-border-color);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/* Overflow uses a stronger border color */
|
|
245
|
-
:host([overflow~='bottom']) [part
|
|
245
|
+
:host([overflow~='bottom']) [part~='row']:first-child [part~='footer-cell'] {
|
|
246
246
|
border-top-color: var(--_lumo-grid-border-color);
|
|
247
247
|
}
|
|
248
248
|
|
|
@@ -334,7 +334,7 @@ registerStyles(
|
|
|
334
334
|
|
|
335
335
|
/* Compact */
|
|
336
336
|
|
|
337
|
-
:host([theme~='compact']) [part
|
|
337
|
+
:host([theme~='compact']) [part~='row']:only-child [part~='header-cell'] {
|
|
338
338
|
min-height: var(--lumo-size-m);
|
|
339
339
|
}
|
|
340
340
|
|
|
@@ -342,7 +342,7 @@ registerStyles(
|
|
|
342
342
|
min-height: var(--lumo-size-s);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
:host([theme~='compact']) [part
|
|
345
|
+
:host([theme~='compact']) [part~='row'][first] [part~='cell']:not([part~='details-cell']) {
|
|
346
346
|
min-height: calc(var(--lumo-size-s) - var(--_lumo-grid-border-width));
|
|
347
347
|
}
|
|
348
348
|
|
|
@@ -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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha3",
|
|
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/24.0.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/24.0.0-alpha3/#/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/24.0.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/24.0.0-alpha3/#/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",
|
|
@@ -1603,17 +1603,6 @@
|
|
|
1603
1603
|
]
|
|
1604
1604
|
}
|
|
1605
1605
|
},
|
|
1606
|
-
{
|
|
1607
|
-
"name": "item-has-children-path",
|
|
1608
|
-
"description": "JS Path of the property in the item that indicates whether the item has child items.",
|
|
1609
|
-
"value": {
|
|
1610
|
-
"type": [
|
|
1611
|
-
"string",
|
|
1612
|
-
"null",
|
|
1613
|
-
"undefined"
|
|
1614
|
-
]
|
|
1615
|
-
}
|
|
1616
|
-
},
|
|
1617
1606
|
{
|
|
1618
1607
|
"name": "theme",
|
|
1619
1608
|
"description": "The theme variants to apply to the component.",
|
|
@@ -1762,17 +1751,6 @@
|
|
|
1762
1751
|
"boolean"
|
|
1763
1752
|
]
|
|
1764
1753
|
}
|
|
1765
|
-
},
|
|
1766
|
-
{
|
|
1767
|
-
"name": "itemHasChildrenPath",
|
|
1768
|
-
"description": "JS Path of the property in the item that indicates whether the item has child items.",
|
|
1769
|
-
"value": {
|
|
1770
|
-
"type": [
|
|
1771
|
-
"string",
|
|
1772
|
-
"null",
|
|
1773
|
-
"undefined"
|
|
1774
|
-
]
|
|
1775
|
-
}
|
|
1776
1754
|
}
|
|
1777
1755
|
],
|
|
1778
1756
|
"events": []
|
|
@@ -1780,7 +1758,7 @@
|
|
|
1780
1758
|
},
|
|
1781
1759
|
{
|
|
1782
1760
|
"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/24.0.0-
|
|
1761
|
+
"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/24.0.0-alpha3/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/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/24.0.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/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/24.0.0-alpha3/#/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/24.0.0-alpha3/#/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`expanded-row` | Expanded row\n`selected-row` | Selected row\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting. The value is a number when multiple rows are dragged\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`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.",
|
|
1784
1762
|
"attributes": [
|
|
1785
1763
|
{
|
|
1786
1764
|
"name": "size",
|
|
@@ -1842,6 +1820,15 @@
|
|
|
1842
1820
|
]
|
|
1843
1821
|
}
|
|
1844
1822
|
},
|
|
1823
|
+
{
|
|
1824
|
+
"name": "multi-sort-on-shift-click",
|
|
1825
|
+
"description": "When `true`, Shift-clicking an unsorted column's sorter adds it to the multi-sort.\nShift + Space does the same action via keyboard. This property has precedence over the\n`multiSort` property. If `multiSortOnShiftClick` is true, the multiSort property is effectively ignored.",
|
|
1826
|
+
"value": {
|
|
1827
|
+
"type": [
|
|
1828
|
+
"boolean"
|
|
1829
|
+
]
|
|
1830
|
+
}
|
|
1831
|
+
},
|
|
1845
1832
|
{
|
|
1846
1833
|
"name": "column-reordering-allowed",
|
|
1847
1834
|
"description": "Set to true to allow column reordering.",
|
|
@@ -2024,6 +2011,15 @@
|
|
|
2024
2011
|
]
|
|
2025
2012
|
}
|
|
2026
2013
|
},
|
|
2014
|
+
{
|
|
2015
|
+
"name": "multiSortOnShiftClick",
|
|
2016
|
+
"description": "When `true`, Shift-clicking an unsorted column's sorter adds it to the multi-sort.\nShift + Space does the same action via keyboard. This property has precedence over the\n`multiSort` property. If `multiSortOnShiftClick` is true, the multiSort property is effectively ignored.",
|
|
2017
|
+
"value": {
|
|
2018
|
+
"type": [
|
|
2019
|
+
"boolean"
|
|
2020
|
+
]
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2027
2023
|
{
|
|
2028
2024
|
"name": "columnReorderingAllowed",
|
|
2029
2025
|
"description": "Set to true to allow column reordering.",
|
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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha3",
|
|
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/24.0.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/24.0.0-alpha3/#/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/24.0.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/24.0.0-alpha3/#/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
|
{
|
|
@@ -690,19 +690,12 @@
|
|
|
690
690
|
"value": {
|
|
691
691
|
"kind": "expression"
|
|
692
692
|
}
|
|
693
|
-
},
|
|
694
|
-
{
|
|
695
|
-
"name": ".itemHasChildrenPath",
|
|
696
|
-
"description": "JS Path of the property in the item that indicates whether the item has child items.",
|
|
697
|
-
"value": {
|
|
698
|
-
"kind": "expression"
|
|
699
|
-
}
|
|
700
693
|
}
|
|
701
694
|
]
|
|
702
695
|
},
|
|
703
696
|
{
|
|
704
697
|
"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/24.0.0-
|
|
698
|
+
"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/24.0.0-alpha3/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/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/24.0.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha3/#/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/24.0.0-alpha3/#/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/24.0.0-alpha3/#/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`expanded-row` | Expanded row\n`selected-row` | Selected row\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`first-row` | The first body row\n`last-row` | The last body row\n`dragstart-row` | Set on the row for one frame when drag is starting. The value is a number when multiple rows are dragged\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`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.",
|
|
706
699
|
"extension": true,
|
|
707
700
|
"attributes": [
|
|
708
701
|
{
|
|
@@ -712,6 +705,13 @@
|
|
|
712
705
|
"kind": "expression"
|
|
713
706
|
}
|
|
714
707
|
},
|
|
708
|
+
{
|
|
709
|
+
"name": "?multiSortOnShiftClick",
|
|
710
|
+
"description": "When `true`, Shift-clicking an unsorted column's sorter adds it to the multi-sort.\nShift + Space does the same action via keyboard. This property has precedence over the\n`multiSort` property. If `multiSortOnShiftClick` is true, the multiSort property is effectively ignored.",
|
|
711
|
+
"value": {
|
|
712
|
+
"kind": "expression"
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
715
|
{
|
|
716
716
|
"name": "?columnReorderingAllowed",
|
|
717
717
|
"description": "Set to true to allow column reordering.",
|