UNPKG

igniteui-react-inputs

Version:

Ignite UI React input components.

467 lines (466 loc) 17 kB
/* 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 { 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 */ export let XInputBridge = /*@__PURE__*/ (() => { class XInputBridge extends XComponentBridge { constructor(a) { super(a); 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; } addHandler(a, b, c, d) { let e = a; let 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); let g = this.w(a); let 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; } } at(a, b) { if (this.ae != null) { let c = new NativeUIMouseEventArgs(); c.b = b.originalSource; this.ae(this.al, c); } } ar(a, b) { if (this.ad != null) { let 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); } } ap(a, b) { if (this.ac != null) { let c = new NativeUIInputChangingEventArgs(); c.b = b.value; this.ac(this.ah, c); } } as(a, b) { if (this.z != null) { let c = new NativeUIFocusEventArgs(); this.z(this.ak, c); } } aq(a, b) { if (this.y != null) { let c = new NativeUIFocusEventArgs(); this.y(this.ai, c); } } aw(a, b) { if (this.x != null) { let c = new NativeUIClickedEventArgs(); this.x(this.am, c); if (c.a) { b.handled = true; } } } removeHandler(a, b, c, d) { let e = a; let 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); let g = this.w(a); let 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; } } av(a, b) { if (this.ab != null) { let c = new NativeUIInputChangingEventArgs(); c.a = b.isCompositionInProgress; c.b = b.value; this.ab(this.ag, c); } } au(a, b) { if (this.aa != null) { let c = new NativeUIInputChangingEventArgs(); c.a = b.isCompositionInProgress; c.b = b.value; this.aa(this.af, c); } } v(a) { for (let b = 0; b < a.inputs.count; b++) { let c = a.inputs._inner[b]; if (typeCast(XLabel.$, c) !== null) { return c; } } return null; } an(a) { let b = this.v(a); if (b == null) { b = new XLabel(); let c = a.view.l; let d = c.createElement("div"); let e = c.getSubRenderer(d); b.provideContainer(e); a.inputs.add(b); a.appendContentChild(d); } } w(a) { for (let b = 0; b < a.inputs.count; b++) { let c = a.inputs._inner[b]; if (typeCast(XSuffix.$, c) !== null) { return c; } } return null; } ao(a) { let b = this.w(a); if (b == null) { let c = a.view.l; let d = new XSuffix(); let e = c.createElement("div"); let f = c.getSubRenderer(e); d.provideContainer(f); this.u = new XIcon(); let g = c.createElement("div"); let h = c.getSubRenderer(g); this.u.provideContainer(h); d.appendContentChild(g); a.inputs.add(d); a.appendContentChild(e); } } getValue(a, b) { let c = a; let d = typeCast(XInput.$, c.inputs._inner[0]); switch (b) { case 103: return a.mc; case 3: this.an(a); let 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; } setValue(a, b, c) { let d = a; let e = typeCast(XInput.$, d.inputs._inner[0]); switch (b) { case 103: a.mc = c; break; case 3: this.an(a); let 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; } } getTargetForProperty(a, b) { switch (a) { case 9: case 10: return b; case 2: return b; case 3: return b; case 4: return b; } return super.getTargetForProperty(a, b); } focus(a) { let b = this.t; let c = b.inputs._inner[0]; c.focus(true); } select(a) { let b = a; let c = b.inputs._inner[0]; window.setTimeout(() => c.dp(), 0); } resetIsExpanded(a) { let b = a; b.j8(); } setSelectionRange(a, b, c) { let d = a; let e = d.inputs._inner[0]; window.setTimeout(() => e.dr(b, c), 0); } exportVisualData(a) { return a.fe(); } } XInputBridge.$t = /*@__PURE__*/ markType(XInputBridge, 'XInputBridge', XComponentBridge.$, [INativeUIInputBridge_$type]); return XInputBridge; })();