Browse Source

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

es6
dailer 6 years ago
parent
commit
ec54f6c7e2
  1. 6
      changelog.md
  2. 4
      demo/js/config/widget.js
  3. 47
      demo/js/widget/date/demo.multidate_combo.js
  4. 1
      demo/js/widget/multiselect/demo.multi_select_combo.js
  5. 48
      demo/js/widget/timecombo/demo.timecombo.js
  6. 4
      dist/2.0/fineui.css
  7. 641
      dist/2.0/fineui.ie.js
  8. 54
      dist/2.0/fineui.ie.min.js
  9. 641
      dist/2.0/fineui.js
  10. 2
      dist/2.0/fineui.min.css
  11. 54
      dist/2.0/fineui.min.js
  12. 9
      dist/base.js
  13. 4
      dist/bundle.css
  14. 641
      dist/bundle.ie.js
  15. 54
      dist/bundle.ie.min.js
  16. 641
      dist/bundle.js
  17. 2
      dist/bundle.min.css
  18. 54
      dist/bundle.min.js
  19. 26
      dist/case.js
  20. 6
      dist/core.js
  21. 99
      dist/demo.js
  22. 4
      dist/fineui.css
  23. 641
      dist/fineui.ie.js
  24. 54
      dist/fineui.ie.min.js
  25. 641
      dist/fineui.js
  26. 2
      dist/fineui.min.css
  27. 54
      dist/fineui.min.js
  28. 639
      dist/fineui_without_jquery_polyfill.js
  29. 4
      dist/utils.js
  30. 6
      dist/utils.min.js
  31. 4
      dist/widget.css
  32. 600
      dist/widget.js
  33. 4
      src/base/single/editor/editor.js
  34. 5
      src/base/single/input/input.js
  35. 4
      src/case/editor/editor.clear.js
  36. 6
      src/case/editor/editor.shelter.js
  37. 6
      src/case/editor/editor.sign.js
  38. 5
      src/case/editor/editor.state.js
  39. 5
      src/case/editor/editor.state.simple.js
  40. 4
      src/core/func/date.js
  41. 2
      src/core/platform/web/dom.js
  42. 4
      src/css/widget/timecombo/timecombo.css
  43. 8
      src/less/widget/timecombo/timecombo.less
  44. 6
      src/widget/dynamicdate/dynamicdate.combo.js
  45. 127
      src/widget/dynamicdate/dynamicdate.trigger.js
  46. 6
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  47. 134
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  48. 4
      src/widget/editor/editor.search.js
  49. 4
      src/widget/editor/editor.text.js
  50. 4
      src/widget/multiselect/multiselect.insert.combo.js
  51. 17
      src/widget/multiselect/multiselect.insert.trigger.js
  52. 17
      src/widget/multiselect/multiselect.trigger.js
  53. 4
      src/widget/multitree/multi.tree.insert.combo.js
  54. 4
      src/widget/multitree/multi.tree.list.combo.js
  55. 12
      src/widget/numberinterval/numberinterval.js
  56. 24
      src/widget/numberinterval/singleeditor/single.editor.js
  57. 6
      src/widget/singleslider/button/editor.sign.text.js
  58. 74
      src/widget/time/time.combo.js
  59. 157
      src/widget/time/time.trigger.js

6
changelog.md

@ -1,5 +1,10 @@
# 更新日志
2.0(2019-05)
- editor类控件新增EVENT_CHANGE_CONFIRM事件
- 复选下拉控件和树下拉控件支持trigger是否可编辑
- 时分秒控件支持自定义时间显示格式和是否可编辑
- 日期/时间/日期区间/时间区间支持自定义日期选择范围和是否可编辑
- 日期/时间/日期区间/时间区间支持自定义日期显示格式和是否可编辑
- 增加less函数: 字体资源添加函数addFontRe和字体激活函数activeFont
> @fontList: "dec", "report";
@ -9,7 +14,6 @@
以上即可使用自定义的dec,report字体和fineui的资源字体
2.0(2019-04)
- 新增`bi.multi_tree_list_combo`控件, 此下拉树勾选节点时不会影响父子节点的勾选状态
- 新增`bi.multi_tree_insert_combo`控件, 此下拉树可以插入不存在的新值

4
demo/js/config/widget.js

