checks for dynamic column count for our current size, returning true if changed
()
| 960 | |
| 961 | /** checks for dynamic column count for our current size, returning true if changed */ |
| 962 | protected checkDynamicColumn(): boolean { |
| 963 | const resp = this.opts.columnOpts; |
| 964 | if (!resp || (!resp.columnWidth && !resp.breakpoints?.length)) return false; |
| 965 | const column = this.getColumn(); |
| 966 | let newColumn = column; |
| 967 | const w = this._widthOrContainer(true); |
| 968 | if (resp.columnWidth) { |
| 969 | newColumn = Math.min(Math.round(w / resp.columnWidth) || 1, resp.columnMax); |
| 970 | } else { |
| 971 | // find the closest breakpoint (already sorted big to small) that matches |
| 972 | newColumn = resp.columnMax; |
| 973 | let i = 0; |
| 974 | while (i < resp.breakpoints.length && w <= resp.breakpoints[i].w) { |
| 975 | newColumn = resp.breakpoints[i++].c || column; |
| 976 | } |
| 977 | } |
| 978 | if (newColumn !== column) { |
| 979 | const bk = resp.breakpoints?.find(b => b.c === newColumn); |
| 980 | this.column(newColumn, bk?.layout || resp.layout); |
| 981 | return true; |
| 982 | } |
| 983 | return false; |
| 984 | } |
| 985 | |
| 986 | /** |
| 987 | * Re-layout grid items to reclaim any empty space. This is useful after removing widgets |
no test coverage detected