Ver Fonte

银河平台V2.0 - designer

luoyifan há 2 anos atrás
pai
commit
293345d700
4 ficheiros alterados com 173 adições e 4 exclusões
  1. 129 0
      dist/ScopeEngine.d.ts
  2. 1 0
      dist/dict.d.ts
  3. 42 3
      dist/yvan-ext.js
  4. 1 1
      dist/yvan-ext.js.map

+ 129 - 0
dist/ScopeEngine.d.ts

@@ -0,0 +1,129 @@
+import { Scope } from "./Scope";
+export declare enum FuncDomain {
+    SCOPE = "scope",
+    SYSTEM = "system"
+}
+export declare enum BizMode {
+    query = 1,
+    formAndGridEdit = 2,
+    formEditOnly = 3,
+    gridEditOnly = 4
+}
+export declare enum BizFormat {
+    button = 1,
+    progress = 2,
+    date = 3,
+    datetime = 4,
+    percentage = 5
+}
+export declare enum BizUnique {
+    u_a = 1,
+    u_wh = 2,
+    u_ow = 3,
+    u_pj = 4,
+    u_od = 5,
+    u_wh_ow_pj = 6
+}
+export interface BizField {
+    column_desc: string;
+    column_name: string;
+    mode: BizMode;
+    column_domain: string;
+    column_length: number;
+    column_precision: number;
+    hide: string;
+    xtype: string;
+    readonly: string;
+    disabled: string;
+    required: string;
+    dict: string;
+    datasource: string;
+    dataconv: string;
+    format: BizFormat;
+    grid_sort: number;
+    form_sort: number;
+    form_label: string;
+    form_group: string;
+    grid_width: number;
+    grid_weight: number;
+    form_high: number;
+    form_newline: string;
+    unique: BizUnique;
+    defaults: string;
+    change_event: string;
+    scan_event: string;
+    front_logic: string;
+}
+export interface BizListeners {
+    [propName: string]: string;
+}
+export interface BizButton {
+    sort: number;
+    btn_name: string;
+    hidden: string;
+    listeners: BizListeners;
+    icon: string;
+}
+export interface BizDomain {
+    name?: string;
+    layout?: DomainLayout;
+    controller: string;
+    groovy: string;
+    fields: BizField[];
+    buttons: BizButton[];
+}
+export interface DomainLayout {
+    name?: string;
+}
+export interface BillFile {
+    domains: {
+        [propName: string]: {
+            domain: string;
+            layout: string;
+            type: "header" | "detail";
+            header: string;
+            mode: "table" | "form";
+        };
+    };
+    layout: string;
+    name: string;
+    converter: string;
+}
+export interface BizLayout {
+    layout?: "fit" | "border";
+    items: {
+        domain: string;
+        region?: "center" | "north" | "south" | "east" | "west";
+        height?: string;
+        width?: string;
+        layout?: BizLayout;
+    }[];
+}
+export interface BizConverter {
+    [propName: string]: {
+        [propName: string]: string;
+    };
+}
+export interface BizFile {
+    bill: BillFile;
+    domains: {
+        [propName: string]: BizDomain;
+    };
+    layout: BizLayout;
+    converter: BizConverter;
+}
+export declare class ScopeEngine {
+    static getBizFile(director: any): Promise<BizFile>;
+    static buildScopeFromBillFile(billFile: BillFile): Promise<Scope>;
+    static buildScopeFromPath(path: string): Promise<Scope>;
+    static buildScopeFromBizFile(bizFile: BizFile): Scope;
+    private static buildForm;
+    private static buildGrid;
+    private static buildFieldSet;
+    private static buildButton;
+    private static buildListeners;
+    /**
+     * 只检索 items 的模式,深度遍历 vjson
+     */
+    private static deepTravVJsonReplaceDomain;
+}

+ 1 - 0
dist/dict.d.ts

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

+ 42 - 3
dist/yvan-ext.js

