UNPKG

graphdb-workbench

Version:
2 lines 6.02 kB
export const __webpack_id__=84718;export const __webpack_ids__=[84718];export const __webpack_modules__={2695:(e,t,n)=>{var o;n.d(t,{I:()=>o}),function(e){e.INTERNAL_DOWNLOAD_AS_EVENT="internalDownloadAsEvent",e.INTERNAL_DROPDOWN_VALUE_SELECTED_EVENT="internalDropdownValueSelectedEvent",e.INTERNAL_NOTIFICATION_MESSAGE_EVENT="internalNotificationMessageEvent",e.INTERNAL_SHOW_RESOURCE_COPY_LINK_DIALOG_EVENT="internalShowResourceCopyLinkDialogEvent",e.INTERNAL_SHOW_SAVED_QUERIES_EVENT="internalShowSavedQueriesEvent",e.INTERNAL_SHARE_QUERY_EVENT="internalShareQueryEvent",e.INTERNAL_EXPLAIN_QUERY_EVENT="internalExplainQueryEvent",e.INTERNAL_YASQE_DROPDOWN_ACTION_SELECTED_EVENT="internalYasqeDropdownActionSelected",e.INTERNAL_CREATE_SAVED_QUERY_EVENT="internalCreateSavedQueryEvent",e.INTERNAL_QUERY_EXECUTED="internalQueryExecuted",e.INTERNAL_QUERY_EVENT="internalQueryEvent",e.INTERNAL_COUNT_QUERY_EVENT="internalCountQueryEvent",e.INTERNAL_COUNT_QUERY_RESPONSE_EVENT="internalCountQueryResponseEvent",e.INTERNAL_REQUEST_ABORTED_EVENT="internalRequestAbortedEvent",e.INTERNAL_KEYBOARD_SHORTCUTS_CLICKED_EVENT="internalKeyboardShortcutsClickedEvent"}(o||(o={}))},84718:(e,t,n)=>{n.r(t),n.d(t,{query_split_button:()=>l});var o=n(76128),i=n(2695);class r{constructor(e){this.TYPE=i.I.INTERNAL_YASQE_DROPDOWN_ACTION_SELECTED_EVENT,this.payload=e}}const l=class{constructor(e){(0,o.r)(this,e),this.runActions=[{labelKey:"yasqe.dropdown.run_query.option.explain_query_plan",value:"explain_plan"},{labelKey:"yasqe.dropdown.run_query.option.llm_explain_all",value:"explain_all"},{labelKey:"yasqe.dropdown.run_query.option.llm_explain_query",value:"explain_query"},{labelKey:"yasqe.dropdown.run_query.option.llm_explain_results",value:"explain_results"}],this.toggleQuerySplitMenu=()=>{this.querySplitOpen?this.closeQuerySplitMenu():this.openQuerySplitMenu()},this.yasqe=void 0,this.translationService=void 0,this.eventService=void 0,this.querySplitOpen=!1}onWindowClick(e){this.querySplitOpen&&this.hostElement&&!this.hostElement.contains(e.target)&&this.closeQuerySplitMenu()}onWindowScroll(){this.querySplitOpen&&this.closeQuerySplitMenu()}onKeyDown(e){"Escape"===e.key&&this.querySplitOpen&&this.closeQuerySplitMenu()}onWindowResize(){this.querySplitOpen&&this.closeQuerySplitMenu()}positionDropdownMenu(){const e=window.getComputedStyle(document.querySelector(".yasqe_queryButton")).marginTop,t=parseFloat(e)||0;setTimeout(()=>{const e=this.hostElement.querySelector(".yasqe_querySplitWrapper"),n=this.hostElement.querySelector(".ontotext-run-dropdown-menu.open");if(e&&n){const e=this.hostElement.closest(".yasgui-host-element"),o=!!e&&e.classList.contains("orientation-horizontal")&&e.classList.contains("mode-yasgui"),i=this.hostElement.getBoundingClientRect(),r=this.yasqe.classList.contains("yasqe-fullscreen"),l=window.getComputedStyle(document.querySelector(".yasqe_buttons")),s="auto"!==l.right&&parseFloat(l.right)||0;if(n.style.position="fixed",o)n.style.removeProperty("right");else{const e=(parseFloat(n.style.right)||0)+s+33;n.style.right=`${e}px`}const a=n.getBoundingClientRect().height;r?(n.style.top=`${i.top-a+t}px`,n.style.right=window.innerWidth-i.right+"px"):n.style.top=`${i.bottom+2}px`}})}openQuerySplitMenu(){this.querySplitOpen=!0,this.positionDropdownMenu()}closeQuerySplitMenu(){this.querySplitOpen=!1}handleDropdownAction(e){this.eventService.emit(new r(e))}parseShortcutLabel(e){return e.split("-").map(e=>e.trim()).filter(e=>e.length>0)}render(){const e=this.querySplitOpen?"icon-caret-up-after":"icon-caret-down-after";return(0,o.h)("div",{class:"yasqe_querySplitWrapper"},(0,o.h)("button",{type:"button",class:`yasqe_querySplitToggle ${e}`,"aria-label":this.translationService.translate("yasqe.action.run_query.split.toggle.aria"),onClick:this.toggleQuerySplitMenu}),this.querySplitOpen&&(0,o.h)("div",{class:"yasqe-inline-dropdown ontotext-run-dropdown open"},(0,o.h)("div",{class:"ontotext-run-dropdown-menu open",role:"menu"},this.runActions.map(e=>(0,o.h)("div",{class:"ontotext-run-dropdown-menu-item",role:"menuitem",onClick:t=>{t.preventDefault(),this.handleDropdownAction(e.value),this.closeQuerySplitMenu()}},(0,o.h)("span",{class:"ontotext-run-dropdown-menu-item__label"},this.translationService.translate(e.labelKey)),e.shortcut&&(0,o.h)("span",{class:"ontotext-run-dropdown-menu-item__shortcut"},this.parseShortcutLabel(this.translationService.translate(e.shortcut)).map(e=>(0,o.h)("kbd",{class:"key"},e))))))))}get hostElement(){return(0,o.g)(this)}};l.style='query-split-button .yasqe_querySplitWrapper{position:relative;height:100%}query-split-button .yasqe_querySplitWrapper .yasqe_querySplitToggle{background-color:#9E2B0A;color:#FFFFFF;font-weight:400;height:100%;margin-left:1px;border:none;z-index:9998}query-split-button .yasqe_querySplitWrapper .yasqe_querySplitToggle:hover{background-color:#9E2B0A}query-split-button .yasqe_querySplitWrapper .yasqe-inline-dropdown{position:absolute;top:100%;margin-top:4px;min-width:140px;width:max-content;z-index:10000;display:block}query-split-button .ontotext-run-dropdown{width:max-content;position:absolute;top:100%;right:0;z-index:1400}query-split-button .ontotext-run-dropdown-menu{background-color:#FFFFFF;box-shadow:0 2px 6px rgba(0, 0, 0, 0.15);border-radius:4px;min-width:140px;font-size:13px}query-split-button .ontotext-run-dropdown-menu.open{display:block;padding:5px 0}query-split-button .ontotext-run-dropdown-menu-item{display:flex;justify-content:space-between;font-family:var(--main-font);gap:5px;padding:6px 12px;text-decoration:none;text-align:left;color:#000000;cursor:pointer}query-split-button .ontotext-run-dropdown-menu-item:hover{background-color:#F2F2F2;color:#000000;text-decoration:none}query-split-button .ontotext-run-dropdown-menu-item__label{font-size:16px;font-family:"Roboto", sans-serif;font-weight:400}query-split-button .ontotext-run-dropdown-menu-item__shortcut kbd{background-color:#000000;color:#FFFFFF;font-size:0.8rem}'}}; //# sourceMappingURL=84718.eab750ed91f90068b3a3.bundle.js.map