Browse Source

支持设置日期可设置范围

es6
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,
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);

16
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;

16
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;

11
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);

11
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);

11
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];
},
// 判格式合法

Loading…
Cancel
Save