Browse Source

BI-18887 && BI-18734 && BI-18828

master
windy 7 years ago
parent
commit
ae4d19bb19
  1. 16
      demo/js/widget/date/demo.datepane.js
  2. 16
      demo/js/widget/date/demo.multidate_combo.js
  3. 92
      dist/bundle.js
  4. 32
      dist/demo.js
  5. 92
      dist/widget.js
  6. 4
      src/widget/date/calendar/picker.date.js
  7. 4
      src/widget/datepane/card.static.datepane.js
  8. 2
      src/widget/datepane/datepane.js
  9. 2
      src/widget/datetimepane/card.static.datetimepane.js
  10. 4
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  11. 37
      src/widget/dynamicdatetime/dynamicdatetime.timeselect.js
  12. 4
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  13. 21
      src/widget/timeinterval/timeinterval.js
  14. 4
      src/widget/yearmonth/combo.yearmonth.js
  15. 4
      src/widget/yearmonth/trigger.yearmonth.js
  16. 6
      src/widget/yearmonthinterval/yearmonthinterval.js

16
demo/js/widget/date/demo.datepane.js

@ -15,14 +15,14 @@ Demo.DatePane = BI.inherit(BI.Widget, {
text: "bi.date_pane"
}, {
type: "bi.dynamic_date_pane",
value: {
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
},
// value: {
// type: 1,
// value: {
// year: 2017,
// month: 12,
// day: 11
// }
// },
ref: function (_ref) {
self.datepane = _ref;
},

16
demo/js/widget/date/demo.multidate_combo.js

@ -21,14 +21,14 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datecombo = this;
},
width: 300,
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
}, {
type: "bi.button",
text: "getValue",

92
dist/bundle.js vendored

@ -87709,7 +87709,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this._year = BI.getDate().getFullYear();
this._month = BI.getDate().getMonth();
this._month = BI.getDate().getMonth() + 1;
this.left = BI.createWidget({
type: "bi.icon_button",
cls: "pre-page-h-font",
@ -87744,7 +87744,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 12) {
self.setValue({
year: self.year.getValue() + 1,
month: 0
month: 1
});
} else {
self.setValue({
@ -88621,7 +88621,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
this.today = BI.getDate();
this._year = this.today.getFullYear();
this._month = this.today.getMonth();
this._month = this.today.getMonth() + 1;
this.selectedTime = o.selectedTime || {
year: this._year,
@ -88689,7 +88689,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},
@ -88844,7 +88844,7 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
var date = BI.getDate();
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth()
month: date.getMonth() + 1
});
} else {
this.ymd.setValue(value);
@ -89414,7 +89414,7 @@ BI.shortcut("bi.date_time_trigger", BI.DateTimeTrigger);BI.StaticDateTimePaneCar
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},
@ -91665,6 +91665,10 @@ BI.shortcut("bi.dynamic_date_trigger", BI.DynamicDateTrigger);BI.DynamicDateTime
},
hidePopupView: function () {
this.combo.hideView();
},
isValid: function () {
return this.trigger.isValid();
}
});
@ -91941,7 +91945,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkHour(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -91973,7 +91979,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()), BI.DynamicDateTimeSelect.MINUTE);
var value = this.getValue();
self._checkMinute(value);
this.setValue(self._formatValueToDoubleDigit(value), BI.DynamicDateTimeSelect.MINUTE);
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -92003,7 +92011,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkSecond(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}],
@ -92014,6 +92024,28 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
};
},
_checkBorder: function (v) {
v = v || {};
this._checkHour(v.hour);
this._checkMinute(v.minute);
this._checkSecond(v.second);
},
_checkHour: function (value) {
this.hour.setDownEnable(BI.parseInt(value) > 0);
this.hour.setUpEnable(BI.parseInt(value) < 23);
},
_checkMinute: function (value) {
this.minute.setDownEnable(BI.parseInt(value) > 0);
this.minute.setUpEnable(BI.parseInt(value) < 59);
},
_checkSecond: function (value) {
this.second.setDownEnable(BI.parseInt(value) > 0);
this.second.setUpEnable(BI.parseInt(value) < 59);
},
_autoSwitch: function (v, type) {
var limit = 0;
var value = v;
@ -92022,7 +92054,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
limit = 2;
break;
case BI.DynamicDateTimeSelect.MINUTE:
limit = 6;
limit = 5;
break;
default:
break;
@ -92068,6 +92100,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
this.hour.setValue(v.hour);
this.minute.setValue(v.minute);
this.second.setValue(v.second);
this._checkBorder(v);
}
});
@ -92314,6 +92347,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
},
getValue: function () {
return this.storeValue;
},
isValid: function () {
return this.editor.isValid();
}
});
@ -107800,7 +107837,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -107816,7 +107853,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -107833,26 +107870,11 @@ BI.TimeInterval = BI.inherit(BI.Single, {
self.left.hidePopupView();
self.right.hidePopupView();
});
// combo.on(BI.DynamicDateTimeCombo.EVENT_CHANGE, function () {
// BI.Bubbles.hide("error");
// var smallDate = self.left.getKey(), bigDate = self.right.getKey();
// if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
// self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
// self.element.addClass(self.constants.timeErrorCls);
// BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
// offsetStyle: "center"
// });
// self.fireEvent(BI.TimeInterval.EVENT_ERROR);
// } else {
// self._clearTitle();
// self.element.removeClass(self.constants.timeErrorCls);
// }
// });
combo.on(BI.DynamicDateTimeCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.TimeInterval.EVENT_ERROR);
@ -108996,6 +109018,10 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
getKey: function () {
return this.trigger.getKey();
},
isValid: function () {
return this.trigger.isValid();
}
});
@ -109417,6 +109443,10 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
getKey: function () {
return this.yearEditor.getValue() + "-" + this.monthEditor.getValue();
},
isValid: function () {
return this.yearEditor.isValid() && this.monthEditor.isValid();
}
});
BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS";
@ -109509,7 +109539,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -109525,7 +109555,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -109546,7 +109576,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.YearMonthInterval.EVENT_ERROR);

