igniteui-webcomponents-inputs
Version:
Ignite UI Web Components inputs components.
1,359 lines • 62.2 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 { Base, runOn, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, delegateRemove, enumGetBox, delegateCombine } from "igniteui-webcomponents-core";
import { XInputGroup } from "./XInputGroup";
import { XLabel } from "./XLabel";
import { XInput } from "./XInput";
import { XSuffix } from "./XSuffix";
import { XIcon } from "./XIcon";
import { Popup } from "igniteui-webcomponents-core";
import { XCalendar } from "./XCalendar";
import { Rect } from "igniteui-webcomponents-core";
import { SRProvider } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { DayOfWeek_$type } from "./DayOfWeek";
import { FirstWeek_$type } from "./FirstWeek";
import { DateFormats_$type } from "./DateFormats";
import { BrushUtil } from "igniteui-webcomponents-core";
import { DateTimeValueFormatter } from "./DateTimeValueFormatter";
import { SelectedValueChangedEventArgs } from "./SelectedValueChangedEventArgs";
import { GotFocusEventArgs } from "./GotFocusEventArgs";
import { LostFocusEventArgs } from "./LostFocusEventArgs";
import { DatePickerVisualModelExport } from "./DatePickerVisualModelExport";
import { FontUtil } from "igniteui-webcomponents-core";
import { dateMinValue, dateMaxValue, dateGetDate, dateFromValues, dateGetMonth } from "igniteui-webcomponents-core";
import { stringContains, stringIsNullOrWhiteSpace, stringIsNullOrEmpty } from "igniteui-webcomponents-core";
import { stringSplit } from "igniteui-webcomponents-core";
import { isNaN_ } from "igniteui-webcomponents-core";
let DatePickerView = /*@__PURE__*/ (() => {
class DatePickerView extends Base {
constructor() {
super();
this.b = null;
this.d = null;
this.k = null;
this.e = null;
this.m = null;
this.l = null;
this.j = null;
this.g = null;
this.f = null;
this.i = null;
this.h = null;
this.o = null;
this.document_Click = this.document_Click.bind(this);
this.window_Resize = this.window_Resize.bind(this);
}
am() {
}
get n() {
return this.e;
}
ak(a) {
if (a == null) {
this.b.cr();
if (this.d != null) {
let b = this.d.rootWrapper.getChildAt(0);
b.unlistenAll();
document.removeEventListener("click", this.document_Click, false);
window.removeEventListener("resize", this.window_Resize, false);
}
this.d = null;
return;
}
this.d = a;
let c = Math.round(a.rootWrapper.width());
let d = Math.round(a.rootWrapper.height());
this.ad();
this.ae();
let e = this.d.rootWrapper.getChildAt(0);
e.listen("keydown", runOn(this, this.y));
e.listen("focusin", runOn(this, this.w));
e.listen("focusout", runOn(this, this.x));
document.addEventListener("click", this.document_Click, false);
window.addEventListener("resize", this.window_Resize, false);
this.o = new MutationObserver(runOn(this, this.al));
}
ad() {
if (this.d != null) {
this.k = this.d.rootWrapper.getChildAt(0);
this.k.setAttribute("tabIndex", this.b.bf.toString());
this.k.setStyleProperty("display", "flex");
this.k.setStyleProperty("height", "100%");
this.l = this.d.createElement("div");
this.j = this.d.createElement("div");
this.j.setRawStyleProperty("flex-grow", "1");
this.g = this.d.createElement("div");
this.g.setAttribute("aria-hidden", "true");
this.f = this.d.createElement("div");
this.g.setStyleProperty("padding-right", "2px");
this.i = this.d.createElement("div");
this.i.setAttribute("aria-hidden", "true");
this.h = this.d.createElement("div");
this.b.cs();
this.j.getChildAt(0).setAttribute("aria-expanded", "fasle");
this.j.getChildAt(0).setAttribute("aria-invalid", "false");
this.f.setStyleProperty("height", "16px");
this.f.setStyleProperty("width", "16px");
this.h.setStyleProperty("height", "16px");
this.h.setStyleProperty("width", "16px");
this.f.listen("click", runOn(this, this.ac));
this.f.listen("mousedown", runOn(this, this.aa));
this.f.listen("mouseleave", runOn(this, this.ab));
this.h.listen("click", runOn(this, this.ag));
}
}
aq(a) {
if (this.d != null) {
let b = this.d.getSubRenderer(this.k);
a.provideContainer(b);
let c = b.getExternal(a, b.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
as(a) {
if (this.d != null) {
let b = this.d.getSubRenderer(this.l);
a.provideContainer(b);
let c = b.getExternal(a, b.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
ar(a) {
if (this.d != null) {
let b = this.d.getSubRenderer(this.j);
a.provideContainer(b);
let c = b.getExternal(a, b.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
au(a, b) {
if (this.d != null) {
let c = this.d.getSubRenderer(b);
a.provideContainer(c);
let d = c.getExternal(a, c.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
ap(a, b) {
if (this.d != null) {
let c = this.d.getSubRenderer(b);
a.provideContainer(c);
let d = c.getExternal(a, c.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
v() {
return this.l;
}
u() {
return this.j;
}
r() {
return this.g;
}
q() {
return this.f;
}
t() {
return this.i;
}
s() {
return this.h;
}
aw(a) {
if (this.j != null) {
if (a) {
this.j.getChildAt(0).setAttribute("aria-expanded", "true");
}
else {
this.j.getChildAt(0).setAttribute("aria-expanded", "false");
}
}
}
ay(a) {
if (a != null && a != "") {
this.j.getChildAt(0).setAttribute("aria-label", a);
}
else {
this.j.getChildAt(0).setAttribute("aria-label", "Select a date");
}
}
av() {
if (this.f != null) {
if (this.b.a0 == true) {
this.f.show();
}
else {
this.f.hide();
}
}
}
ah() {
if (this.f != null) {
this.f.hide();
}
}
ax() {
this.k.setAttribute("tabIndex", this.b.bf.toString());
}
an() {
this.o.observe(document, { childList: true, subtree: true });
}
aj() {
this.o.disconnect();
}
ae() {
if (this.d != null) {
this.m = this.d.rootWrapper.getChildAt(1);
this.e = this.d.createElement("div");
this.e.setStyleProperty("width", "100%");
this.e.setStyleProperty("height", "100%");
this.e.setStyleProperty("display", "flex");
this.b.ct();
this.e.parent().setStyleProperty("height", "100%");
if (this.b.a2 == true) {
this.e.parent().parent().setStyleProperty("max-width", "245px");
}
else {
this.e.parent().parent().setStyleProperty("max-width", "232px");
}
}
}
z() {
if (this.d != null) {
if (this.b.a2 == true) {
this.e.parent().parent().setStyleProperty("max-width", "245px");
}
else {
this.e.parent().parent().setStyleProperty("max-width", "232px");
}
}
}
at(a) {
if (this.d != null) {
let b = this.d.getSubRenderer(this.m);
a.provideRenderer(b);
let c = b.getExternal(a, b.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
ao(a) {
if (this.d != null) {
let b = this.d.getSubRenderer(this.e);
a.provideContainer(b);
let c = b.getExternal(a, b.rootWrapper, this.d.getExternal(this.b, null, null));
}
}
p() {
return this.e;
}
ac(a) {
if (this.b.av == true) {
return;
}
this.b.cq();
if (this.f != null) {
this.f.hide();
}
}
aa(a) {
this.b.c9();
}
ab(a) {
this.b.da();
}
ag(a) {
a.stopPropagation();
this.b.cy();
}
y(a) {
let b = a.which;
if (b == 27) {
this.b.cr();
}
}
w(a) {
this.b.focus();
let b = (a.originalEvent.relatedTarget);
if (!this.c(b)) {
this.b.c4();
}
}
x(a) {
let b = (a.originalEvent.relatedTarget);
if (!this.c(b)) {
this.b.cx();
this.b.c5();
}
}
al(a, b) {
if (this.d != null) {
let c = this.d.rootWrapper.getNativeElement();
if (!document.documentElement.contains(c)) {
this.b.cr();
}
}
else {
this.b.cr();
}
}
document_Click(a) {
let b = a.target;
if (!this.c(b)) {
this.b.cr();
}
}
window_Resize(a) {
this.b.dn();
}
a0(a) {
if (this.d != null) {
let b = this.d.rootWrapper.getNativeElement();
let c = (b.getBoundingClientRect());
if (a) {
c = new Rect(0, c.left + window.pageXOffset, c.top + window.pageYOffset, c.width, c.height);
}
return c;
}
return null;
}
a() {
let a = (window.innerWidth);
let b = (window.innerHeight);
let c = new Array(2);
c[0] = a;
c[1] = b;
return c;
}
c(a) {
if (null == a) {
return false;
}
let b = this.d.rootWrapper.getNativeElement();
let c = this.e.getNativeElement();
return b.contains(a) || c.contains(a);
}
ai() {
}
}
DatePickerView.$t = /*@__PURE__*/ markType(DatePickerView, 'DatePickerView');
return DatePickerView;
})();
export { DatePickerView };
let XDatePicker = /*@__PURE__*/ (() => {
class XDatePicker extends Base {
constructor() {
super();
this.h = null;
this.u = null;
this.q = null;
this.o = null;
this.r = null;
this.m = null;
this.n = null;
this.c = null;
this.bh = "dd";
this.bl = "mm";
this.bo = "yyyy";
this.bi = "mdy";
this.bn = "/";
this.ah = false;
this.at = false;
this.ar = false;
this.a6 = dateMinValue();
this.ai = false;
this.propertyChanged = null;
this.selectedValueChanged = null;
this.ae = null;
this.a8 = dateMinValue();
this.a7 = dateMinValue();
this.bk = "";
this.du = BrushUtil.j(255, 24, 29, 31);
this.z = null;
this.bm = "";
this.a5 = dateMinValue();
this.a4 = dateMaxValue();
this.x = 2;
this.v = 1;
this.aa = null;
this.dv = BrushUtil.j(255, 24, 29, 31);
this.dt = BrushUtil.j(255, 163, 172, 184);
this.ao = true;
this.ap = false;
this.ag = true;
this.an = true;
this.i = 0;
this.k = 0;
this.aq = false;
this.a = new DateTimeValueFormatter();
this.d = 0;
this.bj = null;
this.aj = false;
this.be = 0;
this.ak = false;
this.am = false;
this.as = false;
this.al = false;
this.gotFocus = null;
this.lostFocus = null;
this.keyDown = null;
this.changing = null;
let a = new DatePickerView();
a.b = this;
this.h = a;
this.h.am();
this.cp();
}
dc(a, b) {
if (this.u != null) {
this.ah = true;
this.cr();
}
this.dm();
if (this.selectedValueChanged != null) {
this.selectedValueChanged(this, ((() => {
let $ret = new SelectedValueChangedEventArgs();
$ret.oldValue = a;
$ret.newValue = b;
return $ret;
})()));
}
if (this.ai) {
this.dg();
}
}
notifySizeChanged() {
this.h.ai();
}
destroy() {
if (this.c != null) {
let a = this.c;
a.selectedValueChanged = delegateRemove(a.selectedValueChanged, runOn(this, this.co));
let b = this.c;
b.close = delegateRemove(b.close, runOn(this, this.cn));
}
this.provideContainer(null);
}
provideContainer(a) {
this.h.ak(a);
}
setName(a) {
this.o.e = a;
}
get af() {
if (this.ae == null) {
this.ae = new SRProvider(this.h.d);
this.ae.cb("Calendar");
}
return this.ae;
}
get value() {
return this.a8;
}
set value(a) {
let b = this.a8;
this.a6 = b;
this.a8 = a;
if (+b != +(this.a8)) {
this.db("Value", b, this.a8);
}
}
get bb() {
return this.a7;
}
set bb(a) {
let b = this.a7;
this.a7 = a;
if (+b != +(this.a7)) {
this.db("Today", b, this.a7);
}
}
get b4() {
return this.bk;
}
set b4(a) {
let b = this.bk;
this.bk = a;
if (b != this.bk) {
this.db("Label", b, this.bk);
}
}
get dx() {
return this.du;
}
set dx(a) {
let b = this.du;
this.du = a;
if (b != this.du) {
this.db("LabelTextColor", b, a);
}
}
get ac() {
return this.z;
}
set ac(a) {
let b = this.z;
this.z = a;
if (b != this.z) {
this.db("LabelTextStyle", b, this.z);
}
}
get cc() {
return this.bm;
}
set cc(a) {
let b = this.bm;
this.bm = a;
if (b != this.bm) {
this.db("Placeholder", b, this.bm);
}
}
get ba() {
return this.a5;
}
set ba(a) {
let b = this.a5;
this.a5 = a;
if (+b != +(this.a5)) {
this.db("MinDate", b, this.a5);
}
}
get a9() {
return this.a4;
}
set a9(a) {
let b = this.a4;
this.a4 = a;
if (+b != +(this.a4)) {
this.db("MaxDate", b, this.a4);
}
}
get y() {
return this.x;
}
set y(a) {
let b = this.x;
this.x = a;
if (b != this.x) {
this.db("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.x));
}
}
get w() {
return this.v;
}
set w(a) {
let b = this.v;
this.v = a;
if (b != this.v) {
this.db("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.v));
}
}
get ad() {
return this.aa;
}
set ad(a) {
let b = this.aa;
this.aa = a;
if (b != this.aa) {
this.db("TextStyle", b, this.aa);
}
}
get dy() {
return this.dv;
}
set dy(a) {
let b = this.dv;
this.dv = a;
if (b != this.dv) {
this.db("TextColor", b, this.dv);
}
}
get dw() {
return this.dt;
}
set dw(a) {
let b = this.dt;
this.dt = a;
if (b != this.dt) {
this.db("IconColor", b, this.dt);
}
}
get a0() {
return this.ao;
}
set a0(a) {
let b = this.ao;
this.ao = a;
if (b != this.ao) {
this.db("ShowClearButton", b, this.ao);
}
}
get a1() {
return this.ap;
}
set a1(a) {
let b = this.ap;
this.ap = a;
if (b != this.ap) {
this.db("ShowTodayButton", b, this.ap);
}
}
get au() {
return this.ag;
}
set au(a) {
let b = this.ag;
this.ag = a;
if (b != this.ag) {
this.db("AllowTextInput", b, this.ag);
}
}
get ay() {
return this.an;
}
set ay(a) {
let b = this.an;
this.an = a;
if (b != this.an) {
this.db("OpenOnFocus", b, this.an);
}
}
get j() {
return this.i;
}
set j(a) {
let b = this.i;
this.i = a;
if (b != this.i) {
this.db("FirstDayOfWeek", enumGetBox(DayOfWeek_$type, b), enumGetBox(DayOfWeek_$type, this.i));
}
}
get l() {
return this.k;
}
set l(a) {
let b = this.k;
this.k = a;
if (b != this.k) {
this.db("FirstWeekOfYear", enumGetBox(FirstWeek_$type, b), enumGetBox(FirstWeek_$type, this.k));
}
}
get a2() {
return this.aq;
}
set a2(a) {
let b = this.aq;
this.aq = a;
if (b != this.aq) {
this.db("ShowWeekNumbers", b, this.aq);
}
}
get e() {
return this.d;
}
set e(a) {
let b = this.d;
this.d = a;
if (this.d != b) {
this.db("DateFormat", enumGetBox(DateFormats_$type, b), enumGetBox(DateFormats_$type, this.d));
}
}
get bz() {
return this.bj;
}
set bz(a) {
let b = this.bj;
this.bj = a;
if (b != this.bj) {
this.db("FormatString", b, this.bj);
}
}
get av() {
return this.aj;
}
set av(a) {
let b = this.aj;
this.aj = a;
if (b != this.aj) {
this.db("IsDisabled", b, this.aj);
}
}
get bf() {
return this.be;
}
set bf(a) {
let b = this.be;
this.be = a;
if (b != this.be) {
this.db("TabIndex", b, this.be);
}
}
get aw() {
return this.ak;
}
set aw(a) {
let b = this.ak;
this.ak = a;
if (b != this.ak) {
this.db("IsFixed", b, this.ak);
}
}
get ax() {
return this.am;
}
set ax(a) {
let b = this.am;
this.am = a;
if (b != this.am) {
this.db("OpenAsChild", b, this.am);
}
}
get a3() {
return this.as;
}
set a3(a) {
let b = this.as;
this.as = a;
if (b != this.as) {
this.db("UseTopLayer", b, this.as);
}
}
db(a, b, c) {
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
this.de(a, b, c);
}
de(a, b, c) {
switch (a) {
case "Density":
this.dh();
break;
case "BaseTheme":
this.dj();
break;
case "Value":
if (+(dateGetDate(this.value)) != +(dateGetDate(dateMinValue()))) {
if (dateGetDate(this.value) < dateGetDate(this.ba) || dateGetDate(this.value) > dateGetDate(this.a9)) {
this.ai = true;
this.value = this.a6;
this.ai = false;
}
}
this.dc(this.a6, this.value);
this.a6 = this.value;
if (this.c != null) {
if (+(dateGetDate(this.value)) == +(dateGetDate(dateMinValue()))) {
this.c.value = dateMinValue();
}
else {
this.c.value = this.value;
}
}
break;
case "Label":
if (this.r != null) {
this.r.text = this.b4;
if (this.b4 != null && this.b4 != "") {
if (!this.q.inputs.contains(this.r)) {
this.q.inputs.insert(0, this.r);
}
}
else {
if (this.q.inputs.contains(this.r)) {
this.q.inputs.remove(this.r);
}
}
}
break;
case "Placeholder":
if (this.o != null) {
this.o.cg = this.cc;
this.h.ay(this.cc);
}
break;
case "Today":
if (this.c != null) {
this.c.av = this.bb;
}
break;
case "MaxDate":
if (this.c != null) {
let d = Base.compareSimple(this.ba, this.a9);
if (d >= 0) {
this.a9 = dateMaxValue();
}
this.c.at = this.a4;
}
if (dateGetDate(this.value) > dateGetDate(this.a9)) {
this.a6 = dateMinValue();
this.ai = true;
this.value = dateMinValue();
this.ai = false;
}
break;
case "MinDate":
if (this.c != null) {
this.c.au = this.a5;
let e = Base.compareSimple(this.ba, this.a9);
if (e >= 0) {
this.a6 = dateMaxValue();
this.c.at = this.a9;
}
}
if (dateGetDate(this.value) < dateGetDate(this.ba)) {
this.a6 = dateMinValue();
this.ai = true;
this.value = dateMinValue();
this.ai = false;
}
break;
case "TextStyle":
this.dp();
break;
case "ShowClearButton":
if (this.o != null) {
if (this.o.cq != "") {
this.h.av();
}
}
break;
case "LabelTextColor":
case "LabelTextStyle":
case "TextColor":
case "IconColor":
this.dq();
break;
case "ShowTodayButton":
if (this.c != null) {
this.c.ae = this.a1;
this.h.z();
}
break;
case "AllowTextInput":
if (this.o != null) {
this.o.disabled = this.az();
}
break;
case "OpenOnFocus": break;
case "DateFormat":
this.a.k(this.e);
this.dm();
break;
case "FormatString":
this.cp();
this.dm();
break;
case "FirstDayOfWeek":
if (this.c != null) {
this.c.l = this.j;
}
break;
case "ShowWeekNumbers":
if (this.c != null) {
this.c.af = this.a2;
this.h.z();
}
break;
case "FirstWeekOfYear":
if (this.c != null) {
this.c.o = this.l;
}
break;
case "IsDisabled":
{
if (this.q != null) {
this.q.disabled = this.av;
}
if (this.o != null) {
this.o.disabled = this.az();
}
}
break;
case "TabIndex":
this.h.ax();
break;
case "IsFixed":
if (this.u != null) {
this.u.ar = this.aw;
}
break;
case "UseTopLayer":
if (this.u != null) {
this.u.ay = this.a3;
}
break;
}
}
az() {
return this.av || !this.au;
}
cp() {
let a = '/';
let b = this.bz != null ? this.bz.toLowerCase() : this.a.j();
if (stringContains(b, "/")) {
a = '/';
}
else if (stringContains(b, "-")) {
a = '-';
}
else if (stringContains(b, " ")) {
a = ' ';
}
else if (stringContains(b, ".")) {
a = '.';
}
else if (stringContains(b, ",")) {
a = ',';
}
this.bn = a.toString();
let c = b.split(a);
if (c.length == 3) {
let d = "";
for (let e = 0; e < 3; e++) {
if (stringContains(c[e], "d")) {
d += "d";
switch (c[e]) {
case "d":
this.bh = c[e];
break;
case "dd":
this.bh = c[e];
break;
case "ddd":
this.bh = c[e];
break;
case "dddd":
this.bh = c[e];
break;
default:
this.bh = "dd";
break;
}
}
else if (stringContains(c[e], "m")) {
d += "m";
switch (c[e]) {
case "m":
this.bl = c[e];
break;
case "mm":
this.bl = c[e];
break;
case "mmm":
this.bl = c[e];
break;
case "mmmm":
this.bl = c[e];
break;
default:
this.bl = "mm";
break;
}
this.bl = c[e];
}
else if (stringContains(c[e], "y")) {
d += "y";
switch (c[e]) {
case "yy":
this.bo = c[e];
break;
case "yyyy":
this.bo = c[e];
break;
default:
this.bo = "yyyy";
break;
}
}
}
if (d == "dmy" || d == "mdy" || d == "ymd") {
this.bi = d;
}
else {
this.bi = "mdy";
}
}
}
dq() {
if (this.o != null) {
this.o.d8 = this.dy;
}
if (this.m != null) {
this.m.fill = this.dw;
}
if (this.n != null) {
this.n.fill = this.dw;
}
if (this.r != null) {
this.r.dj = this.dx;
this.r.y = this.ac;
}
}
dl() {
if (this.q != null) {
}
}
dp() {
if (this.aa != null) {
this.o.af = this.aa;
}
}
cs() {
this.q = new XInputGroup();
this.h.aq(this.q);
this.q.d = 0;
this.q.p = this.w;
this.q.t = this.y;
this.r = new XLabel();
this.h.as(this.r);
this.r.dj = this.dx;
this.r.y = this.ac;
this.q.appendContentChild(this.h.v());
if (this.b4 != null && this.b4 != "") {
this.r.text = this.b4;
this.q.inputs.add(this.r);
}
this.o = new XInput();
this.h.ar(this.o);
this.o.b8 = "text";
if (this.aa != null) {
this.o.af = this.aa;
}
this.o.disabled = this.az();
this.o.d8 = this.dy;
this.q.appendContentChild(this.h.u());
this.q.inputs.add(this.o);
this.o.cg = this.cc;
this.h.ay(this.cc);
let a = this.o;
a.change = delegateCombine(a.change, runOn(this, this.cz));
let b = this.o;
b.changing = delegateCombine(b.changing, runOn(this, this.c0));
let c = this.o;
c.keyDown = delegateCombine(c.keyDown, runOn(this, this.c1));
let d = new XSuffix();
this.h.au(d, this.h.r());
this.m = new XIcon();
this.h.ap(this.m, this.h.q());
this.m.svgPath = XDatePicker.bs;
this.m.fill = this.dw;
d.appendContentChild(this.h.q());
this.q.appendContentChild(this.h.r());
this.q.inputs.add(d);
this.dm();
let e = new XSuffix();
this.h.au(e, this.h.t());
this.n = new XIcon();
this.h.ap(this.n, this.h.s());
this.n.svgPath = XDatePicker.br;
this.n.fill = this.dw;
e.appendContentChild(this.h.s());
this.q.appendContentChild(this.h.t());
this.q.inputs.add(e);
}
c1(a, b) {
this.c7(b);
if (b.defaultPrevented) {
return;
}
let c = b.keyCode;
let d = b.modifiers;
switch (c) {
case 9:
this.ar = true;
if (!this.at) {
this.ds(this.o.cq);
}
this.ah = true;
this.cr();
this.ar = false;
break;
case 13:
this.ar = true;
if (!this.at) {
this.ds(this.o.cq);
}
this.ah = true;
this.cr();
this.ar = false;
break;
case 40:
if (d == 1) {
this.dd();
this.cw();
}
break;
case 38:
if (d == 1) {
this.cr();
}
break;
}
}
c0(a, b) {
this.c3(b);
if (b.value.length > 0) {
this.h.av();
}
else {
this.h.ah();
}
}
cz(a, b) {
this.at = true;
this.ds(b.value);
this.at = false;
}
ds(a) {
let b = ['/', '-', ' ', '.', ','];
let c = stringSplit(a, b, 1);
let d = 0;
let e = 0;
let f = 0;
let g = true;
if (c.length == 3) {
if (c[0].length == 0 || c[1].length == 0 || c[2].length == 0) {
g = false;
}
if (this.bi == "dmy") {
d = parseInt(c[0]);
e = parseInt(c[1]);
f = parseInt(c[2]);
}
else if (this.bi == "mdy") {
e = parseInt(c[0]);
d = parseInt(c[1]);
f = parseInt(c[2]);
}
else if (this.bi == "ymd") {
f = parseInt(c[0]);
e = parseInt(c[1]);
d = parseInt(c[2]);
}
if (isNaN_(d) || isNaN_(f)) {
g = false;
}
if (f < 50) {
f = f + 2000;
}
if (isNaN_(e)) {
let h = "";
if (this.bi == "dmy") {
h = c[1].toLowerCase();
}
else if (this.bi == "mdy") {
h = c[0].toLowerCase();
}
else if (this.bi == "ymd") {
h = c[1].toLowerCase();
}
let i = !stringIsNullOrWhiteSpace(this.af.b1("January_Full")) ? this.af.b1("January_Full").toLowerCase() : "january";
let j = !stringIsNullOrWhiteSpace(this.af.b1("January_Short")) ? this.af.b1("January_Short").toLowerCase() : "jan";
let k = !stringIsNullOrWhiteSpace(this.af.b1("February_Full")) ? this.af.b1("February_Full").toLowerCase() : "february";
let l = !stringIsNullOrWhiteSpace(this.af.b1("February_Short")) ? this.af.b1("February_Short").toLowerCase() : "feb";
let m = !stringIsNullOrWhiteSpace(this.af.b1("March_Full")) ? this.af.b1("March_Full").toLowerCase() : "march";
let n = !stringIsNullOrWhiteSpace(this.af.b1("March_Short")) ? this.af.b1("March_Short").toLowerCase() : "mar";
let o = !stringIsNullOrWhiteSpace(this.af.b1("April_Full")) ? this.af.b1("April_Full").toLowerCase() : "april";
let p = !stringIsNullOrWhiteSpace(this.af.b1("April_Short")) ? this.af.b1("April_Short").toLowerCase() : "apr";
let q = !stringIsNullOrWhiteSpace(this.af.b1("May_Full")) ? this.af.b1("May_Full").toLowerCase() : "may";
let r = !stringIsNullOrWhiteSpace(this.af.b1("May_Short")) ? this.af.b1("May_Short").toLowerCase() : "may";
let s = !stringIsNullOrWhiteSpace(this.af.b1("June_Full")) ? this.af.b1("June_Full").toLowerCase() : "june";
let t = !stringIsNullOrWhiteSpace(this.af.b1("June_Short")) ? this.af.b1("June_Short").toLowerCase() : "jun";
let u = !stringIsNullOrWhiteSpace(this.af.b1("July_Full")) ? this.af.b1("July_Full").toLowerCase() : "july";
let v = !stringIsNullOrWhiteSpace(this.af.b1("July_Short")) ? this.af.b1("July_Short").toLowerCase() : "jul";
let w = !stringIsNullOrWhiteSpace(this.af.b1("August_Full")) ? this.af.b1("August_Full").toLowerCase() : "august";
let x = !stringIsNullOrWhiteSpace(this.af.b1("August_Short")) ? this.af.b1("August_Short").toLowerCase() : "aug";
let y = !stringIsNullOrWhiteSpace(this.af.b1("September_Full")) ? this.af.b1("September_Full").toLowerCase() : "september";
let z = !stringIsNullOrWhiteSpace(this.af.b1("September_Short")) ? this.af.b1("September_Short").toLowerCase() : "sep";
let aa = !stringIsNullOrWhiteSpace(this.af.b1("October_Full")) ? this.af.b1("October_Full").toLowerCase() : "october";
let ab = !stringIsNullOrWhiteSpace(this.af.b1("October_Short")) ? this.af.b1("October_Short").toLowerCase() : "oct";
let ac = !stringIsNullOrWhiteSpace(this.af.b1("November_Full")) ? this.af.b1("November_Full").toLowerCase() : "november";
let ad = !stringIsNullOrWhiteSpace(this.af.b1("November_Short")) ? this.af.b1("November_Short").toLowerCase() : "nov";
let ae = !stringIsNullOrWhiteSpace(this.af.b1("December_Full")) ? this.af.b1("December_Full").toLowerCase() : "december";
let af = !stringIsNullOrWhiteSpace(this.af.b1("December_Short")) ? this.af.b1("December_Short").toLowerCase() : "dec";
if (h == i || h == j) {
e = 1;
}
else if (h == k || h == l) {
e = 2;
}
else if (h == m || h == n) {
e = 3;
}
else if (h == o || h == p) {
e = 4;
}
else if (h == q || h == r) {
e = 5;
}
else if (h == s || h == t) {
e = 6;
}
else if (h == u || h == v) {
e = 7;
}
else if (h == w || h == x) {
e = 8;
}
else if (h == y || h == z) {
e = 9;
}
else if (h == aa || h == ab) {
e = 10;
}
else if (h == ac || h == ad) {
e = 11;
}
else if (h == ae || h == af) {
e = 12;
}
else {
g = false;
}
}
if (e > 12 || e < 1) {
g = false;
}
}
else {
g = false;
}
if (g) {
let ag = dateFromValues(f, e, d, 0, 0, 0, 0);
let ah = Base.compareSimple(ag, this.ba);
let ai = Base.compareSimple(ag, this.a9);
if (ah < 0 || ai > 0) {
this.dm();
}
else {
this.dr(ag);
this.h.av();
}
}
else {
if (stringIsNullOrEmpty(a)) {
this.cq();
}
else {
this.dm();
}
}
}
dr(a) {
let b = this.value;
this.value = a;
}
dm() {
if (this.o != null) {
if (+(dateGetDate(this.a8)) != +(dateGetDate(dateMinValue()))) {
let a = "";
if (this.bz == null) {
a = this.a.i(this.value);
}
else {
let b = this.value.getDate().toString();
let c = b;
if (this.bh == "dd") {
if (this.value.getDate() < 10) {
b = "0" + b;
}
}
else if (this.bh == "ddd") {
switch (this.value.getDay()) {
case 0:
b = !stringIsNullOrWhiteSpace(this.af.b1("Sunday_Short")) ? this.af.b1("Sunday_Short") : "Sun";
break;
case 1:
b = !stringIsNullOrWhiteSpace(this.af.b1("Monday_Short")) ? this.af.b1("Monday_Short") : "Mon";
break;
case 2:
b = !stringIsNullOrWhiteSpace(this.af.b1("Tuesday_Short")) ? this.af.b1("Tuesday_Short") : "Tue";
break;
case 3:
b = !stringIsNullOrWhiteSpace(this.af.b1("Wednesday_Short")) ? this.af.b1("Wednesday_Short") : "Wed";
break;
case 4:
b = !stringIsNullOrWhiteSpace(this.af.b1("Thursday_Short")) ? this.af.b1("Thursday_Short") : "Thu";
break;
case 5:
b = !stringIsNullOrWhiteSpace(this.af.b1("Friday_Short")) ? this.af.b1("Friday_Short") : "Fri";
break;
case 6:
b = !stringIsNullOrWhiteSpace(this.af.b1("Saturday_Short")) ? this.af.b1("Saturday_Short") : "Sat";
break;
}
}
else if (this.bh == "dddd") {
switch (this.value.getDay()) {
case 0:
b = !stringIsNullOrWhiteSpace(this.af.b1("Sunday_Full")) ? this.af.b1("Sunday_Full") : "Sunday";
break;
case 1:
b = !stringIsNullOrWhiteSpace(this.af.b1("Monday_Full")) ? this.af.b1("Monday_Full") : "Monday";
break;
case 2:
b = !stringIsNullOrWhiteSpace(this.af.b1("Tuesday_Full")) ? this.af.b1("Tuesday_Full") : "Tuesday";
break;
case 3:
b = !stringIsNullOrWhiteSpace(this.af.b1("Wednesday_Full")) ? this.af.b1("Wednesday_Full") : "Wednesday";
break;
case 4:
b = !stringIsNullOrWhiteSpace(this.af.b1("Thursday_Full")) ? this.af.b1("Thursday_Full") : "Thursday";
break;
case 5:
b = !stringIsNullOrWhiteSpace(this.af.b1("Friday_Full")) ? this.af.b1("Friday_Full") : "Friday";
break;
case 6:
b = !stringIsNullOrWhiteSpace(this.af.b1("Saturday_Full")) ? this.af.b1("Saturday_Full") : "Saturday";
break;
}
}
let d = dateGetMonth(this.value).toString();
if (this.bl == "mm") {
if (dateGetMonth(this.value) < 10) {
d = "0" + d;
}
}
else if (this.bl == "mmm") {
switch (dateGetMonth(this.value)) {
case 1:
d = !stringIsNullOrWhiteSpace(this.af.b1("January_Short")) ? this.af.b1("January_Short") : "Jan";
break;
case 2:
d = !stringIsNullOrWhiteSpace(this.af.b1("February_Short")) ? this.af.b1("February_Short") : "Feb";
break;
case 3:
d = !stringIsNullOrWhiteSpace(this.af.b1("March_Short")) ? this.af.b1("March_Short") : "Mar";
break;
case 4:
d = !stringIsNullOrWhiteSpace(this.af.b1("April_Short")) ? this.af.b1("April_Short") : "Apr";
break;
case 5:
d = !stringIsNullOrWhiteSpace(this.af.b1("May_Short")) ? this.af.b1("May_Short") : "May";
break;
case 6:
d = !stringIsNullOrWhiteSpace(this.af.b1("June_Short")) ? this.af.b1("June_Short") : "Jun";
break;
case 7:
d = !stringIsNullOrWhiteSpace(this.af.b1("July_Short")) ? this.af.b1("July_Short") : "Jul";
break;
case 8:
d = !stringIsNullOrWhiteSpace(this.af.b1("August_Short")) ? this.af.b1("August_Short") : "Aug";
break;
case 9:
d = !stringIsNullOrWhiteSpace(this.af.b1("September_Short")) ? this.af.b1("September_Short") : "Sep";
break;
case 10:
d = !stringIsNullOrWhiteSpace(this.af.b1("October_Short")) ? this.af.b1("October_Short") : "Oct";
break;
case 11:
d = !stringIsNullOrWhiteSpace(this.af.b1("November_Short")) ? this.af.b1("November_Short") : "Nov";
break;
case 12:
d = !stringIsNullOrWhiteSpace(this.af.b1("December_Short")) ? this.af.b1("December_Short") : "Dec";
break;
}
}
else if (this.bl == "mmmm") {
switch (dateGetMont