@vaadin/grid
Advanced tools
Comparing version 24.0.0-alpha6 to 24.0.0-alpha7
{ | ||
"name": "@vaadin/grid", | ||
"version": "24.0.0-alpha6", | ||
"version": "24.0.0-alpha7", | ||
"publishConfig": { | ||
@@ -49,13 +49,13 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/checkbox": "24.0.0-alpha6", | ||
"@vaadin/component-base": "24.0.0-alpha6", | ||
"@vaadin/lit-renderer": "24.0.0-alpha6", | ||
"@vaadin/text-field": "24.0.0-alpha6", | ||
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha6", | ||
"@vaadin/vaadin-material-styles": "24.0.0-alpha6", | ||
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha6" | ||
"@vaadin/checkbox": "24.0.0-alpha7", | ||
"@vaadin/component-base": "24.0.0-alpha7", | ||
"@vaadin/lit-renderer": "24.0.0-alpha7", | ||
"@vaadin/text-field": "24.0.0-alpha7", | ||
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha7", | ||
"@vaadin/vaadin-material-styles": "24.0.0-alpha7", | ||
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha7" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/polymer-legacy-adapter": "24.0.0-alpha6", | ||
"@vaadin/polymer-legacy-adapter": "24.0.0-alpha7", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
@@ -69,3 +69,3 @@ "lit": "^2.0.0", | ||
], | ||
"gitHead": "0004ac92b6e5f415b5fa949e0582d1d11e527b1f" | ||
"gitHead": "aeb4535336813636736759e0a5de148b26bfc3b6" | ||
} |
@@ -135,3 +135,3 @@ /** | ||
// Don’t unfreeze the frozen group because of a non-frozen child | ||
this.frozen = this.frozen || value; | ||
this.frozen ||= value; | ||
} | ||
@@ -141,3 +141,3 @@ | ||
// Don’t unfreeze the frozen group because of a non-frozen child | ||
this._lastFrozen = this._lastFrozen || value; | ||
this._lastFrozen ||= value; | ||
} | ||
@@ -147,3 +147,3 @@ | ||
// Don’t unfreeze the frozen group because of a non-frozen child | ||
this.frozenToEnd = this.frozenToEnd || value; | ||
this.frozenToEnd ||= value; | ||
} | ||
@@ -153,3 +153,3 @@ | ||
// Don’t unfreeze the frozen group because of a non-frozen child | ||
this._firstFrozenToEnd = this._firstFrozenToEnd || value; | ||
this._firstFrozenToEnd ||= value; | ||
} | ||
@@ -156,0 +156,0 @@ } |
@@ -228,4 +228,4 @@ /** | ||
_cellFromPoint(x, y) { | ||
x = x || 0; | ||
y = y || 0; | ||
x ||= 0; | ||
y ||= 0; | ||
if (!this._draggedColumn) { | ||
@@ -378,3 +378,3 @@ this.$.scroller.toggleAttribute('no-content-pointer-events', true); | ||
[column1._order, column2._order] = [column2._order, column1._order]; | ||
this._updateFrozenColumn(); | ||
this._debounceUpdateFrozenColumn(); | ||
this._updateFirstAndLastColumn(); | ||
@@ -381,0 +381,0 @@ } |
@@ -507,4 +507,4 @@ /** | ||
if (this._grid._updateFrozenColumn) { | ||
this._grid._updateFrozenColumn(); | ||
if (this._grid._debounceUpdateFrozenColumn) { | ||
this._grid._debounceUpdateFrozenColumn(); | ||
} | ||
@@ -589,4 +589,4 @@ | ||
this.__renderCellsContent(headerRenderer, [headerCell]); | ||
if (this._grid) { | ||
this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement); | ||
if (this._grid && headerCell.parentElement) { | ||
this._grid.__debounceUpdateHeaderFooterRowVisibility(headerCell.parentElement); | ||
} | ||
@@ -631,4 +631,4 @@ } | ||
this.__renderCellsContent(footerRenderer, [footerCell]); | ||
if (this._grid) { | ||
this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement); | ||
if (this._grid && footerCell.parentElement) { | ||
this._grid.__debounceUpdateHeaderFooterRowVisibility(footerCell.parentElement); | ||
} | ||
@@ -635,0 +635,0 @@ } |
@@ -204,6 +204,13 @@ /** | ||
}); | ||
this._updateFrozenColumn(); | ||
this._debounceUpdateFrozenColumn(); | ||
} | ||
/** @protected */ | ||
_debounceUpdateFrozenColumn() { | ||
this.__debounceUpdateFrozenColumn = Debouncer.debounce(this.__debounceUpdateFrozenColumn, microTask, () => | ||
this._updateFrozenColumn(), | ||
); | ||
} | ||
/** @private */ | ||
_updateFrozenColumn() { | ||
@@ -210,0 +217,0 @@ if (!this._columnTree) { |
@@ -10,4 +10,6 @@ /** | ||
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js'; | ||
import { microTask } from '@vaadin/component-base/src/async.js'; | ||
import { isAndroid, isChrome, isFirefox, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js'; | ||
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'; | ||
import { Debouncer } from '@vaadin/component-base/src/debounce.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
@@ -574,2 +576,14 @@ import { TabindexMixin } from '@vaadin/component-base/src/tabindex-mixin.js'; | ||
__getIntrinsicWidth(col) { | ||
if (this.__intrinsicWidthCache.has(col)) { | ||
return this.__intrinsicWidthCache.get(col); | ||
} | ||
const width = this.__calculateIntrinsicWidth(col); | ||
this.__intrinsicWidthCache.set(col, width); | ||
return width; | ||
} | ||
/** @private */ | ||
__calculateIntrinsicWidth(col) { | ||
const initialWidth = col.width; | ||
@@ -641,2 +655,7 @@ const initialFlexGrow = col.flexGrow; | ||
this.__virtualizer.flush(); | ||
[...this.$.header.children, ...this.$.footer.children].forEach((row) => { | ||
if (row.__debounceUpdateHeaderFooterRowVisibility) { | ||
row.__debounceUpdateHeaderFooterRowVisibility.flush(); | ||
} | ||
}); | ||
@@ -648,2 +667,4 @@ // Flush to account for any changes to the visibility of the columns | ||
this.__intrinsicWidthCache = new Map(); | ||
cols.forEach((col) => { | ||
@@ -791,3 +812,3 @@ col.width = `${this.__getDistributedWidth(col)}px`; | ||
_updateRow(row, columns, section, isColumnRow, noNotify) { | ||
section = section || 'body'; | ||
section ||= 'body'; | ||
@@ -808,3 +829,3 @@ const contentsFragment = document.createDocumentFragment(); | ||
// Body | ||
column._cells = column._cells || []; | ||
column._cells ||= []; | ||
cell = column._cells.find((cell) => cell._vacant); | ||
@@ -820,3 +841,3 @@ if (!cell) { | ||
// Add details cell as last cell to body rows | ||
this._detailsCells = this._detailsCells || []; | ||
this._detailsCells ||= []; | ||
const detailsCell = this._detailsCells.find((cell) => cell._vacant) || this._createCell('td'); | ||
@@ -847,3 +868,3 @@ if (this._detailsCells.indexOf(detailsCell) === -1) { | ||
} else { | ||
column._emptyCells = column._emptyCells || []; | ||
column._emptyCells ||= []; | ||
cell = column._emptyCells.find((cell) => cell._vacant) || this._createCell(tagName); | ||
@@ -857,3 +878,2 @@ cell._column = column; | ||
cell.setAttribute('part', `cell ${section}-cell`); | ||
this.__updateHeaderFooterRowVisibility(row); | ||
} | ||
@@ -868,2 +888,6 @@ | ||
if (section !== 'body') { | ||
this.__debounceUpdateHeaderFooterRowVisibility(row); | ||
} | ||
// Might be empty if only cache was used | ||
@@ -880,2 +904,14 @@ this.appendChild(contentsFragment); | ||
*/ | ||
__debounceUpdateHeaderFooterRowVisibility(row) { | ||
row.__debounceUpdateHeaderFooterRowVisibility = Debouncer.debounce( | ||
row.__debounceUpdateHeaderFooterRowVisibility, | ||
microTask, | ||
() => this.__updateHeaderFooterRowVisibility(row), | ||
); | ||
} | ||
/** | ||
* @param {HTMLTableRowElement} row | ||
* @protected | ||
*/ | ||
__updateHeaderFooterRowVisibility(row) { | ||
@@ -882,0 +918,0 @@ if (!row) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
492638
12623
+ Added@vaadin/checkbox@24.0.0-alpha7(transitive)
+ Added@vaadin/component-base@24.0.0-alpha7(transitive)
+ Added@vaadin/field-base@24.0.0-alpha7(transitive)
+ Added@vaadin/icon@24.0.0-alpha7(transitive)
+ Added@vaadin/input-container@24.0.0-alpha7(transitive)
+ Added@vaadin/lit-renderer@24.0.0-alpha7(transitive)
+ Added@vaadin/text-field@24.0.0-alpha7(transitive)
+ Added@vaadin/vaadin-lumo-styles@24.0.0-alpha7(transitive)
+ Added@vaadin/vaadin-material-styles@24.0.0-alpha7(transitive)
+ Added@vaadin/vaadin-themable-mixin@24.0.0-alpha7(transitive)
- Removed@vaadin/checkbox@24.0.0-alpha6(transitive)
- Removed@vaadin/component-base@24.0.0-alpha6(transitive)
- Removed@vaadin/field-base@24.0.0-alpha6(transitive)
- Removed@vaadin/icon@24.0.0-alpha6(transitive)
- Removed@vaadin/input-container@24.0.0-alpha6(transitive)
- Removed@vaadin/lit-renderer@24.0.0-alpha6(transitive)
- Removed@vaadin/text-field@24.0.0-alpha6(transitive)
- Removed@vaadin/vaadin-lumo-styles@24.0.0-alpha6(transitive)
- Removed@vaadin/vaadin-material-styles@24.0.0-alpha6(transitive)
- Removed@vaadin/vaadin-themable-mixin@24.0.0-alpha6(transitive)