UNPKG

graphdb-workbench

Version:
1 lines 2.4 kB
import{Host,h}from"@stencil/core";import{HtmlUtil}from"../../utils/html-util";export class OntoDialog{constructor(){this.handleClose=e=>{this.config.onClose(e)}}componentDidLoad(){this.documentOverflow=HtmlUtil.hideDocumentBodyOverflow(),this.hostElement.addEventListener("keydown",this.preventLeavingDialog.bind(this)),this.closeButton.focus()}disconnectedCallback(){this.hostElement.removeEventListener("keydown",this.preventLeavingDialog.bind(this)),HtmlUtil.setDocumentBodyOverflow(this.documentOverflow)}render(){return h(Host,{key:"eeffeaac1aa5b80b89d0d176d89dc44291fd0cbb",tabindex:"-1"},h("div",{key:"2ba8415fa038ad2666cc0b340a3ceba6f0919bc6",class:`dialog-overlay ${this.config.modalClass?this.config.modalClass:""}`},h("dialog",{key:"39b9fc94944e12e8dcae98a65e74593dc173b336",class:"dialog"},h("header",{key:"183327aad084ff6fd619d204a537871cace84684",class:"dialog-header"},h("h3",{key:"ae4c514e0f75e46d5787d284154392de808100ca",class:"dialog-title"},this.config.dialogTitle)),h("main",{key:"dc991f0ef3baa22f42f683528a4ca67ab8d5e7f4",class:"dialog-body"},h("slot",{key:"ddc1c5176d976f5a518fed1d2faa138d0bc5082a",name:"body"})),h("footer",{key:"b3cb9449b54583a7b5489b7d56fa084e456b4d75",class:"dialog-footer"},h("slot",{key:"b3bc85bdfe12da62019be2e542737e5b6f7db4f6",name:"footer"}),h("button",{key:"c58a84d33d8d07ae67a9988adaa320166371cc5b",class:"onto-btn onto-btn-primary",onClick:this.handleClose,ref:e=>this.closeButton=e},h("translate-label",{key:"b593b5e113baa66e6878a2e885a46bc6581bf27f",labelKey:"common.button.close"}))))))}preventLeavingDialog(e){HtmlUtil.preventLeavingDialog(this.hostElement,e)}static get is(){return"onto-dialog"}static get originalStyleUrls(){return{$:["onto-dialog.scss"]}}static get styleUrls(){return{$:["onto-dialog.css"]}}static get properties(){return{config:{type:"unknown",attribute:"config",mutable:!1,complexType:{original:"DialogConfig",resolved:"{ dialogTitle: string; onClose: (evt: KeyboardEvent | MouseEvent) => void; modalClass?: string; }",references:{DialogConfig:{location:"local",path:"/home/ubuntu/workspace/PRO/GraphDB UI Jobs/workbench/graphdb-workbench-release/packages/shared-components/src/components/dialogs/onto-dialog.tsx",id:"src/components/dialogs/onto-dialog.tsx::DialogConfig"}}},required:!1,optional:!1,docs:{tags:[],text:"Configuration object for the dialog."},getter:!1,setter:!1}}}static get elementRef(){return"hostElement"}}