@internal
()
| 1860 | |
| 1861 | /** @internal */ |
| 1862 | protected _updateContainerHeight(): GridStack { |
| 1863 | if (!this.engine || this.engine.batchMode) return this; |
| 1864 | const parent = this.parentGridNode; |
| 1865 | let row = this.getRow() + this._extraDragRow; // this checks for minRow already |
| 1866 | const cellHeight = this.opts.cellHeight as number; |
| 1867 | const unit = this.opts.cellHeightUnit; |
| 1868 | if (!cellHeight) return this; |
| 1869 | |
| 1870 | // check for css min height (non nested grid). TODO: support mismatch, say: min % while unit is px. |
| 1871 | // If `minRow` was applied, don't override it with this check, and avoid performance issues |
| 1872 | // (reflows) using `getComputedStyle` |
| 1873 | if (!parent && !this.opts.minRow) { |
| 1874 | const cssMinHeight = Utils.parseHeight(getComputedStyle(this.el)['minHeight']); |
| 1875 | if (cssMinHeight.h > 0 && cssMinHeight.unit === unit) { |
| 1876 | const minRow = Math.floor(cssMinHeight.h / cellHeight); |
| 1877 | if (row < minRow) { |
| 1878 | row = minRow; |
| 1879 | } |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | this.el.setAttribute('gs-current-row', String(row)); |
| 1884 | this.el.style.removeProperty('min-height'); |
| 1885 | this.el.style.removeProperty('height'); |
| 1886 | if (row) { |
| 1887 | // nested grids have 'insert:0' to fill the space of parent by default, but we may be taller so use min-height for possible scrollbars |
| 1888 | this.el.style[parent ? 'minHeight' : 'height'] = row * cellHeight + unit; |
| 1889 | } |
| 1890 | |
| 1891 | // if we're a nested grid inside an sizeToContent item, tell it to resize itself too |
| 1892 | if (parent && Utils.shouldSizeToContent(parent)) { |
| 1893 | parent.grid.resizeToContentCBCheck(parent.el); |
| 1894 | } |
| 1895 | |
| 1896 | return this; |
| 1897 | } |
| 1898 | |
| 1899 | /** @internal */ |
| 1900 | protected _prepareElement(el: GridItemHTMLElement, triggerAddEvent = false, node?: GridStackNode): GridStack { |
no test coverage detected