o2.xdesktop.requireapp("process.xform", "$elinput", null, false);
/** @class eltime 基于element ui的时间选择器。
* @o2cn 时间选择
* @example
* //可以在脚本中获取该组件
* //方法1:
* var input = this.form.get("name"); //获取组件
* //方法2
* var input = this.target; //在组件事件脚本中获取
* @extends mwf.xapplication.process.xform.$module
* @o2category formcomponents
* @o2range {process|cms|portal}
* @hideconstructor
* @see {@link https://element.eleme.cn/#/zh-cn/component/time-picker|element ui timepicker 时间选择器}
*/
mwf.xapplication.process.xform.eltime = mwf.appeltime = new class(
/** @lends o2.xapplication.process.xform.eltime# */
{
implements: [events],
extends: mwf.app$elinput,
options: {
"moduleevents": ["load", "queryload", "postload"],
/**
* 当 input 失去焦点时触发。this.event[0]指向组件实例
* @event mwf.xapplication.process.xform.eltime#blur
* @see {@link https://element.eleme.cn/#/zh-cn/component/time-picker|时间选择组件的events章节}
*/
/**
* 当 input 获得焦点时触发。this.event[0]指向组件实例
* @event mwf.xapplication.process.xform.eltime#focus
* @see {@link https://element.eleme.cn/#/zh-cn/component/time-picker|时间选择组件的events章节}
*/
/**
* 用户确认选定的值时触发。this.event[0]为组件绑定值
* @event mwf.xapplication.process.xform.eltime#change
* @see {@link https://element.eleme.cn/#/zh-cn/component/time-picker|时间选择组件的events章节}
*/
"elevents": ["focus", "blur", "change"]
},
_queryloaded: function(){
var data = this._getbusinessdata();
if( ["picker"].contains(this.json.timeselecttype) && this.json.isrange) {
if (typeof(data) === "string") this._setbusinessdata([data, ""]);
}else{
if( typeof(data) === "array" )this._setbusinessdata(data[0] || "");
}
},
_appendvuedata: function(){
if (!this.json.readonly) this.json.readonly = false;
if (!this.json.disabled) this.json.disabled = false;
if (!this.json.clearable) this.json.clearable = false;
if (!this.json.disabled) this.json.disabled = false;
if (!this.json.editable) this.json.editable = false;
if (!this.json.size) this.json.size = "";
if (!this.json.prefixicon) this.json.prefixicon = "";
if (!this.json.suffixicon) this.json.suffixicon = "";
if (!this.json.description) this.json.description = "";
if (!this.json.arrowcontrol) this.json.arrowcontrol = false;
if (this.json.timeselecttype === "select"){
this.json.pickeroptions = {
"start": this.json.start,
"step": this.json.step,
"end": this.json.end
};
}else{
this.json.pickeroptions = {
"format": this.json.format
};
if (!this.json.isrange && this.json.selectablerange && this.json.selectablerange.code){
this.json.pickeroptions.selectablerange = this.form.macro.fire(this.json.selectablerange.code, this);
}
}
},
_createelementhtml: function() {
if (this.json.timeselecttype === "select"){
return this.createselectelementhtml();
}else{
if (this.json.isrange) {
return this.createpickerrangeelementhtml();
} else {
return this.createpickerelementhtml();
}
}
},
getcommonhtml: function(){
var html = "";
html = " v-model=\"" this.json.$id "\"";
html = " :readonly=\"isreadonly\"";
html = " :disabled=\"disabled\"";
html = " :editable=\"editable\"";
html = " :clearable=\"clearable\"";
html = " :size=\"size\"";
html = " :prefix-icon=\"prefixicon\"";
this.options.elevents.foreach(function(k){
html = " @" k "=\"$loadelevent_" k.camelcase() "\"";
});
if (this.json.elproperties){
object.keys(this.json.elproperties).foreach(function(k){
if (this.json.elproperties[k]) html = " " k "=\"" this.json.elproperties[k] "\"";
}, this);
}
if (this.json.elstyles) html = " :style=\"elstyles\"";
html = ">";
if (this.json.vueslot) html = this.json.vueslot;
return html;
},
createselectelementhtml: function(){
var html = "";
//
// html = "