32
dist/demo.js vendored

@ -12161,14 +12161,14 @@ BI.shortcut("demo.tips", Demo.Tips);Demo.DatePane = BI.inherit(BI.Widget, {
text: "bi.date_pane"
}, {
type: "bi.dynamic_date_pane",
value: {
type: 1,
value: {
year: 2017,
month: 12,
day: 11
}
},
// value: {
// type: 1,
// value: {
// year: 2017,
// month: 12,
// day: 11
// }
// },
ref: function (_ref) {
self.datepane = _ref;
},
@ -12247,14 +12247,14 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datecombo = this;
},
width: 300,
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
}, {
type: "bi.button",
text: "getValue",

92
dist/widget.js vendored

@ -562,7 +562,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this._year = BI.getDate().getFullYear();
this._month = BI.getDate().getMonth();
this._month = BI.getDate().getMonth() + 1;
this.left = BI.createWidget({
type: "bi.icon_button",
cls: "pre-page-h-font",
@ -597,7 +597,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 12) {
self.setValue({
year: self.year.getValue() + 1,
month: 0
month: 1
});
} else {
self.setValue({
@ -1474,7 +1474,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
this.today = BI.getDate();
this._year = this.today.getFullYear();
this._month = this.today.getMonth();
this._month = this.today.getMonth() + 1;
this.selectedTime = o.selectedTime || {
year: this._year,
@ -1542,7 +1542,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},
@ -1697,7 +1697,7 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
var date = BI.getDate();
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth()
month: date.getMonth() + 1
});
} else {
this.ymd.setValue(value);
@ -2267,7 +2267,7 @@ BI.shortcut("bi.date_time_trigger", BI.DateTimeTrigger);BI.StaticDateTimePaneCar
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},
@ -4518,6 +4518,10 @@ BI.shortcut("bi.dynamic_date_trigger", BI.DynamicDateTrigger);BI.DynamicDateTime
},
hidePopupView: function () {
this.combo.hideView();
},
isValid: function () {
return this.trigger.isValid();
}
});
@ -4794,7 +4798,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkHour(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -4826,7 +4832,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()), BI.DynamicDateTimeSelect.MINUTE);
var value = this.getValue();
self._checkMinute(value);
this.setValue(self._formatValueToDoubleDigit(value), BI.DynamicDateTimeSelect.MINUTE);
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -4856,7 +4864,9 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkSecond(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}],
@ -4867,6 +4877,28 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
};
},
_checkBorder: function (v) {
v = v || {};
this._checkHour(v.hour);
this._checkMinute(v.minute);
this._checkSecond(v.second);
},
_checkHour: function (value) {
this.hour.setDownEnable(BI.parseInt(value) > 0);
this.hour.setUpEnable(BI.parseInt(value) < 23);
},
_checkMinute: function (value) {
this.minute.setDownEnable(BI.parseInt(value) > 0);
this.minute.setUpEnable(BI.parseInt(value) < 59);
},
_checkSecond: function (value) {
this.second.setDownEnable(BI.parseInt(value) > 0);
this.second.setUpEnable(BI.parseInt(value) < 59);
},
_autoSwitch: function (v, type) {
var limit = 0;
var value = v;
@ -4875,7 +4907,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
limit = 2;
break;
case BI.DynamicDateTimeSelect.MINUTE:
limit = 6;
limit = 5;
break;
default:
break;
@ -4921,6 +4953,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat
this.hour.setValue(v.hour);
this.minute.setValue(v.minute);
this.second.setValue(v.second);
this._checkBorder(v);
}
});
@ -5167,6 +5200,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
},
getValue: function () {
return this.storeValue;
},
isValid: function () {
return this.editor.isValid();
}
});
@ -20653,7 +20690,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -20669,7 +20706,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -20686,26 +20723,11 @@ BI.TimeInterval = BI.inherit(BI.Single, {
self.left.hidePopupView();
self.right.hidePopupView();
});
// combo.on(BI.DynamicDateTimeCombo.EVENT_CHANGE, function () {
// BI.Bubbles.hide("error");
// var smallDate = self.left.getKey(), bigDate = self.right.getKey();
// if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
// self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
// self.element.addClass(self.constants.timeErrorCls);
// BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
// offsetStyle: "center"
// });
// self.fireEvent(BI.TimeInterval.EVENT_ERROR);
// } else {
// self._clearTitle();
// self.element.removeClass(self.constants.timeErrorCls);
// }
// });
combo.on(BI.DynamicDateTimeCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.TimeInterval.EVENT_ERROR);
@ -21849,6 +21871,10 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
getKey: function () {
return this.trigger.getKey();
},
isValid: function () {
return this.trigger.isValid();
}
});
@ -22270,6 +22296,10 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
getKey: function () {
return this.yearEditor.getValue() + "-" + this.monthEditor.getValue();
},
isValid: function () {
return this.yearEditor.isValid() && this.monthEditor.isValid();
}
});
BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS";
@ -22362,7 +22392,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -22378,7 +22408,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -22399,7 +22429,7 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year
combo.on(BI.DynamicYearMonthCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.YearMonthInterval.EVENT_ERROR);

