diff --git a/README-zh.md b/README-zh.md index 09fa8ab..842f608 100644 --- a/README-zh.md +++ b/README-zh.md @@ -102,7 +102,7 @@ npm run dev ``` ### 打包 ``` -nnpm run build +npm run build ``` ## 合作项目 diff --git a/README.md b/README.md index fee146d..bc08ebd 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ npm run dev ``` ### Package ``` -nnpm run build +npm run build ``` ## Partner project diff --git a/docs/guide/api.md b/docs/guide/api.md index cc9a984..334b137 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -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**: diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 79bf2eb..4a5a998 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -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]) - **参数**: diff --git a/src/controllers/resize.js b/src/controllers/resize.js index 2f45c2d..2883312 100644 --- a/src/controllers/resize.js +++ b/src/controllers/resize.js @@ -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--) { diff --git a/src/controllers/server.js b/src/controllers/server.js index e3a30a2..a42e90c 100644 --- a/src/controllers/server.js +++ b/src/controllers/server.js @@ -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(){ @@ -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]); @@ -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) { diff --git a/src/global/api.js b/src/global/api.js index 8a955db..ad4ebce 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -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; /** @@ -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 可选参数 diff --git a/src/index.html b/src/index.html index b529de3..7a734dd 100644 --- a/src/index.html +++ b/src/index.html @@ -21,7 +21,6 @@
- diff --git a/src/locale/en.js b/src/locale/en.js index 6bbfe01..67589dd 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -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', } }; \ No newline at end of file diff --git a/src/locale/es.js b/src/locale/es.js index 14138fb..ce51b35 100644 --- a/src/locale/es.js +++ b/src/locale/es.js @@ -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', } }; \ No newline at end of file diff --git a/src/locale/zh.js b/src/locale/zh.js index cd94a96..dd7b883 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -10240,6 +10240,14 @@ export default { }, edit:{ typing:"正在输入", + }, + websocket:{ + success: 'WebSocket连接成功', + refresh: 'WebSocket连接发生错误, 请刷新页面!', + wait: 'WebSocket连接发生错误, 请耐心等待!', + close: 'WebSocket连接关闭', + contact: '服务器通信发生错误,请刷新页面后再试,如若不行请联系管理员!', + support: '当前浏览器不支持WebSocket', } };