diff --git a/src/widget/datetime/datetime.combo.js b/src/widget/datetime/datetime.combo.js index aa8b6e2471..71184aa915 100644 --- a/src/widget/datetime/datetime.combo.js +++ b/src/widget/datetime/datetime.combo.js @@ -6,15 +6,15 @@ BI.DateTimeCombo = BI.inherit(BI.Single, { popupHeight: 290, popupWidth: 270, comboAdjustHeight: 1, - border: 1, - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + border: 1 }, _defaultConfig: function () { return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-date-time-combo bi-border bi-border-radius", width: 200, - height: 24 + height: 24, + minDate: "1900-01-01", + maxDate: "2099-12-31" }); }, _init: function () { @@ -31,16 +31,16 @@ BI.DateTimeCombo = BI.inherit(BI.Single, { }; this.trigger = BI.createWidget({ type: "bi.date_time_trigger", - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, value: opts.value }); this.popup = BI.createWidget({ type: "bi.date_time_popup", behaviors: opts.behaviors, - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, value: opts.value }); self.setValue(this.storeValue); diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index 86baf4eabb..473abc11c7 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -3,14 +3,14 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { popupHeight: 259, popupWidth: 270, comboAdjustHeight: 1, - border: 1, - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + border: 1 }, props: { baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius", - height: 22 + height: 22, + minDate: "1900-01-01", + maxDate: "2099-12-31" }, @@ -46,8 +46,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { isNeedAdjustWidth: false, el: { type: "bi.dynamic_date_trigger", - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, height: opts.height, value: opts.value, ref: function () { @@ -128,8 +128,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { el: { type: "bi.dynamic_date_popup", behaviors: opts.behaviors, - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, value: opts.value, ref: function () { self.popup = this; diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 6983ee7d0e..09536bed34 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -3,14 +3,14 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { popupHeight: 259, popupWidth: 270, comboAdjustHeight: 1, - border: 1, - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + border: 1 }, props: { baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow", - height: 22 + height: 22, + minDate: "1900-01-01", + maxDate: "2099-12-31" }, @@ -46,8 +46,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { isNeedAdjustWidth: false, el: { type: "bi.dynamic_date_time_trigger", - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, height: opts.height, value: opts.value, ref: function () { @@ -128,8 +128,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { el: { type: "bi.dynamic_date_time_popup", behaviors: opts.behaviors, - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE, + min: opts.minDate, + max: opts.maxDate, value: opts.value, ref: function () { self.popup = this; diff --git a/src/widget/timeinterval/dateinterval.js b/src/widget/timeinterval/dateinterval.js index 253c46adeb..12a1d2b27b 100644 --- a/src/widget/timeinterval/dateinterval.js +++ b/src/widget/timeinterval/dateinterval.js @@ -7,14 +7,14 @@ BI.DateInterval = BI.inherit(BI.Single, { width: 24, lgap: 15, offset: 0, - timeErrorCls: "time-error", - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + timeErrorCls: "time-error" }, _defaultConfig: function () { var conf = BI.DateInterval.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { - extraCls: "bi-date-interval" + extraCls: "bi-date-interval", + minDate: "1900-01-01", + maxDate: "2099-12-31" }); }, _init: function () { @@ -136,7 +136,8 @@ BI.DateInterval = BI.inherit(BI.Single, { BI.print(BI.parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date; }, _checkVoid: function (obj) { - return !BI.checkDateVoid(obj.year, obj.month, obj.day, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0]; + var o = this.options; + return !BI.checkDateVoid(obj.year, obj.month, obj.day, o.minDate, o.maxDate)[0]; }, _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); diff --git a/src/widget/timeinterval/timeinterval.js b/src/widget/timeinterval/timeinterval.js index 45f0b892c8..83bd84aa0c 100644 --- a/src/widget/timeinterval/timeinterval.js +++ b/src/widget/timeinterval/timeinterval.js @@ -7,14 +7,14 @@ BI.TimeInterval = BI.inherit(BI.Single, { width: 24, lgap: 15, offset: 0, - timeErrorCls: "time-error", - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + timeErrorCls: "time-error" }, _defaultConfig: function () { var conf = BI.TimeInterval.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { - extraCls: "bi-time-interval" + extraCls: "bi-time-interval", + minDate: "1900-01-01", + maxDate: "2099-12-31" }); }, _init: function () { @@ -136,7 +136,8 @@ BI.TimeInterval = BI.inherit(BI.Single, { BI.print(BI.parseDateTime(date, "%Y-%X-%e %H:%M:%S"), "%Y-%X-%e %H:%M:%S") === date; }, _checkVoid: function (obj) { - return !BI.checkDateVoid(obj.year, obj.month, obj.day, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0]; + var o = this.options; + return !BI.checkDateVoid(obj.year, obj.month, obj.day, o.minDate, o.maxDate)[0]; }, _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); diff --git a/src/widget/yearmonthinterval/yearmonthinterval.js b/src/widget/yearmonthinterval/yearmonthinterval.js index 8e681c376a..80abe69ac2 100644 --- a/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/src/widget/yearmonthinterval/yearmonthinterval.js @@ -4,13 +4,13 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { width: 25, lgap: 15, offset: -15, - timeErrorCls: "time-error", - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" + timeErrorCls: "time-error" }, props: { - extraCls: "bi-year-month-interval" + extraCls: "bi-year-month-interval", + minDate: "1900-01-01", + macDate: "2099-12-31" }, _init: function () { @@ -117,7 +117,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { // 判是否在最大最小之间 _checkVoid: function (obj) { - return !BI.checkDateVoid(obj.year, obj.month, 1, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0]; + var o = this.options; + return !BI.checkDateVoid(obj.year, obj.month, 1, o.minDate, o.maxDate)[0]; }, // 判格式合法