@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 2.26 kB
JavaScript
import{__esDecorate as a,__runInitializers as l}from"tslib";import{computed as u}from"mobx";import{BaseSubButtonProvider as c}from"../SubButtonProvider";let S=(()=>{let o=c,r=[],i;return class extends o{static{const t=typeof Symbol=="function"&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;i=[u],a(this,null,i,{kind:"getter",name:"computedSubButtons",static:!1,private:!1,access:{has:e=>"computedSubButtons"in e,get:e=>e.computedSubButtons},metadata:t},null,r),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}rootStore=l(this,r);id="sessions";constructor(t){super(),this.rootStore=t}get computedSubButtons(){const t=[];return t.push({id:"sessions_show_all",label:"All Tracks",text:"All Tracks",enabled:!0,active:this.rootStore.searchButtonsStore.activeSubButtonId==="sessions_show_all"||!this.rootStore.searchButtonsStore.activeSubButtonId&&!this.rootStore.uiState.selectedTrack,parentButtonId:"sessions",type:"show_all",onClick:()=>this.handleSessionsShowAllClick()}),this.rootStore.eventStore.tracks.forEach(e=>{const s=this.rootStore.eventStore.getEventsByTrack(e.id).length;t.push({id:`sessions_track_${e.id}`,label:e.name,text:e.name,enabled:!0,active:this.rootStore.searchButtonsStore.activeSubButtonId===`sessions_track_${e.id}`,parentButtonId:"sessions",type:"track",data:e,count:s,onClick:()=>this.handleSessionsTrackClick(e)})}),t}createSubButtons(){return this.computedSubButtons}handleSubButtonClick(t){if(t==="sessions_show_all")this.handleSessionsShowAllClick();else if(t.startsWith("sessions_track_")){const e=parseInt(t.replace("sessions_track_","")),s=this.rootStore.eventStore.tracks.find(n=>n.id===e);s&&this.handleSessionsTrackClick(s)}}shouldShowSubButtons(){return this.rootStore.eventStore.tracks.length>0}handleSessionsShowAllClick(){this.rootStore.uiState.list={type:"sessions",text:"",focused:!1},this.rootStore.uiState.selectedTrack=null,this.rootStore.searchButtonsStore.setSubButtonId("sessions_show_all")}handleSessionsTrackClick(t){this.rootStore.uiState.list={type:"sessions",text:"",focused:!1},this.rootStore.uiState.selectedTrack=t,this.rootStore.searchButtonsStore.setSubButtonId(`sessions_track_${t.id}`)}}})();export{S as SessionsSubButtonProvider};