igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
147 lines (146 loc) • 5.66 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 { NativeUIElementBridge } from "./NativeUIElementBridge";
import { runOn, EnumUtil, markType } from "./type";
import { NativeUIDropDownSelectedValueChangedEventArgs } from "./NativeUIDropDownSelectedValueChangedEventArgs";
import { NativeUIDisplayDensity_$type } from "./NativeUIDisplayDensity";
/**
* @hidden
*/
var IgcDropdownBridge = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcDropdownBridge, _super);
function IgcDropdownBridge(a) {
var _this = _super.call(this) || this;
_this.d = null;
_this.c = null;
_this.f = null;
_this.g = null;
_this.e = null;
_this.h = null;
_this.e = a;
return _this;
}
IgcDropdownBridge.prototype.addHandler = function (a, b, c, d) {
switch (c) {
case 3:
var e = a;
this.d = e.listen("igcChange", runOn(this, this.i));
this.c = d;
this.f = b;
break;
}
};
IgcDropdownBridge.prototype.i = function (a) {
if (this.c != null) {
var b = new NativeUIDropDownSelectedValueChangedEventArgs();
this.c(this.f, b);
}
};
IgcDropdownBridge.prototype.getValue = function (a, b) {
switch (b) {
case 6: return this.g;
case 7:
var currItem_ = a.getProperty("selectedItem");
if (currItem_ == null || currItem_ == undefined) {
return null;
}
return currItem_.innerText;
}
return null;
};
IgcDropdownBridge.prototype.removeHandler = function (a, b, c, d) {
switch (c) {
case 3:
if (this.d != null) {
this.d();
}
this.c = null;
this.f = null;
break;
}
};
IgcDropdownBridge.prototype.setValue = function (a, b, c) {
switch (b) {
case 6:
{
this.g = c;
var d = a.querySelectorAll("igc-dropdown-item");
if (d != null) {
for (var e = 0; e < d.length; e++) {
var f = d[e];
f.remove();
}
}
{
var g = this.g;
for (var h = 0; h < g.length; h++) {
var i = g[h];
var j = this.e.createElement("igc-dropdown-item");
j.setText(i);
a.append(j);
}
}
if (this.h != null) {
d = a.querySelectorAll("igc-dropdown-item");
if (d != null) {
for (var k = 0; k < d.length; k++) {
var l = d[k];
var m = l.getText();
if (m == this.h) {
a.setProperty("selectedItem", l.getNativeElement());
}
}
}
}
}
return;
case 7:
{
this.h = c;
var n = a.querySelectorAll("igc-dropdown-item");
if (n != null) {
for (var o = 0; o < n.length; o++) {
var p = n[o];
var q = p.getText();
if (q == this.h) {
a.setProperty("selectedItem", p.getNativeElement());
}
}
}
}
return;
case 1:
var r = "large";
switch (EnumUtil.getEnumValue(NativeUIDisplayDensity_$type, c)) {
case 0:
r = "large";
break;
case 1:
r = "large";
break;
case 2:
r = "small";
break;
case 3:
r = "medium";
break;
}
a.setProperty("size", r);
var s = a.querySelectorAll("igc-input");
if (s != null) {
for (var t = 0; t < s.length; t++) {
s[t].setProperty("size", r);
}
}
break;
}
};
IgcDropdownBridge.$t = markType(IgcDropdownBridge, 'IgcDropdownBridge', NativeUIElementBridge.$);
return IgcDropdownBridge;
}(NativeUIElementBridge));
export { IgcDropdownBridge };