unknown 5 lat temu
rodzic
commit
60afaeb665

+ 47 - 22
o2web/jsdoc.conf.json

@@ -2,16 +2,17 @@
     "opts": {
         "encoding": "utf8",               // same as -e utf8
         "destination": "./o2web/jsdoc/",          // same as -d ./out/
-        "recurse": true,                  // same as -r
-        "template" : "./node_modules/ink-docstrap/template"
-//        "tutorials": "./o2web/tutorials" // same as -u path/to/tutorials
+        "recurse": true,                 // same as -r
+        "template" : "./node_modules/docdash"
+        //        "tutorials": "./o2web/tutorials" // same as -u path/to/tutorials
     },
 
     "tags": {
-        "allowUnknownTags": true
+        "allowUnknownTags": true,
+        "dictionaries": ["jsdoc"]
     },
     "source": {
-        "include": ["./o2web/source/x_component_process_Xform"],
+        "include": ["./o2web/source/x_component_process_Xform","./o2web/source/x_component_cms_Xform"],
         "includePattern": ".+\\.js(doc|x)?$",
         "excludePattern": "(^|\\/|\\\\)_"
     },
@@ -22,23 +23,47 @@
     "templates": {
         "cleverLinks": false,
         "monospaceLinks": false,
-        "dateFormat": "YYYY-MM-dd",
-        "outputSourceFiles": true,
-        "outputSourcePath": true,
-        "systemName": "O2前台组件API",
-        "footer": "",
-        "copyright": "o2 group",
-        "navType": "vertical",
-        "theme": "cosmo", //readable lumen cosmo
-        "linenums": true,
-        "collapseSymbols": false,
-        "inverseNav": true,
-        "protocol": "html://",
-        "methodHeadingReturns": false
+        "default" : {
+            "useLongnameInNav": false
+        }
     },
-    "markdown": {
-        "parser": "gfm",
-        "hardwrap": true
+    "docdash": {
+        "static": true,         // Display the static members inside the navbar
+        "sort": true,           // Sort the methods in the navbar
+        "sectionOrder": [               // Order the main section in the navbar (default order shown here)
+            "Classes",
+            "Modules",
+            "Externals",
+            "Events",
+            "Namespaces",
+            "Mixins",
+            "Tutorials",
+            "Interfaces"
+        ],
+        "disqus": "",                   // Shortname for your disqus (subdomain during site creation)
+        "openGraph": {                  // Open Graph options (mostly for Facebook and other sites to easily extract meta information)
+            "title": "",                // Title of the website
+            "type": "website",          // Type of the website
+            "image": "",                // Main image/logo
+            "site_name": "",            // Site name
+            "url": ""                   // Main canonical URL for the main page of the site
+        },
+        "meta": {                       // Meta information options (mostly for search engines that have not indexed your site yet)
+            "title": "",                // Also will be used as postfix to actualy page title, prefixed with object/document name
+            "description": "",          // Description of overal contents of your website
+            "keyword": ""               // Keywords for search engines
+        },
+        "search": true,         // Display seach box above navigation which allows to search/filter navigation items
+        "collapse": true,       // Collapse navigation by default except current object's navigation of the current page
+        "wrap": true,           // Wrap long navigation names instead of trimming them
+        "typedefs": true,       // Include typedefs in menu
+        "navLevel": 3,          // depth level to show in navbar, starting at 0 (false or -1 to disable)
+        "private": false,        // set to false to not show @private in navbar
+        "removeQuotes": true,// Remove single and double quotes, trim removes only surrounding ones
+        "scripts": [],                  // Array of external (or relative local copied using templates.default.staticFiles.include) js or css files to inject into HTML,
+        "scopeInOutputPath": true, // Add scope from package file (if present) to the output path, true by default.
+        "nameInOutputPath": true, // Add name from package file to the output path, true by default.
+        "versionInOutputPath": true // Add package version to the output path, true by default.
     }
 }
-//执行命令: jsdoc -c ./o2web/jsdoc.conf.json
+//执行命令: jsdoc -c ./o2web/jsdoc.conf.json

+ 4 - 0
o2web/source/x_component_cms_Xform/Textfield.js

@@ -1,4 +1,8 @@
 MWF.xDesktop.requireApp("process.Xform", "Textfield", null, false);