@ -170,6 +170,10 @@ Demo.WIDGET_CONFIG = [{
pId: 412,
text: "bi.date_time",
value: "demo.date_time"
}, {
pId: 412,
text: "bi.time_combo",
value: "demo.time_combo"
}, {
pId: 412,
text: "bi.time_interval",

47
demo/js/widget/date/demo.multidate_combo.js

@ -20,15 +20,25 @@ Demo.Date = BI.inherit(BI.Widget, {
ref: function () {
self.datecombo = this;
},
width: 300
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d", // yyyy-MM-dd
// format: "%Y/%X/%d", // yyyy/MM/dd
// format: "%Y-%x-%e", // yyyy-M-d
// format: "%Y/%x/%e", // yyyy/M/d
// format: "%X/%d/%Y", // MM/dd/yyyy
// format: "%X/%e/%y", // MM/d/yy
// format: "%X.%d.%Y", // MM.dd.yyyy
// format: "%X.%e.%Y", // MM.d.yyyy
// format: "%X-%e-%y", // MM.d.yyyy
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
}, {
type: "bi.button",
text: "getValue",
@ -42,6 +52,25 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datetimecombo = this;
},
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d %H:%M:%S", // yyyy-MM-dd HH:mm:ss
// format: "%Y/%X/%d %H:%M:%S", // yyyy/MM/dd HH:mm:ss
// format: "%Y-%X-%d %I:%M:%S", // yyyy-MM-dd hh:mm:ss
// format: "%Y/%X/%d %I:%M:%S", // yyyy/MM/dd hh:mm:ss
// format: "%Y-%X-%d %H:%M:%S %p", // yyyy-MM-dd HH:mm:ss a
// format: "Y/%X/%d %H:%M:%S %p", // yyyy/MM/dd HH:mm:ss a
// format: "%Y-%X-%d %I:%M:%S %p", // yyyy-MM-dd hh:mm:ss a
// format: "%Y/%X/%d %I:%M:%S %p", // yyyy/MM/dd hh:mm:ss a
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss
// format: "%X/%d/%Y %H:%M:%S", // MM/dd/yyyy HH:mm:ss
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %I:%M:%S %p", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %l:%M %p", // MM/dd/yyyy h:mm a
// format: "%X-%d-%Y %k:%M %p", // MM/dd/yyyy H:mm a
// format: "%Y-%x-%e %l:%M", // yyyy-M-d h:mm
// format: "%Y-%x-%e %k:%M", // yyyy-M-d H:mm
value: {
type: 1,
value: {

1
demo/js/widget/multiselect/demo.multi_select_combo.js

@ -10,6 +10,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
// allowEdit: false,
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {

48
demo/js/widget/timecombo/demo.timecombo.js

@ -0,0 +1,48 @@
/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.time_combo",
ref: function (_ref) {
self.timeCombo = _ref;
},
// allowEdit: true,
// format: "%H:%M:%S", // HH:mm:ss
// format: "%I:%M:%S", // hh:mm:ss
// format: "%l:%M:%S", // h:mm:ss
// format: "%k:%M:%S", // H:mm:ss
// format: "%l:%M:%S %p", // h:mm:ss a
// format: "%l:%M", // h:mm
// format: "%k:%M", // H:mm
// format: "%I:%M", // hh:mm
// format: "%H:%M", // HH:mm
// format: "%M:%S", // mm:ss
value: {
hour: 12,
minute: 0,
second: 0
},
width: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast(JSON.stringify(self.timeCombo.getValue()));
},
width: 300
}],
vgap: 20
};
}
});
BI.shortcut("demo.time_combo", Demo.TimeCombo);

4
dist/2.0/fineui.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

641
dist/2.0/fineui.ie.js vendored

File diff suppressed because it is too large Load Diff

54
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

641
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

54
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

9
dist/base.js vendored

@ -9022,6 +9022,9 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Input.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CHANGE_CONFIRM, arguments);
});
this.element.click(function (e) {
e.stopPropagation();
return false;
@ -9166,6 +9169,7 @@ BI.Editor.EVENT_START = "EVENT_START";
BI.Editor.EVENT_PAUSE = "EVENT_PAUSE";
BI.Editor.EVENT_STOP = "EVENT_STOP";
BI.Editor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Editor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Editor.EVENT_VALID = "EVENT_VALID";
BI.Editor.EVENT_ERROR = "EVENT_ERROR";
BI.Editor.EVENT_ENTER = "EVENT_ENTER";
@ -10476,9 +10480,13 @@ BI.Input = BI.inherit(BI.Single, {
self._isEditing = false;
self._start = false;
if (self.isValid()) {
var lastValidValue = self._lastValidValue;
self._lastValidValue = self.getValue();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CONFIRM, self.getValue(), self);
self.fireEvent(BI.Input.EVENT_CONFIRM);
if(self._lastValidValue !== lastValidValue) {
self.fireEvent(BI.Input.EVENT_CHANGE_CONFIRM);
}
}
self.fireEvent(BI.Input.EVENT_BLUR);
}
@ -10664,6 +10672,7 @@ BI.Input.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.Input.EVENT_START = "EVENT_START";
BI.Input.EVENT_PAUSE = "EVENT_PAUSE";
BI.Input.EVENT_STOP = "EVENT_STOP";
BI.Input.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Input.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Input.EVENT_REMOVE = "EVENT_REMOVE";
BI.Input.EVENT_EMPTY = "EVENT_EMPTY";

4
dist/bundle.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

641
dist/bundle.ie.js vendored

File diff suppressed because it is too large Load Diff

54
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

641
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

54
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

26
dist/case.js vendored

@ -5634,6 +5634,9 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ClearEditor.EVENT_START);
});
@ -5698,6 +5701,7 @@ BI.ClearEditor.EVENT_START = "EVENT_START";
BI.ClearEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ClearEditor.EVENT_STOP = "EVENT_STOP";
BI.ClearEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ClearEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ClearEditor.EVENT_VALID = "EVENT_VALID";
BI.ClearEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER";
@ -5805,6 +5809,11 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ShelterEditor.EVENT_START, arguments);
});
@ -5957,6 +5966,7 @@ BI.ShelterEditor.EVENT_START = "EVENT_START";
BI.ShelterEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ShelterEditor.EVENT_STOP = "EVENT_STOP";
BI.ShelterEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ShelterEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ShelterEditor.EVENT_VALID = "EVENT_VALID";
BI.ShelterEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ShelterEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6068,6 +6078,11 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SignEditor.EVENT_START, arguments);
});
@ -6217,6 +6232,7 @@ BI.SignEditor.EVENT_START = "EVENT_START";
BI.SignEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SignEditor.EVENT_STOP = "EVENT_STOP";
BI.SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignEditor.EVENT_VALID = "EVENT_VALID";
BI.SignEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SignEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6337,6 +6353,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.StateEditor.EVENT_START, arguments);
});
@ -6500,6 +6520,7 @@ BI.StateEditor.EVENT_START = "EVENT_START";
BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.StateEditor.EVENT_STOP = "EVENT_STOP";
BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.StateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.StateEditor.EVENT_VALID = "EVENT_VALID";
BI.StateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.StateEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6609,6 +6630,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SimpleStateEditor.EVENT_START, arguments);
});
@ -6758,6 +6783,7 @@ BI.SimpleStateEditor.EVENT_START = "EVENT_START";
BI.SimpleStateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SimpleStateEditor.EVENT_STOP = "EVENT_STOP";
BI.SimpleStateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SimpleStateEditor.EVENT_VALID = "EVENT_VALID";
BI.SimpleStateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SimpleStateEditor.EVENT_ENTER = "EVENT_ENTER";

