import { FeatureBlend } from "../../../FeatureBlend.js";
export class InputEditorView extends Jade.UI.Control {
    constructor(options) {
        super(options);
        this.m_editorModel = options.editor;
        this.state.unset("editor");
    }
    get editorModel() {
        return this.m_editorModel;
    }
    get editorView() {
        return this.m_editorView;
    }
    get focusCallback() {
        return this.state.get("focus", () => { });
    }
    template() {
        return `<div class="-fb-grid-input-editor"></div>`;
    }
    focus() {
        this.editorView.focus();
    }
    show() {
        this.node.show();
    }
    hide() {
        this.node.hide();
    }
    onActivate(e) {
        super.onActivate(e);
        this.editor_init();
    }
    editor_init() {
        let editorType = FeatureBlend.getEditorType(this.editorModel.script);
        if (editorType != null) {
            this.m_editorView = new editorType({
                source: this.editorModel,
                focused: () => {
                    this.focusCallback();
                }
            });
            this.controls.add(this.m_editorView);
        }
    }
}
