From dad714992934dd169cf847050709452091316137 Mon Sep 17 00:00:00 2001 From: flowerField Date: Tue, 12 Jan 2021 19:21:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0API=20=20refreshMenuButto?= =?UTF-8?q?nFocus=20=E6=92=A4=E9=94=80=E5=92=8C=E5=9B=9E=E9=80=80=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=88=B7=E6=96=B0=E7=8A=B6=E6=80=81=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/controlHistory.js | 6 ++++++ src/global/api.js | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/controllers/controlHistory.js b/src/controllers/controlHistory.js index c27d68e..d7b12b2 100644 --- a/src/controllers/controlHistory.js +++ b/src/controllers/controlHistory.js @@ -25,6 +25,7 @@ import { getSheetIndex } from '../methods/get'; import Store from '../store'; import { selectHightlightShow } from './select'; import method from '../global/method'; +import {refreshMenuButtonFocus} from "../global/api"; function formulaHistoryHanddler(ctr, type="redo"){ if(ctr==null){ @@ -428,6 +429,9 @@ const controlHistory = { } Store.clearjfundo = true; + /* 刷新当前状态栏 */ + refreshMenuButtonFocus(); + // 撤销的时候curdata 跟 data 数据要调换一下 let newCtr = {...ctr, ...{data: ctr.curdata, curdata: ctr.data}} // 钩子函数 @@ -744,6 +748,8 @@ const controlHistory = { } Store.clearjfundo = true; + /* 刷新当前状态栏 */ + refreshMenuButtonFocus(); } }; diff --git a/src/global/api.js b/src/global/api.js index 61a9944..33185ce 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -6543,6 +6543,23 @@ export function getTxtByRange(range=Store.luckysheet_select_save){ return conditionformat.getTxtByRange(range); } +/** + * 刷新状态栏的状态 + * @param {Array} data 当前的数据 + * @param {Number} r 指定的行 + * @param {Number} c 指定的列 + */ +export function refreshMenuButtonFocus(data ,r,c){ + data = data || Store.flowdata; + if(r == null && c == null){ + /* 获取选取范围 */ + let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length -1]; + r = last.row_focus || last.row[0]; + c = last.column_focus || last.column[0]; + } + + menuButton.menuButtonFocus(data, r, c); +} /** * 初始化分页器 From 5936136182adb031e5d7050c9bf0876a2d0b322a Mon Sep 17 00:00:00 2001 From: flowerField Date: Tue, 12 Jan 2021 19:38:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0API=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/api.md | 15 +++++++++++++++ docs/zh/guide/api.md | 15 +++++++++++++++ src/global/api.js | 44 ++++++++++++++++++++++++++------------------ 3 files changed, 56 insertions(+), 18 deletions(-) diff --git a/docs/guide/api.md b/docs/guide/api.md index 65dcd22..f9ea705 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -2570,6 +2570,21 @@ Use note: ------------ +### refreshMenuButtonFocus([data],[r],[c],[success]) + +- **Parameter**: + + - {Array} [data]: Operational data + - {Number} [r]: Specified row + - {Number} [c]: Specified column + - {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Refreshes the top status bar status of the specified cell. + +------------ + ## Chart ### insertChart([setting]) diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 51a022e..fb9493d 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -2486,6 +2486,21 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +### refreshMenuButtonFocus([data],[r],[c],[success]) + +- **参数**: + + - {Array} [data]: 操作数据 + - {Number} [r]: 指定的行 + - {Number} [c]: 指定的列 + - {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 刷新指定单元格的顶部状态栏状态。 + +------------ + ## 图表 ### insertChart([setting]) diff --git a/src/global/api.js b/src/global/api.js index 33185ce..321d1af 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -6543,24 +6543,6 @@ export function getTxtByRange(range=Store.luckysheet_select_save){ return conditionformat.getTxtByRange(range); } -/** - * 刷新状态栏的状态 - * @param {Array} data 当前的数据 - * @param {Number} r 指定的行 - * @param {Number} c 指定的列 - */ -export function refreshMenuButtonFocus(data ,r,c){ - data = data || Store.flowdata; - if(r == null && c == null){ - /* 获取选取范围 */ - let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length -1]; - r = last.row_focus || last.row[0]; - c = last.column_focus || last.column[0]; - } - - menuButton.menuButtonFocus(data, r, c); -} - /** * 初始化分页器 * @param {Object} config 分页器配置 @@ -6600,3 +6582,29 @@ export function refreshFormula (success) { } }) } + +/** + * 刷新状态栏的状态 + * @param {Array} data 操作数据 + * @param {Number} r 指定的行 + * @param {Number} c 指定的列 + * @param {Function} success 回调函数 + */ +export function refreshMenuButtonFocus(data ,r,c , success){ + data = data || Store.flowdata; + if(r == null && c == null){ + /* 获取选取范围 */ + let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length -1]; + + r = last.row_focus || last.row[0]; + c = last.column_focus || last.column[0]; + } + + menuButton.menuButtonFocus(data, r, c); + + setTimeout(() => { + if (success && typeof success === 'function') { + success(); + } + }) +} \ No newline at end of file