import dndod from './dndod';
export class Dialog {
    constructor() {
        this.index = 0;
        this.confirmLabel = 'Ok';
        this.cancelLabel = 'Cancel';
        this.continueLabel = 'Yes';
        this.allowClose = true;
    }
    // todo: add cancel + continue handlers
    getOptions() {
        return {
            confirmLabel: this.confirmLabel,
            cancelLabel: this.cancelLabel,
            continueLabel: this.continueLabel,
            allowClose: this.allowClose,
            disableCloseBtn: !this.allowClose,
            hostElement: this.host
        };
    }
    popup(options = {}) {
        options = Object.assign(options, this.getOptions());
        dndod.popup(options);
    }
    notice(msg = "", options = {}) {
        options = Object.assign(options, this.getOptions());
        dndod.notice(msg, options);
    }
    alert(msg = "", options = {}) {
        options = Object.assign(options, this.getOptions());
        dndod.alert(msg, options);
    }
    ;
    confirm(msg = "", calllback = this.dialogConfirmHandler, options = {}) {
        options = Object.assign(options, this.getOptions());
        dndod.confirm(msg, calllback, options);
    }
    setConfirmHandler(callBackHandler) {
        this.dialogConfirmHandler = callBackHandler;
    }
    dialogConfirmHandler() {
        if (this && this.dialogConfirmCallback) {
            this.dialogConfirmCallback();
        }
    }
    // componentDidLoad() {
    //     this.postrender()
    // }
    //
    // componentDidUpdate() {
    //     this.postrender()
    // }
    //
    // postrender() {
    //     Array.from(document.querySelectorAll('.dndod-custom-btn-wrapper')).forEach((wrapper) => {
    //         let buttons = Array.from(wrapper.querySelectorAll('button'))
    //
    //         // Now do something with my button
    //     });
    //     // document.getElementsByClassName('dndod-custom-btn-wrapper');
    //
    // }
    render() {
        return (h("div", null));
    }
    static get is() { return "ema-dialog"; }
    static get properties() { return {
        "alert": {
            "method": true
        },
        "allowClose": {
            "type": Boolean,
            "attr": "allow-close"
        },
        "cancelLabel": {
            "type": String,
            "attr": "cancel-label"
        },
        "confirm": {
            "method": true
        },
        "confirmLabel": {
            "type": String,
            "attr": "confirm-label"
        },
        "continueLabel": {
            "type": String,
            "attr": "continue-label"
        },
        "host": {
            "elementRef": true
        },
        "index": {
            "state": true
        },
        "notice": {
            "method": true
        },
        "popup": {
            "method": true
        },
        "setConfirmHandler": {
            "method": true
        }
    }; }
    static get style() { return "/**style-placeholder:ema-dialog:**/"; }
}
//# sourceMappingURL=dialog.js.map