Browse Source

控件部分月份取值为1-12

es6
windy 7 years ago
parent
commit
086cf229bb
  1. 6
      demo/js/widget/date/demo.datepane.js
  2. 4
      demo/js/widget/date/demo.multidate_combo.js
  3. 6
      demo/js/widget/yearmonth/demo.year_month_combo.js
  4. 2
      demo/js/widget/yearmonthinterval/demo.year_month_interval.js
  5. 39
      dist/bundle.js
  6. 9
      dist/case.js
  7. 18
      dist/demo.js
  8. 30
      dist/widget.js
  9. 9
      src/case/calendar/calendar.js
  10. 2
      src/widget/date/calendar/combo.month.date.js
  11. 6
      src/widget/date/calendar/picker.date.js
  12. 2
      src/widget/dynamicdate/dynamicdate.popup.js
  13. 4
      src/widget/dynamicdate/dynamicdate.trigger.js
  14. 2
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  15. 4
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  16. 4
      src/widget/month/popup.month.js
  17. 4
      src/widget/yearmonth/card.static.yearmonth.js
  18. 2
      src/widget/yearmonth/trigger.yearmonth.js

6
demo/js/widget/date/demo.datepane.js

@ -19,7 +19,7 @@ Demo.DatePane = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2017, year: 2017,
month: 11, month: 12,
day: 11 day: 11
} }
}, },
@ -39,7 +39,7 @@ Demo.DatePane = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2017, year: 2017,
month: 11, month: 12,
day: 11, day: 11,
hour: 12, hour: 12,
minute: 12, minute: 12,
@ -62,7 +62,7 @@ Demo.DatePane = BI.inherit(BI.Widget, {
handler: function () { handler: function () {
self.datepane.setValue({ self.datepane.setValue({
year: 2017, year: 2017,
month: 11, month: 12,
day: 31 day: 31
}); });
} }

4
demo/js/widget/date/demo.multidate_combo.js

@ -25,7 +25,7 @@ Demo.Date = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 1, month: 2,
day: 23 day: 23
} }
} }
@ -46,7 +46,7 @@ Demo.Date = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 1, month: 2,
day: 23 day: 23
} }
} }

6
demo/js/widget/yearmonth/demo.year_month_combo.js

@ -20,7 +20,7 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0 month: 1
} }
} }
}, { }, {
@ -32,12 +32,12 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, {
width: 300 width: 300
}, { }, {
type: "bi.button", type: "bi.button",
text: "setVlaue '2017-12'", text: "setValue '2017-12'",
width: 300, width: 300,
handler: function () { handler: function () {
self.widget.setValue({ self.widget.setValue({
year: 2017, year: 2017,
month: 11 month: 12
}); });
} }
}], }],

2
demo/js/widget/yearmonthinterval/demo.year_month_interval.js

@ -24,7 +24,7 @@ Demo.YearMonthInterval = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0 month: 1
} }
} }
}, },

39
dist/bundle.js vendored

