(columns)
| 263 | // static functions |
| 264 | |
| 265 | static toModel(columns) { |
| 266 | // Convert array of Column into compressed list cols |
| 267 | const cols = []; |
| 268 | let col = null; |
| 269 | if (columns) { |
| 270 | columns.forEach((column, index) => { |
| 271 | if (column.isDefault) { |
| 272 | if (col) { |
| 273 | col = null; |
| 274 | } |
| 275 | } else if (!col || !column.equivalentTo(col)) { |
| 276 | col = { |
| 277 | min: index + 1, |
| 278 | max: index + 1, |
| 279 | width: column.width !== undefined ? column.width : DEFAULT_COLUMN_WIDTH, |
| 280 | style: column.style, |
| 281 | isCustomWidth: column.isCustomWidth, |
| 282 | hidden: column.hidden, |
| 283 | outlineLevel: column.outlineLevel, |
| 284 | collapsed: column.collapsed, |
| 285 | }; |
| 286 | cols.push(col); |
| 287 | } else { |
| 288 | col.max = index + 1; |
| 289 | } |
| 290 | }); |
| 291 | } |
| 292 | return cols.length ? cols : undefined; |
| 293 | } |
| 294 | |
| 295 | static fromModel(worksheet, cols) { |
| 296 | cols = cols || []; |
no test coverage detected