@vaadin/grid 23.0.0-beta1 → 23.0.0-beta5
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 +9 -9
- package/src/vaadin-grid-a11y-mixin.js +6 -18
- package/src/vaadin-grid-data-provider-mixin.d.ts +6 -0
- package/src/vaadin-grid-data-provider-mixin.js +9 -0
- package/src/vaadin-grid-keyboard-navigation-mixin.js +7 -6
- package/src/vaadin-grid-row-details-mixin.js +0 -1
- package/src/vaadin-grid-styles.js +4 -0
- package/src/vaadin-grid-tree-column.d.ts +1 -0
- package/src/vaadin-grid-tree-column.js +16 -2
- package/src/vaadin-grid.d.ts +3 -1
- package/src/vaadin-grid.js +26 -2
- package/theme/lumo/vaadin-grid-styles.js +4 -0
- package/theme/material/vaadin-grid-styles.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.0.0-
|
|
3
|
+
"version": "23.0.0-beta5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
43
43
|
"@polymer/polymer": "^3.0.0",
|
|
44
|
-
"@vaadin/checkbox": "23.0.0-
|
|
45
|
-
"@vaadin/component-base": "23.0.0-
|
|
46
|
-
"@vaadin/text-field": "23.0.0-
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "23.0.0-
|
|
48
|
-
"@vaadin/vaadin-material-styles": "23.0.0-
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "23.0.0-
|
|
44
|
+
"@vaadin/checkbox": "23.0.0-beta5",
|
|
45
|
+
"@vaadin/component-base": "23.0.0-beta5",
|
|
46
|
+
"@vaadin/text-field": "23.0.0-beta5",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-beta5",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "23.0.0-beta5",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-beta5"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@esm-bundle/chai": "^4.3.4",
|
|
53
|
-
"@vaadin/polymer-legacy-adapter": "23.0.0-
|
|
53
|
+
"@vaadin/polymer-legacy-adapter": "23.0.0-beta5",
|
|
54
54
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
55
55
|
"lit": "^2.0.0",
|
|
56
56
|
"sinon": "^9.2.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "4c388aeec6623869c70896c909799804fc95d0f9"
|
|
59
59
|
}
|
|
@@ -94,24 +94,12 @@ export const A11yMixin = (superClass) =>
|
|
|
94
94
|
* @protected
|
|
95
95
|
*/
|
|
96
96
|
_a11yUpdateRowLevel(row, level) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* @protected
|
|
104
|
-
*/
|
|
105
|
-
_a11yUpdateRowDetailsOpened(row, detailsOpened) {
|
|
106
|
-
const detailsCell = row.querySelector('[part~=details-cell]');
|
|
107
|
-
|
|
108
|
-
Array.from(row.children).forEach((cell) => {
|
|
109
|
-
if (detailsCell) {
|
|
110
|
-
cell.setAttribute('aria-expanded', detailsOpened);
|
|
111
|
-
} else {
|
|
112
|
-
cell.removeAttribute('aria-expanded');
|
|
113
|
-
}
|
|
114
|
-
});
|
|
97
|
+
// Set level for the expandable rows itself, and all the nested rows.
|
|
98
|
+
if (level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row)) {
|
|
99
|
+
row.setAttribute('aria-level', level + 1);
|
|
100
|
+
} else {
|
|
101
|
+
row.removeAttribute('aria-level');
|
|
102
|
+
}
|
|
115
103
|
}
|
|
116
104
|
|
|
117
105
|
/**
|
|
@@ -101,6 +101,12 @@ export declare class DataProviderMixinClass<TItem> {
|
|
|
101
101
|
*/
|
|
102
102
|
readonly loading: boolean | null | undefined;
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Path to an item sub-property that indicates whether the item has child items.
|
|
106
|
+
* @attr {string} item-has-children-path
|
|
107
|
+
*/
|
|
108
|
+
itemHasChildrenPath: string;
|
|
109
|
+
|
|
104
110
|
/**
|
|
105
111
|
* Path to an item sub-property that identifies the item.
|
|
106
112
|
* @attr {string} item-id-path
|
|
@@ -186,6 +186,15 @@ export const DataProviderMixin = (superClass) =>
|
|
|
186
186
|
value: false
|
|
187
187
|
},
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Path to an item sub-property that indicates whether the item has child items.
|
|
191
|
+
* @attr {string} item-has-children-path
|
|
192
|
+
*/
|
|
193
|
+
itemHasChildrenPath: {
|
|
194
|
+
type: String,
|
|
195
|
+
value: 'children'
|
|
196
|
+
},
|
|
197
|
+
|
|
189
198
|
/**
|
|
190
199
|
* Path to an item sub-property that identifies the item.
|
|
191
200
|
* @attr {string} item-id-path
|
|
@@ -216,14 +216,12 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
// TODO: A tree toggle component should not be the way to determine if the row is expandable
|
|
220
219
|
/** @private */
|
|
221
220
|
__isRowExpandable(row) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return treeToggle && !treeToggle.expanded && !treeToggle.leaf;
|
|
221
|
+
if (this.itemHasChildrenPath) {
|
|
222
|
+
const item = row._item;
|
|
223
|
+
return item && this.get(this.itemHasChildrenPath, item) && !this._isExpanded(item);
|
|
224
|
+
}
|
|
227
225
|
}
|
|
228
226
|
|
|
229
227
|
/** @private */
|
|
@@ -616,6 +614,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
616
614
|
_onTabKeyDown(e) {
|
|
617
615
|
const focusTarget = this._predictFocusStepTarget(e.composedPath()[0], e.shiftKey ? -1 : 1);
|
|
618
616
|
|
|
617
|
+
// Prevent focus-trap logic from intercepting the event.
|
|
618
|
+
e.stopPropagation();
|
|
619
|
+
|
|
619
620
|
if (focusTarget === this.$.table) {
|
|
620
621
|
// The focus is about to exit the grid to the top.
|
|
621
622
|
this.$.table.focus();
|
|
@@ -84,7 +84,6 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
84
84
|
if (!row.querySelector('[part~=details-cell]')) {
|
|
85
85
|
this._updateRow(row, this._columnTree[this._columnTree.length - 1]);
|
|
86
86
|
const isDetailsOpened = this._isDetailsOpened(row._item);
|
|
87
|
-
this._a11yUpdateRowDetailsOpened(row, isDetailsOpened);
|
|
88
87
|
this._toggleDetailsCell(row, isDetailsOpened);
|
|
89
88
|
}
|
|
90
89
|
});
|
|
@@ -28,6 +28,7 @@ declare class GridTreeColumn<TItem = GridDefaultItem> extends GridColumn<TItem>
|
|
|
28
28
|
/**
|
|
29
29
|
* JS Path of the property in the item that indicates whether the item has child items.
|
|
30
30
|
* @attr {string} item-has-children-path
|
|
31
|
+
* @deprecated Use `grid.itemHasChildrenPath` instead.
|
|
31
32
|
*/
|
|
32
33
|
itemHasChildrenPath: string | null | undefined;
|
|
33
34
|
}
|
|
@@ -34,10 +34,11 @@ class GridTreeColumn extends GridColumn {
|
|
|
34
34
|
/**
|
|
35
35
|
* JS Path of the property in the item that indicates whether the item has child items.
|
|
36
36
|
* @attr {string} item-has-children-path
|
|
37
|
+
* @deprecated Use `grid.itemHasChildrenPath` instead.
|
|
37
38
|
*/
|
|
38
39
|
itemHasChildrenPath: {
|
|
39
40
|
type: String,
|
|
40
|
-
|
|
41
|
+
observer: '_itemHasChildrenPathChanged'
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
}
|
|
@@ -68,7 +69,7 @@ class GridTreeColumn extends GridColumn {
|
|
|
68
69
|
toggle.__item = item;
|
|
69
70
|
toggle.__rendererExpanded = expanded;
|
|
70
71
|
toggle.expanded = expanded;
|
|
71
|
-
toggle.leaf = this.__isLeafItem(item, this.itemHasChildrenPath);
|
|
72
|
+
toggle.leaf = this.__isLeafItem(item, this._grid.itemHasChildrenPath);
|
|
72
73
|
toggle.textContent = this.__getToggleContent(this.path, item);
|
|
73
74
|
toggle.level = level;
|
|
74
75
|
}
|
|
@@ -84,6 +85,19 @@ class GridTreeColumn extends GridColumn {
|
|
|
84
85
|
return this.__defaultRenderer;
|
|
85
86
|
}
|
|
86
87
|
|
|
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
|
+
|
|
87
101
|
/**
|
|
88
102
|
* Expands or collapses the row once the tree toggle is switched.
|
|
89
103
|
* The listener handles only user-fired events.
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -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 { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
6
7
|
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
8
|
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
9
|
import { ActiveItemMixinClass } from './vaadin-grid-active-item-mixin.js';
|
|
@@ -389,7 +390,8 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
389
390
|
}
|
|
390
391
|
|
|
391
392
|
interface Grid<TItem = GridDefaultItem>
|
|
392
|
-
extends
|
|
393
|
+
extends DisabledMixinClass,
|
|
394
|
+
ElementMixinClass,
|
|
393
395
|
ThemableMixinClass,
|
|
394
396
|
ActiveItemMixinClass<TItem>,
|
|
395
397
|
ArrayDataProviderMixinClass<TItem>,
|
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, isFirefox, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
11
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
12
|
+
import { TabindexMixin } from '@vaadin/component-base/src/tabindex-mixin.js';
|
|
12
13
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
13
14
|
import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
|
|
14
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -256,7 +257,9 @@ class Grid extends ElementMixin(
|
|
|
256
257
|
A11yMixin(
|
|
257
258
|
FilterMixin(
|
|
258
259
|
ColumnReorderingMixin(
|
|
259
|
-
ColumnResizingMixin(
|
|
260
|
+
ColumnResizingMixin(
|
|
261
|
+
EventContextMixin(DragAndDropMixin(StylingMixin(TabindexMixin(PolymerElement))))
|
|
262
|
+
)
|
|
260
263
|
)
|
|
261
264
|
)
|
|
262
265
|
)
|
|
@@ -337,6 +340,11 @@ class Grid extends ElementMixin(
|
|
|
337
340
|
value: isTouch
|
|
338
341
|
},
|
|
339
342
|
|
|
343
|
+
/** @protected */
|
|
344
|
+
tabindex: {
|
|
345
|
+
value: undefined
|
|
346
|
+
},
|
|
347
|
+
|
|
340
348
|
/**
|
|
341
349
|
* If true, the grid's height is defined by its rows.
|
|
342
350
|
*
|
|
@@ -465,6 +473,23 @@ class Grid extends ElementMixin(
|
|
|
465
473
|
}
|
|
466
474
|
}
|
|
467
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Override an observer from `DisabledMixin` to not
|
|
478
|
+
* set `tabindex` on the grid when it is re-enabled.
|
|
479
|
+
*
|
|
480
|
+
* @param {boolean} disabled
|
|
481
|
+
* @param {boolean} oldDisabled
|
|
482
|
+
* @protected
|
|
483
|
+
* @override
|
|
484
|
+
*/
|
|
485
|
+
_disabledChanged(disabled, oldDisabled) {
|
|
486
|
+
super._disabledChanged(disabled, oldDisabled);
|
|
487
|
+
|
|
488
|
+
if (oldDisabled) {
|
|
489
|
+
this.removeAttribute('tabindex');
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
468
493
|
/** @private */
|
|
469
494
|
__getBodyCellCoordinates(cell) {
|
|
470
495
|
if (this.$.items.contains(cell) && cell.localName === 'td') {
|
|
@@ -910,7 +935,6 @@ class Grid extends ElementMixin(
|
|
|
910
935
|
|
|
911
936
|
this._a11yUpdateRowLevel(row, model.level);
|
|
912
937
|
this._a11yUpdateRowSelected(row, model.selected);
|
|
913
|
-
this._a11yUpdateRowDetailsOpened(row, model.detailsOpened);
|
|
914
938
|
|
|
915
939
|
row.toggleAttribute('expanded', model.expanded);
|
|
916
940
|
row.toggleAttribute('selected', model.selected);
|