UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 1.5 kB
import{__esDecorate as h,__runInitializers as u}from"tslib";import{computed as S}from"mobx";import{BaseShortcutProvider as d}from"../ShortcutProvider";let m=(()=>{let s=d,a=[],i;return class extends s{static{const t=typeof Symbol=="function"&&Symbol.metadata?Object.create(s[Symbol.metadata]??null):void 0;i=[S],h(this,null,i,{kind:"getter",name:"shortcuts",static:!1,private:!1,access:{has:e=>"shortcuts"in e,get:e=>e.shortcuts},metadata:t},null,a),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}rootStore=u(this,a);id="search";constructor(t){super(),this.rootStore=t}createShortcuts(){const{searchButtonsStore:t}=this.rootStore,e=[],o=t.getActiveParent();if(o&&o.children){const n=o.children.filter(r=>r.visible);if(o.type==="poi_types"&&n.length===1)return e;n.forEach(r=>{if(r.type==="poi_types"||r.type==="categories"){const c=r.id?.toString()||r.name,l=t.isChildActive(c);e.push({id:c,label:r.name,enabled:!0,active:l,tooltip:l?`Remove ${r.name} from filter (show all ${o.name})`:`Filter only by ${r.name}`,variant:"default",action:"toggle",showResetButton:!1})}})}return e}get shortcuts(){return this.createShortcuts()}shouldShowShortcuts(){const{searchButtonsStore:t}=this.rootStore;return t.hasActiveParentWithChildren}handleShortcutClick(t){const{searchButtonsStore:e}=this.rootStore;e.toggleChildFilter(t)}handleShortcutReset(){const{searchButtonsStore:t}=this.rootStore;t.clearAllChildFilters()}}})();export{m as SearchShortcutProvider};