import {css, html, LitElement, repeat, SlotMixin} from '@lion/core'; import {DialogButton, Et2Dialog} from "./Et2Dialog"; /** * This handles the visible portion of the dialog, including the title & close button. * * Note we can't extend Et2Widget. If I try, something in the render / creation breaks and calling open() gives an * error */ export class Et2DialogOverlay extends SlotMixin(LitElement) { private egw : IegwAppLocal; protected buttons : DialogButton[]; protected _dialog : Et2Dialog; static get styles() { return [ css` :host { display: inline-block; background: white; position: relative; border: 1px solid silver; } :host([hidden]) { display: none; } .overlay__header { display: flex; } .overlay__heading { margin: 0px; padding: 6px 16px 8px; flex: 1; } .overlay__heading > .overlay__close-button { flex: none; } .overlay__close-button { min-width: 40px; min-height: 32px; border-width: 0; padding: 0; font-size: 24px; } `, ]; } get slots() { return { ...super.slots, buttons: () => { return this._buttonsTemplate(); } } } constructor() { super(); this.buttons = []; } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); debugger; } /** * Block until after the paint - This is needed to deal with children not fully "done" before the OverlayController * tries to do things with them * * @returns {Promise} */ async performUpdate() { await new Promise((resolve) => setTimeout(() => resolve())); return super.performUpdate(); } /** @private */ __dispatchCloseEvent() { this.dispatchEvent(new Event('close-overlay')); } render() { // eslint-disable-line class-methods-use-this return html`

`; } _buttonsTemplate() { return html`${repeat(this.buttons, (button : DialogButton) => button.id, (button, index) => html` `)}`; } }