Browse Source

BI-7322 update

es6
Urthur 8 years ago
parent
commit
0ee36be8ed
  1. 19
      demo/js/widget/multidatetime/multi.datetime.combo.js
  2. 13
      demo/js/widget/multidatetime/multi.datetime.js
  3. 10
      demo/js/widget/multidatetime/multi.datetime.popup.js
  4. 3
      demo/js/widget/multidatetime/multi.datetime.trigger.js

19
demo/js/widget/multidatetime/multi.datetime.combo.js

@ -41,20 +41,11 @@ BI.MultiDateTimeCombo = BI.inherit(BI.Single, {
min: this.constants.DATE_MIN_VALUE, min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE max: this.constants.DATE_MAX_VALUE
}); });
self.setValue(this.storeValue);
this.popup.on(BI.MultiDateTimePopup.BUTTON_CANCEL_EVENT_CHANGE, function () { this.popup.on(BI.MultiDateTimePopup.BUTTON_CANCEL_EVENT_CHANGE, function () {
self.setValue({
value: {
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate(),
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
}
});
self.combo.hideView(); self.combo.hideView();
self.fireEvent(BI.MultiDateTimeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiDateTimeCombo.EVENT_CANCEL);
}); });
this.popup.on(BI.MultiDateTimePopup.BUTTON_OK_EVENT_CHANGE, function () { this.popup.on(BI.MultiDateTimePopup.BUTTON_OK_EVENT_CHANGE, function () {
self.setValue(self.popup.getValue()); self.setValue(self.popup.getValue());
@ -124,15 +115,11 @@ BI.MultiDateTimeCombo = BI.inherit(BI.Single, {
}, },
getValue: function () { getValue: function () {
return this.storeValue; return this.storeValue;
},
hidePopupView: function () {
this.combo.hideView();
} }
}); });
BI.MultiDateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL";
BI.MultiDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW"; BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateTimeCombo.EVENT_BEFORE_POPUPVIEW";
BI.shortcut('bi.multi_date_time_combo', BI.MultiDateTimeCombo); BI.shortcut('bi.multi_date_time_combo', BI.MultiDateTimeCombo);

13
demo/js/widget/multidatetime/multi.datetime.js

@ -15,8 +15,12 @@ BI.CustomMultiDateTimeCombo = BI.inherit(BI.Widget, {
type: "bi.multi_date_time_combo", type: "bi.multi_date_time_combo",
element: this element: this
}); });
this.multiDateTime.on(BI.MultiDateTimeCombo.EVENT_CANCEL, function () {
self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CANCEL);
});
this.multiDateTime.on(BI.MultiDateTimeCombo.EVENT_CONFIRM, function () { this.multiDateTime.on(BI.MultiDateTimeCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CHANGE); self.fireEvent(BI.CustomMultiDateTimeCombo.EVENT_CONFIRM);
}); });
}, },
@ -25,13 +29,10 @@ BI.CustomMultiDateTimeCombo = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
if (BI.isEmpty(v)) {
this.multiDateTime.setValue();
return;
}
this.multiDateTime.setValue(v); this.multiDateTime.setValue(v);
} }
}); });
BI.CustomMultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.CustomMultiDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.CustomMultiDateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL";
BI.CustomMultiDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.custom_multi_date_time_combo", BI.CustomMultiDateTimeCombo); BI.shortcut("bi.custom_multi_date_time_combo", BI.CustomMultiDateTimeCombo);

10
demo/js/widget/multidatetime/multi.datetime.popup.js

@ -111,16 +111,6 @@ BI.MultiDateTimePopup = BI.inherit(BI.Widget, {
}] }]
}); });
var date = new Date();
self.dateCombo.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
});
self.hour.setValue(date.getHours());
self.minute.setValue(date.getMinutes());
self.second.setValue(date.getSeconds());
this.dateButton = BI.createWidget({ this.dateButton = BI.createWidget({
type: "bi.grid", type: "bi.grid",
items: [[this.cancelButton, this.okButton]] items: [[this.cancelButton, this.okButton]]

3
demo/js/widget/multidatetime/multi.datetime.trigger.js

@ -19,7 +19,6 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
_init: function () { _init: function () {
BI.DateTimeTrigger.superclass._init.apply(this, arguments); BI.DateTimeTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var date = new Date();
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
@ -27,8 +26,6 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
vgap: c.vgap, vgap: c.vgap,
disabled: true disabled: true
}); });
this.editor.setValue(date.getFullYear() + "-" + self._printTime(date.getMonth() + 1) + "-" + self._printTime(date.getDate())
+ " " + self._printTime(date.getHours()) + ":" + self._printTime(date.getMinutes()) + ":" + self._printTime(date.getSeconds()));
BI.createWidget({ BI.createWidget({
type: "bi.htape", type: "bi.htape",

Loading…
Cancel
Save