Pārlūkot izejas kodu

移动端框架整理 / 测试用例优化

luoyifan 3 gadi atpakaļ
vecāks
revīzija
75763de1d3

+ 1 - 0
dist/Defaults.d.ts

@@ -96,6 +96,7 @@ export declare const grid: {
     border: boolean;
     columnLines: boolean;
     rowLines: boolean;
+    scrollable: boolean;
     plugins: {
         cellediting: {
             clicksToEdit: number;

+ 1 - 2
dist/PropertyDescriptionTable.d.ts

@@ -1,5 +1,4 @@
-import {PropertyDescription, PropertyDescriptionInterface, PropertyValue} from './PropertyDescription';
-
+import { PropertyDescription, PropertyDescriptionInterface, PropertyValue } from './PropertyDescription';
 export declare const PropertyDescriptionTable: Map<String, PropertyDescription>;
 export declare const width: PropertyValue;
 export declare const height: PropertyValue;

+ 11 - 0
dist/Scope.d.ts

@@ -1,5 +1,6 @@
 export declare class Scope {
     private static readonly SHOW_PAGE_STACK;
+    scopeTag: string;
     /**
      * 业务模块的唯一编号
      */
@@ -46,6 +47,11 @@ export declare class Scope {
      * 组件卸载之后的回调
      */
     onDestroy(): void;
+    onGoBack(params: any): void;
+    /**
+     * 模块载入动画结束之后的回调, 在onload之后
+     */
+    onLoadAnimationEnd(): void;
     get isScope(): boolean;
     /**
      * 产生一个当前模块有效的唯一id
@@ -54,6 +60,8 @@ export declare class Scope {
     uid(key: any): string;
     _onDestroy(): void;
     _onLoad(): void;
+    _onLoadAnimationEnd(): void;
+    _onGoBack(params: any): void;
     showMainWindow(): void;
     /**
      * 渲染模块到全屏
@@ -66,6 +74,8 @@ export declare class Scope {
         vjsonOption: {};
         dataOption: {};
     }): any;
+    goHome(): void;
+    goBack(params?: any, scopeTag?: string | null | undefined): void;
     /**
      * 对话框"保存"成功.
      * 关闭对话框,并响应 success 方法
@@ -78,6 +88,7 @@ export declare class Scope {
      * @param msg
      */
     setLoading(value: boolean): void;
+    showDialog(sender: any, vjsonOption?: {}, dataOption?: {}): void;
     /**
      * 关闭对话框(或标签页)
      */

+ 1 - 0
dist/controls/component.d.ts

@@ -0,0 +1 @@
+export default function _default(): void;

+ 1 - 1
dist/index.d.ts

@@ -5,7 +5,6 @@ import jquery from 'jquery';
 import json5 from 'json5';
 import moment from 'moment';
 import './wotu-ui.css';
-
 export { axios, qs, lodash, jquery, json5, moment, };
 export * from './Scope';
 export * from './init';
@@ -13,3 +12,4 @@ export * from './lib/ajax';
 export * from './lib/lib';
 export * from './lib/config';
 export * from './message';
+export { invokeServer, setComboStore } from './lib/systemLib';

+ 0 - 1
dist/init.d.ts

@@ -1,3 +1,2 @@
 import './lib/fix';
-
 export declare function init(): void;

+ 1 - 2
dist/lib/ajax.d.ts

@@ -1,5 +1,4 @@
-import {PlainObject} from "../types";
-
+import { PlainObject } from "../types";
 export declare type ApiMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'download' | 'post-json' | 'post-file' | 'invoke' | 'sql' | string;
 export declare type ApiDataType = 'json' | 'form-data' | 'form';
 export interface ApiObject {

+ 2 - 3
dist/lib/config.d.ts

@@ -1,6 +1,5 @@
-import {ConfigProcess} from "../types";
-import {ApiFunction} from "./ajax";
-
+import { ConfigProcess } from "../types";
+import { ApiFunction } from "./ajax";
 export declare type ServerInvokeUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
 export declare type SqlUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
 export interface ApiConvert {

+ 13 - 3
dist/lib/lib.d.ts

@@ -1,6 +1,7 @@
-import {FunctionRegiste, LibParamType} from "../types";
-import {Scope} from "../Scope";
-
+import { FunctionRegiste, LibParamType } from "../types";
+import { Scope } from "../Scope";
+export declare function toString(value: any): string;
+export declare function isEmpty(value: any): boolean;
 export declare function getRegList(): FunctionRegiste[];
 export declare function getRegParamList(methodName: string): any;
 /**
@@ -29,3 +30,12 @@ export declare function lookupFn(scope: Scope, event: string): Function;
  * 从 ext.element 获取 scope 对象
  */
 export declare function lookupScope(extHandle: any): Scope;
+/**
+ * 转换内联结构的行,到平面结构
+ * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
+ *
+ * @param array
+ * @param flatOption
+ * @return {[]}
+ */
+export declare function flatRow(array: any): any[];

+ 4 - 0
dist/lib/systemLib.d.ts

@@ -1,5 +1,9 @@
 export declare const SIMPLE_RE: RegExp;
 /**
+ * 替换内部结构中,所有 N/A
+ */
+export declare function replaceNA(obj: any): string;
+/**
  * 对某个表达式进行求值
  * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  *

+ 127 - 205
dist/yvan-ext-mobile.js

@@ -37671,7 +37671,7 @@ define(['exports'], function (exports) { 'use strict';
       }
       // 为 eval 准备环境
       var _a = window['yvanLib'], system = _a.system, format = _a.format;
-      var data = scope.viewModel.data;
+      var data = (scope.viewModel ? scope.viewModel.data : scope.model.data);
       var keys = [];
       var values = [];
       lodash.forOwn(data, function (value, key) {
@@ -37747,7 +37747,6 @@ define(['exports'], function (exports) { 'use strict';
           }
       });
   }
-  //# sourceMappingURL=lib.js.map
 
   var Scope = /** @class */ (function () {
       function Scope(_a) {
@@ -38121,6 +38120,119 @@ define(['exports'], function (exports) { 'use strict';
       return Scope;
   }());
 
+  /**
+   * 全局 ajax 方法
+   */
+  var ajax = {};
+  /**
+   * 计算拼音的函数
+   */
+  var pinyinFunc = function (str) { return (str); };
+  exports.scopeOnLoad = null;
+  exports.apiConvert = undefined;
+  var baseConfigProcessList = [];
+  /**
+   * 在基类添加 Config 的处理方法
+   */
+  function baseConfigProcess(option) {
+      return function (target, propertyKey) {
+          baseConfigProcessList.push(target[propertyKey]);
+      };
+  }
+  var designMode = false;
+  function isDesignMode() {
+      return designMode;
+  }
+  function setDesignMode(v) {
+      designMode = v;
+  }
+  /**
+   * 将业务定义的 url 转换为调用服务端 groovy 的 url
+   */
+  function serverInvokeUrlTransform(url, option) {
+      return lodash.get(window, '_YvanUI_serverInvokePrefix')(url, option);
+  }
+  /**
+   * 将业务定义的 url 转换为调用服务端 sql 的 Url
+   */
+  function sqlUrlTransform(url) {
+      return lodash.get(window, '_YvanUI_sqlPrefix')(url);
+  }
+  /**
+   * YvanUI 全局扩展配置
+   */
+  function extend$1(option) {
+      if (option.ajax) {
+          ajax.func = option.ajax;
+      }
+      if (option.serverInvokeUrlTransform) {
+          lodash.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
+      }
+      if (option.sqlUrlTransform) {
+          lodash.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
+      }
+      if (option.pinyinFunction) {
+          pinyinFunc = option.pinyinFunction;
+      }
+      if (option.scopeOnLoad) {
+          exports.scopeOnLoad = option.scopeOnLoad;
+      }
+      if (option.apiConvert) {
+          exports.apiConvert = option.apiConvert;
+      }
+      if (typeof option.designMode !== 'undefined') {
+          setDesignMode(option.designMode);
+      }
+  }
+  function getApiConvert() {
+      return exports.apiConvert;
+  }
+  function getPinyin(v) {
+      return pinyinFunc(v);
+  }
+  /**
+   * 适用于 Select / Tree 等,作筛选的通用方法.
+   * 1.首字母模糊匹配(不区分大小写)
+   * 2.标识的模糊匹配(不区分大小写)
+   * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
+   */
+  function keywordFilter(keyword, label, value) {
+      if (!keyword) {
+          return true;
+      }
+      var ws = lodash.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
+      var labelPy = lodash.toLower(getPinyin(label));
+      value = lodash.toLower(lodash.trim(value));
+      var found = 0;
+      lodash.some(ws, function (word) {
+          if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
+              found++;
+              return;
+          }
+          if (value && value.indexOf(word.toLowerCase()) >= 0) {
+              found++;
+              return;
+          }
+      });
+      return found >= ws.length;
+  }
+
+  function initComponent () {
+      var ct = Ext.Component.prototype.constructor;
+      Ext.Component.override({
+          constructor: function (config) {
+              if (!window["IS_DESIGN_MODE"] && config) {
+                  var me_1 = this;
+                  // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
+                  lodash.each(baseConfigProcessList, function (process) {
+                      process.call(me_1, me_1, config);
+                  });
+              }
+              ct.call(this, config);
+          }
+      });
+  }
+
   var column = {
       menuDisabled: true
   };
@@ -38175,7 +38287,6 @@ define(['exports'], function (exports) { 'use strict';
           flex: 1
       },
   };
-  //# sourceMappingURL=Defaults.js.map
 
   /**
    * 构建所有组件的公共属性
@@ -38222,7 +38333,6 @@ define(['exports'], function (exports) { 'use strict';
       }
       return config;
   }
-  //# sourceMappingURL=base.js.map
 
   function initCols () {
       Ext.define('Yvan.Cols', {
@@ -38239,7 +38349,6 @@ define(['exports'], function (exports) { 'use strict';
           },
       });
   }
-  //# sourceMappingURL=cols.js.map
 
   var PropertyDescription = /** @class */ (function () {
       function PropertyDescription() {
@@ -38281,7 +38390,6 @@ define(['exports'], function (exports) { 'use strict';
       };
       return PropertyDescription;
   }());
-  //# sourceMappingURL=PropertyDescription.js.map
 
   var PropertyDescriptionTable = new Map();
   PropertyDescriptionTable.set('tabCell', new PropertyDescription({
@@ -38613,105 +38721,6 @@ define(['exports'], function (exports) { 'use strict';
           width, height
       ]
   }));
-  //# sourceMappingURL=PropertyDescriptionTable.js.map
-
-  /**
-   * 全局 ajax 方法
-   */
-  var ajax = {};
-  /**
-   * 计算拼音的函数
-   */
-  var pinyinFunc = function (str) { return (str); };
-  exports.scopeOnLoad = null;
-  exports.apiConvert = undefined;
-  var baseConfigProcessList = [];
-  /**
-   * 在基类添加 Config 的处理方法
-   */
-  function baseConfigProcess(option) {
-      return function (target, propertyKey) {
-          baseConfigProcessList.push(target[propertyKey]);
-      };
-  }
-  var designMode = false;
-  function isDesignMode() {
-      return designMode;
-  }
-  function setDesignMode(v) {
-      designMode = v;
-  }
-  /**
-   * 将业务定义的 url 转换为调用服务端 groovy 的 url
-   */
-  function serverInvokeUrlTransform(url, option) {
-      return lodash.get(window, '_YvanUI_serverInvokePrefix')(url, option);
-  }
-  /**
-   * 将业务定义的 url 转换为调用服务端 sql 的 Url
-   */
-  function sqlUrlTransform(url) {
-      return lodash.get(window, '_YvanUI_sqlPrefix')(url);
-  }
-  /**
-   * YvanUI 全局扩展配置
-   */
-  function extend$1(option) {
-      if (option.ajax) {
-          ajax.func = option.ajax;
-      }
-      if (option.serverInvokeUrlTransform) {
-          lodash.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
-      }
-      if (option.sqlUrlTransform) {
-          lodash.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
-      }
-      if (option.pinyinFunction) {
-          pinyinFunc = option.pinyinFunction;
-      }
-      if (option.scopeOnLoad) {
-          exports.scopeOnLoad = option.scopeOnLoad;
-      }
-      if (option.apiConvert) {
-          exports.apiConvert = option.apiConvert;
-      }
-      if (typeof option.designMode !== 'undefined') {
-          setDesignMode(option.designMode);
-      }
-  }
-  function getApiConvert() {
-      return exports.apiConvert;
-  }
-  function getPinyin(v) {
-      return pinyinFunc(v);
-  }
-  /**
-   * 适用于 Select / Tree 等,作筛选的通用方法.
-   * 1.首字母模糊匹配(不区分大小写)
-   * 2.标识的模糊匹配(不区分大小写)
-   * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
-   */
-  function keywordFilter(keyword, label, value) {
-      if (!keyword) {
-          return true;
-      }
-      var ws = lodash.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
-      var labelPy = lodash.toLower(getPinyin(label));
-      value = lodash.toLower(lodash.trim(value));
-      var found = 0;
-      lodash.some(ws, function (word) {
-          if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
-              found++;
-              return;
-          }
-          if (value && value.indexOf(word.toLowerCase()) >= 0) {
-              found++;
-              return;
-          }
-      });
-      return found >= ws.length;
-  }
-  //# sourceMappingURL=config.js.map
 
   function prompt(message, multiLine, value) {
       if (multiLine === void 0) { multiLine = false; }
@@ -38817,7 +38826,6 @@ define(['exports'], function (exports) { 'use strict';
           $w.remove();
       }, 3000);
   }
-  //# sourceMappingURL=message.js.map
 
   var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
   /**
@@ -39192,7 +39200,6 @@ define(['exports'], function (exports) { 'use strict';
    * @param multiValueSeparator 多个字典值的分割符号
    */
   function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
-      if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
       // sender 和 config为空的时候获取值、
       if (!sender) {
           return new Promise(function (resolve, reject) {
@@ -39201,25 +39208,18 @@ define(['exports'], function (exports) { 'use strict';
               });
           });
       }
-      if (sender.xtype === 'combotree') {
-          getDictFn(bizKey, function (r) {
-              if (sender.store) {
-                  // 异步回传
-                  sender.setStore(new Ext.data.TreeStore({ root: r }));
-              }
-              else {
-                  // 同步回传
-                  config.store = new Ext.data.TreeStore({ root: r });
-              }
-          });
-          return;
-      }
-      else if (sender.$className === 'Ext.form.field.ComboBox') {
+      if (sender.$className === 'Ext.field.Select') {
           getDictFn(bizKey, function (r) {
               var _a, _b;
-              if (sender.store) {
+              var options = lodash.map(r.data, function (r) {
+                  return {
+                      value: r.id,
+                      text: r.text,
+                  };
+              });
+              if (sender.getOptions()) {
                   // 异步回传
-                  sender.setStore(new Ext.data.Store(r));
+                  sender.setOptions(options);
                   // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
                   // 否则在 forceSelection 的模式下。displayField 不会强制做变更
                   var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
@@ -39229,80 +39229,7 @@ define(['exports'], function (exports) { 'use strict';
               }
               else {
                   // 同步回传
-                  config.store = new Ext.data.Store(r);
-              }
-          });
-          return;
-      }
-      else if (sender.xtype === 'gridcolumn') {
-          var grid = getParentGrid(config);
-          var editor_1 = config.editor, renderer = config.renderer;
-          getDictFn(bizKey, function (r) {
-              if (sender.store) {
-                  // 已经渲染出来了, 用方法进行修改
-                  var editor_2 = sender.getEditor();
-                  if (editor_2 && editor_2.xtype === 'combo') {
-                      var valueField = r.field[0];
-                      var displayField = r.field[1];
-                      editor_2.valueField = valueField;
-                      editor_2.setDisplayField(displayField);
-                      editor_2.setStore(new Ext.data.Store(r));
-                  }
-              }
-              else {
-                  // 没有渲染之前,修改 config 即可
-                  if (editor_1 && editor_1.xtype === 'combo') {
-                      // 带编辑模式
-                      editor_1.store = new Ext.data.Store(r);
-                  }
-              }
-              var renderer = function (value, metaData) {
-                  var valueField = r.field[0];
-                  var displayField = r.field[1];
-                  var separator = multiValueSeparator;
-                  if (separator) {
-                      var arr = value.split(separator);
-                      var displayValue_1 = "";
-                      var _loop_1 = function (i) {
-                          var itv = arr[i];
-                          if (i > 0) {
-                              displayValue_1 += separator;
-                          }
-                          lodash.each(r.data, function (row) {
-                              // 从 valueField 找到要显示的 displayField
-                              if (row[valueField] == itv) {
-                                  displayValue_1 += row[displayField];
-                                  return false;
-                              }
-                              else {
-                                  if (i >= r.data.length - 1) {
-                                      displayValue_1 += itv;
-                                  }
-                              }
-                          });
-                      };
-                      for (var i = 0; i < arr.length; i++) {
-                          _loop_1(i);
-                      }
-                      return displayValue_1;
-                  }
-                  lodash.each(r.data, function (row) {
-                      // 从 valueField 找到要显示的 displayField
-                      if (row[valueField] == value) {
-                          value = row[displayField];
-                          return false;
-                      }
-                  });
-                  return value;
-              };
-              if (sender.rendered) {
-                  // 已经渲染出来了, 对列进行渲染
-                  sender.renderer = renderer;
-                  sender.getView().refresh();
-              }
-              else {
-                  sender.renderer = renderer;
-                  config.renderer = renderer;
+                  sender.setOptions(options);
               }
           });
           return;
@@ -40050,7 +39977,6 @@ define(['exports'], function (exports) { 'use strict';
           err: err
       };
   }
-  //# sourceMappingURL=systemLib.js.map
 
   var SystemLib = /*#__PURE__*/Object.freeze({
     __proto__: null,
@@ -40222,7 +40148,6 @@ define(['exports'], function (exports) { 'use strict';
           }
       });
   }
-  //# sourceMappingURL=stores.js.map
 
   function initGrid () {
       Ext.define('Yvan.Grid', {
@@ -40706,7 +40631,6 @@ define(['exports'], function (exports) { 'use strict';
       }
       // throw new TypeError('无法识别的调用方法')
   }
-  //# sourceMappingURL=grid.js.map
 
   function initGridColumn () {
       var ct = Ext.grid.column.Column.prototype.constructor;
@@ -40739,7 +40663,6 @@ define(['exports'], function (exports) { 'use strict';
       //     }
       // });
   }
-  //# sourceMappingURL=gridcolumn.js.map
 
   function initLocale() {
       Ext.define('Ext.locale.zh_CN.Panel', {
@@ -40783,7 +40706,6 @@ define(['exports'], function (exports) { 'use strict';
       //     }
       // });
   }
-  //# sourceMappingURL=locale-zh_CN.js.map
 
   var FixClass = /** @class */ (function () {
       function FixClass() {
@@ -40826,7 +40748,6 @@ define(['exports'], function (exports) { 'use strict';
       ], FixClass.prototype, "fix", null);
       return FixClass;
   }());
-  //# sourceMappingURL=fix.js.map
 
   function init() {
       /**
@@ -40895,13 +40816,13 @@ define(['exports'], function (exports) { 'use strict';
           window['system'] = {};
       }
       lodash.extend(window['system'], SystemLib);
+      initComponent();
       initCols();
       initLocale();
       initGridColumn();
       initGrid();
       initStores();
   }
-  //# sourceMappingURL=init.js.map
 
   /**
    * 创建一个 Ajax 客户端
@@ -41074,7 +40995,6 @@ define(['exports'], function (exports) { 'use strict';
       };
       xhr.send(formData);
   }
-  //# sourceMappingURL=ajax.js.map
 
   exports.Lib = Lib;
   exports.LibParam = LibParam;
@@ -41093,6 +41013,7 @@ define(['exports'], function (exports) { 'use strict';
   exports.getRegList = getRegList;
   exports.getRegParamList = getRegParamList;
   exports.init = init;
+  exports.invokeServer = invokeServer;
   exports.isDesignMode = isDesignMode;
   exports.isEmpty = isEmpty;
   exports.jquery = jquery;
@@ -41108,6 +41029,7 @@ define(['exports'], function (exports) { 'use strict';
   exports.qs = lib;
   exports.raiseClick = raiseClick;
   exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
+  exports.setComboStore = setComboStore;
   exports.setDesignMode = setDesignMode;
   exports.showErrorDialog = showErrorDialog;
   exports.showInfoDialog = showInfoDialog;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/yvan-ext-mobile.js.map