diff --git a/o2web/jsdoc.conf.json b/o2web/jsdoc.conf.json index 1b44a3bc9d265b42c43bf48a78b4319fba180b08..6cacc69e9dbecfd628a03b044d15d7f884d8ba6d 100644 --- a/o2web/jsdoc.conf.json +++ b/o2web/jsdoc.conf.json @@ -4,8 +4,7 @@ "destination": "./o2web/jsdoc/", // same as -d ./out/ "recurse": true, // same as -r "template" : "./node_modules/ink-docstrap/template" - //"template": "templates/default" // same as -t templates/default - // "tutorials": "path/to/tutorials" // same as -u path/to/tutorials +// "tutorials": "./o2web/tutorials" // same as -u path/to/tutorials }, "tags": { diff --git a/o2web/source/x_component_process_Xform/$Input.js b/o2web/source/x_component_process_Xform/$Input.js index 2538563dec568745d93bb01541186ec474868b49..f60af2f9823ecf9b666586af7e521160d2ee74ad 100644 --- a/o2web/source/x_component_process_Xform/$Input.js +++ b/o2web/source/x_component_process_Xform/$Input.js @@ -1,7 +1,8 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false); /** @class $Input 组件类,此类为所有输入组件的父类 * @extends MWF.xApplication.process.Xform.$Module -*/ + * @abstract + */ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class( /** @lends MWF.xApplication.process.Xform.$Input# */ { @@ -86,6 +87,11 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class( if( this.json.showIcon!='no' && !this.form.json.hideModuleIcon ){ if (COMMON.Browser.safari) w = w-20; } + + /** + * 描述信息节点,select\radio\checkbox无此节点,只读情况下无此节点. + * @member {Element} + */ this.descriptionNode = new Element("div", {"styles": this.form.css.descriptionNode, "text": this.json.description}).inject(this.node); this.descriptionNode.setStyles({ "width": ""+w+"px", diff --git a/o2web/source/x_component_process_Xform/$Module.js b/o2web/source/x_component_process_Xform/$Module.js index 137e4c627cfd7c99fce6865f2b4d3a5f9ee8e9bf..d553cee79d6b8ab6f9be6e3c9ca9e63305213c4d 100644 --- a/o2web/source/x_component_process_Xform/$Module.js +++ b/o2web/source/x_component_process_Xform/$Module.js @@ -1,6 +1,7 @@ MWF.require("MWF.widget.Common", null, false); -/** @class $Module 组件类,此类为所有组件的父类。 */ +/** @class $Module 组件类,此类为所有组件的父类。 + * @abstract*/ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class( /** @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){ /** * 组件的节点 - * {@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} + * @example + * //可以在脚本中获取该组件 + * var field = this.form.get("fieldName"); //获取组件对象 + * field.node.setStyle("font-size","12px"); //给节点设置样式 + * @extends MWF.xApplication.process.Xform.$Input */ this.node = $(node); 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; + /** * 组件的所在表单对象. * @member {MWF.xApplication.process.Xform.Form} + * @example + * var form = this.form.get("fieldName").form; //获取组件所在表单对象 + * form.saveFormData(); //保存表单数据 */ this.form = form; }, @@ -33,12 +53,22 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class( )) parent = parent.getParent(); return (parent) ? parent.retrieve("module") : null; }, + /** + * 隐藏组件. + * @example + * this.form.get("fieldName").hide(); //隐藏组件 + */ hide: function(){ var dsp = this.node.getStyle("display"); if (dsp!=="none") this.node.store("mwf_display", dsp); this.node.setStyle("display", "none"); if (this.iconNode) this.iconNode.setStyle("display", "none"); }, + /** + * 显示组件. + * @example + * this.form.get("fieldName").show(); //显示组件 + */ show: function(){ var dsp = this.node.retrieve("mwf_display", dsp); this.node.setStyle("display", dsp); diff --git a/o2web/source/x_component_process_Xform/Actionbar.js b/o2web/source/x_component_process_Xform/Actionbar.js index edd6938600c577af85863074e4684965d0d9e996..3e0f154206d03dbdfc97d866874654257f3baf4a 100644 --- a/o2web/source/x_component_process_Xform/Actionbar.js +++ b/o2web/source/x_component_process_Xform/Actionbar.js @@ -1,11 +1,28 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false); //MWF.require("MWF.widget.Tree", null, false); //MWF.require("MWF.widget.Toolbar", null, false); -MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class({ + +/** @class Actionbar 操作条类。 + * @example + * //可以在脚本中获取该组件 + * //方法1: + * var actionbar = this.form.get("name"); //获取操作条 + * //方法2 + * var actionbar = this.target; //在操作条和操作本身的事件脚本中获取 + * @extends MWF.xApplication.process.Xform.$Module + */ +MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class( + /** @lends MWF.xApplication.process.Xform.Actionbar# */ + { Extends: MWF.APP$Module, options: { "moduleEvents": ["load", "queryLoad", "postLoad", "afterLoad"] }, + /** + * 重新加载操作条. + * @example + * this.form.get("name").reload(); //显示操作条 + */ reload : function(){ this._loadUserInterface(); }, @@ -201,6 +218,32 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class({ } } }, + /** + * 根据操作id获取操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。 + * @param {string} id - 必选,操作id. + * @return {o2.widget.ToolbarButton} 操作 + * @example + * var actionbar = this.form.get("name"); //获取操作条 + * var item = actionbar.getItem( "action_delete" ); //获取删除操作 + * item.node.hide(); //隐藏删除操作的节点 + * item.node.click(); //触发操作的click事件 + */ + getItem : function( id ){ + if( this.toolbarWidget && id ){ + return this.toolbarWidget.items[id] + } + }, + /** + * 获取所有操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。 + * @return {Array} 操作数组 + * @example + * var actionbar = this.form.get("name"); //获取操作条 + * var itemList = actionbar.getAllItem(); //获取操作数组 + * itemList[1].node.hide(); //隐藏第一个操作 + */ + getAllItem : function(){ + return this.toolbarWidget ? this.toolbarWidget.childrenButton : []; + }, setToolbars: function(tools, node, readonly, noCondition){ tools.each(function(tool){ this.setToolbarItem(tool, node, readonly, noCondition); diff --git a/o2web/source/x_component_process_Xform/Textfield.js b/o2web/source/x_component_process_Xform/Textfield.js index 2166e91371397e891d6160dc210682d9a908ffb6..635d1e9bc4e4f699c268b4523993cab820fa4028 100644 --- a/o2web/source/x_component_process_Xform/Textfield.js +++ b/o2web/source/x_component_process_Xform/Textfield.js @@ -1,5 +1,18 @@ MWF.xDesktop.requireApp("process.Xform", "$Input", null, false); /** @class Textfield 文本输入框类。 + * @example + * //可以在脚本中获取该组件 + * //方法1: + * var field = this.form.get("fieldName"); //获取组件对象 + * //方法2 + * var field = this.target; //在组件本身的脚本中获取,比如事件脚本、默认值脚本、校验脚本等等 + * + * var data = field.getData(); //获取值 + * field.setData("字符串值"); //设置值 + * field.hide(); //隐藏字段 + * var id = field.json.id; //获取字段标识 + * var flag = field.isEmpty(); //字段是否为空 + * field.resetData(); //重置字段的值为默认值或置空 * @extends MWF.xApplication.process.Xform.$Input */ MWF.xApplication.process.Xform.Textfield = MWF.APPTextfield = new Class({