@@ -61282,14 +61282,20 @@ define(['exports'], function (exports) { 'use strict';
     }
 
     function isDesignMode(control, config) {
-        var _a;
+        var _a, _b;
         if (window["IS_DESIGN_MODE"]) {
             return true;
         }
+        if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
+            return true;
+        }
+        if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
+            return true;
+        }
         if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
             return true;
         }
-        if (((_a = config === null || config === void 0 ? void 0 : config.session) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
+        if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
             return true;
         }
         return false;
@@ -61517,6 +61523,9 @@ define(['exports'], function (exports) { 'use strict';
         if (option.scopeOnLoad) {
             exports.scopeOnLoad = option.scopeOnLoad;
         }
+        if (option.scopeOnCreate) {
+            exports.scopeOnCreate = option.scopeOnCreate;
+        }
         if (option.apiConvert) {
             exports.apiConvert = option.apiConvert;
         }
@@ -61527,6 +61536,9 @@ define(['exports'], function (exports) { 'use strict';
     function getApiConvert() {
         return exports.apiConvert;
     }
+    function getScopeOnCreate() {
+        return exports.scopeOnCreate;
+    }
     function getPinyin(v) {
         return pinyinFunc(v);
     }
@@ -61573,8 +61585,18 @@ define(['exports'], function (exports) { 'use strict';
             this.isLoadFinish = false;
             this._isLoading = false;
             this.model = model;
+            if (typeof vjson.layout === 'undefined') {
+                // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
+                var ret = buildPlus({ model: model, vjson: vjson });
+                model = ret.model;
+                vjson = ret.vjson;
+            }
             this.originalVjson = lodash.cloneDeep(vjson);
             this.vjson = this.originalVjson; // this.buildVjson()
+            var extScope = getScopeOnCreate();
+            if (typeof extScope === 'function') {
+                extScope({ vjson: vjson, model: model }, this);
+            }
         }
         Scope.prototype._addWatch = function (tplExpress, fn) {
             if (!this._watchList) {
@@ -61901,6 +61923,20 @@ define(['exports'], function (exports) { 'use strict';
         }
         return (hash & 0x7FFFFFFF) + "";
     }
+    function buildPlus(_a) {
+        var model = _a.model, vjson = _a.vjson;
+        var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
+                {
+                    layout: 'border',
+                    // tbar: vjson.action,
+                    items: vjson.items,
+                },
+            ] });
+        if (lodash.isArray(vjson.action)) {
+            vjsonNew.items[0].tbar = vjson.action;
+        }
+        return { model: model, vjson: vjsonNew };
+    }
 
     (function (FuncDomain) {
         FuncDomain["SCOPE"] = "scope";
@@ -98037,7 +98073,8 @@ define(['exports'], function (exports) { 'use strict';
      *      row-item rows中的一行,比如 tree / grid / panel 等等
      */
     function baseConfig(config, dragType) {
-        if (isDesignMode(config, undefined) && dragType) {
+        // if (isDesignMode(config, undefined) && dragType) {
+        if (typeof config === 'object') {
             var cc = '';
             switch (dragType) {
                 case "cols-container":
@@ -136691,6 +136728,7 @@ define(['exports'], function (exports) { 'use strict';
     exports.axios = index;
     exports.baseConfigProcess = baseConfigProcess;
     exports.baseConfigProcessList = baseConfigProcessList;
+    exports.buildPlus = buildPlus;
     exports.buildReportScope = buildReportScope;
     exports.calcExpress = calcExpress;
     exports.calcObject = calcObject;
@@ -136713,6 +136751,7 @@ define(['exports'], function (exports) { 'use strict';
     exports.getPinyin = getPinyin;
     exports.getRegList = getRegList;
     exports.getRegParamList = getRegParamList;
+    exports.getScopeOnCreate = getScopeOnCreate;
     exports.init = init$1;
     exports.insertGridRow = insertGridRow;
     exports.invokeServer = invokeServer;

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
dist/yvan-ext.js.map