瀏覽代碼

combogrid queryValue bug

luoyifan 2 年之前
父節點
當前提交
ca92bf0b13
共有 2 個文件被更改,包括 299 次插入2 次删除
  1. 298 1
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 298 - 1
dist/yvan-ext.js

@@ -130944,11 +130944,14 @@ define(['exports'], function (exports) { 'use strict';
                     },
                     {
                         title: '界面源码',
+                        xtype: 'jseditor',
+                        reference: 'jseditor'
                     }
                 ]
             }
         ]
     };
+    //# sourceMappingURL=GridColumnCustom.view.js.map
 
     var GridColumnCustom = /** @class */ (function (_super) {
         __extends(GridColumnCustom, _super);
@@ -134524,6 +134527,10 @@ define(['exports'], function (exports) { 'use strict';
              */
             getExpressData: function () {
                 var queryValue = this.getRawValue();
+                if (!queryValue) {
+                    // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
+                    queryValue = this.getPicker().down('textfield').getRawValue();
+                }
                 if (this.column) {
                     // 列模式, 准备好判断 editEnable 表达式用的数据
                     var parentRecord = this._lookupEditorRecord();
@@ -134557,7 +134564,6 @@ define(['exports'], function (exports) { 'use strict';
             }
         });
     }
-    //# sourceMappingURL=combogrid.js.map
 
     function initRows () {
         Ext.define('Yvan.Rows', {
@@ -135847,6 +135853,295 @@ define(['exports'], function (exports) { 'use strict';
     }
     //# sourceMappingURL=SqlEditor.js.map
 
+    function initJsonEditor () {
+        Ext.define('com.yvan.studio.JsonEditor', {
+            extend: 'Ext.panel.Panel',
+            alias: 'widget.jsoneditor',
+            xtype: 'jsoneditor',
+            layout: 'fit',
+            border: false,
+            html: "<div class=\"editor\"/>",
+            autoFocusMethod: true,
+            autoFocusStartLine: 0,
+            autoFocusStartColumn: 0,
+            codeChange: undefined,
+            funcArr: [],
+            modulePage: null,
+            isChangeFromOuter: false,
+            name: "",
+            /**
+             * 设置代码
+             */
+            setCode: function (value) {
+                var _this = this;
+                this.code = value;
+                lodash.defer(function () {
+                    _this.isChangeFromOuter = true;
+                    if (_this.editor) {
+                        _this.editor.setValue(value);
+                    }
+                });
+            },
+            updateOptions: function (options) {
+                if (this.editor && options) {
+                    this.editor.updateOptions(options);
+                }
+            },
+            setLanguage: function (lang) {
+                if (!window['monaco']) {
+                    return;
+                }
+                var monaco = window['monaco'];
+                if (this.editor && lang) {
+                    monaco.editor.setModelLanguage(this.editor.getModel(), lang);
+                }
+            },
+            getCode: function () {
+                var _a;
+                return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
+            },
+            applyPosition: function () {
+                var _this = this;
+                if (this.autoFocusMethod) {
+                    if (this.editor) {
+                        lodash.defer(function () {
+                            if (_this.autoFocusStartLine) {
+                                _this.editor.setPosition({
+                                    lineNumber: _this.autoFocusStartLine,
+                                    column: _this.autoFocusStartColumn
+                                });
+                                _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
+                            }
+                            _this.editor.focus();
+                        });
+                        delete this.autoFocusMethod;
+                    }
+                }
+                this.editor.layout();
+            },
+            initComponent: function () {
+                var that = this;
+                this.superclass.initComponent.apply(this, arguments);
+                this.on({
+                    resize: function (sender, width, height) {
+                        if (that.editor) {
+                            that.editor.layout();
+                        }
+                    },
+                    destory: function () {
+                        if (that.editor) {
+                            that.editor.dispose();
+                            delete that.editor;
+                        }
+                    },
+                    afterrender: function (sender) {
+                        var $dom = $(that.el.dom).find('.editor');
+                        attach_116($dom[0], {
+                            value: that.code
+                        }).then(function (editor) {
+                            that.editor = editor;
+                            that.applyPosition();
+                            that.editor.onDidChangeModelContent(function (e) {
+                                that.fireEvent('change', that.editor, e);
+                                if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
+                                    that.codeChange(that.editor.getValue(), that.name, e);
+                                }
+                                that.isChangeFromOuter = false;
+                            });
+                        });
+                    }
+                });
+            },
+        });
+        function attach_116(element, opts) {
+            if (!window['monaco']) {
+                return;
+            }
+            var monaco = window['monaco'];
+            return new Promise(function (resolve) {
+                var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
+                        enabled: false
+                    } }));
+                editor.onKeyUp(function (e) {
+                    // console.log(e)
+                    if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
+                        editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
+                    }
+                });
+                resolve(editor);
+            });
+        }
+    }
+    //# sourceMappingURL=JsonEditor.js.map
+
+    function initJsEditor () {
+        Ext.define('com.yvan.studio.JsEditor', {
+            extend: 'Ext.panel.Panel',
+            alias: 'widget.jseditor',
+            xtype: 'jseditor',
+            layout: 'fit',
+            border: false,
+            html: "<div class=\"editor\"/>",
+            autoFocusMethod: true,
+            autoFocusStartLine: 0,
+            autoFocusStartColumn: 0,
+            codeChange: undefined,
+            funcArr: [],
+            modulePage: null,
+            isChangeFromOuter: false,
+            name: "",
+            /**
+             * 设置代码
+             */
+            setCode: function (value) {
+                var _this = this;
+                this.code = value;
+                lodash.defer(function () {
+                    _this.isChangeFromOuter = true;
+                    if (_this.editor) {
+                        _this.editor.setValue(value);
+                        if (_this.name === "controllerEditor") {
+                            _this.funcArr = _this.getAllFunction();
+                        }
+                    }
+                });
+            },
+            getCode: function () {
+                var _a;
+                if (!this.editor) {
+                    return this.code;
+                }
+                return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
+            },
+            applyPosition: function () {
+                var _this = this;
+                if (this.autoFocusMethod) {
+                    if (this.editor) {
+                        lodash.defer(function () {
+                            if (_this.autoFocusStartLine) {
+                                _this.editor.setPosition({
+                                    lineNumber: _this.autoFocusStartLine,
+                                    column: _this.autoFocusStartColumn
+                                });
+                                _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
+                            }
+                            _this.editor.focus();
+                        });
+                        delete this.autoFocusMethod;
+                    }
+                }
+                this.editor.layout();
+            },
+            initComponent: function () {
+                var that = this;
+                this.superclass.initComponent.apply(this, arguments);
+                this.on({
+                    resize: function (sender, width, height) {
+                        if (that.editor) {
+                            that.editor.layout();
+                        }
+                    },
+                    destory: function () {
+                        if (that.editor) {
+                            that.editor.dispose();
+                            delete that.editor;
+                        }
+                    },
+                    afterrender: function () {
+                        var $dom = $(that.el.dom).find('.editor');
+                        attach_1($dom[0], {
+                            value: that.code
+                        }).then(function (editor) {
+                            that.editor = editor;
+                            that.applyPosition();
+                            that.editor.onDidChangeModelContent(function (e) {
+                                that.fireEvent('change', that.editor, e);
+                                if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
+                                    that.codeChange(that.editor.getValue(), that.name, e);
+                                }
+                                that.isChangeFromOuter = false;
+                            });
+                        });
+                    }
+                });
+            },
+            getAllFunction: function () {
+                var funcArr = [];
+                var ast = window['YvanUI'].recast.parse(this.code);
+                if (ast && ast.program && ast.program.body) {
+                    if (Array.isArray(ast.program.body)) {
+                        for (var i = 0; i < ast.program.body.length; i++) {
+                            var m = ast.program.body[i];
+                            if (m.type === "ExportDefaultDeclaration") {
+                                if (m.declaration.type === "ClassDeclaration") {
+                                    if (m.declaration.body.type === "ClassBody") {
+                                        if (Array.isArray(m.declaration.body.body)) {
+                                            for (var j = 0; j < m.declaration.body.body.length; j++) {
+                                                var ob = m.declaration.body.body[j];
+                                                if (ob.type === "MethodDefinition" && ob.kind === "method") {
+                                                    var funcItem = { name: ob.key.name, args: [] };
+                                                    if (Array.isArray(ob.value.params)) {
+                                                        for (var k = 0; k < ob.value.params.length; k++) {
+                                                            var p = ob.value.params[k];
+                                                            funcItem.args.push(p.name);
+                                                        }
+                                                    }
+                                                    funcArr.push(funcItem);
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                return funcArr;
+            }
+        });
+        var isInited = false;
+        function attach_1(element, opts) {
+            if (!window['monaco']) {
+                return;
+            }
+            var monaco = window['monaco'];
+            return new Promise(function (resolve) {
+                if (!isInited) {
+                    isInited = true;
+                    monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
+                        noSemanticValidation: true,
+                        noSyntaxValidation: false
+                    });
+                    // compiler options
+                    monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
+                        target: monaco.languages.typescript.ScriptTarget.ES2016,
+                        allowNonTsExtensions: true,
+                    });
+                    // extra libraries
+                    var libSource = [
+                        'declare class Facts {',
+                        '    /**',
+                        '     * Returns the next fact',
+                        '     */',
+                        '    static next():string',
+                        '    static next222():string',
+                        '}',
+                        "\n        declare namespace WotuUI {\n            export class Text {\n              label: string\n            }\n\n            export function wrapText(n1: string): Text\n            export function render(element:HTMLElement, vjson:any): void\n        }\n        ",
+                        "\n        declare module 'fs' {\n            function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n        }\n                "
+                    ].join('\n');
+                    var libUri = 'file:///index.d.ts';
+                    monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
+                    // When resolving definitions and references, the editor will try to use created models.
+                    // Creating a model for the library allows "peek definition/references" commands to work with the library.
+                    monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
+                }
+                var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
+                resolve(editor);
+            });
+        }
+    }
+    //# sourceMappingURL=JsEditor.js.map
+
     function initDict () {
         var DICT_CACHE = window['DICT_CACHE'];
         if (!DICT_CACHE) {
@@ -136169,6 +136464,8 @@ define(['exports'], function (exports) { 'use strict';
         initIframe();
         initBpmn();
         initSqlEditor();
+        initJsonEditor();
+        initJsEditor();
         initSqlComplex();
         initParamComplex();
         initDict();

文件差異過大導致無法顯示
+ 1 - 1
dist/yvan-ext.js.map