igniteui-react-grids
Version:
Ignite UI React grid components.
175 lines (174 loc) • 6.15 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 { 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
*/
export let TextEditorView = /*@__PURE__*/ (() => {
class TextEditorView extends BaseEditorView {
constructor(a, b, c) {
super(a, c);
this.ab = null;
this.aa = null;
this.z = null;
let d = a.createElement("div");
d.setRawStyleProperty("display", "flex");
d.setRawStyleProperty("width", "100%");
d.setRawStyleProperty("margin-top", "-10px");
d.setRawStyleProperty("height", "38px");
this.container = d;
let 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;
let f = e.getExternal(this.aa, e.rootWrapper, null);
let g = a.createElement("div");
g.setRawStyleProperty("width", "100%");
let 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;
let i = e.getExternal(this.z, h.rootWrapper, null);
this.aa.appendContentChild(g);
this.aa.inputs.add(this.z);
}
setFont(a) {
if (this.z != null) {
this.z.af = a;
}
}
attachEvents() {
if (this.z != null) {
let a = this.z;
a.changing = delegateCombine(a.changing, runOn(this, this.ad));
let b = this.z;
b.keyDown = delegateCombine(b.keyDown, runOn(this, this.onInputKeyDown));
let c = this.z;
c.compositionEnd = delegateCombine(c.compositionEnd, runOn(this, this.ac));
let d = this.z;
d.gotFocus = delegateCombine(d.gotFocus, runOn(this, this.ae));
let e = this.z;
e.lostFocus = delegateCombine(e.lostFocus, runOn(this, this.af));
}
}
detachEvents() {
if (this.z != null) {
let a = this.z;
a.changing = delegateRemove(a.changing, runOn(this, this.ad));
let b = this.z;
b.keyDown = delegateRemove(b.keyDown, runOn(this, this.onInputKeyDown));
let c = this.z;
c.compositionEnd = delegateRemove(c.compositionEnd, runOn(this, this.ac));
let d = this.z;
d.gotFocus = delegateRemove(d.gotFocus, runOn(this, this.ae));
let e = this.z;
e.lostFocus = delegateRemove(e.lostFocus, runOn(this, this.af));
}
}
onTargetChanged() {
this.ab = null;
if (this.z != null) {
this.focus();
}
}
onEditStarted() {
super.onEditStarted();
if (!this.a.isEditRefocusDesired) {
this.focus();
}
}
onEditEnded() {
super.onEditEnded();
if (this.a.isEditRefocusDesired) {
let a = this.i.rootWrapper.getNativeElement();
if (a == document.activeElement || a.contains(document.activeElement)) {
this.z.ct();
this.focus();
}
}
}
t() {
if (this.z != null) {
this.z.focus(true);
if (this.z.b8 != "date") {
window.setTimeout(() => this.z.dp(), 0);
}
}
}
x() {
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;
}
}
}
s() {
if (this.aa != null) {
this.aa.disabled = !this.isEnabled;
}
if (this.z != null) {
this.z.disabled = !this.isEnabled;
}
}
w() {
super.w();
if (this.z != null) {
this.z.d8 = this.textColor;
}
}
ad(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);
}
ac(a, b) {
this.ab = b.value;
this.r(this.z.cq, false);
}
af(a, b) {
this.p();
}
ae(a, b) {
this.o();
}
getEditorValue() {
if (this.z != null) {
return this.z.cq;
}
return null;
}
setEditorValue(a) {
if (this.z != null) {
this.z.cq = a;
}
}
}
TextEditorView.$t = /*@__PURE__*/ markType(TextEditorView, 'TextEditorView', BaseEditorView.$);
return TextEditorView;
})();