/*
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 * as tslib_1 from "tslib";
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
 */
var TextEditorView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(TextEditorView, _super);
    function TextEditorView(a, b, c) {
        var _this = _super.call(this, a, c) || this;
        _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");
        var 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;
        var e = a.createElement("div");
        e.setRawStyleProperty("width", "100%");
        var 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);
        return _this;
    }
    TextEditorView.prototype.setFont = function (a) {
        if (this.p != null) {
            this.p.ac = a;
        }
    };
    TextEditorView.prototype.attachEvents = function () {
        if (this.p != null) {
            var a = this.p;
            a.changing = delegateCombine(a.changing, runOn(this, this.r));
            var b = this.p;
            b.keyDown = delegateCombine(b.keyDown, runOn(this, this.onInputKeyDown));
            var c = this.p;
            c.gotFocus = delegateCombine(c.gotFocus, runOn(this, this.s));
            var d = this.p;
            d.lostFocus = delegateCombine(d.lostFocus, runOn(this, this.t));
        }
    };
    TextEditorView.prototype.detachEvents = function () {
        if (this.p != null) {
            var a = this.p;
            a.changing = delegateRemove(a.changing, runOn(this, this.r));
            var b = this.p;
            b.keyDown = delegateRemove(b.keyDown, runOn(this, this.onInputKeyDown));
            var c = this.p;
            c.gotFocus = delegateRemove(c.gotFocus, runOn(this, this.s));
            var d = this.p;
            d.lostFocus = delegateRemove(d.lostFocus, runOn(this, this.t));
        }
    };
    TextEditorView.prototype.onTargetChanged = function () {
        if (this.p != null) {
            this.focus();
        }
    };
    TextEditorView.prototype.onEditStarted = function () {
        _super.prototype.onEditStarted.call(this);
        if (!this.a.isEditRefocusDesired) {
            this.focus();
        }
    };
    TextEditorView.prototype.onEditEnded = function () {
        _super.prototype.onEditEnded.call(this);
        if (this.a.isEditRefocusDesired) {
            var a = this.e.rootWrapper.getNativeElement();
            if (a == document.activeElement || a.contains(document.activeElement)) {
                this.p.cj();
                this.focus();
            }
        }
    };
    TextEditorView.prototype.l = function () {
        var _this = this;
        if (this.p != null) {
            this.p.focus(true);
            if (this.p.b1 != "date") {
                window.setTimeout(function () { return _this.p.dd(); }, 0);
            }
        }
    };
    TextEditorView.prototype.o = function () {
        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;
            }
        }
    };
    TextEditorView.prototype.r = function (a, b) {
        this.j();
        this.k(b.value, false);
    };
    TextEditorView.prototype.t = function (a, b) {
        this.i();
    };
    TextEditorView.prototype.s = function (a, b) {
        this.h();
    };
    TextEditorView.$t = markType(TextEditorView, 'TextEditorView', BaseEditorView.$);
    return TextEditorView;
}(BaseEditorView));
export { TextEditorView };
//# sourceMappingURL=TextEditorView.js.map
