Browse Source

Merge pull request #455 from flowerField/master

add api refreshMenuButtonFocus
master
文顶顶 5 years ago
committed by GitHub
parent
commit
c3bcd5e167
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      docs/guide/api.md
  2. 15
      docs/zh/guide/api.md
  3. 6
      src/controllers/controlHistory.js
  4. 27
      src/global/api.js

15
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])

15
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])

6
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();
}
};

27
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();
}
})
}
Loading…
Cancel
Save