Browse Source

Merge branch 'date'

# Conflicts:
#	changelog.md
es6
windy 6 years ago
parent
commit
860464c474
  1. 1
      changelog.md
  2. 4
      demo/js/config/widget.js
  3. 48
      demo/js/widget/timecombo/demo.timecombo.js
  4. 4
      dist/2.0/fineui.css
  5. 230
      dist/2.0/fineui.ie.js
  6. 230
      dist/2.0/fineui.js
  7. 4
      dist/bundle.css
  8. 230
      dist/bundle.ie.js
  9. 230
      dist/bundle.js
  10. 51
      dist/demo.js
  11. 4
      dist/fineui.css
  12. 230
      dist/fineui.ie.js
  13. 230
      dist/fineui.js
  14. 230
      dist/fineui_without_jquery_polyfill.js
  15. 4
      dist/widget.css
  16. 230
      dist/widget.js
  17. 4
      src/css/widget/timecombo/timecombo.css
  18. 8
      src/less/widget/timecombo/timecombo.less
  19. 74
      src/widget/time/time.combo.js
  20. 156
      src/widget/time/time.trigger.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2019-05) 2.0(2019-05)
- 时分秒控件支持自定义时间显示格式和是否可编辑
- 日期/时间/日期区间/时间区间支持自定义日期选择范围 - 日期/时间/日期区间/时间区间支持自定义日期选择范围
- 日期/时间/日期区间/时间区间支持自定义日期显示格式 - 日期/时间/日期区间/时间区间支持自定义日期显示格式
- 增加less函数: 字体资源添加函数addFontRe和字体激活函数activeFont - 增加less函数: 字体资源添加函数addFontRe和字体激活函数activeFont

4
demo/js/config/widget.js

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

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; -moz-border-radius: 3px;
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 { .bi-date-interval.time-error .bi-input {
color: #ff4949; color: #ff4949;
} }

230
dist/2.0/fineui.ie.js vendored

@ -80423,12 +80423,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -80471,10 +80473,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -80498,7 +80564,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -80558,42 +80624,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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;
} }
}); });

230
dist/2.0/fineui.js vendored

@ -80827,12 +80827,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -80875,10 +80877,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -80902,7 +80968,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -80962,42 +81028,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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
dist/bundle.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px; -moz-border-radius: 3px;
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 { .bi-date-interval.time-error .bi-input {
color: #ff4949; color: #ff4949;
} }

230
dist/bundle.ie.js vendored

@ -80423,12 +80423,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -80471,10 +80473,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -80498,7 +80564,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -80558,42 +80624,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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;
} }
}); });

230
dist/bundle.js vendored

@ -80827,12 +80827,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -80875,10 +80877,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -80902,7 +80968,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -80962,42 +81028,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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;
} }
}); });

51
dist/demo.js vendored

@ -3504,6 +3504,10 @@ Demo.COMPONENT_CONFIG = [{
pId: 412, pId: 412,
text: "bi.date_time", text: "bi.date_time",
value: "demo.date_time" value: "demo.date_time"
}, {
pId: 412,
text: "bi.time_combo",
value: "demo.time_combo"
}, { }, {
pId: 412, pId: 412,
text: "bi.time_interval", text: "bi.time_interval",
@ -10087,6 +10091,53 @@ Demo.Slider = BI.inherit(BI.Widget, {
BI.shortcut("demo.slider", Demo.Slider);/** BI.shortcut("demo.slider", Demo.Slider);/**
* Created by Dailer on 2017/7/13. * 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, { Demo.TimeInterval = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "" baseCls: ""

4
dist/fineui.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px; -moz-border-radius: 3px;
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 { .bi-date-interval.time-error .bi-input {
color: #ff4949; color: #ff4949;
} }

230
dist/fineui.ie.js vendored

@ -80668,12 +80668,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -80716,10 +80718,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -80743,7 +80809,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -80803,42 +80869,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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;
} }
}); });

230
dist/fineui.js vendored

@ -81072,12 +81072,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -81120,10 +81122,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -81147,7 +81213,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -81207,42 +81273,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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;
} }
}); });

230
dist/fineui_without_jquery_polyfill.js vendored

@ -63464,12 +63464,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -63512,10 +63514,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -63539,7 +63605,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -63599,42 +63665,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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
dist/widget.css vendored

@ -320,6 +320,10 @@
-moz-border-radius: 3px; -moz-border-radius: 3px;
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 { .bi-date-interval.time-error .bi-input {
color: #ff4949; color: #ff4949;
} }

230
dist/widget.js vendored

@ -20430,12 +20430,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -20478,10 +20480,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -20505,7 +20571,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {
@ -20565,42 +20631,164 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
BI.shortcut("bi.time_combo", BI.TimeCombo); BI.shortcut("bi.time_combo", BI.TimeCombo);
})();!(function () { })();!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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/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);
}
}

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

@ -15,12 +15,14 @@
props: { props: {
baseCls: "bi-time-combo bi-border bi-border-radius", baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78, width: 78,
height: 22 height: 22,
format: "",
allowEdit: false
}, },
render: function () { render: function () {
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value; this.storeValue = opts.value;
var popup = { var popup = {
@ -63,10 +65,74 @@
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: { el: {
type: "bi.time_trigger", type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value, value: opts.value,
ref: function (_ref) { ref: function (_ref) {
self.trigger = _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, adjustLength: this.constants.comboAdjustHeight,
popup: { popup: {
@ -90,7 +156,7 @@
}, },
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 22,
bottom: 0 bottom: 0
}, { }, {
el: { el: {

156
src/widget/time/time.trigger.js

@ -1,41 +1,163 @@
!(function () { !(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, { 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: { props: {
extraCls: "bi-time-trigger", extraCls: "bi-time-trigger",
height: 22, value: {},
width: 80, format: "",
value: {} allowEdit: false
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return { return {
type: "bi.htape", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.sign_editor",
title: function () {
return self.text.getText();
},
textAlign: "left",
height: o.height, height: o.height,
width: o.width, validationChecker: function (v) {
text: this._formatValue(o.value), return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) { 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) { _dateCheck: function (date) {
this.text.setText(this._formatValue(v)); 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 || {};
return BI.print(BI.getDate(storeValue.year, (storeValue.month - 1), storeValue.day), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
}, },
_formatValue: function (v) { _formatValue: function (v) {
var now = BI.getDate(); 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