@vaadin/grid
Advanced tools
Comparing version 22.0.3 to 22.0.4
{ | ||
"name": "@vaadin/grid", | ||
"version": "22.0.3", | ||
"version": "22.0.4", | ||
"publishConfig": { | ||
@@ -43,12 +43,12 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/checkbox": "^22.0.3", | ||
"@vaadin/component-base": "^22.0.3", | ||
"@vaadin/text-field": "^22.0.3", | ||
"@vaadin/vaadin-lumo-styles": "^22.0.3", | ||
"@vaadin/vaadin-material-styles": "^22.0.3", | ||
"@vaadin/vaadin-themable-mixin": "^22.0.3" | ||
"@vaadin/checkbox": "^22.0.4", | ||
"@vaadin/component-base": "^22.0.4", | ||
"@vaadin/text-field": "^22.0.4", | ||
"@vaadin/vaadin-lumo-styles": "^22.0.4", | ||
"@vaadin/vaadin-material-styles": "^22.0.4", | ||
"@vaadin/vaadin-themable-mixin": "^22.0.4" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/polymer-legacy-adapter": "^22.0.3", | ||
"@vaadin/polymer-legacy-adapter": "^22.0.4", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
@@ -58,3 +58,3 @@ "lit": "^2.0.0", | ||
}, | ||
"gitHead": "935ad1ea65a79b0f9ecb10d767689479b36c4e07" | ||
"gitHead": "55891f68d4da41e846e06dfe51dceba1665e41ce" | ||
} |
@@ -497,3 +497,5 @@ /** | ||
this.__renderCellsContent(headerRenderer, [headerCell]); | ||
this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement); | ||
if (this._grid) { | ||
this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement); | ||
} | ||
} | ||
@@ -537,3 +539,5 @@ | ||
this.__renderCellsContent(footerRenderer, [footerCell]); | ||
this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement); | ||
if (this._grid) { | ||
this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement); | ||
} | ||
} | ||
@@ -540,0 +544,0 @@ |
@@ -134,2 +134,33 @@ /** | ||
/** | ||
* Since the focused cell/row state is stored as an element reference, the reference may get | ||
* out of sync when the virtual indexes for elements update due to effective size change. | ||
* This function updates the reference to the correct element after a possible index change. | ||
* @private | ||
*/ | ||
__updateItemsFocusable() { | ||
if (!this._itemsFocusable) { | ||
return; | ||
} | ||
const wasFocused = this.shadowRoot.activeElement === this._itemsFocusable; | ||
this._getVisibleRows().forEach((row) => { | ||
if (row.index === this._focusedItemIndex) { | ||
if (this.__rowFocusMode) { | ||
// Row focus mode | ||
this._itemsFocusable = row; | ||
} else if (this._itemsFocusable.parentElement) { | ||
// Cell focus mode | ||
const cellIndex = [...this._itemsFocusable.parentElement.children].indexOf(this._itemsFocusable); | ||
this._itemsFocusable = row.children[cellIndex]; | ||
} | ||
} | ||
}); | ||
if (wasFocused) { | ||
this._itemsFocusable.focus(); | ||
} | ||
} | ||
/** | ||
* @param {!KeyboardEvent} e | ||
@@ -536,3 +567,7 @@ * @protected | ||
if (wantInteracting) { | ||
const focusTarget = cell._content.querySelector('[focus-target]') || cell._content.firstElementChild; | ||
const focusTarget = | ||
cell._content.querySelector('[focus-target]') || | ||
// If a child element hasn't been explicitly marked as a focus target, | ||
// fall back to any focusable element inside the cell. | ||
[...cell._content.querySelectorAll('*')].find((node) => this._isFocusable(node)); | ||
if (focusTarget) { | ||
@@ -809,2 +844,4 @@ e.preventDefault(); | ||
} | ||
} else { | ||
this.__updateItemsFocusable(); | ||
} | ||
@@ -811,0 +848,0 @@ } |
@@ -86,3 +86,5 @@ /** | ||
this._updateRow(row, this._columnTree[this._columnTree.length - 1]); | ||
this._a11yUpdateRowDetailsOpened(row, false); | ||
const isDetailsOpened = this._isDetailsOpened(row._item); | ||
this._a11yUpdateRowDetailsOpened(row, isDetailsOpened); | ||
this._toggleDetailsCell(row, isDetailsOpened); | ||
} | ||
@@ -89,0 +91,0 @@ }); |
@@ -80,8 +80,4 @@ /** | ||
/** @private */ | ||
_selectedItemsChanged(e) { | ||
if (this.$.items.children.length && (e.path === 'selectedItems' || e.path === 'selectedItems.splices')) { | ||
Array.from(this.$.items.children).forEach((row) => { | ||
this._updateItem(row, row._item); | ||
}); | ||
} | ||
_selectedItemsChanged() { | ||
this.requestContentUpdate(); | ||
} | ||
@@ -88,0 +84,0 @@ |
329248
8940