@vaadin/vaadin-grid
Advanced tools
Comparing version 5.3.0-alpha7 to 5.3.0-alpha8
@@ -18,3 +18,3 @@ { | ||
"name": "@vaadin/vaadin-grid", | ||
"version": "5.3.0-alpha7", | ||
"version": "5.3.0-alpha8", | ||
"main": "vaadin-grid.js", | ||
@@ -21,0 +21,0 @@ "author": "Vaadin Ltd", |
@@ -286,3 +286,2 @@ /** | ||
this.__setColumnTemplateOrRenderer(headerTemplate, headerRenderer, [headerCell]); | ||
headerCell.parentElement.hidden = false; | ||
} | ||
@@ -294,3 +293,3 @@ } | ||
this.__setColumnTemplateOrRenderer(footerTemplate, footerRenderer, [footerCell]); | ||
footerCell.parentElement.hidden = false; | ||
this._grid.__updateHeaderFooterRowVisibility(footerCell.parentElement); | ||
} | ||
@@ -358,6 +357,5 @@ } | ||
_pathOrHeaderChanged(path, header, headerCell, footerCell, cells, renderer, headerRenderer, bodyTemplate, headerTemplate) { | ||
const hasHeaderText = header !== undefined && header !== null; | ||
const hasHeaderText = header !== undefined; | ||
if (!headerRenderer && !headerTemplate && hasHeaderText && headerCell) { | ||
this.__setTextContent(headerCell._content, header); | ||
headerCell.parentElement.hidden = false; | ||
} | ||
@@ -371,7 +369,10 @@ | ||
if (!headerRenderer && !headerTemplate && !hasHeaderText && headerCell) { | ||
if (!headerRenderer && !headerTemplate && !hasHeaderText && headerCell && header !== null) { | ||
this.__setTextContent(headerCell._content, this._generateHeader(path)); | ||
headerCell.parentElement.hidden = false; | ||
} | ||
} | ||
if (headerCell) { | ||
this._grid.__updateHeaderFooterRowVisibility(headerCell.parentElement); | ||
} | ||
} | ||
@@ -378,0 +379,0 @@ |
@@ -115,4 +115,6 @@ /** | ||
'vaadin-grid-filter', | ||
'vaadin-grid-filter-column', | ||
'vaadin-grid-tree-toggle', | ||
'vaadin-grid-selection-column', | ||
'vaadin-grid-sort-column', | ||
'vaadin-grid-sorter' | ||
@@ -119,0 +121,0 @@ ].forEach(elementName => { |
@@ -130,2 +130,4 @@ /** | ||
row.style.setProperty('padding-bottom', `${cell.offsetHeight}px`); | ||
requestAnimationFrame(() => this.notifyResize()); | ||
} | ||
@@ -132,0 +134,0 @@ } |
@@ -319,3 +319,3 @@ /** | ||
static get version() { | ||
return '5.3.0-alpha7'; | ||
return '5.3.0-alpha8'; | ||
} | ||
@@ -404,3 +404,3 @@ | ||
if (this._columnTree) { | ||
this._columnTree[this._columnTree.length - 1].forEach(c => c.notifyPath('_cells.*', c._cells)); | ||
this._columnTree[this._columnTree.length - 1].forEach(c => c.notifyPath && c.notifyPath('_cells.*', c._cells)); | ||
} | ||
@@ -514,6 +514,4 @@ | ||
cell = column[`_${section}Cell`] || this._createCell(tagName); | ||
cell._column = column; | ||
row.appendChild(cell); | ||
if (cell._instance) { | ||
row.hidden = false; | ||
} | ||
column[`_${section}Cell`] = cell; | ||
@@ -523,2 +521,3 @@ } else { | ||
cell = column._emptyCells.filter(cell => cell._vacant)[0] || this._createCell(tagName); | ||
cell._column = column; | ||
row.appendChild(cell); | ||
@@ -530,2 +529,3 @@ if (column._emptyCells.indexOf(cell) === -1) { | ||
cell.setAttribute('part', `cell ${section}-cell`); | ||
this.__updateHeaderFooterRowVisibility(row); | ||
} | ||
@@ -547,2 +547,43 @@ | ||
__updateHeaderFooterRowVisibility(row) { | ||
if (!row) { | ||
return; | ||
} | ||
const visibleRowCells = Array.from(row.children).filter(cell => { | ||
const column = cell._column; | ||
if (column._emptyCells && column._emptyCells.indexOf(cell) > -1) { | ||
// The cell is an "empty cell" -> doesn't block hiding the row | ||
return false; | ||
} | ||
if (row.parentElement === this.$.header) { | ||
if (column.headerRenderer || column._headerTemplate) { | ||
// The cell is the header cell of a column that has a header renderer | ||
// or a header template -> row should be visible | ||
return true; | ||
} | ||
if (column.header === null) { | ||
// The column header is explicilty set to null -> doesn't block hiding the row | ||
return false; | ||
} | ||
if (column.path || column.header !== undefined) { | ||
// The column has an explicit non-null header or a path that generates a header | ||
// -> row should be visible | ||
return true; | ||
} | ||
} else { | ||
if (column.footerRenderer || column._footerTemplate) { | ||
// The cell is the footer cell of a column that has a footer renderer | ||
// or a footer template -> row should be visible | ||
return true; | ||
} | ||
} | ||
}); | ||
if (row.hidden !== !visibleRowCells.length) { | ||
row.hidden = !visibleRowCells.length; | ||
this.notifyResize(); | ||
} | ||
} | ||
_updateScrollerItem(row, index) { | ||
@@ -549,0 +590,0 @@ this._preventScrollerRotatingCellFocus(row, index); |
260401
6846