/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { BaseEditorView } from "./BaseEditorView";
import { InputGroup } from "igniteui-webcomponents-inputs";
import { Input } from "igniteui-webcomponents-inputs";
import { runOn, delegateCombine, delegateRemove, markType } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let TextEditorView = /*@__PURE__*/ (() => {
    class TextEditorView extends BaseEditorView {
        constructor(a, b, c) {
            super(a, c);
            this.q = null;
            this.p = null;
            this.container = a.createElement("div");
            this.container.setRawStyleProperty("display", "flex");
            this.container.setRawStyleProperty("width", "100%");
            this.container.setRawStyleProperty("margin-top", "-10px");
            this.container.setRawStyleProperty("height", "38px");
            let d = a.getSubRenderer(this.container);
            this.q = new InputGroup();
            this.q.provideContainer(d);
            this.q.k = 0;
            this.q.d = b;
            this.q.h = 3;
            let e = a.createElement("div");
            e.setRawStyleProperty("width", "100%");
            let f = a.getSubRenderer(e);
            this.p = new Input();
            this.p.provideContainer(f);
            this.p.b1 = "text";
            this.q.appendContentChild(e);
            this.q.inputs.add(this.p);
        }
        setFont(a) {
            if (this.p != null) {
                this.p.ac = a;
            }
        }
        attachEvents() {
            if (this.p != null) {
                let a = this.p;
                a.changing = delegateCombine(a.changing, runOn(this, this.r));
                let b = this.p;
                b.keyDown = delegateCombine(b.keyDown, runOn(this, this.onInputKeyDown));
                let c = this.p;
                c.gotFocus = delegateCombine(c.gotFocus, runOn(this, this.s));
                let d = this.p;
                d.lostFocus = delegateCombine(d.lostFocus, runOn(this, this.t));
            }
        }
        detachEvents() {
            if (this.p != null) {
                let a = this.p;
                a.changing = delegateRemove(a.changing, runOn(this, this.r));
                let b = this.p;
                b.keyDown = delegateRemove(b.keyDown, runOn(this, this.onInputKeyDown));
                let c = this.p;
                c.gotFocus = delegateRemove(c.gotFocus, runOn(this, this.s));
                let d = this.p;
                d.lostFocus = delegateRemove(d.lostFocus, runOn(this, this.t));
            }
        }
        onTargetChanged() {
            if (this.p != null) {
                this.focus();
            }
        }
        onEditStarted() {
            super.onEditStarted();
            if (!this.a.isEditRefocusDesired) {
                this.focus();
            }
        }
        onEditEnded() {
            super.onEditEnded();
            if (this.a.isEditRefocusDesired) {
                let a = this.e.rootWrapper.getNativeElement();
                if (a == document.activeElement || a.contains(document.activeElement)) {
                    this.p.cj();
                    this.focus();
                }
            }
        }
        l() {
            if (this.p != null) {
                this.p.focus(true);
                if (this.p.b1 != "date") {
                    window.setTimeout(() => this.p.dd(), 0);
                }
            }
        }
        o() {
            if (this.p != null) {
                if (this.value != null) {
                    this.p.cg = null;
                    this.p.cg = this.value.toString();
                    this.l();
                }
                else {
                    this.p.cg = null;
                }
            }
        }
        r(a, b) {
            this.j();
            this.k(b.value, false);
        }
        t(a, b) {
            this.i();
        }
        s(a, b) {
            this.h();
        }
    }
    TextEditorView.$t = /*@__PURE__*/ markType(TextEditorView, 'TextEditorView', BaseEditorView.$);
    return TextEditorView;
})();
//# sourceMappingURL=TextEditorView.js.map
