o2.xdesktop.requireapp("process.xform", "$elinput", null, false);
/** @class eldate 基于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/date-picker|element ui datepicker 日期选择器}
*/
mwf.xapplication.process.xform.eldate = mwf.appeldate = new class(
/** @lends o2.xapplication.process.xform.eldate# */
{
implements: [events],
extends: mwf.app$elinput,
options: {
"moduleevents": ["load", "queryload", "postload"],
/**
* 当 input 失去焦点时触发。this.event[0]指向组件实例
* @event mwf.xapplication.process.xform.eldate#blur
* @see {@link https://element.eleme.cn/#/zh-cn/component/date-picker|日期选择组件的events章节}
*/
/**
* 当 input 获得焦点时触发。this.event[0]指向组件实例
* @event mwf.xapplication.process.xform.eldate#focus
* @see {@link https://element.eleme.cn/#/zh-cn/component/date-picker|日期选择组件的events章节}
*/
/**
* 用户确认选定的值时触发。this.event[0]为组件绑定值;格式与绑定值一致,可受 value-format 控制
* @event mwf.xapplication.process.xform.eldate#change
* @see {@link https://element.eleme.cn/#/zh-cn/component/date-picker|日期选择组件的events章节}
*/
"elevents": ["focus", "blur", "change"]
},
_loadmergereadcontentnode: function( contentnode, data ){
var d = o2.typeof( data.data ) === "array" ? data.data : [data.data];
contentnode.set("text", d.join( this.json.rangeseparator ? " " this.json.rangeseparator " " : " 至 " ) );
},
_queryloaded: function(){
var data = this._getbusinessdata();
if (data){
if( ["monthrange","daterange"].contains(this.json.selecttype) ) {
if (typeof(data) === "string") this._setbusinessdata([data, ""]);
}else if( ["dates"].contains(this.json.selecttype) ){
if (typeof(data) === "string") this._setbusinessdata([data]);
}else{
if( typeof(data) === "array" )this._setbusinessdata(data[0] || "");
}
}
},
__setreadonly: function(data){
if (this.isreadonly()){
if( o2.typeof(data) === "array" ){
if( ["monthrange","daterange"].contains(this.json.selecttype) ) {
this.node.set("text", this.json.rangeseparator ? data.join(this.json.rangeseparator) : data);
}else{
this.node.set("text", data );
}
}else{
this.node.set("text", data );
}
if( this.json.elproperties ){
this.node.set(this.json.elproperties );
}
if (this.json.elstyles){
this.node.setstyles( this._parsestyles(this.json.elstyles) );
}
this.fireevent("postload");
this.fireevent("load");
this.isloaded = true;
}
},
_appendvuedata: function(){
if (!this.json.isreadonly && !this.form.json.isreadonly) this.json.isreadonly = 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.description) this.json.description = "";
this.json.pickeroptions = {
firstdayofweek: this.json.firstdayofweek.toint()
}
if (this.json.disableddate && this.json.disableddate.code){
this.json.pickeroptions.disableddate = function(date){
return this.form.macro.fire(this.json.disableddate.code, this, date);
}.bind(this)
}
},
_createelementhtml: function() {
var html = "