4
src/widget/date/calendar/picker.date.js

@ -18,7 +18,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this._year = BI.getDate().getFullYear();
this._month = BI.getDate().getMonth();
this._month = BI.getDate().getMonth() + 1;
this.left = BI.createWidget({
type: "bi.icon_button",
cls: "pre-page-h-font",
@ -53,7 +53,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 12) {
self.setValue({
year: self.year.getValue() + 1,
month: 0
month: 1
});
} else {
self.setValue({

4
src/widget/datepane/card.static.datepane.js

@ -17,7 +17,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
this.today = BI.getDate();
this._year = this.today.getFullYear();
this._month = this.today.getMonth();
this._month = this.today.getMonth() + 1;
this.selectedTime = o.selectedTime || {
year: this._year,
@ -85,7 +85,7 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, {
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},

2
src/widget/datepane/datepane.js

@ -116,7 +116,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
var date = BI.getDate();
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth()
month: date.getMonth() + 1
});
} else {
this.ymd.setValue(value);

2
src/widget/datetimepane/card.static.datetimepane.js

@ -84,7 +84,7 @@ BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, {
var today = BI.getDate();
return {
year: today.getFullYear(),
month: today.getMonth()
month: today.getMonth() + 1
};
},

4
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -243,6 +243,10 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
},
hidePopupView: function () {
this.combo.hideView();
},
isValid: function () {
return this.trigger.isValid();
}
});

