@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 1.13 kB
JavaScript
import{__decorate as c}from"tslib";import{computed as h}from"mobx";import{BaseShortcutProvider as a}from"../ShortcutProvider";export class SearchShortcutProvider extends a{constructor(t){super(),this.rootStore=t,this.id="search"}createShortcuts(){const{searchButtonsStore:t}=this.rootStore,o=[],r=t.getActiveParent();if(r&&r.children){const s=r.children.filter(e=>e.visible);if(r.type==="poi_types"&&s.length===1)return o;s.forEach(e=>{if(e.type==="poi_types"||e.type==="categories"){const i=e.id?.toString()||e.name,n=t.isChildActive(i);o.push({id:i,label:e.name,enabled:!0,active:n,tooltip:n?`Remove ${e.name} from filter (show all ${r.name})`:`Filter only by ${e.name}`,variant:"default",action:"toggle",showResetButton:!1})}})}return o}get shortcuts(){return this.createShortcuts()}shouldShowShortcuts(){const{searchButtonsStore:t}=this.rootStore;return t.hasActiveParentWithChildren}handleShortcutClick(t){const{searchButtonsStore:o}=this.rootStore;o.toggleChildFilter(t)}handleShortcutReset(){const{searchButtonsStore:t}=this.rootStore;t.clearAllChildFilters()}}c([h],SearchShortcutProvider.prototype,"shortcuts",null);