Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mengshukeji authored Dec 4, 2020
2 parents 59f6ca2 + 464c50a commit 2565400
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ npm run dev
```
### 打包
```
nnpm run build
npm run build
```

## 合作项目
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ npm run dev
```
### Package
```
nnpm run build
npm run build
```

## Partner project
Expand Down
19 changes: 19 additions & 0 deletions docs/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,25 @@ Use note:

------------

### getRangeAxis()

- **Explanation**

Returns an array of coordinate strings corresponding to the current selection. Multiple selections may exist. Each selection may be a single cell (such as A1) or a rectangular region of multiple cells (such as D9: E12)

- **Usage**:

- The current selection is"E10:E14"、"A7:B13"、"C4"、 "A3" and "C6:D9", execute
`luckysheet.getRangeAxis()`
The returned result is:
```json
["E10:E14", "A7:B13", "C4", "A3", "C6:D9"]
```

------------

### getRangeValue([setting])

- **Parameter**
Expand Down
19 changes: 19 additions & 0 deletions docs/zh/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,25 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开

------------

### getRangeAxis()

- **说明**

返回对应当前选区的坐标字符串数组,可能存在多个选区。每个选区可能是单个单元格(如 A1)或多个单元格组成的矩形区域(如 D9:E12)

- **示例**:

- 当前选区为"E10:E14"、"A7:B13"、"C4"、 "A3"和"C6:D9",执行
`luckysheet.getRangeAxis()`
则返回结果为:
```json
["E10:E14", "A7:B13", "C4", "A3", "C6:D9"]
```

------------

### getRangeValue([setting])

- **参数**
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
const toobarElements = Store.toobarObject.toobarElements;
let moreButtonIndex = 0;

// When you resize the window during initialization, you will find that the dom has not been rendered yet
if(toobarWidths == undefined){
return;
}
// 找到应该隐藏的起始元素位置
for (let index = toobarWidths.length - 1; index >= 0; index--) {

Expand Down
23 changes: 14 additions & 9 deletions src/controllers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ const server = {

//连接建立时触发
_this.websocket.onopen = function() {
console.info('WebSocket连接成功');
hideloading();
_this.wxErrorCount = 0;

console.info(locale().websocket.success);
hideloading();
_this.wxErrorCount = 0;

//防止websocket长时间不发送消息导致断连
setInterval(function(){
Expand Down Expand Up @@ -292,7 +293,10 @@ const server = {
}
}
else if(type == 4){ //批量指令更新
let items = JSON.parse(data.data);
// let items = JSON.parse(data.data);

// After editing by multiple people, data.data may appear as an empty string
let items = data.data === "" ? data.data : JSON.parse(data.data);

for(let i = 0; i < items.length; i++){
_this.wsUpdateMsg(item[i]);
Expand All @@ -305,22 +309,23 @@ const server = {
_this.wxErrorCount++;

if(_this.wxErrorCount > 3){
showloading("WebSocket连接发生错误, 请刷新页面!");
showloading(locale().websocket.refresh);
}
else{
showloading("WebSocket连接发生错误, 请耐心等待!");
showloading(locale().websocket.wait);
_this.openWebSocket();
}
}

//连接关闭时触发
_this.websocket.onclose = function(){
console.info('WebSocket连接关闭');
alert("服务器通信发生错误,请刷新页面后再试,如若不行请联系管理员!");
console.info(locale().websocket.close);

alert(locale().websocket.contact);
}
}
else{
alert('当前浏览器 Not Support WebSocket');
alert(locale().websocket.support);
}
},
wsUpdateMsg: function(item) {
Expand Down
21 changes: 20 additions & 1 deletion src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import controlHistory from '../controllers/controlHistory';
import { zoomRefreshView, zoomNumberDomBind } from '../controllers/zoom';
import dataVerificationCtrl from "../controllers/dataVerificationCtrl";
import dayjs from "dayjs";

import {getRangetxt } from '../methods/get';
const IDCardReg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;

/**
Expand Down Expand Up @@ -1470,6 +1470,25 @@ export function getRange() {
return result;
}


/**
* 返回对应当前选区的坐标字符串数组,可能存在多个选区。
* 每个选区可能是单个单元格(如 A1)或多个单元格组成的矩形区域(如 D9:E12)
* @returns {Array}
*/
export function getRangeAxis() {
let result = [];
let rangeArr = Store.luckysheet_select_save;
let sheetIndex = Store.currentSheetIndex;

rangeArr.forEach(ele=>{
let axisText = getRangetxt(sheetIndex, {column:ele.column,row:ele.row});
result.push(axisText);
})

return result;
}

/**
* 返回指定工作表指定范围的单元格二维数组数据,每个单元格为一个对象
* @param {Object} options 可选参数
Expand Down
1 change: 0 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

<body>
<div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:100%;left: 0px;top: 0px;"></div>
<!-- 1 -->
<!-- demo feature, non-production use -->
<script src="./demoData/demoFeature.js"></script>
<script src="./demoData/sheetFormula.js"></script>
Expand Down
8 changes: 8 additions & 0 deletions src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -9999,6 +9999,14 @@ export default {
},
edit:{
typing:"typing",
},
websocket:{
success: 'WebSocket connection success',
refresh: 'An error occurred in the WebSocket connection, please refresh the page!',
wait: 'An error occurred in the WebSocket connection, please be patient!',
close: 'WebSocket connection closed',
contact: 'Server communication error occurred, please refresh the page and try again, if not, please contact the administrator!',
support: 'The current browser does not support WebSocket',
}
};

11 changes: 11 additions & 0 deletions src/locale/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -9979,5 +9979,16 @@ export default {
menuItemAreas:"Imprimir áreas",
menuItemRows:"Imprimir títulos de filas",
menuItemColumns:"Imprimir títulos de columnas",
},
edit:{
typing:"mecanografía",
},
websocket:{
success: 'Éxito de la conexión de WebSocket',
refresh: 'Se produjo un error en la conexión de WebSocket, ¡actualice la página!',
wait: 'Se produjo un error en la conexión de WebSocket, ¡tenga paciencia!',
close: 'Conexión WebSocket cerrada',
contact: 'Ocurrió un error de comunicación con el servidor, actualice la página y vuelva a intentarlo; de lo contrario, comuníquese con el administrador.',
support: 'El navegador actual no es compatible con WebSocket',
}
};
8 changes: 8 additions & 0 deletions src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -10240,6 +10240,14 @@ export default {
},
edit:{
typing:"正在输入",
},
websocket:{
success: 'WebSocket连接成功',
refresh: 'WebSocket连接发生错误, 请刷新页面!',
wait: 'WebSocket连接发生错误, 请耐心等待!',
close: 'WebSocket连接关闭',
contact: '服务器通信发生错误,请刷新页面后再试,如若不行请联系管理员!',
support: '当前浏览器不支持WebSocket',
}

};

0 comments on commit 2565400

Please sign in to comment.