+/** @class cms.Textfield 文本输入框。
+ * @extends MWF.xApplication.process.Xform.Textfield
+ * @hideconstructor
+ */
 MWF.xApplication.cms.Xform.Textfield = MWF.CMSTextfield =  new Class({
 	Extends: MWF.APPTextfield
 }); 

+ 19 - 3
o2web/source/x_component_process_Xform/$Input.js

@@ -1,5 +1,6 @@
 MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-/** @class $Input 组件类,此类为所有输入组件的父类
+/** @class process.$Input 组件类,此类为所有输入组件的父类
+ * @hideconstructor
 * @extends MWF.xApplication.process.Xform.$Module
  * @abstract
  */
@@ -9,6 +10,9 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
 	Implements: [Events],
 	Extends: MWF.APP$Module,
 	iconStyle: "personfieldIcon",
+    /**
+     * @hideconstructor
+     */
     initialize: function(node, json, form, options){
         this.node = $(node);
         this.node.store("module", this);
@@ -272,7 +276,11 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
 	},
     /**
      * 判断组件值是否为空.
-     * @return {Boolean}.
+     * @example
+     * if( this.form.get('subject').isEmpty() ){
+     *     this.form.notice('标题不能为空', 'warn');
+     * }
+     * @return {Boolean} 值是否为空.
      */
     isEmpty : function(){
 	    var data = this.getData();
@@ -280,7 +288,9 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
     },
     /**
      * 获取组件值.
-     * @return {Array|Object|String|Number|Boolean}.
+     *  @example
+     * var data = this.form.get('subject').getData();
+     * @return {Array|Object|String|Number|Boolean} 组件的数据.
      */
 	getData: function(when){
         if (this.json.compute == "save") this._setValue(this._computeValue());
@@ -295,6 +305,8 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
     },
     /**
      * 重置组件的值为默认值或置空。
+     *  @example
+     * this.form.get('subject').resetData();
      */
     resetData: function(){
         this.setData(this.getValue());
@@ -536,6 +548,10 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
     /**
      * 根据组件的校验设置进行校验。
      *  @param {String} routeName - 可选,路由名称.
+     *  @example
+     *  if( !this.form.get('fieldName').validation() ){
+     *      return false;
+     *  }
      *  @return {Boolean} 是否通过校验
      */
     validation: function(routeName, opinion){

+ 4 - 3
o2web/source/x_component_process_Xform/$Module.js

@@ -1,7 +1,9 @@
 
 MWF.require("MWF.widget.Common", null, false);
-/** @class $Module 组件类,此类为所有组件的父类。
- * @abstract*/
+/** @classdesc process.$Module 组件类,此类为所有组件的父类。
+ * @class
+ * @hideconstructor
+ * */
 MWF.xApplication.process.Xform.$Module = MWF.APP$Module =  new Class(
     /** @lends MWF.xApplication.process.Xform.$Module# */
     {
@@ -9,7 +11,6 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module =  new Class(
     options: {
         "moduleEvents": ["load", "queryLoad", "postLoad"]
     },
-
     initialize: function(node, json, form, options){
         /**
          * 组件的节点

+ 2 - 1
o2web/source/x_component_process_Xform/Actionbar.js

@@ -2,7 +2,7 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
 //MWF.require("MWF.widget.Tree", null, false);
 //MWF.require("MWF.widget.Toolbar", null, false);
 
-/** @class Actionbar 操作条类
+/** @class process.Actionbar 操作条组件
  * @example
  * //可以在脚本中获取该组件
  * //方法1:
@@ -10,6 +10,7 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  * //方法2
  * var actionbar = this.target; //在操作条和操作本身的事件脚本中获取
  * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
  */
 MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar =  new Class(
     /** @lends MWF.xApplication.process.Xform.Actionbar# */

+ 15 - 3
o2web/source/x_component_process_Xform/Attachment.js

@@ -1036,6 +1036,13 @@ MWF.xApplication.process.Xform.AttachmentController = new Class({
 
 });
 
+/**
+ * 当前登录人员的附件权限数据结构.
+ * @typedef {Object} AttachmentControl
+ * @property {Boolean} allowRead - 是否允许阅读.
+ * @property {Boolean} allowEdit - 是否允许编辑.
+ * @property {Boolean} allowControl - 是否允许设置.
+ */
 /**
  * 附件数据结构.
  * @typedef {Object} AttachmentData
@@ -1044,13 +1051,13 @@ MWF.xApplication.process.Xform.AttachmentController = new Class({
  * @property {String} person - 上传人.
  * @property {Number} orderNumber - 排序号.
  * @property {String} activityName - 上传的节点.
- * @property {Object} control - 当前登录人员对附件拥有的权限.
+ * @property {AttachmentControl} control - 当前登录人员对附件拥有的权限.
  * @property {Number} length - 附件大小.
  * @property {String} createTime - 创建时间.
  * @property {String} updateTime - 修改时间.
  * @property {String} extension - 附件扩展名.
  */
-/** @class Actionbar 附件组件
+/** @class process.Actionbar 附件组件。
  * @example
  * //可以在脚本中获取该组件
  * //方法1:
@@ -1058,6 +1065,7 @@ MWF.xApplication.process.Xform.AttachmentController = new Class({
  * //方法2
  * var attachment = this.target; //在组件事件脚本中获取
  * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
  */
 MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
     /** @lends MWF.xApplication.process.Xform.Attachment# */
@@ -1176,7 +1184,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
      * 获取当前组件所有附件的标题.如果没有附件返回null
      * @example
      * var getAttachmentNames = this.form.get("name").getData();
-     * @return {StringArray|Null}.
+     * @return {StringArray|Null} 附件标题.
      */
     getData: function () {
         return (this.attachmentController) ? this.attachmentController.getAttachmentNames() : null;
@@ -1801,6 +1809,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
     /**
      * 根据组件的校验设置进行校验。
      *  @param {String} routeName - 可选,路由名称.
+     *  @example
+     *  if( !this.form.get('fieldName').validation() ){
+     *      return false;
+     *  }
      *  @return {Boolean} 是否通过校验
      */
     validation: function (routeName, opinion) {

+ 10 - 0
o2web/source/x_component_process_Xform/Button.js

@@ -1,4 +1,14 @@
 MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
+/** @class process.Button 按钮组件。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
 MWF.xApplication.process.Xform.Button = MWF.APPButton =  new Class({
     Implements: [Events],
     Extends: MWF.APP$Module,

+ 20 - 1
o2web/source/x_component_process_Xform/Calendar.js

@@ -1,5 +1,17 @@
 MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
-MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class({
+/** @class process.Calendar 日期组件。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var field = this.form.get("fieldName"); //获取组件对象
+ * //方法2
+ * var field = this.target; //在组件本身的脚本中获取,比如事件脚本、默认值脚本、校验脚本等等
+ * @extends MWF.xApplication.process.Xform.$Input
+ * @hideconstructor
+ */
+MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class(
+    /** @lends MWF.xApplication.process.Xform.Calendar# */
+{
 	Implements: [Events],
 	Extends: MWF.APP$Input,
 	iconStyle: "calendarIcon",
@@ -141,6 +153,13 @@ MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class({
                     }.bind(this)
                 };
                 options.baseDate = this.getBaseDate();
+                /**
+                 * 日期弹出选择组件,只读情况下无此节点.
+                 * @member {MWF.widget.Calendar}
+                 * @example
+                 * var calendar = this.form.get("fieldName").calendar; //获取组件
+                 * if(calendar)calendar.show(); //弹出选择组件
+                 */
                 this.calendar = new MWF.widget.Calendar(this.node.getFirst(), options);
                 if( this.form.json && this.form.json.canlendarStyle && typeOf( this.form.json.canlendarStyle.zIndex ) !== "null" && typeOf( this.form.json.canlendarStyle.zIndex ) !== "undefined" ){
                     this.calendar.container.setStyle("z-index", this.form.json.canlendarStyle.zIndex );

+ 10 - 0
o2web/source/x_component_process_Xform/Common.js

@@ -1,4 +1,14 @@
 MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
+/** @class process.Common 通用组件。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
 MWF.xApplication.process.Xform.Common = MWF.APPCommon =  new Class({
     Extends: MWF.APP$Module,
     _loadUserInterface: function(){

+ 51 - 3
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -1,5 +1,17 @@
 MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-MWF.xApplication.process.Xform.DatagridPC = new Class({
+/** @class process.Button 数据网格组件(PC端)。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
+MWF.xApplication.process.Xform.DatagridPC = new Class(
+	/** @lends MWF.xApplication.process.Xform.DatagridPC# */
+	{
 	Implements: [Events],
 	Extends: MWF.APP$Module,
 	isEdit: false,
@@ -1096,9 +1108,18 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 	_afterLoaded: function(){
 		this._loadDatagridStyle();
 	},
+	/**
+	 * 重置组件的值为默认值或置空。
+	 *  @example
+	 * this.form.get('fieldName').resetData();
+	 */
 	resetData: function(){
 		this.setData(this._getValue());
 	},
+	/**
+	 * 为数据网格赋值。
+	 *  @param data{Array}  - 必选,数组.
+	 */
 	setData: function(data){
 		if (!data){
 			data = this._getValue();
@@ -1180,11 +1201,24 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			this._loadDatagridStyle();
 		}
 	},
-
+	/**
+	 * 获取总计数据.
+	 * @example
+	 * var totalObject = this.form.get('fieldName').getTotal();
+	 * @return {Object} 总计数据
+	 */
 	getTotal: function(){
 		this._loadTotal();
 		return this.totalResaults;
 	},
+	/**
+	 * 判断数据网格是否为空.
+	 * @example
+	 * if( this.form.get('fieldName').isEmpty() ){
+	 *     this.form.notice('至少需要添加一条数据', 'warn');
+	 * }
+	 * @return {Boolean} 是否为空
+	 */
 	isEmpty: function(){
 		var data = this.getData();
 		if( !data )return true;
@@ -1194,6 +1228,12 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		}
 		return false;
 	},
+	/**
+	 * 获取数据网格数据.
+	 *  @example
+	 * var data = this.form.get('fieldName').getData();
+	 * @return {Object} - 格式如下{ data : [] }.
+	 */
 	getData: function(){
 		if (this.editable!=false){
 			if (this.isEdit) this._completeLineEdit();
@@ -1350,7 +1390,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		}
 		return true;
 	},
-
+	/**
+	 * 根据组件的校验设置进行校验。
+	 *  @param {String} routeName - 可选,路由名称.
+	 *  @example
+	 *  if( !this.form.get('fieldName').validation() ){
+	 *      return false;
+	 *  }
+	 *  @return {Boolean} 是否通过校验
+	 */
 	validation: function(routeName, opinion){
 		if (this.isEdit){
 			if (!this.editValidation()){

+ 10 - 0
o2web/source/x_component_process_Xform/Div.js

@@ -1,4 +1,14 @@
 MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
+/** @class process.Button 容器组件。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
 MWF.xApplication.process.Xform.Div = MWF.APPDiv =  new Class({
     Extends: MWF.APP$Module
 });

+ 2 - 1
o2web/source/x_component_process_Xform/Textfield.js

@@ -1,5 +1,5 @@
 MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
-/** @class Textfield 文本输入框
+/** @class process.Textfield 文本输入框。
  * @example
  * //可以在脚本中获取该组件
  * //方法1:
@@ -14,6 +14,7 @@ MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
  * var flag = field.isEmpty(); //字段是否为空
  * field.resetData();  //重置字段的值为默认值或置空
  * @extends MWF.xApplication.process.Xform.$Input
+ * @hideconstructor
  */
 MWF.xApplication.process.Xform.Textfield = MWF.APPTextfield =  new Class({
 	Implements: [Events],

+ 9 - 2
package.json

@@ -53,6 +53,7 @@
         "license": "ISC",
         "dependencies": {
                 "dateformat": "^3.0.3",
+                "docdash": "^1.2.0",
                 "fast-glob": "^3.2.2",
                 "gulp": "^4.0.2",
                 "gulp-changed": "^3.2.0",
@@ -68,11 +69,17 @@
                 "gulp-uglify-es": "^2.0.0",
                 "gulp-util": "^3.0.8",
                 "ink-docstrap": "^1.3.2",
+                "jsdoc-template": "git+https://github.com/braintree/jsdoc-template.git",
                 "minimist": "^1.2.0",
                 "progress-stream": "^2.0.0",
                 "request": "^2.88.2",
                 "single-line-log": "^1.1.2",
-                "targz": "^1.0.1",
-                "gulp-sourcemaps": "^3.0.0"
+                "targz": "^1.0.1"
+        },
+        "devDependencies": {
+                "jsdoc": "^3.6.6",
+                "minami": "^1.2.3",
+                "tidy-jsdoc": "^1.4.0",
+                "tui-jsdoc-template": "^1.2.2"
         }
 }