UNPKG

graphdb-workbench

Version:
2 lines 10.6 kB
export const __webpack_esm_id__=78681;export const __webpack_esm_ids__=[78681];export const __webpack_esm_modules__={44123(e,t,n){var o;n.d(t,{O:()=>o}),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom",e.AUTO="auto"}(o||(o={}))},78681(e,t,n){n.r(t),n.d(t,{onto_dialog:()=>r,onto_toggle_switch:()=>g});var o=n(55508),a=n(81491),s=n(79939),i=n(44123);n(57154);const r=class{constructor(e){(0,o.r)(this,e),this.handleClose=e=>{this.config.onClose(e)}}componentDidLoad(){this.documentOverflow=a.H.hideDocumentBodyOverflow(),this.hostElement.addEventListener("keydown",this.preventLeavingDialog.bind(this)),this.closeButton.focus()}disconnectedCallback(){this.hostElement.removeEventListener("keydown",this.preventLeavingDialog.bind(this)),a.H.setDocumentBodyOverflow(this.documentOverflow)}render(){return(0,o.h)(o.a,{key:"eeffeaac1aa5b80b89d0d176d89dc44291fd0cbb",tabindex:"-1"},(0,o.h)("div",{key:"2ba8415fa038ad2666cc0b340a3ceba6f0919bc6",class:`dialog-overlay ${this.config.modalClass?this.config.modalClass:""}`},(0,o.h)("dialog",{key:"39b9fc94944e12e8dcae98a65e74593dc173b336",class:"dialog"},(0,o.h)("header",{key:"183327aad084ff6fd619d204a537871cace84684",class:"dialog-header"},(0,o.h)("h3",{key:"ae4c514e0f75e46d5787d284154392de808100ca",class:"dialog-title"},this.config.dialogTitle)),(0,o.h)("main",{key:"dc991f0ef3baa22f42f683528a4ca67ab8d5e7f4",class:"dialog-body"},(0,o.h)("slot",{key:"ddc1c5176d976f5a518fed1d2faa138d0bc5082a",name:"body"})),(0,o.h)("footer",{key:"b3cb9449b54583a7b5489b7d56fa084e456b4d75",class:"dialog-footer"},(0,o.h)("slot",{key:"b3bc85bdfe12da62019be2e542737e5b6f7db4f6",name:"footer"}),(0,o.h)("button",{key:"c58a84d33d8d07ae67a9988adaa320166371cc5b",class:"onto-btn onto-btn-primary",onClick:this.handleClose,ref:e=>this.closeButton=e},(0,o.h)("translate-label",{key:"b593b5e113baa66e6878a2e885a46bc6581bf27f",labelKey:"common.button.close"}))))))}preventLeavingDialog(e){a.H.preventLeavingDialog(this.hostElement,e)}get hostElement(){return(0,o.g)(this)}};r.style=".dialog-overlay{position:fixed;top:0;bottom:0;left:0;right:0;display:flex;align-items:center;justify-content:center;z-index:9998;margin-left:-10px;background-color:rgba(0, 0, 0, 0.5);font-family:var(--main-font), sans-serif;font-weight:var(--main-font-weight);color:var(--gw-secondary-base, var(--base-text-color))}.dialog{z-index:1001;max-width:60vw;max-height:90vh;font-family:inherit;font-weight:inherit;display:flex;flex-direction:column;position:relative;justify-content:space-between;border:none;color:var(--gw-dialog-color);background-color:var(--gw-dialog-background);box-shadow:0 5px 15px rgba(0, 0, 0, 0.5)}.dialog .dialog-header{display:flex;justify-content:space-between;padding:15px;font-size:20px}.dialog .dialog-header .dialog-title{margin:0.5rem 0;font-weight:400}.dialog .dialog-body{padding:0 15px 15px;overflow:auto}.dialog .dialog-footer{display:flex;justify-content:flex-end;padding:15px}";class l{static deepEqual(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if("object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!l.deepEqual(e[n],t[n]))return!1;return!0}if(!Array.isArray(e)&&!Array.isArray(t)){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n)if(!(o in t)||!l.deepEqual(e[o],t[o]))return!1;return!0}return!1}return!1}static deepCopy(e){if("object"!=typeof e||null==e||"function"==typeof e)return e;if(l.hasCopyMethod(e))return e.copy();const t=l.copyBuiltInType(e);return null!==t?t:l.copyPlainObject(e)}static copyBuiltInType(e){return Array.isArray(e)?e.map(e=>l.deepCopy(e)):e instanceof Date?new Date(e.getTime()):e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Map?new Map(Array.from(e.entries()).map(([e,t])=>[l.deepCopy(e),l.deepCopy(t)])):e instanceof Set?new Set(Array.from(e.values()).map(e=>l.deepCopy(e))):null}static copyPlainObject(e){const t=Object.create(Object.getPrototypeOf(e));for(const n of Object.keys(e))t[n]=l.deepCopy(e[n]);return t}static hasCopyMethod(e){return"object"==typeof e&&null!==e&&Object.prototype.hasOwnProperty.call(e,"copy")&&"function"==typeof e.copy}}l.isNullOrUndefined=e=>null==e;class c{copy(){return l.deepCopy(this)}}class d extends c{constructor(e=[]){super(),this.items=e}size(){return this.items.length}getItems(){return this.items}getFirstItem(){return this.items[0]}sort(e){this.items.sort(e)}filter(e){return this.items.filter(e)}find(e){return this.items.find(e)}isEmpty(){return 0===this.items.length}addToStart(e){this.items.unshift(e)}addItems(e){this.items.push(...e)}remove(e){const t=this.items.indexOf(e);-1!==t&&this.items.splice(t,1)}}class h extends d{constructor(e){super(e)}add(e){this.items.push(e)}addAll(e){this.items.push(...e)}unsubscribeAll(){this.items.forEach(e=>e()),this.items=[]}}const g=class{constructor(e){(0,o.r)(this,e),this.toggleChanged=(0,o.c)(this,"toggleChanged"),this.subscriptions=new h,this.checked=!1,this.toggle=()=>{this.checked=!this.checked,this.toggleChanged.emit({checked:this.checked,context:this.context})}}subscribeToLanguageChange(){this.tooltipTranslationKey&&this.subscriptions.add(s.T.onTranslate(this.tooltipTranslationKey,[],e=>{this.tooltipLabel=e}))}disconnectedCallback(){this.subscriptions.unsubscribeAll()}connectedCallback(){this.subscribeToLanguageChange()}render(){return(0,o.h)("section",{key:"3afb9d800ec06e6cac57d65eab4059bc7db42535"},this.labelKey&&(0,o.h)("label",{key:"90ae5f881975462da986f65fdce7b0548d9afa2d"},(0,o.h)("strong",{key:"ce8ca2e649681a874585835b35554dd9920f0aef"},(0,o.h)("translate-label",{key:"601a0371d31081ce5a84b824ddb43536c3e87405",labelKey:this.labelKey})," ")),(0,o.h)("button",{key:"90ea147e6e350461cdd74ccacf2dfe86cf875925",class:"toggle-switch",onClick:this.toggle,"tooltip-append-to":"parent","tooltip-content":this.tooltipLabel,"tooltip-placement":i.O.TOP},(0,o.h)("input",{key:"e7ae6a6c71a0fe9decebb559ed601998b6ee8bac",type:"checkbox",checked:this.checked}),(0,o.h)("label",{key:"02d328613d9e7c675e6531a1777ae7cf9a2d16b1"})))}};g.style='.toggle-switch{all:unset;clear:both;margin:0 5px;width:36px}.toggle-switch:focus{outline:none;box-shadow:none}.toggle-switch:focus-visible{outline:none;box-shadow:none}.toggle-switch input:empty{display:none}.toggle-switch input:empty~label{position:relative;cursor:pointer;user-select:none;margin:0.05em 0.6em -0.05em 0;vertical-align:text-bottom}.toggle-switch input:empty~label:before{display:block;content:" ";width:2.2em;height:1.25em;background-color:var(--gw-toggleswitch-background);border-radius:10em;transition:all 100ms ease-in}.toggle-switch input:empty~label:after{position:absolute;display:block;top:0.08em;left:0.1em;content:" ";width:0.9em;height:0.9em;background-color:var(--gw-toggleswitch-handle-background);border:1px solid var(--gw-toggleswitch-background);border-radius:50%;transition:all 100ms ease-in}.toggle-switch input:checked~label:before{background-color:var(--gw-toggleswitch-checked-background)}.toggle-switch input:checked~label:after{left:1em;background-color:var(--gw-toggleswitch-handle-checked-background);border:1px solid var(--gw-toggleswitch-checked-background)}'},79939(e,t,n){n.d(t,{L:()=>s,T:()=>r,s:()=>a});var o=n(57154);function a(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}class s{static get logger(){return o.Loggers.getLoggerInstance("SharedComponents")}}class i{constructor(){this.languageContextService=o.ServiceProvider.get(o.LanguageContextService),this.translationChangedObservers={},this.logger=s.logger,this.defaultBundle=this.languageContextService.getDefaultBundle(),this.subscribeToBundleChange()}onTranslate(e,t=[],n=()=>{}){this.translationChangedObservers[e]=this.translationChangedObservers[e]||[];const o={parameters:t,callback:n};return this.translationChangedObservers[e].push(o),n(this.translate(e,t)),()=>{const t=this.translationChangedObservers[e].indexOf(o);-1!==t&&this.translationChangedObservers[e].splice(t,1)}}translate(e,t){return this.translateInLocale(e,t)}translateInLocale(e,t){let n=this.translateFromBundle(this.currentBundle,e);return n||(n=this.translateFromBundle(this.defaultBundle,e)),n?(n=this.applyParameters(n,t),a(n)):(this.logger.warn(`Missing translation for key: [${e}]`),e)}translateFromBundle(e,t){if(!e)return;let n=e[t];return"string"!=typeof n&&(n=this.translateAsJsonObject(e,t)),n}translateAsJsonObject(e,t){let n=t.split(".");return this.getTranslation(e,n)}getTranslation(e,t){if(!t||!e)return;const n=e[t.splice(0,1)[0]];return 0===t.length?n:"string"!=typeof n?t.length>0?this.getTranslation(n,t):n:void 0}applyParameters(e,t){return t?t.reduce((e,t)=>i.replaceAll(e,t),e):e}static replaceAll(e,t){return t?e.split(`{{${t.key}}}`).join(t.value):e}notifyTranslationsChanged(){Object.keys(this.translationChangedObservers).forEach(e=>{(this.translationChangedObservers[e]||[]).forEach(t=>t.callback(this.translate(e,t.parameters)))})}subscribeToBundleChange(){this.languageChangeSubscription=this.languageContextService.onLanguageBundleChanged(e=>{e&&(this.currentBundle=e,this.notifyTranslationsChanged())})}destroy(){this.languageChangeSubscription&&this.languageChangeSubscription()}}const r=new i},81491(e,t,n){n.d(t,{H:()=>a});const o='button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])';class a{static setDocumentBodyOverflow(e){const t=document.body.style.overflow;return document.body.style.overflow=e,t}static hideDocumentBodyOverflow(){return a.setDocumentBodyOverflow("hidden")}static focusNextElement(e,t=o){const n=Array.from(e.querySelectorAll(t));if(n.length>0){const e=n.indexOf(document.activeElement),t=n[(e+1)%n.length];t&&t.focus()}}static focusPreviousElement(e,t=o){const n=Array.from(e.querySelectorAll(t));if(n.length>0){const e=n.indexOf(document.activeElement),t=n[(e-1+n.length)%n.length];t&&t.focus()}}static preventLeavingDialog(e,t){"Tab"===t.key&&(t.preventDefault(),t.shiftKey?a.focusPreviousElement(e):a.focusNextElement(e))}static focusElement(e){const t=document.querySelector(e);null==t||t.focus()}static scrollElementIntoView(e,t={block:"nearest"}){const n=document.querySelector(e);n&&n.scrollIntoView(t)}static waitForElement(e){return new Promise((t,n)=>{const o=new MutationObserver(()=>{try{const n=document.querySelector(e);n&&(o.disconnect(),t(n))}catch(e){o.disconnect(),n(e)}});o.observe(document.body,{subtree:!0,childList:!0,attributes:!0})})}}}}; //# sourceMappingURL=78681.0cfa1e86d4dac1b7e7e8.bundle.js.map