@vaadin/grid
Advanced tools
Comparing version 24.0.0 to 24.0.1
{ | ||
"name": "@vaadin/grid", | ||
"version": "24.0.0", | ||
"version": "24.0.1", | ||
"publishConfig": { | ||
@@ -49,13 +49,13 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/checkbox": "~24.0.0", | ||
"@vaadin/component-base": "~24.0.0", | ||
"@vaadin/lit-renderer": "~24.0.0", | ||
"@vaadin/text-field": "~24.0.0", | ||
"@vaadin/vaadin-lumo-styles": "~24.0.0", | ||
"@vaadin/vaadin-material-styles": "~24.0.0", | ||
"@vaadin/vaadin-themable-mixin": "~24.0.0" | ||
"@vaadin/checkbox": "~24.0.1", | ||
"@vaadin/component-base": "~24.0.1", | ||
"@vaadin/lit-renderer": "~24.0.1", | ||
"@vaadin/text-field": "~24.0.1", | ||
"@vaadin/vaadin-lumo-styles": "~24.0.1", | ||
"@vaadin/vaadin-material-styles": "~24.0.1", | ||
"@vaadin/vaadin-themable-mixin": "~24.0.1" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/polymer-legacy-adapter": "~24.0.0", | ||
"@vaadin/polymer-legacy-adapter": "~24.0.1", | ||
"@vaadin/testing-helpers": "^0.4.0", | ||
@@ -69,3 +69,3 @@ "lit": "^2.0.0", | ||
], | ||
"gitHead": "b0cf651bb624d74b78a42b3e3ea889b2e401daec" | ||
"gitHead": "41f02b2407a3587da78bce6f0753027ff96f16d8" | ||
} |
@@ -8,3 +8,3 @@ /** | ||
import { Debouncer } from '@vaadin/component-base/src/debounce.js'; | ||
import { getBodyRowCells, iterateChildren, updateCellsPart, updateState } from './vaadin-grid-helpers.js'; | ||
import { getBodyRowCells, updateCellsPart, updateState } from './vaadin-grid-helpers.js'; | ||
@@ -407,8 +407,6 @@ /** | ||
iterateChildren(this.$.items, (row) => { | ||
if (!row.hidden) { | ||
const cachedItem = this._cache.getItemForIndex(row.index); | ||
if (cachedItem) { | ||
this._getItem(row.index, row); | ||
} | ||
this._getVisibleRows().forEach((row) => { | ||
const cachedItem = this._cache.getItemForIndex(row.index); | ||
if (cachedItem) { | ||
this._getItem(row.index, row); | ||
} | ||
@@ -415,0 +413,0 @@ }); |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { iterateChildren, updateRowStates } from './vaadin-grid-helpers.js'; | ||
import { iterateChildren, updateBooleanRowStates, updateStringRowStates } from './vaadin-grid-helpers.js'; | ||
@@ -160,3 +160,3 @@ const DropMode = { | ||
updateRowStates(row, { dragstart: rows.length > 1 ? `${rows.length}` : '' }); | ||
updateBooleanRowStates(row, { dragstart: rows.length > 1 ? `${rows.length}` : '' }); | ||
this.style.setProperty('--_grid-drag-start-x', `${e.clientX - rowRect.left + 20}px`); | ||
@@ -166,3 +166,3 @@ this.style.setProperty('--_grid-drag-start-y', `${e.clientY - rowRect.top + 10}px`); | ||
requestAnimationFrame(() => { | ||
updateRowStates(row, { dragstart: null }); | ||
updateBooleanRowStates(row, { dragstart: false }); | ||
this.style.setProperty('--_grid-drag-start-x', ''); | ||
@@ -261,3 +261,3 @@ this.style.setProperty('--_grid-drag-start-y', ''); | ||
if (row.getAttribute('dragover') !== this._dropLocation) { | ||
updateRowStates(row, { dragover: this._dropLocation }, true); | ||
updateStringRowStates(row, { dragover: this._dropLocation }); | ||
} | ||
@@ -317,3 +317,3 @@ } else { | ||
iterateChildren(this.$.items, (row) => { | ||
updateRowStates(row, { dragover: null }, true); | ||
updateStringRowStates(row, { dragover: null }); | ||
}); | ||
@@ -406,3 +406,3 @@ } | ||
updateRowStates(row, { | ||
updateBooleanRowStates(row, { | ||
'drag-disabled': !!dragDisabled, | ||
@@ -409,0 +409,0 @@ 'drop-disabled': !!dropDisabled, |
@@ -89,5 +89,4 @@ /** | ||
* @param {Object} states | ||
* @param {boolean} appendValue | ||
*/ | ||
export function updateRowStates(row, states, appendValue) { | ||
export function updateBooleanRowStates(row, states) { | ||
const cells = getBodyRowCells(row); | ||
@@ -99,3 +98,3 @@ | ||
const rowPart = appendValue ? `${state}-${value}-row` : `${state}-row`; | ||
const rowPart = `${state}-row`; | ||
@@ -111,2 +110,31 @@ // Row part attribute | ||
/** | ||
* @param {!HTMLElement} row | ||
* @param {Object} states | ||
*/ | ||
export function updateStringRowStates(row, states) { | ||
const cells = getBodyRowCells(row); | ||
Object.entries(states).forEach(([state, value]) => { | ||
const prevValue = row.getAttribute(state); | ||
// Row state attribute | ||
updateState(row, state, value); | ||
// remove previous part from row and cells if there was any | ||
if (prevValue) { | ||
const prevRowPart = `${state}-${prevValue}-row`; | ||
updatePart(row, false, prevRowPart); | ||
updateCellsPart(cells, `${prevRowPart}-cell`, false); | ||
} | ||
// set new part to rows and cells if there is a value | ||
if (value) { | ||
const rowPart = `${state}-${value}-row`; | ||
updatePart(row, value, rowPart); | ||
updateCellsPart(cells, `${rowPart}-cell`, value); | ||
} | ||
}); | ||
} | ||
/** | ||
* @param {!HTMLElement} cell | ||
@@ -113,0 +141,0 @@ * @param {string} attribute |
@@ -30,3 +30,3 @@ /** | ||
import { FilterMixin } from './vaadin-grid-filter-mixin.js'; | ||
import { getBodyRowCells, iterateChildren, updateCellsPart, updateRowStates } from './vaadin-grid-helpers.js'; | ||
import { getBodyRowCells, iterateChildren, updateBooleanRowStates, updateCellsPart } from './vaadin-grid-helpers.js'; | ||
import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js'; | ||
@@ -979,3 +979,3 @@ import { RowDetailsMixin } from './vaadin-grid-row-details-mixin.js'; | ||
_updateRowOrderParts(row, index = row.index) { | ||
updateRowStates(row, { | ||
updateBooleanRowStates(row, { | ||
first: index === 0, | ||
@@ -990,3 +990,3 @@ last: index === this._effectiveSize - 1, | ||
_updateRowStateParts(row, { expanded, selected, detailsOpened }) { | ||
updateRowStates(row, { | ||
updateBooleanRowStates(row, { | ||
expanded, | ||
@@ -993,0 +993,0 @@ selected, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
562812
13653