igniteui-react-inputs
Version:
Ignite UI React input components.
469 lines (468 loc) • 16.3 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 { XComponentBridge } from "./XComponentBridge";
import { INativeUIInputBridge_$type } from "igniteui-react-core";
import { typeCast, runOn, delegateCombine, delegateRemove, enumGetBox, EnumUtil, typeGetValue, markType } from "igniteui-react-core";
import { XInput } from "./XInput";
import { XSuffix } from "./XSuffix";
import { NativeUIInputChangingEventArgs } from "igniteui-react-core";
import { NativeUIKeyEventArgs } from "igniteui-react-core";
import { NativeUIMouseEventArgs } from "igniteui-react-core";
import { XIcon } from "./XIcon";
import { NativeUIClickedEventArgs } from "igniteui-react-core";
import { NativeUIFocusEventArgs } from "igniteui-react-core";
import { XLabel } from "./XLabel";
import { NativeUIDisplayDensity_$type } from "igniteui-react-core";
import { NativeUIInputDisplayType_$type } from "igniteui-react-core";
import { BaseControlTheme_$type } from "igniteui-react-core";
import { NativeUIInputType_$type } from "igniteui-react-core";
import { NativeUIComponentHorizontalAlignment_$type } from "igniteui-react-core";
/**
* @hidden
*/
var XInputBridge = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(XInputBridge, _super);
function XInputBridge(a) {
var _this = _super.call(this, a) || this;
_this.ab = null;
_this.aa = null;
_this.ag = null;
_this.af = null;
_this.x = null;
_this.am = null;
_this.y = null;
_this.z = null;
_this.ai = null;
_this.ak = null;
_this.ac = null;
_this.ah = null;
_this.ad = null;
_this.aj = null;
_this.ae = null;
_this.al = null;
_this.u = null;
return _this;
}
XInputBridge.prototype.addHandler = function (a, b, c, d) {
var e = a;
var f = typeCast(XInput.$, e.inputs._inner[0]);
switch (c) {
case 0:
f.changing = delegateCombine(f.changing, runOn(this, this.av));
this.ab = d;
this.ag = b;
break;
case 27:
f.compositionEnd = delegateCombine(f.compositionEnd, runOn(this, this.ap));
this.ac = d;
this.ah = b;
break;
case 28:
f.keyDown = delegateCombine(f.keyDown, runOn(this, this.ar));
this.ad = d;
this.aj = b;
break;
case 9:
f.mouseDown = delegateCombine(f.mouseDown, runOn(this, this.at));
this.ae = d;
this.al = b;
break;
case 2:
f.change = delegateCombine(f.change, runOn(this, this.au));
this.aa = d;
this.af = b;
break;
case 25:
this.ao(a);
var g = this.w(a);
var h = this.u;
h.clicked = delegateCombine(h.clicked, runOn(this, this.aw));
this.x = d;
this.am = b;
break;
case 13:
{
f.gotFocus = delegateCombine(f.gotFocus, runOn(this, this.aq));
this.y = d;
this.ai = b;
}
break;
case 14:
{
f.lostFocus = delegateCombine(f.lostFocus, runOn(this, this.as));
this.z = d;
this.ak = b;
}
break;
}
};
XInputBridge.prototype.at = function (a, b) {
if (this.ae != null) {
var c = new NativeUIMouseEventArgs();
c.b = b.originalSource;
this.ae(this.al, c);
}
};
XInputBridge.prototype.ar = function (a, b) {
if (this.ad != null) {
var c = new NativeUIKeyEventArgs();
c.g = b.keyCode;
c.b = b.ctrl;
c.e = b.shift;
c.a = b.alt;
c.h = b.originalEvent;
this.ad(this.aj, c);
}
};
XInputBridge.prototype.ap = function (a, b) {
if (this.ac != null) {
var c = new NativeUIInputChangingEventArgs();
c.b = b.value;
this.ac(this.ah, c);
}
};
XInputBridge.prototype.as = function (a, b) {
if (this.z != null) {
var c = new NativeUIFocusEventArgs();
this.z(this.ak, c);
}
};
XInputBridge.prototype.aq = function (a, b) {
if (this.y != null) {
var c = new NativeUIFocusEventArgs();
this.y(this.ai, c);
}
};
XInputBridge.prototype.aw = function (a, b) {
if (this.x != null) {
var c = new NativeUIClickedEventArgs();
this.x(this.am, c);
if (c.a) {
b.handled = true;
}
}
};
XInputBridge.prototype.removeHandler = function (a, b, c, d) {
var e = a;
var f = typeCast(XInput.$, e.inputs._inner[0]);
switch (c) {
case 0:
f.changing = delegateRemove(f.changing, runOn(this, this.av));
this.ab = null;
this.ag = null;
break;
case 27:
f.compositionEnd = delegateRemove(f.compositionEnd, runOn(this, this.ap));
this.ac = null;
this.ah = null;
break;
case 28:
f.keyDown = delegateRemove(f.keyDown, runOn(this, this.ar));
this.ad = null;
this.aj = null;
break;
case 9:
f.mouseDown = delegateRemove(f.mouseDown, runOn(this, this.at));
this.ae = null;
this.al = null;
break;
case 2:
f.change = delegateRemove(f.change, runOn(this, this.au));
this.aa = null;
this.af = null;
break;
case 25:
this.ao(a);
var g = this.w(a);
var h = this.u;
h.clicked = delegateRemove(h.clicked, runOn(this, this.aw));
this.x = null;
this.am = null;
break;
case 13:
{
f.gotFocus = delegateRemove(f.gotFocus, runOn(this, this.aq));
this.y = null;
this.ai = null;
}
break;
case 14:
{
f.lostFocus = delegateRemove(f.lostFocus, runOn(this, this.as));
this.z = null;
this.ak = null;
}
break;
}
};
XInputBridge.prototype.av = function (a, b) {
if (this.ab != null) {
var c = new NativeUIInputChangingEventArgs();
c.a = b.isCompositionInProgress;
c.b = b.value;
this.ab(this.ag, c);
}
};
XInputBridge.prototype.au = function (a, b) {
if (this.aa != null) {
var c = new NativeUIInputChangingEventArgs();
c.a = b.isCompositionInProgress;
c.b = b.value;
this.aa(this.af, c);
}
};
XInputBridge.prototype.v = function (a) {
for (var b = 0; b < a.inputs.count; b++) {
var c = a.inputs._inner[b];
if (typeCast(XLabel.$, c) !== null) {
return c;
}
}
return null;
};
XInputBridge.prototype.an = function (a) {
var b = this.v(a);
if (b == null) {
b = new XLabel();
var c = a.view.l;
var d = c.createElement("div");
var e = c.getSubRenderer(d);
b.provideContainer(e);
a.inputs.add(b);
a.appendContentChild(d);
}
};
XInputBridge.prototype.w = function (a) {
for (var b = 0; b < a.inputs.count; b++) {
var c = a.inputs._inner[b];
if (typeCast(XSuffix.$, c) !== null) {
return c;
}
}
return null;
};
XInputBridge.prototype.ao = function (a) {
var b = this.w(a);
if (b == null) {
var c = a.view.l;
var d = new XSuffix();
var e = c.createElement("div");
var f = c.getSubRenderer(e);
d.provideContainer(f);
this.u = new XIcon();
var g = c.createElement("div");
var h = c.getSubRenderer(g);
this.u.provideContainer(h);
d.appendContentChild(g);
a.inputs.add(d);
a.appendContentChild(e);
}
};
XInputBridge.prototype.getValue = function (a, b) {
var c = a;
var d = typeCast(XInput.$, c.inputs._inner[0]);
switch (b) {
case 103: return a.mc;
case 3:
this.an(a);
var e = this.v(a);
return e.text;
case 100:
this.ao(a);
return this.u.svgPath;
case 101:
this.ao(a);
return this.u.fill;
case 102:
this.ao(a);
return this.u.ea;
case 2: return d.cq;
case 1:
switch (c.t) {
case 0: return enumGetBox(NativeUIDisplayDensity_$type, 0);
case 1: return enumGetBox(NativeUIDisplayDensity_$type, 1);
case 3: return enumGetBox(NativeUIDisplayDensity_$type, 3);
case 2: return enumGetBox(NativeUIDisplayDensity_$type, 2);
case 4: return enumGetBox(NativeUIDisplayDensity_$type, 4);
}
break;
case 0:
switch (c.d) {
case 2: return enumGetBox(NativeUIInputDisplayType_$type, 1);
case 1: return enumGetBox(NativeUIInputDisplayType_$type, 2);
case 0: return enumGetBox(NativeUIInputDisplayType_$type, 0);
}
break;
case 18: return enumGetBox(BaseControlTheme_$type, c.p);
case 19:
switch (d.b8) {
case "text": return enumGetBox(NativeUIInputType_$type, 0);
case "number": return enumGetBox(NativeUIInputType_$type, 1);
}
break;
case 20:
switch (d.dy) {
case 0: return enumGetBox(NativeUIComponentHorizontalAlignment_$type, 0);
case 2: return enumGetBox(NativeUIComponentHorizontalAlignment_$type, 2);
case 1: return enumGetBox(NativeUIComponentHorizontalAlignment_$type, 1);
case 3: return enumGetBox(NativeUIComponentHorizontalAlignment_$type, 3);
}
break;
case 21: return d.a1;
case 32: return d.disabled;
case 33: return d.d8;
case 105: return d.selectionStart;
case 106: return d.selectionEnd;
case 107: return c.an;
}
return null;
};
XInputBridge.prototype.setValue = function (a, b, c) {
var d = a;
var e = typeCast(XInput.$, d.inputs._inner[0]);
switch (b) {
case 103:
a.mc = c;
break;
case 3:
this.an(a);
var f = this.v(a);
f.text = c;
break;
case 100:
this.ao(a);
this.u.svgPath = c;
break;
case 101:
this.ao(a);
this.u.fill = c;
break;
case 102:
this.ao(a);
this.u.ea = c;
break;
case 2:
e.cq = c == null ? null : c.toString();
break;
case 1:
switch (EnumUtil.getEnumValue(NativeUIDisplayDensity_$type, c)) {
case 0:
d.t = 0;
break;
case 1:
d.t = 1;
break;
case 3:
d.t = 3;
break;
case 2:
d.t = 2;
break;
case 4:
d.t = 4;
break;
}
break;
case 0:
switch (EnumUtil.getEnumValue(NativeUIInputDisplayType_$type, c)) {
case 1:
d.d = 2;
break;
case 2:
d.d = 1;
break;
case 0:
d.d = 0;
break;
}
break;
case 18:
d.p = EnumUtil.getEnumValue(BaseControlTheme_$type, c);
break;
case 19:
switch (EnumUtil.getEnumValue(NativeUIInputType_$type, c)) {
case 0:
e.b8 = "text";
break;
case 1:
e.b8 = "number";
break;
}
break;
case 20:
switch (EnumUtil.getEnumValue(NativeUIComponentHorizontalAlignment_$type, c)) {
case 0:
e.dy = 0;
break;
case 2:
e.dy = 2;
break;
case 1:
e.dy = 1;
break;
case 3:
e.dy = 3;
break;
}
break;
case 21:
e.a1 = c;
break;
case 32:
e.disabled = c;
break;
case 33:
e.d8 = c;
break;
case 105:
e.selectionStart = typeGetValue(c);
break;
case 106:
e.selectionEnd = typeGetValue(c);
break;
case 107:
d.an = c;
break;
}
};
XInputBridge.prototype.getTargetForProperty = function (a, b) {
switch (a) {
case 9:
case 10: return b;
case 2: return b;
case 3: return b;
case 4: return b;
}
return _super.prototype.getTargetForProperty.call(this, a, b);
};
XInputBridge.prototype.focus = function (a) {
var b = this.t;
var c = b.inputs._inner[0];
c.focus(true);
};
XInputBridge.prototype.select = function (a) {
var b = a;
var c = b.inputs._inner[0];
window.setTimeout(function () { return c.dp(); }, 0);
};
XInputBridge.prototype.resetIsExpanded = function (a) {
var b = a;
b.j8();
};
XInputBridge.prototype.setSelectionRange = function (a, b, c) {
var d = a;
var e = d.inputs._inner[0];
window.setTimeout(function () { return e.dr(b, c); }, 0);
};
XInputBridge.prototype.exportVisualData = function (a) {
return a.fe();
};
XInputBridge.$t = markType(XInputBridge, 'XInputBridge', XComponentBridge.$, [INativeUIInputBridge_$type]);
return XInputBridge;
}(XComponentBridge));
export { XInputBridge };