|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
|
|
MWF.require("MWF.widget.Common", null, false);
|
|
MWF.require("MWF.widget.Common", null, false);
|
|
|
-/** @class $Module 组件类,此类为所有组件的父类。 */
|
|
|
|
|
|
|
+/** @class $Module 组件类,此类为所有组件的父类。
|
|
|
|
|
+ * @abstract*/
|
|
|
MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
|
|
MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
|
|
|
/** @lends MWF.xApplication.process.Xform.$Module# */
|
|
/** @lends MWF.xApplication.process.Xform.$Module# */
|
|
|
{
|
|
{
|
|
@@ -12,15 +13,34 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
|
|
|
initialize: function(node, json, form, options){
|
|
initialize: function(node, json, form, options){
|
|
|
/**
|
|
/**
|
|
|
* 组件的节点
|
|
* 组件的节点
|
|
|
- * {@link https://mootools.net/core/docs/1.6.0/Element/Element MootoolsElement }
|
|
|
|
|
|
|
+ * @see https://mootools.net/core/docs/1.6.0/Element/Element
|
|
|
* @member {Element}
|
|
* @member {Element}
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * //可以在脚本中获取该组件
|
|
|
|
|
+ * var field = this.form.get("fieldName"); //获取组件对象
|
|
|
|
|
+ * field.node.setStyle("font-size","12px"); //给节点设置样式
|
|
|
|
|
+ * @extends MWF.xApplication.process.Xform.$Input
|
|
|
*/
|
|
*/
|
|
|
this.node = $(node);
|
|
this.node = $(node);
|
|
|
this.node.store("module", this);
|
|
this.node.store("module", this);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 组件的配置信息,比如id,类型等.
|
|
|
|
|
+ * @member {JsonObject}
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * //可以在脚本中获取该组件
|
|
|
|
|
+ * var json = this.form.get("fieldName").json; //获取组件对象
|
|
|
|
|
+ * var id = json.id; //获取组件的id
|
|
|
|
|
+ * var type = json.type; //获取组件的类型,如Textfield 为文本输入组件,Select为下拉组件
|
|
|
|
|
+ */
|
|
|
this.json = json;
|
|
this.json = json;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 组件的所在表单对象.
|
|
* 组件的所在表单对象.
|
|
|
* @member {MWF.xApplication.process.Xform.Form}
|
|
* @member {MWF.xApplication.process.Xform.Form}
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * var form = this.form.get("fieldName").form; //获取组件所在表单对象
|
|
|
|
|
+ * form.saveFormData(); //保存表单数据
|
|
|
*/
|
|
*/
|
|
|
this.form = form;
|
|
this.form = form;
|
|
|
},
|
|
},
|
|
@@ -33,12 +53,22 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
|
|
|
)) parent = parent.getParent();
|
|
)) parent = parent.getParent();
|
|
|
return (parent) ? parent.retrieve("module") : null;
|
|
return (parent) ? parent.retrieve("module") : null;
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 隐藏组件.
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * this.form.get("fieldName").hide(); //隐藏组件
|
|
|
|
|
+ */
|
|
|
hide: function(){
|
|
hide: function(){
|
|
|
var dsp = this.node.getStyle("display");
|
|
var dsp = this.node.getStyle("display");
|
|
|
if (dsp!=="none") this.node.store("mwf_display", dsp);
|
|
if (dsp!=="none") this.node.store("mwf_display", dsp);
|
|
|
this.node.setStyle("display", "none");
|
|
this.node.setStyle("display", "none");
|
|
|
if (this.iconNode) this.iconNode.setStyle("display", "none");
|
|
if (this.iconNode) this.iconNode.setStyle("display", "none");
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 显示组件.
|
|
|
|
|
+ * @example
|
|
|
|
|
+ * this.form.get("fieldName").show(); //显示组件
|
|
|
|
|
+ */
|
|
|
show: function(){
|
|
show: function(){
|
|
|
var dsp = this.node.retrieve("mwf_display", dsp);
|
|
var dsp = this.node.retrieve("mwf_display", dsp);
|
|
|
this.node.setStyle("display", dsp);
|
|
this.node.setStyle("display", dsp);
|