igniteui-react-grids
Version:
Ignite UI React grid components.
223 lines (222 loc) • 7.44 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 { 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
*/
export let DateEditorView = /*@__PURE__*/ (() => {
class DateEditorView extends BaseEditorView {
get af() {
return this.ae;
}
set af(a) {
let b = this.ae;
this.ae = a;
if (b != this.ae) {
this.v("FormatString", b, this.ae);
}
}
get ad() {
return this.ab;
}
set ad(a) {
let b = this.ab;
this.ab = a;
if (b != this.ab) {
this.v("ShowTodayButton", b, this.ab);
}
}
constructor(a, b, c) {
super(a, c);
this.ae = null;
this.z = null;
this.aa = null;
this.ac = false;
this.ab = false;
let d = a.createElement("div");
d.setRawStyleProperty("width", "100%");
d.setRawStyleProperty("margin-top", "-10px");
d.setRawStyleProperty("height", "38px");
this.container = d;
let e = a.getSubRenderer(d);
let f = a.createElement("div");
e.append(f);
let 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;
let h = e.getExternal(this.z, e.rootWrapper, null);
if (this.aa != null) {
this.z.ad = this.aa;
}
this.attachEvents();
}
setFont(a) {
this.aa = a;
if (this.z != null && this.aa != null) {
this.z.ad = this.aa;
}
}
attachEvents() {
if (this.z != null) {
let a = this.z;
a.selectedValueChanged = delegateCombine(a.selectedValueChanged, runOn(this, this.onDatePickerValueChanged));
let b = this.z;
b.gotFocus = delegateCombine(b.gotFocus, runOn(this, this.onDatePickerGotFocus));
let c = this.z;
c.lostFocus = delegateCombine(c.lostFocus, runOn(this, this.onDatePickerLostFocus));
let d = this.z;
d.keyDown = delegateCombine(d.keyDown, runOn(this, this.onInputKeyDown));
let e = this.z;
e.changing = delegateCombine(e.changing, runOn(this, this.onInputChanging));
}
}
detachEvents() {
if (this.z != null) {
let a = this.z;
a.selectedValueChanged = delegateRemove(a.selectedValueChanged, runOn(this, this.onDatePickerValueChanged));
let b = this.z;
b.gotFocus = delegateRemove(b.gotFocus, runOn(this, this.onDatePickerGotFocus));
let c = this.z;
c.lostFocus = delegateRemove(c.lostFocus, runOn(this, this.onDatePickerLostFocus));
let d = this.z;
d.keyDown = delegateRemove(d.keyDown, runOn(this, this.onInputKeyDown));
let e = this.z;
e.changing = delegateRemove(e.changing, runOn(this, this.onInputChanging));
}
}
onTargetChanged() {
if (this.z != null) {
this.ac = true;
this.focus();
this.ac = false;
}
}
onEditStarted() {
super.onEditStarted();
if (!this.a.isEditRefocusDesired) {
this.focus();
}
}
onEditEnded() {
super.onEditEnded();
if (this.a.isEditRefocusDesired) {
let a = this.i.rootWrapper.getNativeElement();
if (a == document.activeElement || a.contains(document.activeElement)) {
this.focus();
}
}
}
t() {
if (this.z != null) {
this.z.focus(true);
this.z.dg();
}
}
ah() {
if (this.z != null) {
this.z.cr();
}
}
v(a, b, c) {
super.v(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;
}
}
al() {
this.z.bz = this.af;
}
x() {
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;
}
s() {
if (this.z != null) {
this.z.av = !this.isEnabled;
}
}
w() {
super.w();
if (this.z != null) {
this.z.dy = this.textColor;
}
}
onDatePickerValueChanged(a, b) {
this.an();
}
an() {
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);
}
}
onInputChanging(a, b) {
this.q();
}
onDatePickerLostFocus(a, b) {
this.p();
}
onDatePickerGotFocus(a, b) {
this.o();
}
getEditorValue() {
if (this.z != null) {
return this.z.value;
}
return null;
}
setEditorValue(a) {
if (this.z != null) {
this.z.value = a != null ? a : dateMinValue();
}
}
}
DateEditorView.$t = /*@__PURE__*/ markType(DateEditorView, 'DateEditorView', BaseEditorView.$);
return DateEditorView;
})();