Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

luoyifan 3 лет назад
Родитель
Сommit
894ebf678b
5 измененных файлов с 30 добавлено и 7 удалено
  1. 2 2
      src/Defaults.ts
  2. 4 0
      src/Scope.ts
  3. 7 3
      src/controls/input/combogrid.js
  4. 11 0
      src/lib/config.ts
  5. 6 2
      src/lib/systemLib.ts

+ 2 - 2
src/Defaults.ts

@@ -116,7 +116,7 @@ export const grid = {
     hideAutoSize: false,
     hideClearFilter: false,
     autoLoad: true,
-    remoteSort: true,
+    remoteSort: false,
     remoteFilter: true,
     enableLocking: true,
     enableColumnMove: true,
@@ -183,4 +183,4 @@ export const cols = {
     defaults: {
         flex: 1
     },
-}
+}

+ 4 - 0
src/Scope.ts

@@ -2,6 +2,7 @@ import _ from 'lodash'
 import {invokeMethod} from "./utils"
 import {windows} from './Defaults'
 import {lookupScope} from "./lib/lib";
+import {scopeOnLoad} from './lib/config'
 
 export class Scope {
 
@@ -320,6 +321,9 @@ export class Scope {
      * 模块载入完成之后的回调
      */
     onLoad() {
+        if (scopeOnLoad && typeof scopeOnLoad === 'function') {
+            scopeOnLoad(this)
+        }
     }
 
     /**

+ 7 - 3
src/controls/input/combogrid.js

@@ -35,6 +35,7 @@ export default function () {
 
         editable: true,
         _superBlur: false,
+        allowCustomInput: false,
 
         initComponent() {
             const that = this
@@ -87,8 +88,11 @@ export default function () {
                                 that.onTriggerClick(that, that.getPickerTrigger(), e);
                                 return
                             }
-                            // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
-                            stopEvent(e)
+
+                            if(!that.allowCustomInput) {
+                                // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
+                                stopEvent(e)
+                            }
                         })
                         $dom.on('change', e => {
                             if (that.isExpanded) {
@@ -403,4 +407,4 @@ export default function () {
         }
     });
 
-}
+}

+ 11 - 0
src/lib/config.ts

@@ -35,6 +35,11 @@ export interface ConfigOption {
      * 获取拼音首字母的函数
      */
     pinyinFunction: (py: string) => string
+
+    /**
+     * Scope onload 时扩展方法
+     */
+    scopeOnLoad: (scope:any)=> void
 }
 
 /**
@@ -49,6 +54,8 @@ export const ajax: {
  */
 let pinyinFunc: Function = (str) => (str)
 
+export let scopeOnLoad : (scope:any)=>void = null
+
 export const baseConfigProcessList: ConfigProcess[] = []
 
 /**
@@ -104,6 +111,10 @@ export function extend(option: Partial<ConfigOption>) {
         pinyinFunc = option.pinyinFunction
     }
 
+    if (option.scopeOnLoad) {
+        scopeOnLoad = option.scopeOnLoad
+    }
+
     if (typeof option.designMode !== 'undefined') {
         setDesignMode(option.designMode)
     }

+ 6 - 2
src/lib/systemLib.ts

@@ -1020,13 +1020,17 @@ export function showErrorDialog(msg, sender?) {
 export function evalFunction(data, express) {
     const keys = []
     const values = []
+
     _.forOwn(data, (value, key) => {
+        const match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i)
+        if(match){
+            key = key.substring(0, match.index)
+        }
         keys.push(key)
         values.push(value)
     })
 
     const func = Function(...keys, 'return ' + express)
-
     try {
         return func(...values)
     } catch (e) {
@@ -1090,4 +1094,4 @@ export function getGridEditRows(grid) {
         modifyRows,
         err: err
     }
-}
+}