import{__decorate}from"tslib";import{wxComponent,SuperComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{getRect}from"../common/utils";const{prefix:prefix}=config,classPrefix=`${prefix}-tab-bar`;let Tabbar=class extends SuperComponent{constructor(){super(...arguments),this.relations={"../tab-bar-item/tab-bar-item":{type:"descendant"}},this.externalClasses=[`${prefix}-class`],this.backupValue=-1,this.data={prefix:prefix,classPrefix:classPrefix,placeholderHeight:56},this.properties=props,this.controlledProps=[{key:"value",event:"change"}],this.observers={value(){this.updateChildren()},"fixed, placeholder"(){this.setPlaceholderHeight()}},this.lifetimes={ready(){this.showChildren()}},this.methods={setPlaceholderHeight(){this.properties.fixed&&this.properties.placeholder&&wx.nextTick(()=>{getRect(this,`.${classPrefix}`).then(e=>{this.setData({placeholderHeight:e.height})})})},showChildren(){const{value:e}=this.data;this.$children.forEach(t=>{t.setData({crowded:this.$children.length>3}),t.properties.value===e&&t.showSpread()})},updateChildren(){const{value:e}=this.data;this.$children.forEach(t=>{t.checkActive(e)})},updateValue(e){this._trigger("change",{value:e})},changeOtherSpread(e){this.$children.forEach(t=>{t.properties.value!==e&&t.closeSpread()})},initName(){return this.backupValue+=1}}}};Tabbar=__decorate([wxComponent()],Tabbar);export default Tabbar;