@ -73547,7 +73547,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
year: 2015, year: 2015,
month: 7, // 7表示八月 month: 8,
day: 25 day: 25
}); });
}, },
@ -73565,18 +73565,23 @@ BI.Calendar = BI.inherit(BI.Widget, {
var MD = Date._MD.slice(0); var MD = Date._MD.slice(0);
MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28; MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28;
// 日期所在月第一天
De.setFullYear(log.ymd[0], log.ymd[1], 1); De.setFullYear(log.ymd[0], log.ymd[1], 1);
// 是周几
log.FDay = De.getDay(); log.FDay = De.getDay();
// 当前月页第一天是几号
log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1; log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1;
log.NDay = 1; log.NDay = 1;
var items = []; var items = [];
BI.each(BI.range(42), function (i) { BI.each(BI.range(42), function (i) {
var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD; var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD;
// 上个月的日期
if (i < log.FDay) { if (i < log.FDay) {
td.lastMonth = true; td.lastMonth = true;
DD = i + log.PDay; DD = i + log.PDay;
// 上一年
MM === 1 && (YY -= 1); MM === 1 && (YY -= 1);
MM = MM === 1 ? 12 : MM - 1; MM = MM === 1 ? 12 : MM - 1;
} else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) { } else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) {
@ -73619,7 +73624,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
vgap: 10 vgap: 10
}] }]
}); });
var days = this._dateCreator(o.year, o.month, o.day); var days = this._dateCreator(o.year, o.month - 1, o.day);
items = []; items = [];
items.push(days.slice(0, 7)); items.push(days.slice(0, 7));
items.push(days.slice(7, 14)); items.push(days.slice(7, 14));
@ -86943,7 +86948,7 @@ BI.MonthDateCombo = BI.inherit(BI.Trigger, {
}, },
setValue: function (v) { setValue: function (v) {
this.trigger.setValue(v + 1); this.trigger.setValue(v);
this.popup.setValue(v); this.popup.setValue(v);
}, },
@ -87048,7 +87053,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 0) { if (self._month === 0) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 11 month: 12
}); });
} else { } else {
self.setValue({ self.setValue({
@ -87140,14 +87145,14 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_checkLeftValid: function () { _checkLeftValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 0 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 1 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear());
this.left.setEnable(valid); this.left.setEnable(valid);
return valid; return valid;
}, },
_checkRightValid: function () { _checkRightValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 11 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 12 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear());
this.right.setEnable(valid); this.right.setEnable(valid);
return valid; return valid;
}, },
@ -90452,7 +90457,7 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
@ -90547,7 +90552,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0 day: date[2] | 0
} }
}; };
@ -90676,7 +90681,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day; var dateStr = value.year + "-" + (value.month) + "-" + value.day;
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);
@ -91166,7 +91171,7 @@ BI.extend(BI.DynamicDateTimeCombo, {
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.timeSelect.setValue(); this.timeSelect.setValue();
@ -91431,7 +91436,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0, day: date[2] | 0,
hour: date[3] | 0, hour: date[3] | 0,
minute: date[4] | 0, minute: date[4] | 0,
@ -91563,7 +91568,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day + " " + var dateStr = value.year + "-" + (value.month) + "-" + value.day + " " +
(value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00"); (value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
@ -93499,7 +93504,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -93519,7 +93524,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });
@ -106840,7 +106845,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
_createMonths: function () { _createMonths: function () {
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -106860,7 +106865,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });
@ -107502,7 +107507,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {}; value = value || {};
var month = BI.isNull(value.month) ? null : value.month + 1; var month = BI.isNull(value.month) ? null : value.month;
this.yearEditor.setValue(value.year); this.yearEditor.setValue(value.year);
this.yearEditor.setTitle(value.year); this.yearEditor.setTitle(value.year);
this.monthEditor.setValue(month); this.monthEditor.setValue(month);

9
dist/case.js vendored

@ -1605,7 +1605,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
year: 2015, year: 2015,
month: 7, // 7表示八月 month: 8,
day: 25 day: 25
}); });
}, },
@ -1623,18 +1623,23 @@ BI.Calendar = BI.inherit(BI.Widget, {
var MD = Date._MD.slice(0); var MD = Date._MD.slice(0);
MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28; MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28;
// 日期所在月第一天
De.setFullYear(log.ymd[0], log.ymd[1], 1); De.setFullYear(log.ymd[0], log.ymd[1], 1);
// 是周几
log.FDay = De.getDay(); log.FDay = De.getDay();
// 当前月页第一天是几号
log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1; log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1;
log.NDay = 1; log.NDay = 1;
var items = []; var items = [];
BI.each(BI.range(42), function (i) { BI.each(BI.range(42), function (i) {
var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD; var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD;
// 上个月的日期
if (i < log.FDay) { if (i < log.FDay) {
td.lastMonth = true; td.lastMonth = true;
DD = i + log.PDay; DD = i + log.PDay;
// 上一年
MM === 1 && (YY -= 1); MM === 1 && (YY -= 1);
MM = MM === 1 ? 12 : MM - 1; MM = MM === 1 ? 12 : MM - 1;
} else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) { } else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) {
@ -1677,7 +1682,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
vgap: 10 vgap: 10
}] }]
}); });
var days = this._dateCreator(o.year, o.month, o.day); var days = this._dateCreator(o.year, o.month - 1, o.day);
items = []; items = [];
items.push(days.slice(0, 7)); items.push(days.slice(0, 7));
items.push(days.slice(7, 14)); items.push(days.slice(7, 14));

18
dist/demo.js vendored

