igniteui-react-grids
Version:
Ignite UI React grid components.
178 lines (177 loc) • 6.4 kB
JavaScript
/*
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 { __extends } from "tslib";
import { BaseEditorView } from "./BaseEditorView";
import { XInputGroup } from "igniteui-react-inputs";
import { XInput } from "igniteui-react-inputs";
import { runOn, delegateCombine, delegateRemove, markType } from "igniteui-react-core";
/**
* @hidden
*/
var TextEditorView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TextEditorView, _super);
function TextEditorView(a, b, c) {
var _this = _super.call(this, a, c) || this;
_this.ab = null;
_this.aa = null;
_this.z = null;
var d = a.createElement("div");
d.setRawStyleProperty("display", "flex");
d.setRawStyleProperty("width", "100%");
d.setRawStyleProperty("margin-top", "-10px");
d.setRawStyleProperty("height", "38px");
_this.container = d;
var e = a.getSubRenderer(d);
_this.aa = new XInputGroup();
_this.aa.provideContainer(e);
_this.aa.d = 0;
_this.aa.p = b;
_this.aa.t = 3;
_this.aa.disabled = !_this.isEnabled;
var f = e.getExternal(_this.aa, e.rootWrapper, null);
var g = a.createElement("div");
g.setRawStyleProperty("width", "100%");
var h = a.getSubRenderer(g);
_this.z = new XInput();
_this.z.provideContainer(h);
_this.z.b8 = "text";
_this.z.disabled = !_this.isEnabled;
_this.z.d8 = _this.textColor;
var i = e.getExternal(_this.z, h.rootWrapper, null);
_this.aa.appendContentChild(g);
_this.aa.inputs.add(_this.z);
return _this;
}
TextEditorView.prototype.setFont = function (a) {
if (this.z != null) {
this.z.af = a;
}
};
TextEditorView.prototype.attachEvents = function () {
if (this.z != null) {
var a = this.z;
a.changing = delegateCombine(a.changing, runOn(this, this.ad));
var b = this.z;
b.keyDown = delegateCombine(b.keyDown, runOn(this, this.onInputKeyDown));
var c = this.z;
c.compositionEnd = delegateCombine(c.compositionEnd, runOn(this, this.ac));
var d = this.z;
d.gotFocus = delegateCombine(d.gotFocus, runOn(this, this.ae));
var e = this.z;
e.lostFocus = delegateCombine(e.lostFocus, runOn(this, this.af));
}
};
TextEditorView.prototype.detachEvents = function () {
if (this.z != null) {
var a = this.z;
a.changing = delegateRemove(a.changing, runOn(this, this.ad));
var b = this.z;
b.keyDown = delegateRemove(b.keyDown, runOn(this, this.onInputKeyDown));
var c = this.z;
c.compositionEnd = delegateRemove(c.compositionEnd, runOn(this, this.ac));
var d = this.z;
d.gotFocus = delegateRemove(d.gotFocus, runOn(this, this.ae));
var e = this.z;
e.lostFocus = delegateRemove(e.lostFocus, runOn(this, this.af));
}
};
TextEditorView.prototype.onTargetChanged = function () {
this.ab = null;
if (this.z != 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.i.rootWrapper.getNativeElement();
if (a == document.activeElement || a.contains(document.activeElement)) {
this.z.ct();
this.focus();
}
}
};
TextEditorView.prototype.t = function () {
var _this = this;
if (this.z != null) {
this.z.focus(true);
if (this.z.b8 != "date") {
window.setTimeout(function () { return _this.z.dp(); }, 0);
}
}
};
TextEditorView.prototype.x = function () {
if (this.z != null) {
if (this.value != null) {
this.ab = null;
this.z.cq = null;
this.z.cq = this.value.toString();
if (this.focusOnValueChanged && !this.h()) {
this.t();
}
}
else {
this.z.cq = null;
}
}
};
TextEditorView.prototype.s = function () {
if (this.aa != null) {
this.aa.disabled = !this.isEnabled;
}
if (this.z != null) {
this.z.disabled = !this.isEnabled;
}
};
TextEditorView.prototype.w = function () {
_super.prototype.w.call(this);
if (this.z != null) {
this.z.d8 = this.textColor;
}
};
TextEditorView.prototype.ad = function (a, b) {
this.q();
if (b.isCompositionInProgress) {
return;
}
if (this.ab != null && this.ab != b.value) {
this.ab = null;
return;
}
this.r(b.value, false);
};
TextEditorView.prototype.ac = function (a, b) {
this.ab = b.value;
this.r(this.z.cq, false);
};
TextEditorView.prototype.af = function (a, b) {
this.p();
};
TextEditorView.prototype.ae = function (a, b) {
this.o();
};
TextEditorView.prototype.getEditorValue = function () {
if (this.z != null) {
return this.z.cq;
}
return null;
};
TextEditorView.prototype.setEditorValue = function (a) {
if (this.z != null) {
this.z.cq = a;
}
};
TextEditorView.$t = markType(TextEditorView, 'TextEditorView', BaseEditorView.$);
return TextEditorView;
}(BaseEditorView));
export { TextEditorView };