diff --git a/docs/guide/FAQ.md b/docs/guide/FAQ.md index d1edb76..f152567 100644 --- a/docs/guide/FAQ.md +++ b/docs/guide/FAQ.md @@ -275,4 +275,20 @@ In this case, after Luckysheet is modified in real time, the changes can be seen - Triggered before the workbook is created [workbookCreateBefore](/guide/config.html#workbookcreatebefore) - Triggered after the workbook is created [workbookCreateAfter](/guide/config.html#workbookcreateafter) +------------ + +## **Q** When create, the first cell is selected by default, how to remove it? + +**A** When the cell is selected, it is highlighted by default, just remove the highlight, use API: [setRangeShow](/guide/api.html#setrangeshow-range-setting) + +```js +luckysheet.setRangeShow("A2",{show:false}) +``` + +------------ + +## **Q** Where is the right-click event bound? + +**A** In the source code [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js), search for `event.which == "3"` to find the code executed by the right-click event. + ------------ \ No newline at end of file diff --git a/docs/guide/api.md b/docs/guide/api.md index 5793a08..f21dfe4 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -175,6 +175,7 @@ Use note: + {Boolean} [isWholeWord]: Whether to match the whole word; the default is `false` + {Boolean} [isCaseSensitive]: Whether to match case sensitively; the default is `false` + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {String} [type]: cell attribute; the default value is `"m"` - **Explanation**: @@ -184,6 +185,8 @@ Use note: - Find the string `"value"` in the current worksheet `luckysheet.find("value")` + - Find cells in the current worksheet whose formula contains `"SUM"` + `luckysheet.find("SUM",{type:"f"})` ------------ @@ -869,7 +872,6 @@ Use note: ------------ ### getRangeJson(title [,setting]) - - **Parameter**: @@ -896,8 +898,7 @@ Use note: The returned result is: ```json [ - { "A": "value1", "B": "value3" }, - { "A": "value2", "B": "value4" } + { "value1": "value2", "value3": "value4" } ] ``` @@ -908,7 +909,8 @@ Use note: The returned result is: ```json [ - { "value1": "value2", "value3": "value4" } + { "A": "value1", "B": "value3" }, + { "A": "value2", "B": "value4" } ] ``` @@ -1121,8 +1123,6 @@ Use note: ### setRangeShow(range [,setting])
-[todo] - - **Parameter**: - {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection diff --git a/docs/guide/operate.md b/docs/guide/operate.md index c349bf7..77c58fd 100644 --- a/docs/guide/operate.md +++ b/docs/guide/operate.md @@ -886,3 +886,18 @@ There are four types of chart operations: add new chart -"add", move chart posit ```js luckysheetfile[0].chart[v.chart_id] = v; ``` + +## Backend return format + +Data format returned by websocket backend +```js +{ + createTime: command sending time + data:{} modified command + id: "7a" websocket id + returnMessage: "success" + status: "0" 0 tells the front end to modify according to the data command 1 meaningless + type: 0: connection is successful, 1: send to the currently connected user, 2: send information to other users, 3: send selection location information, 999: user disconnected + username: username +} +``` \ No newline at end of file diff --git a/docs/zh/guide/FAQ.md b/docs/zh/guide/FAQ.md index 89a575d..7082123 100644 --- a/docs/zh/guide/FAQ.md +++ b/docs/zh/guide/FAQ.md @@ -276,4 +276,20 @@ Luckysheet教程里采用的CDN链接是 [jsdelivr](https://www.jsdelivr.com/pac - 表格创建之前触发 [workbookCreateBefore](/zh/guide/config.html#workbookcreatebefore) - 表格创建之后触发 [workbookCreateAfter](/zh/guide/config.html#workbookcreateafter) +------------ + +## **Q** create的时候默认选中第一个单元格,怎么去除? + +**A** 选中单元格时默认是高亮,把高亮去除即可,使用API: [setRangeShow](/zh/guide/api.html#setrangeshow-range-setting) + +```js +luckysheet.setRangeShow("A2",{show:false}) +``` + +------------ + +## **Q** 右键事件绑定在哪? + +**A** 在源码的 [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js) 搜索`event.which == "3"`即可找到右键事件触发执行的代码。 + ------------ \ No newline at end of file diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 54377e0..f20295c 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -178,6 +178,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 + {Boolean} [isWholeWord]: 是否整词匹配;默认为 `false` + {Boolean} [isCaseSensitive]: 是否区分大小写匹配;默认为 `false` + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {String} [type]: 单元格属性;默认值为`"m"` - **说明**: @@ -187,6 +188,8 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 - 当前工作表查找`"value"`字符串 `luckysheet.find("value")` + - 当前工作表查找公式包含`"SUM"`的单元格 + `luckysheet.find("SUM",{type:"f"})` ------------ @@ -882,8 +885,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 则返回结果为: ```json [ - { "A": "value1", "B": "value3" }, - { "A": "value2", "B": "value4" } + { "value1": "value2", "value3": "value4" } ] ``` @@ -894,7 +896,8 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 则返回结果为: ```json [ - { "value1": "value2", "value3": "value4" } + { "A": "value1", "B": "value3" }, + { "A": "value2", "B": "value4" } ] ``` diff --git a/docs/zh/guide/operate.md b/docs/zh/guide/operate.md index 02db446..8e428fe 100644 --- a/docs/zh/guide/operate.md +++ b/docs/zh/guide/operate.md @@ -1266,3 +1266,18 @@ ```js luckysheetfile[0].chart[v.chart_id] = v; ``` + +## 后端返回格式 + +websocket 后端返回的数据格式 +```js +{ + createTime: 命令发送时间 + data:{} 修改的命令 + id: "7a" websocket的id + returnMessage: "success" + status: "0" 0告诉前端需要根据data的命令修改 1无意义 + type: 0:连接成功,1:发送给当前连接的用户,2:发送信息给其他用户,3:发送选区位置信息,999:用户连接断开 + username: 用户名 +} +``` \ No newline at end of file diff --git a/src/global/api.js b/src/global/api.js index 2f5fd52..583c61b 100644 --- a/src/global/api.js +++ b/src/global/api.js @@ -383,6 +383,7 @@ export function setCellFormat(row, column, attr, value, options = {}) { * @param {Boolean} options.isWholeWord 是否整词匹配;默认为 false * @param {Boolean} options.isCaseSensitive 是否区分大小写匹配;默认为 false * @param {Number} options.order 工作表索引;默认值为当前工作表索引 + * @param {String} options.type 单元格属性;默认值为m */ export function find(content, options = {}) { if (!content && content != 0) { @@ -394,7 +395,8 @@ export function find(content, options = {}) { isRegularExpression = false, isWholeWord = false, isCaseSensitive = false, - order = curSheetOrder + order = curSheetOrder, + type = "m" } = { ...options }; let targetSheetData = Store.luckysheetfile[order].data; @@ -416,11 +418,11 @@ export function find(content, options = {}) { if (isWholeWord) { if (isCaseSensitive) { - if (content.toString() == cell.m) { + if (content.toString() == cell[type]) { result.push(cell) } } else { - if (cell.m && content.toString().toLowerCase() == cell.m.toLowerCase()) { + if (cell[type] && content.toString().toLowerCase() == cell[type].toLowerCase()) { result.push(cell) } } @@ -431,17 +433,17 @@ export function find(content, options = {}) { } else { reg = new RegExp(func_methods.getRegExpStr(content), 'ig') } - if (reg.test(cell.m)) { + if (reg.test(cell[type])) { result.push(cell) } } else if (isCaseSensitive) { let reg = new RegExp(func_methods.getRegExpStr(content), 'g'); - if (reg.test(cell.m)) { + if (reg.test(cell[type])) { result.push(cell); } } else { let reg = new RegExp(func_methods.getRegExpStr(content), 'ig'); - if (reg.test(cell.m)) { + if (reg.test(cell[type])) { result.push(cell); } }