37
src/widget/dynamicdatetime/dynamicdatetime.timeselect.js

@ -25,7 +25,9 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkHour(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -57,7 +59,9 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()), BI.DynamicDateTimeSelect.MINUTE);
var value = this.getValue();
self._checkMinute(value);
this.setValue(self._formatValueToDoubleDigit(value), BI.DynamicDateTimeSelect.MINUTE);
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}, {
@ -87,7 +91,9 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () {
this.setValue(self._formatValueToDoubleDigit(this.getValue()));
var value = this.getValue();
self._checkSecond(value);
this.setValue(self._formatValueToDoubleDigit(value));
self.fireEvent(BI.DynamicDateTimeSelect.EVENT_CONFIRM);
}
}],
@ -98,6 +104,28 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
};
},
_checkBorder: function (v) {
v = v || {};
this._checkHour(v.hour);
this._checkMinute(v.minute);
this._checkSecond(v.second);
},
_checkHour: function (value) {
this.hour.setDownEnable(BI.parseInt(value) > 0);
this.hour.setUpEnable(BI.parseInt(value) < 23);
},
_checkMinute: function (value) {
this.minute.setDownEnable(BI.parseInt(value) > 0);
this.minute.setUpEnable(BI.parseInt(value) < 59);
},
_checkSecond: function (value) {
this.second.setDownEnable(BI.parseInt(value) > 0);
this.second.setUpEnable(BI.parseInt(value) < 59);
},
_autoSwitch: function (v, type) {
var limit = 0;
var value = v;
@ -106,7 +134,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
limit = 2;
break;
case BI.DynamicDateTimeSelect.MINUTE:
limit = 6;
limit = 5;
break;
default:
break;
@ -152,6 +180,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, {
this.hour.setValue(v.hour);
this.minute.setValue(v.minute);
this.second.setValue(v.second);
this._checkBorder(v);
}
});

4
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -235,6 +235,10 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
},
getValue: function () {
return this.storeValue;
},
isValid: function () {
return this.editor.isValid();
}
});

21
src/widget/timeinterval/timeinterval.js

@ -79,7 +79,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -95,7 +95,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicDateTimeCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -112,26 +112,11 @@ BI.TimeInterval = BI.inherit(BI.Single, {
self.left.hidePopupView();
self.right.hidePopupView();
});
// combo.on(BI.DynamicDateTimeCombo.EVENT_CHANGE, function () {
// BI.Bubbles.hide("error");
// var smallDate = self.left.getKey(), bigDate = self.right.getKey();
// if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
// self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
// self.element.addClass(self.constants.timeErrorCls);
// BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
// offsetStyle: "center"
// });
// self.fireEvent(BI.TimeInterval.EVENT_ERROR);
// } else {
// self._clearTitle();
// self.element.removeClass(self.constants.timeErrorCls);
// }
// });
combo.on(BI.DynamicDateTimeCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.TimeInterval.EVENT_ERROR);

4
src/widget/yearmonth/combo.yearmonth.js

@ -162,6 +162,10 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
getKey: function () {
return this.trigger.getKey();
},
isValid: function () {
return this.trigger.isValid();
}
});

4
src/widget/yearmonth/trigger.yearmonth.js

@ -201,6 +201,10 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
getKey: function () {
return this.yearEditor.getValue() + "-" + this.monthEditor.getValue();
},
isValid: function () {
return this.yearEditor.isValid() && this.monthEditor.isValid();
}
});
BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS";

6
src/widget/yearmonthinterval/yearmonthinterval.js

@ -82,7 +82,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -98,7 +98,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, {
@ -119,7 +119,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
combo.on(BI.DynamicYearMonthCombo.EVENT_CONFIRM, function () {
BI.Bubbles.hide("error");
var smallDate = self.left.getKey(), bigDate = self.right.getKey();
if (self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) {
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text"));
self.element.addClass(self.constants.timeErrorCls);
self.fireEvent(BI.YearMonthInterval.EVENT_ERROR);

Loading…
Cancel
Save