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/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..321d1af 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -6543,7 +6543,6 @@ export function getTxtByRange(range=Store.luckysheet_select_save){ return conditionformat.getTxtByRange(range); } - /** * 初始化分页器 * @param {Object} config 分页器配置 @@ -6583,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