@vaadin/grid 22.0.3 → 22.0.6
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-column.js +6 -2
- package/src/vaadin-grid-keyboard-navigation-mixin.js +41 -1
- package/src/vaadin-grid-row-details-mixin.js +2 -1
- package/src/vaadin-grid-selection-mixin.js +2 -6
- package/src/vaadin-grid.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
42
|
"@polymer/polymer": "^3.0.0",
|
|
43
|
-
"@vaadin/checkbox": "^22.0.
|
|
44
|
-
"@vaadin/component-base": "^22.0.
|
|
45
|
-
"@vaadin/text-field": "^22.0.
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.
|
|
47
|
-
"@vaadin/vaadin-material-styles": "^22.0.
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.
|
|
43
|
+
"@vaadin/checkbox": "^22.0.6",
|
|
44
|
+
"@vaadin/component-base": "^22.0.6",
|
|
45
|
+
"@vaadin/text-field": "^22.0.6",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.6",
|
|
47
|
+
"@vaadin/vaadin-material-styles": "^22.0.6",
|
|
48
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.6"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@esm-bundle/chai": "^4.3.4",
|
|
52
|
-
"@vaadin/polymer-legacy-adapter": "^22.0.
|
|
52
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.6",
|
|
53
53
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
54
54
|
"lit": "^2.0.0",
|
|
55
55
|
"sinon": "^9.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "18c55872d764e338e0f98e65826cbe895156251a"
|
|
58
58
|
}
|
|
@@ -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
|
/**
|
|
@@ -494,7 +494,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
this.__renderCellsContent(headerRenderer, [headerCell]);
|
|
497
|
-
this._grid
|
|
497
|
+
if (this._grid) {
|
|
498
|
+
this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement);
|
|
499
|
+
}
|
|
498
500
|
}
|
|
499
501
|
|
|
500
502
|
/** @protected */
|
|
@@ -533,7 +535,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
533
535
|
}
|
|
534
536
|
|
|
535
537
|
this.__renderCellsContent(footerRenderer, [footerCell]);
|
|
536
|
-
this._grid
|
|
538
|
+
if (this._grid) {
|
|
539
|
+
this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement);
|
|
540
|
+
}
|
|
537
541
|
}
|
|
538
542
|
|
|
539
543
|
/** @protected */
|
|
@@ -130,6 +130,37 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
130
130
|
this._updateGridSectionFocusTarget(this._footerFocusable);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Since the focused cell/row state is stored as an element reference, the reference may get
|
|
135
|
+
* out of sync when the virtual indexes for elements update due to effective size change.
|
|
136
|
+
* This function updates the reference to the correct element after a possible index change.
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
__updateItemsFocusable() {
|
|
140
|
+
if (!this._itemsFocusable) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const wasFocused = this.shadowRoot.activeElement === this._itemsFocusable;
|
|
145
|
+
|
|
146
|
+
this._getVisibleRows().forEach((row) => {
|
|
147
|
+
if (row.index === this._focusedItemIndex) {
|
|
148
|
+
if (this.__rowFocusMode) {
|
|
149
|
+
// Row focus mode
|
|
150
|
+
this._itemsFocusable = row;
|
|
151
|
+
} else if (this._itemsFocusable.parentElement) {
|
|
152
|
+
// Cell focus mode
|
|
153
|
+
const cellIndex = [...this._itemsFocusable.parentElement.children].indexOf(this._itemsFocusable);
|
|
154
|
+
this._itemsFocusable = row.children[cellIndex];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
if (wasFocused) {
|
|
160
|
+
this._itemsFocusable.focus();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
133
164
|
/**
|
|
134
165
|
* @param {!KeyboardEvent} e
|
|
135
166
|
* @protected
|
|
@@ -532,7 +563,11 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
532
563
|
|
|
533
564
|
if (this.interacting !== wantInteracting && cell !== null) {
|
|
534
565
|
if (wantInteracting) {
|
|
535
|
-
const focusTarget =
|
|
566
|
+
const focusTarget =
|
|
567
|
+
cell._content.querySelector('[focus-target]') ||
|
|
568
|
+
// If a child element hasn't been explicitly marked as a focus target,
|
|
569
|
+
// fall back to any focusable element inside the cell.
|
|
570
|
+
[...cell._content.querySelectorAll('*')].find((node) => this._isFocusable(node));
|
|
536
571
|
if (focusTarget) {
|
|
537
572
|
e.preventDefault();
|
|
538
573
|
focusTarget.focus();
|
|
@@ -582,6 +617,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
582
617
|
_onTabKeyDown(e) {
|
|
583
618
|
const focusTarget = this._predictFocusStepTarget(e.composedPath()[0], e.shiftKey ? -1 : 1);
|
|
584
619
|
|
|
620
|
+
// Prevent focus-trap logic from intercepting the event.
|
|
621
|
+
e.stopPropagation();
|
|
622
|
+
|
|
585
623
|
if (focusTarget === this.$.table) {
|
|
586
624
|
// The focus is about to exit the grid to the top.
|
|
587
625
|
this.$.table.focus();
|
|
@@ -804,6 +842,8 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
804
842
|
delete this._focusedColumnOrder;
|
|
805
843
|
this._itemsFocusable = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
|
|
806
844
|
}
|
|
845
|
+
} else {
|
|
846
|
+
this.__updateItemsFocusable();
|
|
807
847
|
}
|
|
808
848
|
}
|
|
809
849
|
|
|
@@ -83,7 +83,8 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
83
83
|
Array.from(this.$.items.children).forEach((row) => {
|
|
84
84
|
if (!row.querySelector('[part~=details-cell]')) {
|
|
85
85
|
this._updateRow(row, this._columnTree[this._columnTree.length - 1]);
|
|
86
|
-
this.
|
|
86
|
+
const isDetailsOpened = this._isDetailsOpened(row._item);
|
|
87
|
+
this._toggleDetailsCell(row, isDetailsOpened);
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
}
|
|
@@ -77,12 +77,8 @@ export const SelectionMixin = (superClass) =>
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** @private */
|
|
80
|
-
_selectedItemsChanged(
|
|
81
|
-
|
|
82
|
-
Array.from(this.$.items.children).forEach((row) => {
|
|
83
|
-
this._updateItem(row, row._item);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
80
|
+
_selectedItemsChanged() {
|
|
81
|
+
this.requestContentUpdate();
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
package/src/vaadin-grid.js
CHANGED
|
@@ -908,7 +908,6 @@ class Grid extends ElementMixin(
|
|
|
908
908
|
|
|
909
909
|
this._a11yUpdateRowLevel(row, model.level);
|
|
910
910
|
this._a11yUpdateRowSelected(row, model.selected);
|
|
911
|
-
this._a11yUpdateRowDetailsOpened(row, model.detailsOpened);
|
|
912
911
|
|
|
913
912
|
row.toggleAttribute('expanded', model.expanded);
|
|
914
913
|
row.toggleAttribute('selected', model.selected);
|