6
dist/core.js vendored

@ -18039,8 +18039,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
@ -19473,7 +19473,7 @@ BI.prepares.push(function () {
BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = BI.Widget._renderEngine._data(fromElement[0]);
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
BI.each(event, function (i, handler) {

99
dist/demo.js vendored

@ -3504,6 +3504,10 @@ Demo.COMPONENT_CONFIG = [{
pId: 412,
text: "bi.date_time",
value: "demo.date_time"
}, {
pId: 412,
text: "bi.time_combo",
value: "demo.time_combo"
}, {
pId: 412,
text: "bi.time_interval",
@ -8861,15 +8865,25 @@ Demo.Date = BI.inherit(BI.Widget, {
ref: function () {
self.datecombo = this;
},
width: 300
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d", // yyyy-MM-dd
// format: "%Y/%X/%d", // yyyy/MM/dd
// format: "%Y-%x-%e", // yyyy-M-d
// format: "%Y/%x/%e", // yyyy/M/d
// format: "%X/%d/%Y", // MM/dd/yyyy
// format: "%X/%e/%y", // MM/d/yy
// format: "%X.%d.%Y", // MM.dd.yyyy
// format: "%X.%e.%Y", // MM.d.yyyy
// format: "%X-%e-%y", // MM.d.yyyy
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
}, {
type: "bi.button",
text: "getValue",
@ -8883,6 +8897,25 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datetimecombo = this;
},
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d %H:%M:%S", // yyyy-MM-dd HH:mm:ss
// format: "%Y/%X/%d %H:%M:%S", // yyyy/MM/dd HH:mm:ss
// format: "%Y-%X-%d %I:%M:%S", // yyyy-MM-dd hh:mm:ss
// format: "%Y/%X/%d %I:%M:%S", // yyyy/MM/dd hh:mm:ss
// format: "%Y-%X-%d %H:%M:%S %p", // yyyy-MM-dd HH:mm:ss a
// format: "Y/%X/%d %H:%M:%S %p", // yyyy/MM/dd HH:mm:ss a
// format: "%Y-%X-%d %I:%M:%S %p", // yyyy-MM-dd hh:mm:ss a
// format: "%Y/%X/%d %I:%M:%S %p", // yyyy/MM/dd hh:mm:ss a
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss
// format: "%X/%d/%Y %H:%M:%S", // MM/dd/yyyy HH:mm:ss
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %I:%M:%S %p", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %l:%M %p", // MM/dd/yyyy h:mm a
// format: "%X-%d-%Y %k:%M %p", // MM/dd/yyyy H:mm a
// format: "%Y-%x-%e %l:%M", // yyyy-M-d h:mm
// format: "%Y-%x-%e %k:%M", // yyyy-M-d H:mm
value: {
type: 1,
value: {
@ -9255,6 +9288,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
// allowEdit: false,
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {
@ -10060,6 +10094,53 @@ Demo.Slider = BI.inherit(BI.Widget, {
BI.shortcut("demo.slider", Demo.Slider);/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.time_combo",
ref: function (_ref) {
self.timeCombo = _ref;
},
// allowEdit: true,
// format: "%H:%M:%S", // HH:mm:ss
// format: "%I:%M:%S", // hh:mm:ss
// format: "%l:%M:%S", // h:mm:ss
// format: "%k:%M:%S", // H:mm:ss
// format: "%l:%M:%S %p", // h:mm:ss a
// format: "%l:%M", // h:mm
// format: "%k:%M", // H:mm
// format: "%I:%M", // hh:mm
// format: "%H:%M", // HH:mm
// format: "%M:%S", // mm:ss
value: {
hour: 12,
minute: 0,
second: 0
},
width: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast(JSON.stringify(self.timeCombo.getValue()));
},
width: 300
}],
vgap: 20
};
}
});
BI.shortcut("demo.time_combo", Demo.TimeCombo);/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeInterval = BI.inherit(BI.Widget, {
props: {
baseCls: ""

4
dist/fineui.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

641
dist/fineui.ie.js vendored

File diff suppressed because it is too large Load Diff

54
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

641
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

54
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

639
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

4
dist/utils.js vendored

@ -10753,8 +10753,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59

6
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

4
dist/widget.css vendored

@ -320,6 +320,10 @@
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

600
dist/widget.js vendored

@ -2710,7 +2710,9 @@ BI.extend(BI.DynamicDateCard, {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius",
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31"
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -2748,6 +2750,8 @@ BI.extend(BI.DynamicDateCard, {
type: "bi.dynamic_date_trigger",
min: opts.minDate,
max: opts.maxDate,
format: opts.format,
allowEdit: opts.allowEdit,
height: opts.height,
value: opts.value,
ref: function () {
@ -3332,14 +3336,17 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d"
},
props: {
extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -3350,9 +3357,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -3366,30 +3374,13 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Date_Trigger_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text"): BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%X-%d");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTrigger.EVENT_KEY_DOWN);
@ -3414,7 +3405,8 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split("-");
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -3447,8 +3439,81 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var c = this._const;
var result = [0, 1, 2];
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
default:
result[2] = idx;
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
BI.each(dateArray, function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 这边之所以不直接返回join结果是因为年的格式可能只有2位,所以需要format一下
if(newArray.length === result.length && newArray[0].length === 2) {
return BI.print(BI.parseDateTime(newArray.join("-"), c.compareFormat), c.compareFormat);
}
// 这边format成-20-也没关系, 反正都是不合法的
return newArray.join("-");
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d"), "%Y-%x-%d") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d"), "%Y-%X-%d") === date ||
@ -3478,19 +3543,19 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
},
_yearCheck: function (v) {
var date = BI.print(BI.parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d");
var date = BI.print(BI.parseDateTime(v, this._getFormatString()), this._const.compareFormat);
return BI.print(BI.parseDateTime(v, "%Y"), "%Y") === v && date >= this.options.min && date <= this.options.max;
},
_monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d");
var dateStr = BI.print(date, "%Y-%X-%d");
var date = BI.parseDateTime(v, this._getFormatString());
var dateStr = BI.print(date, this._const.compareFormat);
return (date.getMonth() >= 0 && (BI.print(BI.parseDateTime(v, "%Y-%X"), "%Y-%X") === v ||
BI.print(BI.parseDateTime(v, "%Y-%x"), "%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%d");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -3566,7 +3631,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
this.editor.setState("");
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}
@ -3605,7 +3670,9 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31"
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -3643,6 +3710,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_time_trigger",
min: opts.minDate,
max: opts.maxDate,
allowEdit: opts.allowEdit,
format: opts.format,
height: opts.height,
value: opts.value,
ref: function () {
@ -4337,14 +4406,17 @@ BI.extend(BI.DynamicDateTimeSelect, {
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d %H:%M:%S"
},
props: {
extraCls: "bi-date-time-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -4355,9 +4427,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -4371,30 +4444,13 @@ BI.extend(BI.DynamicDateTimeSelect, {
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Basic_Date_Time_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Basic_Date_Time_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%x-%e %H:%M:%S");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTimeTrigger.EVENT_KEY_DOWN);
@ -4419,7 +4475,8 @@ BI.extend(BI.DynamicDateTimeSelect, {
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split(/-|\s|:/);
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -4450,8 +4507,94 @@ BI.extend(BI.DynamicDateTimeSelect, {
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var result = [];
var hasSecond = false;
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
result[2] = idx;
break;
case "%S":
hasSecond = true;
break;
default:
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
// 处理乱序的年月日
BI.each(dateArray.slice(0, 3), function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 拼接时分秒和pm
var suffixArray = dateArray.slice(3);
// hh:mm
if(suffixArray.length === 2 && !hasSecond) {
suffixArray.push("00");
}
var suffixString = suffixArray.join(":");
var dateString = newArray.slice(0, 3).join("-");
if (BI.isNotEmptyString(suffixString)) {
dateString += " " + suffixString;
}
return dateString;
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d %H:%M:%S"), "%Y-%x-%d %H:%M:%S") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d %H:%M:%S"), "%Y-%X-%d %H:%M:%S") === date ||
@ -4498,7 +4641,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%e %H:%M:%S");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -4575,7 +4718,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
value.second || 0), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}
@ -4716,6 +4859,9 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
@ -4793,6 +4939,7 @@ BI.SearchEditor.EVENT_START = "EVENT_START";
BI.SearchEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SearchEditor.EVENT_STOP = "EVENT_STOP";
BI.SearchEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SearchEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SearchEditor.EVENT_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";
@ -4903,6 +5050,9 @@ BI.TextEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
@ -4975,6 +5125,7 @@ BI.TextEditor.EVENT_START = "EVENT_START";
BI.TextEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.TextEditor.EVENT_STOP = "EVENT_STOP";
BI.TextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.TextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.TextEditor.EVENT_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";
@ -8712,7 +8863,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
height: 24,
attributes: {
tabIndex: 0
}
},
allowEdit: true
});
},
@ -8731,6 +8883,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_insert_trigger",
allowEdit: o.allowEdit,
height: o.height,
text: o.text,
// adapter: this.popup,
@ -9494,7 +9647,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -9574,6 +9728,20 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
@ -10197,7 +10365,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -10274,6 +10443,20 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
@ -12976,7 +13159,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-insert-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -12992,6 +13176,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -13261,7 +13446,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-list-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -13277,6 +13463,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -14650,7 +14837,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setFocusEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_FOCUS, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, function () {
self._setTitle("");
switch (self._checkValidation()) {
case c.typeError:
@ -14679,7 +14866,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
},
_setBlurEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_BLUR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_BLUR, function () {
BI.Bubbles.hide(c.typeError);
BI.Bubbles.hide(c.numberError);
BI.Bubbles.hide(c.signalError);
@ -14701,7 +14888,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setErrorEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_ERROR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_ERROR, function () {
self._checkValidation();
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
offsetStyle: "left",
@ -14714,7 +14901,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setValidEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_VALID, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_VALID, function () {
switch (self._checkValidation()) {
case c.numberError:
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, {
@ -14739,7 +14926,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setEditorValueChangedEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_CHANGE, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, function () {
switch (self._checkValidation()) {
case c.typeError:
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
@ -14764,7 +14951,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
}
self.fireEvent(BI.NumberInterval.EVENT_CHANGE);
});
w.on(BI.Editor.EVENT_CONFIRM, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberInterval.EVENT_CONFIRM);
});
},
@ -14929,32 +15116,37 @@ BI.shortcut("bi.number_interval", BI.NumberInterval);BI.NumberIntervalSingleEidt
listeners: [{
eventName: BI.Editor.EVENT_ERROR,
action: function () {
self.fireEvent(BI.Editor.EVENT_ERROR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_ERROR, arguments);
}
}, {
eventName: BI.Editor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.Editor.EVENT_FOCUS, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, arguments);
}
}, {
eventName: BI.Editor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.Editor.EVENT_BLUR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_BLUR, arguments);
}
}, {
eventName: BI.Editor.EVENT_VALID,
action: function () {
self.fireEvent(BI.Editor.EVENT_VALID, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_VALID, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Editor.EVENT_CHANGE, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.Editor.EVENT_CONFIRM,
action: function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE_CONFIRM,
action: function () {
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM, arguments);
}
}]
}]
@ -14978,6 +15170,13 @@ BI.shortcut("bi.number_interval", BI.NumberInterval);BI.NumberIntervalSingleEidt
}
});
BI.NumberIntervalSingleEidtor.EVENT_FOCUS = "EVENT_FOCUS";
BI.NumberIntervalSingleEidtor.EVENT_BLUR = "EVENT_BLUR";
BI.NumberIntervalSingleEidtor.EVENT_ERROR = "EVENT_ERROR";
BI.NumberIntervalSingleEidtor.EVENT_VALID = "EVENT_VALID";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE = "EVENT_CHANGE";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.NumberIntervalSingleEidtor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.number_interval_single_editor", BI.NumberIntervalSingleEidtor);/**
* 季度下拉框
*
@ -18925,6 +19124,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self._checkText();
});
@ -19045,6 +19249,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
}
});
BI.SignTextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignTextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignTextEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.shortcut("bi.sign_text_editor", BI.SignTextEditor);/**
@ -20326,12 +20531,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: {
baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78,
height: 22
height: 22,
format: "",
allowEdit: false
},
render: function () {
var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value;
var popup = {
@ -20374,10 +20581,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false,
el: {
type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value,
ref: function (_ref) {
self.trigger = _ref;
}
},
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
}
}
}, {
eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.trigger.getKey();
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
var date = BI.getDate();
self.storeValue = {
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
};
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
if (self.combo.isViewVisible()) {
return;
}
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
}
}]
},
adjustLength: this.constants.comboAdjustHeight,
popup: {
@ -20401,7 +20672,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
},
top: 0,
left: 0,
right: 0,
right: 22,
bottom: 0
}, {
el: {
@ -20461,42 +20732,165 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, {
_const: {
COMPARE_FORMAT: "%H:%M:%S",
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S",
FORMAT_ARRAY: [
"%H:%M:%S", // HH:mm:ss
"%I:%M:%S", // hh:mm:ss
"%l:%M:%S", // h:mm:ss
"%k:%M:%S", // H:mm:ss
"%l:%M:%S %p", // h:mm:ss a
"%l:%M:%S %P", // h:mm:ss a
"%l:%M", // h:mm
"%k:%M", // H:mm
"%I:%M", // hh:mm
"%H:%M", // HH:mm
"%M:%S" // mm:ss
],
DEFAULT_DATE_STRING: "2000-01-01"
},
props: {
extraCls: "bi-time-trigger",
height: 22,
width: 80,
value: {}
value: {},
format: "",
allowEdit: false
},
render: function () {
var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return {
type: "bi.htape",
type: "bi.absolute",
items: [{
el: {
type: "bi.label",
title: function () {
return self.text.getText();
},
textAlign: "left",
type: "bi.sign_editor",
height: o.height,
width: o.width,
text: this._formatValue(o.value),
validationChecker: function (v) {
return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) {
self.text = _ref;
}
self.editor = _ref;
},
value: this._formatValue(o.value),
hgap: 4,
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
title: BI.bind(this._getTitle, this),
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
self.fireEvent("EVENT_KEY_DOWN");
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.getKey();
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_STOP",
action: function () {
self.fireEvent("EVENT_STOP");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.match(/\d+/g);
self.storeValue = {
hour: date[0] | 0,
minute: date[1] | 0,
second: date[2] | 0
};
}
self.fireEvent("EVENT_CONFIRM");
}
}, {
eventName: "EVENT_START",
action: function () {
self.fireEvent("EVENT_START");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.text",
invisible: o.allowEdit,
cls: "show-text",
title: BI.bind(this._getTitle, this),
hgap: 4
},
hgap: 4
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
setValue: function (v) {
this.text.setText(this._formatValue(v));
_dateCheck: function (date) {
var c = this._const;
return BI.any(c.FORMAT_ARRAY, function (idx, format) {
return BI.print(BI.parseDateTime(c.DEFAULT_DATE_STRING + " " + date, c.COMPLETE_COMPARE_FORMAT), format) === date;
});
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var date = BI.getDate();
return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
},
_formatValue: function (v) {
var now = BI.getDate();
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted");
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : BI.i18nText("BI-Basic_Unrestricted");
},
getKey: function () {
return this.editor.getValue();
},
setValue: function (v) {
this.storeValue = v;
this.editor.setValue(this._formatValue(v));
},
getValue: function () {
return this.storeValue;
}
});

4
src/base/single/editor/editor.js

@ -184,6 +184,9 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Input.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CHANGE_CONFIRM, arguments);
});
this.element.click(function (e) {
e.stopPropagation();
return false;
@ -328,6 +331,7 @@ BI.Editor.EVENT_START = "EVENT_START";
BI.Editor.EVENT_PAUSE = "EVENT_PAUSE";
BI.Editor.EVENT_STOP = "EVENT_STOP";
BI.Editor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Editor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Editor.EVENT_VALID = "EVENT_VALID";
BI.Editor.EVENT_ERROR = "EVENT_ERROR";
BI.Editor.EVENT_ENTER = "EVENT_ENTER";

5
src/base/single/input/input.js

@ -111,9 +111,13 @@ BI.Input = BI.inherit(BI.Single, {
self._isEditing = false;
self._start = false;
if (self.isValid()) {
var lastValidValue = self._lastValidValue;
self._lastValidValue = self.getValue();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CONFIRM, self.getValue(), self);
self.fireEvent(BI.Input.EVENT_CONFIRM);
if(self._lastValidValue !== lastValidValue) {
self.fireEvent(BI.Input.EVENT_CHANGE_CONFIRM);
}
}
self.fireEvent(BI.Input.EVENT_BLUR);
}
@ -299,6 +303,7 @@ BI.Input.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.Input.EVENT_START = "EVENT_START";
BI.Input.EVENT_PAUSE = "EVENT_PAUSE";
BI.Input.EVENT_STOP = "EVENT_STOP";
BI.Input.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Input.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Input.EVENT_REMOVE = "EVENT_REMOVE";
BI.Input.EVENT_EMPTY = "EVENT_EMPTY";

4
src/case/editor/editor.clear.js

@ -101,6 +101,9 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ClearEditor.EVENT_START);
});
@ -165,6 +168,7 @@ BI.ClearEditor.EVENT_START = "EVENT_START";
BI.ClearEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ClearEditor.EVENT_STOP = "EVENT_STOP";
BI.ClearEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ClearEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ClearEditor.EVENT_VALID = "EVENT_VALID";
BI.ClearEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER";

6
src/case/editor/editor.shelter.js

@ -99,6 +99,11 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ShelterEditor.EVENT_START, arguments);
});
@ -251,6 +256,7 @@ BI.ShelterEditor.EVENT_START = "EVENT_START";
BI.ShelterEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ShelterEditor.EVENT_STOP = "EVENT_STOP";
BI.ShelterEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ShelterEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ShelterEditor.EVENT_VALID = "EVENT_VALID";
BI.ShelterEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ShelterEditor.EVENT_ENTER = "EVENT_ENTER";

6
src/case/editor/editor.sign.js

@ -101,6 +101,11 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SignEditor.EVENT_START, arguments);
});
@ -250,6 +255,7 @@ BI.SignEditor.EVENT_START = "EVENT_START";
BI.SignEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SignEditor.EVENT_STOP = "EVENT_STOP";
BI.SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignEditor.EVENT_VALID = "EVENT_VALID";
BI.SignEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SignEditor.EVENT_ENTER = "EVENT_ENTER";

5
src/case/editor/editor.state.js

@ -111,6 +111,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.StateEditor.EVENT_START, arguments);
});
@ -274,6 +278,7 @@ BI.StateEditor.EVENT_START = "EVENT_START";
BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.StateEditor.EVENT_STOP = "EVENT_STOP";
BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.StateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.StateEditor.EVENT_VALID = "EVENT_VALID";
BI.StateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.StateEditor.EVENT_ENTER = "EVENT_ENTER";

5
src/case/editor/editor.state.simple.js

@ -99,6 +99,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SimpleStateEditor.EVENT_START, arguments);
});
@ -248,6 +252,7 @@ BI.SimpleStateEditor.EVENT_START = "EVENT_START";
BI.SimpleStateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SimpleStateEditor.EVENT_STOP = "EVENT_STOP";
BI.SimpleStateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SimpleStateEditor.EVENT_VALID = "EVENT_VALID";
BI.SimpleStateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SimpleStateEditor.EVENT_ENTER = "EVENT_ENTER";

4
src/core/func/date.js

@ -171,8 +171,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59

2
src/core/platform/web/dom.js

@ -14,7 +14,7 @@
BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = BI.Widget._renderEngine._data(fromElement[0]);
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
BI.each(event, function (i, handler) {

4
src/css/widget/timecombo/timecombo.css

@ -0,0 +1,4 @@
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}

8
src/less/widget/timecombo/timecombo.less

@ -0,0 +1,8 @@
@import "../../index";
.bi-time-trigger{
& .show-text {
// ie10一下无背景色会鼠标穿透
.background-color(@background-color-default, 0);
}
}

6
src/widget/dynamicdate/dynamicdate.combo.js

@ -10,7 +10,9 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius",
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31"
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -48,6 +50,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_trigger",
min: opts.minDate,
max: opts.maxDate,
format: opts.format,
allowEdit: opts.allowEdit,
height: opts.height,
value: opts.value,
ref: function () {

127
src/widget/dynamicdate/dynamicdate.trigger.js

@ -4,14 +4,17 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d"
},
props: {
extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -22,9 +25,10 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -38,30 +42,13 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Date_Trigger_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text"): BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%X-%d");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTrigger.EVENT_KEY_DOWN);
@ -86,7 +73,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split("-");
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -119,8 +107,81 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var c = this._const;
var result = [0, 1, 2];
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
default:
result[2] = idx;
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
BI.each(dateArray, function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 这边之所以不直接返回join结果是因为年的格式可能只有2位,所以需要format一下
if(newArray.length === result.length && newArray[0].length === 2) {
return BI.print(BI.parseDateTime(newArray.join("-"), c.compareFormat), c.compareFormat);
}
// 这边format成-20-也没关系, 反正都是不合法的
return newArray.join("-");
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d"), "%Y-%x-%d") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d"), "%Y-%X-%d") === date ||
@ -150,19 +211,19 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
},
_yearCheck: function (v) {
var date = BI.print(BI.parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d");
var date = BI.print(BI.parseDateTime(v, this._getFormatString()), this._const.compareFormat);
return BI.print(BI.parseDateTime(v, "%Y"), "%Y") === v && date >= this.options.min && date <= this.options.max;
},
_monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d");
var dateStr = BI.print(date, "%Y-%X-%d");
var date = BI.parseDateTime(v, this._getFormatString());
var dateStr = BI.print(date, this._const.compareFormat);
return (date.getMonth() >= 0 && (BI.print(BI.parseDateTime(v, "%Y-%X"), "%Y-%X") === v ||
BI.print(BI.parseDateTime(v, "%Y-%x"), "%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%d");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -238,7 +299,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
this.editor.setState("");
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}

6
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -10,7 +10,9 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31"
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -48,6 +50,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_time_trigger",
min: opts.minDate,
max: opts.maxDate,
allowEdit: opts.allowEdit,
format: opts.format,
height: opts.height,
value: opts.value,
ref: function () {

134
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -4,14 +4,17 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d %H:%M:%S"
},
props: {
extraCls: "bi-date-time-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -22,9 +25,10 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -38,30 +42,13 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Basic_Date_Time_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Basic_Date_Time_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%x-%e %H:%M:%S");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTimeTrigger.EVENT_KEY_DOWN);
@ -86,7 +73,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split(/-|\s|:/);
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -117,8 +105,94 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var result = [];
var hasSecond = false;
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
result[2] = idx;
break;
case "%S":
hasSecond = true;
break;
default:
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
// 处理乱序的年月日
BI.each(dateArray.slice(0, 3), function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 拼接时分秒和pm
var suffixArray = dateArray.slice(3);
// hh:mm
if(suffixArray.length === 2 && !hasSecond) {
suffixArray.push("00");
}
var suffixString = suffixArray.join(":");
var dateString = newArray.slice(0, 3).join("-");
if (BI.isNotEmptyString(suffixString)) {
dateString += " " + suffixString;
}
return dateString;
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d %H:%M:%S"), "%Y-%x-%d %H:%M:%S") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d %H:%M:%S"), "%Y-%X-%d %H:%M:%S") === date ||
@ -165,7 +239,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%e %H:%M:%S");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -242,7 +316,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
value.second || 0), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}

4
src/widget/editor/editor.search.js

@ -109,6 +109,9 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
@ -186,6 +189,7 @@ BI.SearchEditor.EVENT_START = "EVENT_START";
BI.SearchEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SearchEditor.EVENT_STOP = "EVENT_STOP";
BI.SearchEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SearchEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SearchEditor.EVENT_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";

4
src/widget/editor/editor.text.js

@ -83,6 +83,9 @@ BI.TextEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
@ -155,6 +158,7 @@ BI.TextEditor.EVENT_START = "EVENT_START";
BI.TextEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.TextEditor.EVENT_STOP = "EVENT_STOP";
BI.TextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.TextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.TextEditor.EVENT_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";

4
src/widget/multiselect/multiselect.insert.combo.js

@ -13,7 +13,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
height: 24,
attributes: {
tabIndex: 0
}
},
allowEdit: true
});
},
@ -32,6 +33,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_insert_trigger",
allowEdit: o.allowEdit,
height: o.height,
text: o.text,
// adapter: this.popup,

17
src/widget/multiselect/multiselect.insert.trigger.js

@ -22,7 +22,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -102,6 +103,20 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);

17
src/widget/multiselect/multiselect.trigger.js

@ -22,7 +22,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -99,6 +100,20 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);

4
src/widget/multitree/multi.tree.insert.combo.js

@ -20,7 +20,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-insert-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -36,6 +37,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,

4
src/widget/multitree/multi.tree.list.combo.js

@ -20,7 +20,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-list-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -36,6 +37,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,

12
src/widget/numberinterval/numberinterval.js

@ -307,7 +307,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setFocusEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_FOCUS, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, function () {
self._setTitle("");
switch (self._checkValidation()) {
case c.typeError:
@ -336,7 +336,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
},
_setBlurEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_BLUR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_BLUR, function () {
BI.Bubbles.hide(c.typeError);
BI.Bubbles.hide(c.numberError);
BI.Bubbles.hide(c.signalError);
@ -358,7 +358,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setErrorEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_ERROR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_ERROR, function () {
self._checkValidation();
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
offsetStyle: "left",
@ -371,7 +371,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setValidEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_VALID, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_VALID, function () {
switch (self._checkValidation()) {
case c.numberError:
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, {
@ -396,7 +396,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setEditorValueChangedEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_CHANGE, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, function () {
switch (self._checkValidation()) {
case c.typeError:
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
@ -421,7 +421,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
}
self.fireEvent(BI.NumberInterval.EVENT_CHANGE);
});
w.on(BI.Editor.EVENT_CONFIRM, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberInterval.EVENT_CONFIRM);
});
},

24
src/widget/numberinterval/singleeditor/single.editor.js

@ -25,32 +25,37 @@ BI.NumberIntervalSingleEidtor = BI.inherit(BI.Single, {
listeners: [{
eventName: BI.Editor.EVENT_ERROR,
action: function () {
self.fireEvent(BI.Editor.EVENT_ERROR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_ERROR, arguments);
}
}, {
eventName: BI.Editor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.Editor.EVENT_FOCUS, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, arguments);
}
}, {
eventName: BI.Editor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.Editor.EVENT_BLUR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_BLUR, arguments);
}
}, {
eventName: BI.Editor.EVENT_VALID,
action: function () {
self.fireEvent(BI.Editor.EVENT_VALID, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_VALID, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Editor.EVENT_CHANGE, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.Editor.EVENT_CONFIRM,
action: function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE_CONFIRM,
action: function () {
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM, arguments);
}
}]
}]
@ -74,4 +79,11 @@ BI.NumberIntervalSingleEidtor = BI.inherit(BI.Single, {
}
});
BI.NumberIntervalSingleEidtor.EVENT_FOCUS = "EVENT_FOCUS";
BI.NumberIntervalSingleEidtor.EVENT_BLUR = "EVENT_BLUR";
BI.NumberIntervalSingleEidtor.EVENT_ERROR = "EVENT_ERROR";
BI.NumberIntervalSingleEidtor.EVENT_VALID = "EVENT_VALID";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE = "EVENT_CHANGE";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.NumberIntervalSingleEidtor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.number_interval_single_editor", BI.NumberIntervalSingleEidtor);

6
src/widget/singleslider/button/editor.sign.text.js

@ -63,6 +63,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self._checkText();
});
@ -183,6 +188,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
}
});
BI.SignTextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignTextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignTextEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.shortcut("bi.sign_text_editor", BI.SignTextEditor);

74
src/widget/time/time.combo.js

@ -15,12 +15,14 @@
props: {
baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78,
height: 22
height: 22,
format: "",
allowEdit: false
},
render: function () {
var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value;
var popup = {
@ -63,10 +65,74 @@
isNeedAdjustWidth: false,
el: {
type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value,
ref: function (_ref) {
self.trigger = _ref;
}
},
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
}
}
}, {
eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.trigger.getKey();
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
var date = BI.getDate();
self.storeValue = {
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
};
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
if (self.combo.isViewVisible()) {
return;
}
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
}
}]
},
adjustLength: this.constants.comboAdjustHeight,
popup: {
@ -90,7 +156,7 @@
},
top: 0,
left: 0,
right: 0,
right: 22,
bottom: 0
}, {
el: {

157
src/widget/time/time.trigger.js

@ -1,41 +1,164 @@
!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, {
_const: {
COMPARE_FORMAT: "%H:%M:%S",
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S",
FORMAT_ARRAY: [
"%H:%M:%S", // HH:mm:ss
"%I:%M:%S", // hh:mm:ss
"%l:%M:%S", // h:mm:ss
"%k:%M:%S", // H:mm:ss
"%l:%M:%S %p", // h:mm:ss a
"%l:%M:%S %P", // h:mm:ss a
"%l:%M", // h:mm
"%k:%M", // H:mm
"%I:%M", // hh:mm
"%H:%M", // HH:mm
"%M:%S" // mm:ss
],
DEFAULT_DATE_STRING: "2000-01-01"
},
props: {
extraCls: "bi-time-trigger",
height: 22,
width: 80,
value: {}
value: {},
format: "",
allowEdit: false
},
render: function () {
var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return {
type: "bi.htape",
type: "bi.absolute",
items: [{
el: {
type: "bi.label",
title: function () {
return self.text.getText();
},
textAlign: "left",
type: "bi.sign_editor",
height: o.height,
width: o.width,
text: this._formatValue(o.value),
validationChecker: function (v) {
return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) {
self.text = _ref;
}
self.editor = _ref;
},
value: this._formatValue(o.value),
hgap: 4,
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
title: BI.bind(this._getTitle, this),
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
self.fireEvent("EVENT_KEY_DOWN");
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.getKey();
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_STOP",
action: function () {
self.fireEvent("EVENT_STOP");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.match(/\d+/g);
self.storeValue = {
hour: date[0] | 0,
minute: date[1] | 0,
second: date[2] | 0
};
}
self.fireEvent("EVENT_CONFIRM");
}
}, {
eventName: "EVENT_START",
action: function () {
self.fireEvent("EVENT_START");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}]
},
hgap: 4
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.text",
invisible: o.allowEdit,
cls: "show-text",
title: BI.bind(this._getTitle, this),
hgap: 4
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
setValue: function (v) {
this.text.setText(this._formatValue(v));
_dateCheck: function (date) {
var c = this._const;
return BI.any(c.FORMAT_ARRAY, function (idx, format) {
return BI.print(BI.parseDateTime(c.DEFAULT_DATE_STRING + " " + date, c.COMPLETE_COMPARE_FORMAT), format) === date;
});
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var date = BI.getDate();
return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
},
_formatValue: function (v) {
var now = BI.getDate();
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted");
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : BI.i18nText("BI-Basic_Unrestricted");
},
getKey: function () {
return this.editor.getValue();
},
setValue: function (v) {
this.storeValue = v;
this.editor.setValue(this._formatValue(v));
},
getValue: function () {
return this.storeValue;
}
});

Loading…
Cancel
Save