UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

233 lines (232 loc) 7.99 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 { __extends } from "tslib"; import { BaseEditorView } from "./BaseEditorView"; import { XDatePicker } from "igniteui-react-inputs"; import { runOn, delegateCombine, delegateRemove, markType } from "igniteui-react-core"; import { dateMinValue } from "igniteui-react-core"; /** * @hidden */ var DateEditorView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(DateEditorView, _super); function DateEditorView(a, b, c) { var _this = _super.call(this, a, c) || this; _this.ae = null; _this.z = null; _this.aa = null; _this.ac = false; _this.ab = false; var d = a.createElement("div"); d.setRawStyleProperty("width", "100%"); d.setRawStyleProperty("margin-top", "-10px"); d.setRawStyleProperty("height", "38px"); _this.container = d; var e = a.getSubRenderer(d); var f = a.createElement("div"); e.append(f); var g = a.createElement("div"); e.append(g); _this.z = new XDatePicker(); _this.z.ay = false; _this.z.provideContainer(e); _this.z.w = b; _this.z.y = 3; _this.z.a0 = _this.showClearButton; _this.z.a1 = _this.ad; _this.z.dy = _this.textColor; _this.z.bf = -1; var h = e.getExternal(_this.z, e.rootWrapper, null); if (_this.aa != null) { _this.z.ad = _this.aa; } _this.attachEvents(); return _this; } Object.defineProperty(DateEditorView.prototype, "af", { get: function () { return this.ae; }, set: function (a) { var b = this.ae; this.ae = a; if (b != this.ae) { this.v("FormatString", b, this.ae); } }, enumerable: false, configurable: true }); Object.defineProperty(DateEditorView.prototype, "ad", { get: function () { return this.ab; }, set: function (a) { var b = this.ab; this.ab = a; if (b != this.ab) { this.v("ShowTodayButton", b, this.ab); } }, enumerable: false, configurable: true }); DateEditorView.prototype.setFont = function (a) { this.aa = a; if (this.z != null && this.aa != null) { this.z.ad = this.aa; } }; DateEditorView.prototype.attachEvents = function () { if (this.z != null) { var a = this.z; a.selectedValueChanged = delegateCombine(a.selectedValueChanged, runOn(this, this.onDatePickerValueChanged)); var b = this.z; b.gotFocus = delegateCombine(b.gotFocus, runOn(this, this.onDatePickerGotFocus)); var c = this.z; c.lostFocus = delegateCombine(c.lostFocus, runOn(this, this.onDatePickerLostFocus)); var d = this.z; d.keyDown = delegateCombine(d.keyDown, runOn(this, this.onInputKeyDown)); var e = this.z; e.changing = delegateCombine(e.changing, runOn(this, this.onInputChanging)); } }; DateEditorView.prototype.detachEvents = function () { if (this.z != null) { var a = this.z; a.selectedValueChanged = delegateRemove(a.selectedValueChanged, runOn(this, this.onDatePickerValueChanged)); var b = this.z; b.gotFocus = delegateRemove(b.gotFocus, runOn(this, this.onDatePickerGotFocus)); var c = this.z; c.lostFocus = delegateRemove(c.lostFocus, runOn(this, this.onDatePickerLostFocus)); var d = this.z; d.keyDown = delegateRemove(d.keyDown, runOn(this, this.onInputKeyDown)); var e = this.z; e.changing = delegateRemove(e.changing, runOn(this, this.onInputChanging)); } }; DateEditorView.prototype.onTargetChanged = function () { if (this.z != null) { this.ac = true; this.focus(); this.ac = false; } }; DateEditorView.prototype.onEditStarted = function () { _super.prototype.onEditStarted.call(this); if (!this.a.isEditRefocusDesired) { this.focus(); } }; DateEditorView.prototype.onEditEnded = function () { _super.prototype.onEditEnded.call(this); if (this.a.isEditRefocusDesired) { var a = this.i.rootWrapper.getNativeElement(); if (a == document.activeElement || a.contains(document.activeElement)) { this.focus(); } } }; DateEditorView.prototype.t = function () { if (this.z != null) { this.z.focus(true); this.z.dg(); } }; DateEditorView.prototype.ah = function () { if (this.z != null) { this.z.cr(); } }; DateEditorView.prototype.v = function (a, b, c) { _super.prototype.v.call(this, a, b, c); switch (a) { case "FormatString": this.al(); break; case "ShowClearButton": if (this.z != null) { this.z.a0 = this.showClearButton; } break; case "ShowTodayButton": if (this.z != null) { this.z.a1 = this.ad; } break; } }; DateEditorView.prototype.al = function () { this.z.bz = this.af; }; DateEditorView.prototype.x = function () { this.ac = true; if (this.z != null) { if (this.value == null) { this.z.value = dateMinValue(); } else { this.z.value = this.value; } if (this.focusOnValueChanged && !this.h()) { this.t(); } } this.ac = false; }; DateEditorView.prototype.s = function () { if (this.z != null) { this.z.av = !this.isEnabled; } }; DateEditorView.prototype.w = function () { _super.prototype.w.call(this); if (this.z != null) { this.z.dy = this.textColor; } }; DateEditorView.prototype.onDatePickerValueChanged = function (a, b) { this.an(); }; DateEditorView.prototype.an = function () { if (this.ac) { return; } if (+(this.z.value) != +(dateMinValue())) { this.r(this.z.value, false); } else if (+(this.z.value) == +(dateMinValue())) { this.r(null, false); } else { this.r(this.value, false); } }; DateEditorView.prototype.onInputChanging = function (a, b) { this.q(); }; DateEditorView.prototype.onDatePickerLostFocus = function (a, b) { this.p(); }; DateEditorView.prototype.onDatePickerGotFocus = function (a, b) { this.o(); }; DateEditorView.prototype.getEditorValue = function () { if (this.z != null) { return this.z.value; } return null; }; DateEditorView.prototype.setEditorValue = function (a) { if (this.z != null) { this.z.value = a != null ? a : dateMinValue(); } }; DateEditorView.$t = markType(DateEditorView, 'DateEditorView', BaseEditorView.$); return DateEditorView; }(BaseEditorView)); export { DateEditorView };