@meleon/uni-ui
Version:
A uniapp components library written in vue3 and typescript
1 lines • 967 B
JavaScript
const flattenColumns=n=>{const e=[];return n.forEach((n=>{n.children?e.push.apply(e,flattenColumns(n.children)):e.push(n)})),e};export class Watcher{constructor(){this.states={data:[],_columns:[],fixedColumns:[],fixedColumnsLength:0,notFixedColumns:[],notFixedColumnsLength:0,originColumns:[],fixedLeafColumns:[],fixedLeafColumnLength:0},this.observerList=[]}updateColumns(){const n=this.states,e=n._columns||[];n.fixedColumns=e.filter((n=>void 0!==n.fixed)).map((n=>Object.assign(Object.assign({},n),{width:0===n.width?80:n.width}))),n.fixedColumnsLength=n.fixedColumns.length,n.notFixedColumns=e.filter((n=>!n.fixed)),n.notFixedColumnsLength=n.notFixedColumns.length,n.originColumns=[...n.fixedColumns,...n.notFixedColumns],n.fixedLeafColumns=flattenColumns(n.fixedColumns),n.leafColumns=flattenColumns(n.notFixedColumns),n.columns=[...n.fixedLeafColumns,...n.leafColumns],n.leafColumnsLength=n.leafColumns.length,n.fixedLeafColumnLength=n.fixedLeafColumns.length}}