Browse Source

fix(handsontable): outsideClickDeselects为false时,切换tab表格渲染有问题

zhangweicheng 5 năm trước cách đây
mục cha
commit
71b5e09b7b

+ 1 - 1
handsontable/handsontable.d.ts

@@ -38,7 +38,7 @@ declare namespace _Handsontable {
 
     destroy(): void;
 
-    destroyEditor(revertOriginal?: boolean, prepareEditorIfNeeded?: boolean): void;
+    destroyEditor(revertOriginal?: boolean, prepareEditorIfNeeded?: boolean, isOutClick? : boolean): void;
 
     emptySelectedCells(): void;
 

+ 1 - 1
handsontable/package.json

@@ -10,7 +10,7 @@
     "url": "https://github.com/handsontable/handsontable/issues"
   },
   "author": "Handsoncode <hello@handsontable.com>",
-  "version": "6.2.9",
+  "version": "6.3.0",
   "browser": "dist/handsontable.js",
   "main": "commonjs/index.js",
   "module": "es/index.js",

+ 6 - 4
handsontable/src/core.js

@@ -1238,9 +1238,10 @@ export default function Core(rootElement, userSettings, rootInstanceSymbol = fal
    * @function destroyEditor
    * @param {Boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
    * @param {Boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
+   * @param {Boolean} [prepareEditorIfNeeded=false] 解决outsideClickDeselects为False时,切换tab导致表头行号等渲染出错问题,点击表格外部,并不需要重新刷新表格
    */
-  this.destroyEditor = function(revertOriginal = false, prepareEditorIfNeeded = true) {
-    instance._refreshBorders(revertOriginal, prepareEditorIfNeeded);
+  this.destroyEditor = function(revertOriginal = false, prepareEditorIfNeeded = true,isOutClick = false) {
+    instance._refreshBorders(revertOriginal, prepareEditorIfNeeded, isOutClick);
   };
 
   /**
@@ -3580,10 +3581,11 @@ export default function Core(rootElement, userSettings, rootInstanceSymbol = fal
    * @private
    * @param {Boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
    * @param {Boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
+   * @param {Boolean} [isOutClick=false] If `false` 重新刷新表格. If ture 说明是点击表格外不需要重新刷新
    */
-  this._refreshBorders = function(revertOriginal = false, prepareEditorIfNeeded = true) {
+  this._refreshBorders = function(revertOriginal = false, prepareEditorIfNeeded = true,isOutClick = false) {
     editorManager.destroyEditor(revertOriginal);
-    instance.view.render();
+    if( isOutClick===false ) instance.view.render();
 
     if (prepareEditorIfNeeded && selection.isSelected()) {
       editorManager.prepareEditor();

+ 1 - 1
handsontable/src/tableView.js

@@ -170,7 +170,7 @@ function TableView(instance) {
     if (outsideClickDeselects) {
       instance.deselectCell();
     } else {
-      instance.destroyEditor(false, false);
+      instance.destroyEditor(false, false, true);
     }
   });