Browse Source

支持设置日期可设置范围

master
windy 6 years ago
parent
commit
cb9484007a
  1. 16
      src/widget/datetime/datetime.combo.js
  2. 16
      src/widget/dynamicdate/dynamicdate.combo.js
  3. 16
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  4. 11
      src/widget/timeinterval/dateinterval.js
  5. 11
      src/widget/timeinterval/timeinterval.js
  6. 11
      src/widget/yearmonthinterval/yearmonthinterval.js

16
src/widget/datetime/datetime.combo.js

@ -6,15 +6,15 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
popupHeight: 290, popupHeight: 290,
popupWidth: 270, popupWidth: 270,
comboAdjustHeight: 1, comboAdjustHeight: 1,
border: 1, border: 1
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-time-combo bi-border bi-border-radius", baseCls: "bi-date-time-combo bi-border bi-border-radius",
width: 200, width: 200,
height: 24 height: 24,
minDate: "1900-01-01",
maxDate: "2099-12-31"
}); });
}, },
_init: function () { _init: function () {
@ -31,16 +31,16 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
}; };
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.date_time_trigger", type: "bi.date_time_trigger",
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
value: opts.value value: opts.value
}); });
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.date_time_popup", type: "bi.date_time_popup",
behaviors: opts.behaviors, behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
value: opts.value value: opts.value
}); });
self.setValue(this.storeValue); self.setValue(this.storeValue);

16
src/widget/dynamicdate/dynamicdate.combo.js

@ -3,14 +3,14 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
popupHeight: 259, popupHeight: 259,
popupWidth: 270, popupWidth: 270,
comboAdjustHeight: 1, comboAdjustHeight: 1,
border: 1, border: 1
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
props: { props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius", 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, isNeedAdjustWidth: false,
el: { el: {
type: "bi.dynamic_date_trigger", type: "bi.dynamic_date_trigger",
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
height: opts.height, height: opts.height,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
@ -128,8 +128,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: { el: {
type: "bi.dynamic_date_popup", type: "bi.dynamic_date_popup",
behaviors: opts.behaviors, behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
self.popup = this; self.popup = this;

16
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -3,14 +3,14 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
popupHeight: 259, popupHeight: 259,
popupWidth: 270, popupWidth: 270,
comboAdjustHeight: 1, comboAdjustHeight: 1,
border: 1, border: 1
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
props: { props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow", 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, isNeedAdjustWidth: false,
el: { el: {
type: "bi.dynamic_date_time_trigger", type: "bi.dynamic_date_time_trigger",
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
height: opts.height, height: opts.height,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
@ -128,8 +128,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: { el: {
type: "bi.dynamic_date_time_popup", type: "bi.dynamic_date_time_popup",
behaviors: opts.behaviors, behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE, min: opts.minDate,
max: this.constants.DATE_MAX_VALUE, max: opts.maxDate,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
self.popup = this; self.popup = this;

11
src/widget/timeinterval/dateinterval.js

@ -7,14 +7,14 @@ BI.DateInterval = BI.inherit(BI.Single, {
width: 24, width: 24,
lgap: 15, lgap: 15,
offset: 0, offset: 0,
timeErrorCls: "time-error", timeErrorCls: "time-error"
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.DateInterval.superclass._defaultConfig.apply(this, arguments); var conf = BI.DateInterval.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-date-interval" extraCls: "bi-date-interval",
minDate: "1900-01-01",
maxDate: "2099-12-31"
}); });
}, },
_init: function () { _init: function () {
@ -136,7 +136,8 @@ BI.DateInterval = BI.inherit(BI.Single, {
BI.print(BI.parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date; BI.print(BI.parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date;
}, },
_checkVoid: function (obj) { _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) { _check: function (smallDate, bigDate) {
var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g);

11
src/widget/timeinterval/timeinterval.js

@ -7,14 +7,14 @@ BI.TimeInterval = BI.inherit(BI.Single, {
width: 24, width: 24,
lgap: 15, lgap: 15,
offset: 0, offset: 0,
timeErrorCls: "time-error", timeErrorCls: "time-error"
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.TimeInterval.superclass._defaultConfig.apply(this, arguments); var conf = BI.TimeInterval.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-time-interval" extraCls: "bi-time-interval",
minDate: "1900-01-01",
maxDate: "2099-12-31"
}); });
}, },
_init: function () { _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; BI.print(BI.parseDateTime(date, "%Y-%X-%e %H:%M:%S"), "%Y-%X-%e %H:%M:%S") === date;
}, },
_checkVoid: function (obj) { _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) { _check: function (smallDate, bigDate) {
var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g);

11
src/widget/yearmonthinterval/yearmonthinterval.js

@ -4,13 +4,13 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
width: 25, width: 25,
lgap: 15, lgap: 15,
offset: -15, offset: -15,
timeErrorCls: "time-error", timeErrorCls: "time-error"
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
}, },
props: { props: {
extraCls: "bi-year-month-interval" extraCls: "bi-year-month-interval",
minDate: "1900-01-01",
macDate: "2099-12-31"
}, },
_init: function () { _init: function () {
@ -117,7 +117,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
// 判是否在最大最小之间 // 判是否在最大最小之间
_checkVoid: function (obj) { _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];
}, },
// 判格式合法 // 判格式合法

Loading…
Cancel
Save