igniteui-react-core
Version:
Ignite UI React Core.
170 lines (169 loc) • 7.09 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 { NativeUIElementBridge } from "./NativeUIElementBridge";
import { runOn, EnumUtil, markType } from "./type";
import { NativeUIDropDownSelectedValueChangedEventArgs } from "./NativeUIDropDownSelectedValueChangedEventArgs";
import { NativeUIDisplayDensity_$type } from "./NativeUIDisplayDensity";
/**
* @hidden
*/
export let IgcDropdownBridge = /*@__PURE__*/ (() => {
class IgcDropdownBridge extends NativeUIElementBridge {
constructor(a) {
super();
this.t = null;
this.s = null;
this.w = null;
this.u = null;
this.x = null;
this.v = null;
this.y = null;
this.v = a;
}
addHandler(a, b, c, d) {
switch (c) {
case 3:
let e = a;
this.t = e.listen("igcChange", runOn(this, this.z));
this.s = d;
this.w = b;
this.u();
break;
}
}
z(a) {
if (this.s != null) {
let b = new NativeUIDropDownSelectedValueChangedEventArgs();
this.s(this.w, b);
}
}
getValue(a, b) {
switch (b) {
case 8: return this.x;
case 9:
let currItem_ = a.getProperty("selectedItem");
if (currItem_ == null || currItem_ == undefined) {
return null;
}
return currItem_.innerText;
}
return null;
}
removeHandler(a, b, c, d) {
switch (c) {
case 3:
if (this.t != null) {
this.t();
}
this.s = null;
this.w = null;
break;
}
}
setValue(a, b, c) {
switch (b) {
case 8:
{
this.x = c;
let d = a.querySelectorAll("igc-dropdown-item");
if (d != null) {
for (let e = 0; e < d.length; e++) {
let f = d[e];
f.remove();
}
}
{
let g = this.x;
for (let h = 0; h < g.length; h++) {
let i = g[h];
let j = this.v.createElement("igc-dropdown-item");
j.setText(i);
j.setProperty("value", i);
a.append(j);
if (this.y == null) {
this.y = i;
}
}
}
if (this.y != null) {
d = a.querySelectorAll("igc-dropdown-item");
if (d != null) {
for (let k = 0; k < d.length; k++) {
let l = d[k];
let m = l.getText();
if (m == this.y) {
let targ_ = a.getNativeElement();
if (targ_ != null && (targ_._selectItem)) {
let currItem_ = l.getNativeElement();
if (this.s != null) {
targ_._selectItem(currItem_);
}
else {
this.u = () => targ_._selectItem(currItem_);
}
}
else {
a.setProperty("selectedItem", l.getNativeElement());
}
}
}
}
}
}
return;
case 9:
{
this.y = c;
let n = a.querySelectorAll("igc-dropdown-item");
if (n != null) {
for (let o = 0; o < n.length; o++) {
let p = n[o];
let q = p.getText();
if (q == this.y) {
let targ_ = a.getNativeElement();
if (targ_ != null && (targ_._selectItem)) {
let currItem_ = p.getNativeElement();
targ_._selectItem(currItem_);
}
else {
a.setProperty("selectedItem", p.getNativeElement());
}
}
}
}
}
return;
case 1:
let r = "large";
switch (EnumUtil.getEnumValue(NativeUIDisplayDensity_$type, c)) {
case 0:
r = "large";
break;
case 1:
r = "large";
break;
case 3:
r = "small";
break;
case 2:
r = "medium";
break;
}
a.setProperty("size", r);
let s = a.querySelectorAll("igc-input");
if (s != null) {
for (let t = 0; t < s.length; t++) {
s[t].setProperty("size", r);
}
}
break;
}
}
}
IgcDropdownBridge.$t = /*@__PURE__*/ markType(IgcDropdownBridge, 'IgcDropdownBridge', NativeUIElementBridge.$);
return IgcDropdownBridge;
})();