Browse Source

Merge branch 'master' of ssh://cloud.finedevelop.com:7999/~dailer/fineui

# Conflicts:
#	changelog.md
master
zsmj1994 4 years ago
parent
commit
93b2cb9116
  1. 1
      changelog.md
  2. 1
      package.json
  3. 8
      src/base/single/input/file.js
  4. 2
      src/case/calendar/calendar.js
  5. 49
      src/widget/date/calendar/picker.date.js

1
changelog.md

@ -1,6 +1,7 @@
# 更新日志
2.0(2020-07)
- bi.file文件上传控件accept属性与 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) 统一
- 修复了日期类型控件设置一个不在minDate和maxDate之间的日期值时,面板灰化与翻页按钮状态不对的问题
- BI.OB的on方法返回一个解除监听的函数
- 修复了grid_view执行_unMount时不调用子组件的_unMount的问题
- combo新增belowMouse属性,允许popup在点击处弹出

1
package.json

@ -6,6 +6,7 @@
"types": "dist/lib/index.d.ts",
"dependencies": {},
"devDependencies": {
"@babel/polyfill": "7.6.0",
"@fui/babel-preset-fineui": "^1.0.0",
"@fui/eslint-plugin": "1.0.7",
"@typescript-eslint/eslint-plugin": "1.11.0",

8
src/base/single/input/file.js

@ -103,6 +103,7 @@
// FireFox 3+, Safari 4 beta (Chrome 2 beta file is buggy and will not work)
if (xhr.upload || xhr.sendAsBinary) {
sendFile = function (handler, maxSize, width, height) {
var current = handler.current;
if (-1 < maxSize && maxSize < handler.file.fileSize) {
if (isFunction(handler.onerror)) {
handler.onerror();
@ -190,7 +191,7 @@
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
handler.attach_array.push(attachO);
handler.attach_array[current] = attachO;
} else {
upload["onerror"]({});
}
@ -211,7 +212,7 @@
handler.attach_array[0] = attachO;
// handler.attach_array.push(attachO);
} else {
handler.attach_array.push(attachO);
handler.attach_array[current] = attachO;
}
break;
}
@ -238,6 +239,7 @@
// Internet Explorer, Opera, others
else {
sendFile = function (handler, maxSize, width, height) {
var current = handler.current;
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
@ -272,7 +274,7 @@
if (handler.maxlength == 1) {
handler.attach_array[0] = attachO;
} else {
handler.attach_array.push(attachO);
handler.attach_array[current] = attachO;
}
} catch (e) {
if (isFunction(handler.onerror)) {

2
src/case/calendar/calendar.js

@ -23,8 +23,6 @@ BI.Calendar = BI.inherit(BI.Widget, {
var self = this, o = this.options, log = {}, De = BI.getDate();
var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0));
Y > (maxs[0] | 0) && (Y = (maxs[0] | 0));
De.setFullYear(Y, M, D);
log.ymd = [De.getFullYear(), De.getMonth(), De.getDate()];

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

@ -87,7 +87,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
});
this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () {
self.setValue({
year: self.year.getValue(),
year: self.year.getValue() || self._year,
month: self.month.getValue(),
});
self.fireEvent(BI.DatePicker.EVENT_CHANGE);
@ -136,49 +136,68 @@ BI.DatePicker = BI.inherit(BI.Widget, {
if (!BI.contains(allowMonth, month)) {
month = allowMonth[0];
}
return month;
},
_getAllowMonths: function () {
var self = this, o = this.options;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d");
minDate.setDate(1);
maxDate.setDate(1);
var calcMin = BI.print(minDate, "%Y-%X-%d");
var calcMax = BI.print(maxDate, "%Y-%X-%d");
var obj = this._getCheckMinMaxDate();
var year = this.year.getValue() || this._year;
return BI.filter(BI.range(1, 13), function (idx, v) {
return !BI.checkDateVoid(self.year.getValue(), v, 1, calcMin, calcMax)[0];
return !BI.checkDateVoid(year, v, 1, obj.min, obj.max)[0];
});
},
// 上一年月不合法则灰化
_checkLeftValid: function () {
var o = this.options;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var valid = !(this._month <= (minDate.getMonth() + 1) && this._year <= minDate.getFullYear());
var obj = this._getCheckMinMaxDate();
var year = this._month === 1 ? this._year - 1 : this._year;
var month = this._month === 1 ? 12 : this._month - 1;
var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]);
this.left.setEnable(valid);
return valid;
},
// 下一年月不合法则灰化
_checkRightValid: function () {
var o = this.options;
var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d");
var valid = !(this._month >= (maxDate.getMonth() + 1) && this._year >= maxDate.getFullYear());
var obj = this._getCheckMinMaxDate();
var year = this._month === 12 ? this._year + 1 : this._year;
var month = this._month === 12 ? 1 : this._month + 1;
var valid = BI.isNull(BI.checkDateVoid(year, month, 1, obj.min, obj.max)[0]);
this.right.setEnable(valid);
return valid;
},
_getCheckMinMaxDate: function() {
var o = this.options;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d");
minDate.setDate(1);
maxDate.setDate(1);
return {
min: BI.print(minDate, "%Y-%X-%d"),
max: BI.print(maxDate, "%Y-%X-%d")
};
},
setMinDate: function (minDate) {
this.options.min = minDate;
this.year.setMinDate(minDate);
this._refreshMonth();
this._checkLeftValid();
this._checkRightValid();
},
setMaxDate: function (maxDate) {
this.options.max = maxDate;
this.year.setMaxDate(maxDate);
this._refreshMonth();
this._checkLeftValid();
this._checkRightValid();
},
setValue: function (ob) {

Loading…
Cancel
Save