ソースを参照

Merge remote-tracking branch 'origin/master'

yuliang 3 年 前
コミット
83de55728b
2 ファイル変更18 行追加5 行削除
  1. 4 3
      src/controls/input/combogrid.js
  2. 14 2
      src/controls/input/datefield.js

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

@@ -95,9 +95,10 @@ export default function () {
                             }
                         })
                         $dom.on('change', e => {
-                            if (that.isExpanded) {
-                                that.filterChange(that, e.target.value)
-                            }
+                            // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
+                            // if (that.isExpanded) {
+                            //     that.filterChange(that, e.target.value)
+                            // }
                             stopEvent(e)
                         })
                     }

+ 14 - 2
src/controls/input/datefield.js

@@ -16,7 +16,7 @@ import {PropertyDescription} from "../../PropertyDescription";
 export default function () {
 
     const cc = Ext.form.field.Date.prototype.constructor
-    const {initComponent, getValue} = Ext.form.field.Date.prototype
+    const {initComponent, getValue, valueToRaw} = Ext.form.field.Date.prototype
     Ext.form.field.Date.override({
         constructor(config) {
             const newConfig = _.defaultsDeep({
@@ -36,7 +36,6 @@ export default function () {
             return nv
         },
 
-
         initComponent() {
             const that = this
             const toggle = function (e) {
@@ -66,6 +65,19 @@ export default function () {
                 destory() {
                     $(this.el.dom).off('click', toggle.bind(this))
                 },
+                change: {
+                    fn(sender) {
+                        const value = sender.getRawValue()
+                        if (/^\d{8}$/.test(value)) {
+                            const newValue = [
+                                value.substr(0, 4),
+                                value.substr(4, 2),
+                                value.substr(6, 2)
+                            ].join('-')
+                            sender.setValue(newValue)
+                        }
+                    },
+                }
                 // focus: {
                 //     // 获得焦点后自动下拉
                 //     fn(sender) {