浏览代码

combo 筛选

luoyifan 3 年之前
父节点
当前提交
497fc69dee
共有 2 个文件被更改,包括 37 次插入8 次删除
  1. 36 7
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 36 - 7
dist/yvan-ext.js

@@ -61449,7 +61449,9 @@ define(['exports'], function (exports) { 'use strict';
             return true;
         }
         var ws = lodash.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
-        var labelPy = lodash.toLower(getPinyin(label));
+        // const labelPy = _.toLower(getPinyin(label))
+        //@ts-ignore
+        var labelPy = lodash.toLower(getFirstPinyin2(label));
         value = lodash.toLower(lodash.trim(value));
         var found = 0;
         lodash.some(ws, function (word) {
@@ -61464,7 +61466,6 @@ define(['exports'], function (exports) { 'use strict';
         });
         return found >= ws.length;
     }
-    //# sourceMappingURL=config.js.map
 
     var Scope = /** @class */ (function () {
         function Scope(_a) {
@@ -95856,16 +95857,20 @@ define(['exports'], function (exports) { 'use strict';
                                 sender.fireEvent('click', _this, e);
                             });
                             jquery(sender.inputEl.dom).on('keydown', function (e) {
-                                var _a, _b, _c, _d, _e;
+                                var _a, _b, _c, _d;
                                 // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
                                 if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
+                                    if (sender.isExpanded === true) {
+                                        // 弹开下拉框的基础上,不干预上下选择
+                                        return;
+                                    }
                                     if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
                                         var grid = sender.ownerCt.up('grid');
                                         var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
                                         if (editingPlugin) {
                                             var rowIdx = (_c = (_b = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.rowIdx;
-                                            var colIdx = (_e = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.colIdx;
-                                            if (typeof rowIdx !== 'undefined' && typeof colIdx !== 'undefined') {
+                                            var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
+                                            if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
                                                 // editingPlugin
                                                 var targetRecord = void 0;
                                                 if (e.code === 'ArrowDown') {
@@ -95876,7 +95881,7 @@ define(['exports'], function (exports) { 'use strict';
                                                 }
                                                 if (targetRecord) {
                                                     grid.setSelection([targetRecord]);
-                                                    editingPlugin.startEdit(targetRecord, colIdx);
+                                                    editingPlugin.startEdit(targetRecord, column);
                                                 }
                                                 e.stopPropagation();
                                                 e.preventDefault();
@@ -96175,7 +96180,7 @@ define(['exports'], function (exports) { 'use strict';
                     }
                 };
                 this.on({
-                    afterrender: function () {
+                    afterrender: function (sender) {
                         var config = this.config;
                         if (config.dataSource && config.autoLoad) {
                             dataSourceReload(this);
@@ -96183,9 +96188,32 @@ define(['exports'], function (exports) { 'use strict';
                         // 点击后下拉
                         $(this.el.dom).on('click', toggle.bind(this));
                     },
+                    focusenter: function (sender, event, opt) {
+                        var _a;
+                        if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
+                            // 表格内编辑框,获取焦点后自动弹开
+                            toggle.call(this, event);
+                        }
+                    },
                     destory: function () {
                         $(this.el.dom).off('click', toggle.bind(this));
                     },
+                    beforequery: function (context) {
+                        var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
+                        // console.log('beforequery', query)
+                        if (!forceAll && query) {
+                            combo.store.filterBy(function (record, id) {
+                                var text = record.get(combo.displayField);
+                                // 用拼音筛选的方式
+                                return keywordFilter(query, text, id);
+                            });
+                            combo.expand();
+                            return false;
+                        }
+                        combo.store.clearFilter();
+                        combo.expand();
+                        return false;
+                    },
                 });
                 initComponent.call(this);
             },
@@ -96522,6 +96550,7 @@ define(['exports'], function (exports) { 'use strict';
             },
         });
     }
+    //# sourceMappingURL=datefield.js.map
 
     function initDateTimePicker () {
         Ext.define('Yvan.DateTimePicker', {

文件差异内容过多而无法显示
+ 1 - 1
dist/yvan-ext.js.map