@ -12097,7 +12097,7 @@ BI.shortcut("demo.tips", Demo.Tips);Demo.DatePane = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2017, year: 2017,
month: 11, month: 12,
day: 11 day: 11
} }
}, },
@ -12117,7 +12117,7 @@ BI.shortcut("demo.tips", Demo.Tips);Demo.DatePane = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2017, year: 2017,
month: 11, month: 12,
day: 11, day: 11,
hour: 12, hour: 12,
minute: 12, minute: 12,
@ -12140,7 +12140,7 @@ BI.shortcut("demo.tips", Demo.Tips);Demo.DatePane = BI.inherit(BI.Widget, {
handler: function () { handler: function () {
self.datepane.setValue({ self.datepane.setValue({
year: 2017, year: 2017,
month: 11, month: 12,
day: 31 day: 31
}); });
} }
@ -12183,7 +12183,7 @@ Demo.Date = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 1, month: 2,
day: 23 day: 23
} }
} }
@ -12204,7 +12204,7 @@ Demo.Date = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 1, month: 2,
day: 23 day: 23
} }
} }
@ -14557,7 +14557,7 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0 month: 1
} }
} }
}, { }, {
@ -14569,12 +14569,12 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, {
width: 300 width: 300
}, { }, {
type: "bi.button", type: "bi.button",
text: "setVlaue '2017-12'", text: "setValue '2017-12'",
width: 300, width: 300,
handler: function () { handler: function () {
self.widget.setValue({ self.widget.setValue({
year: 2017, year: 2017,
month: 11 month: 12
}); });
} }
}], }],
@ -14609,7 +14609,7 @@ BI.shortcut("demo.year_month_combo", Demo.YearMonthCombo);Demo.YearMonthInterval
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0 month: 1
} }
} }
}, },

30
dist/widget.js vendored

@ -468,7 +468,7 @@ BI.MonthDateCombo = BI.inherit(BI.Trigger, {
}, },
setValue: function (v) { setValue: function (v) {
this.trigger.setValue(v + 1); this.trigger.setValue(v);
this.popup.setValue(v); this.popup.setValue(v);
}, },
@ -573,7 +573,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 0) { if (self._month === 0) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 11 month: 12
}); });
} else { } else {
self.setValue({ self.setValue({
@ -665,14 +665,14 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_checkLeftValid: function () { _checkLeftValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 0 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 1 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear());
this.left.setEnable(valid); this.left.setEnable(valid);
return valid; return valid;
}, },
_checkRightValid: function () { _checkRightValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 11 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 12 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear());
this.right.setEnable(valid); this.right.setEnable(valid);
return valid; return valid;
}, },
@ -3977,7 +3977,7 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
@ -4072,7 +4072,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0 day: date[2] | 0
} }
}; };
@ -4201,7 +4201,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day; var dateStr = value.year + "-" + (value.month) + "-" + value.day;
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);
@ -4691,7 +4691,7 @@ BI.extend(BI.DynamicDateTimeCombo, {
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.timeSelect.setValue(); this.timeSelect.setValue();
@ -4956,7 +4956,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0, day: date[2] | 0,
hour: date[3] | 0, hour: date[3] | 0,
minute: date[4] | 0, minute: date[4] | 0,
@ -5088,7 +5088,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day + " " + var dateStr = value.year + "-" + (value.month) + "-" + value.day + " " +
(value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00"); (value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
@ -7024,7 +7024,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -7044,7 +7044,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });
@ -20365,7 +20365,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
_createMonths: function () { _createMonths: function () {
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -20385,7 +20385,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });
@ -21027,7 +21027,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {}; value = value || {};
var month = BI.isNull(value.month) ? null : value.month + 1; var month = BI.isNull(value.month) ? null : value.month;
this.yearEditor.setValue(value.year); this.yearEditor.setValue(value.year);
this.yearEditor.setTitle(value.year); this.yearEditor.setTitle(value.year);
this.monthEditor.setValue(month); this.monthEditor.setValue(month);

9
src/case/calendar/calendar.js

@ -14,7 +14,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
year: 2015, year: 2015,
month: 7, // 7表示八月 month: 8,
day: 25 day: 25
}); });
}, },
@ -32,18 +32,23 @@ BI.Calendar = BI.inherit(BI.Widget, {
var MD = Date._MD.slice(0); var MD = Date._MD.slice(0);
MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28; MD[1] = BI.isLeapYear(log.ymd[0]) ? 29 : 28;
// 日期所在月第一天
De.setFullYear(log.ymd[0], log.ymd[1], 1); De.setFullYear(log.ymd[0], log.ymd[1], 1);
// 是周几
log.FDay = De.getDay(); log.FDay = De.getDay();
// 当前月页第一天是几号
log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1; log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1;
log.NDay = 1; log.NDay = 1;
var items = []; var items = [];
BI.each(BI.range(42), function (i) { BI.each(BI.range(42), function (i) {
var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD; var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD;
// 上个月的日期
if (i < log.FDay) { if (i < log.FDay) {
td.lastMonth = true; td.lastMonth = true;
DD = i + log.PDay; DD = i + log.PDay;
// 上一年
MM === 1 && (YY -= 1); MM === 1 && (YY -= 1);
MM = MM === 1 ? 12 : MM - 1; MM = MM === 1 ? 12 : MM - 1;
} else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) { } else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) {
@ -86,7 +91,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
vgap: 10 vgap: 10
}] }]
}); });
var days = this._dateCreator(o.year, o.month, o.day); var days = this._dateCreator(o.year, o.month - 1, o.day);
items = []; items = [];
items.push(days.slice(0, 7)); items.push(days.slice(0, 7));
items.push(days.slice(7, 14)); items.push(days.slice(7, 14));

2
src/widget/date/calendar/combo.month.date.js

@ -49,7 +49,7 @@ BI.MonthDateCombo = BI.inherit(BI.Trigger, {
}, },
setValue: function (v) { setValue: function (v) {
this.trigger.setValue(v + 1); this.trigger.setValue(v);
this.popup.setValue(v); this.popup.setValue(v);
}, },

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

@ -29,7 +29,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (self._month === 0) { if (self._month === 0) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 11 month: 12
}); });
} else { } else {
self.setValue({ self.setValue({
@ -121,14 +121,14 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_checkLeftValid: function () { _checkLeftValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 0 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 1 && this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear());
this.left.setEnable(valid); this.left.setEnable(valid);
return valid; return valid;
}, },
_checkRightValid: function () { _checkRightValid: function () {
var o = this.options; var o = this.options;
var valid = !(this._month === 11 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear()); var valid = !(this._month === 12 && this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear());
this.right.setEnable(valid); this.right.setEnable(valid);
return valid; return valid;
}, },

2
src/widget/dynamicdate/dynamicdate.popup.js

@ -189,7 +189,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));

4
src/widget/dynamicdate/dynamicdate.trigger.js

@ -69,7 +69,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0 day: date[2] | 0
} }
}; };
@ -198,7 +198,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day; var dateStr = value.year + "-" + (value.month) + "-" + value.day;
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);

2
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -201,7 +201,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
var date = BI.getDate(); var date = BI.getDate();
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth() + 1,
day: date.getDate() day: date.getDate()
}); });
this.timeSelect.setValue(); this.timeSelect.setValue();

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

@ -69,7 +69,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
type: BI.DynamicDateCombo.Static, type: BI.DynamicDateCombo.Static,
value: { value: {
year: date[0] | 0, year: date[0] | 0,
month: date[1] - 1, month: date[1],
day: date[2] | 0, day: date[2] | 0,
hour: date[3] | 0, hour: date[3] | 0,
minute: date[4] | 0, minute: date[4] | 0,
@ -201,7 +201,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day + " " + var dateStr = value.year + "-" + (value.month) + "-" + value.day + " " +
(value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00"); (value.hour || "00") + ":" + (value.minute || "00") + ":" + (value.second || "00");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);

4
src/widget/month/popup.month.js

@ -19,7 +19,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -39,7 +39,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });

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

@ -7,7 +7,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
_createMonths: function () { _createMonths: function () {
// 纵向排列月 // 纵向排列月
var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
items.push(month.slice(0, 2)); items.push(month.slice(0, 2));
items.push(month.slice(2, 4)); items.push(month.slice(2, 4));
@ -27,7 +27,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td + 1 text: td
}; };
}); });
}); });

2
src/widget/yearmonth/trigger.yearmonth.js

@ -179,7 +179,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {}; value = value || {};
var month = BI.isNull(value.month) ? null : value.month + 1; var month = BI.isNull(value.month) ? null : value.month;
this.yearEditor.setValue(value.year); this.yearEditor.setValue(value.year);
this.yearEditor.setTitle(value.year); this.yearEditor.setTitle(value.year);
this.monthEditor.setValue(month); this.monthEditor.setValue(month);

Loading…
Cancel
Save