diff --git a/CHANGELOG.md b/CHANGELOG.md
index c8570b2..98a03ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,23 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+### [2.1.12](https://github.com/mengshukeji/Luckysheet/compare/v2.1.11...v2.1.12) (2020-12-22)
+
+
+### Features
+
+* **api:** find ([ea97233](https://github.com/mengshukeji/Luckysheet/commit/ea97233a668b3a682f6f0b1ad3fec251b01c33ab))
+
+
+### Bug Fixes
+
+* **bug:** bug ([9357792](https://github.com/mengshukeji/Luckysheet/commit/9357792fd1c49737398cf86cdf87d9dbfe35df26)), closes [#359](https://github.com/mengshukeji/Luckysheet/issues/359) [#360](https://github.com/mengshukeji/Luckysheet/issues/360) [#376](https://github.com/mengshukeji/Luckysheet/issues/376) [#382](https://github.com/mengshukeji/Luckysheet/issues/382)
+* **bug:** bug ([19560eb](https://github.com/mengshukeji/Luckysheet/commit/19560eba3fe36cce4ee65ba3e8ac80ab7ec8d620)), closes [#367](https://github.com/mengshukeji/Luckysheet/issues/367) [#370](https://github.com/mengshukeji/Luckysheet/issues/370)
+* **bug:** bug ([0f257e8](https://github.com/mengshukeji/Luckysheet/commit/0f257e8f153bb6c0cf38fb85200c587aabac164c)), closes [#361](https://github.com/mengshukeji/Luckysheet/issues/361) [#364](https://github.com/mengshukeji/Luckysheet/issues/364) [#365](https://github.com/mengshukeji/Luckysheet/issues/365)
+* **bug:** copy bug ([2bcbab9](https://github.com/mengshukeji/Luckysheet/commit/2bcbab9a9f4727fd03930962a2dbdcaec3401597))
+* **feature:** functionButton ([5983cb0](https://github.com/mengshukeji/Luckysheet/commit/5983cb015e092e2edc1d3f27dba2d585fb4db099)), closes [#336](https://github.com/mengshukeji/Luckysheet/issues/336) [#381](https://github.com/mengshukeji/Luckysheet/issues/381)
+* copy ([d177cc8](https://github.com/mengshukeji/Luckysheet/commit/d177cc8f5ee01d32932d1137920883209ec24be4))
+
### [2.1.10](https://github.com/mengshukeji/Luckysheet/compare/v2.1.9...v2.1.10) (2020-12-18)
diff --git a/docs/guide/FAQ.md b/docs/guide/FAQ.md
index f152567..a6bb0b0 100644
--- a/docs/guide/FAQ.md
+++ b/docs/guide/FAQ.md
@@ -253,7 +253,7 @@ In this case, after Luckysheet is modified in real time, the changes can be seen
**A** You need to introduce a chart plugin to use it. You should configure the chart plugin to use when the workbook is initialized. Refer to
- Plugins configuration [plugins](/guide/config.html#plugins)
-- 或 官方demo [/src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html)
+- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html)
------------
@@ -291,4 +291,13 @@ luckysheet.setRangeShow("A2",{show:false})
**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.
+------------
+
+## **Q** How to add a custom toolbar?
+
+**A** No configuration is currently provided, you can refer to the implementation of the print button in the toolbar to modify the source code:
+1. Search for `luckysheet-icon-print` globally to find the implementation of the print button, in [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) add a similar template string, you need to customize a unique id
+2. Modify [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) and add a new record in the toobarConfig object
+3. Modify [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) to add an event listener
+
------------
\ No newline at end of file
diff --git a/docs/guide/README.md b/docs/guide/README.md
index 6e74329..272c078 100644
--- a/docs/guide/README.md
+++ b/docs/guide/README.md
@@ -134,7 +134,11 @@ There are two ways to introduce dependencies
```
-Note that `https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js` will pull the latest luckysheet code. If you want to specify the luckysheet version, please add the version number after the luckysheet , Such as: `https://cdn.jsdelivr.net/npm/luckysheet@2.0.0/dist/luckysheet.umd.js`
+Note that the path of `https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js` means that the latest luckysheet code will be pulled, but if Luckysheet has just been released, the jsdelivr website may not have time Synchronize from npm, so using this path will still pull to the previous version. We recommend that you directly specify the latest version.
+
+To specify the Luckysheet version, please add the version number after all CDN dependent files, such as: `https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`.
+
+> How do I know which version is the latest version? View the latest [release record](https://github.com/mengshukeji/Luckysheet/releases) or [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json)` version` field.
If it is not convenient to access jsdelivr.net, you can also import it locally
diff --git a/docs/guide/api.md b/docs/guide/api.md
index f21dfe4..66191eb 100644
--- a/docs/guide/api.md
+++ b/docs/guide/api.md
@@ -6,6 +6,7 @@ Use note:
1. When script is introduced globally, all APIs are mounted under the window.luckysheet object, which can be printed and seen in the browser console; when npm is introduced, all APIs are also mounted under the luckysheet object
2. The first parameter of the `success` callback function is the return value of the API method
3. If you need a new API, please submit it to github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose), and decide whether to open the new API according to the number of likes
+4. The required `order` parameter in the API method is the value of `order` in the worksheet object, not `index`
## Cell operation
@@ -319,6 +320,16 @@ Use note:
Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format.
+ If you want to use this API to set the freeze after the workbook is initialized, you can execute it in the hook function after the workbook is created, such as:
+ ```js
+ luckysheet.create({
+ hook:{
+ workbookCreateAfter:function(){
+ luckysheet.setBothFrozen(false);
+ }
+ }
+ });
+
- **Usage**:
- Frozen ranks
diff --git a/docs/zh/guide/FAQ.md b/docs/zh/guide/FAQ.md
index 7082123..3347c13 100644
--- a/docs/zh/guide/FAQ.md
+++ b/docs/zh/guide/FAQ.md
@@ -254,7 +254,9 @@ Luckysheet教程里采用的CDN链接是 [jsdelivr](https://www.jsdelivr.com/pac
**A** 需要引入图表插件才能使用,工作簿初始化的时候应该配置图表插件使用,参考
- 插件配置 [plugins](/zh/guide/config.html#配置项)
-- 或 官方demo [/src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html)
+- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html)
+
+通常,参考demo配置完后就可以和demo一样正常使用了,但是还是会偶现`chartmix is not defined`,这时需要在谷歌浏览器控制台的network里检查下图表的依赖是否都加载了,有5项依赖需要关注:`vue / vuex / element-ui / echarts / chartmix.umd.js`。
------------
@@ -292,4 +294,13 @@ luckysheet.setRangeShow("A2",{show:false})
**A** 在源码的 [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js) 搜索`event.which == "3"`即可找到右键事件触发执行的代码。
+------------
+
+## **Q** 如何添加自定义工具栏?
+
+**A** 暂未提供配置,可以参照工具栏打印按钮的实现来修改源码:
+1. 全局搜索 `luckysheet-icon-print`即可找到打印按钮的实现,在 [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) 中增加一个类似的模板字符串,需要自定义一个唯一id
+2. 修改 [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) ,在toobarConfig对象中新增一条记录
+3. 修改 [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) ,新增一个事件监听
+
------------
\ No newline at end of file
diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md
index 2996a7b..4dd6d3e 100644
--- a/docs/zh/guide/README.md
+++ b/docs/zh/guide/README.md
@@ -133,7 +133,11 @@ npm run build
```
-注意,`https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js`这个路径会拉取到最新的luckysheet代码,想要指定luckysheet版本,请在luckysheet后面加上版本号,如:`https://cdn.jsdelivr.net/npm/luckysheet@2.0.0/dist/luckysheet.umd.js`
+注意,`https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js`这个路径意思是会拉取到最新的luckysheet代码,但是如果Luckysheet刚刚发布,jsdelivr网站可能还没来得及从npm上同步过去,故而使用这个路径还是会拉到上一个版本,我们推荐您直接指定最新版本。
+
+想要指定Luckysheet版本,请在所有的CDN依赖文件后面加上版本号,如:`https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`。
+
+> 如何知道最新版本是哪一版?查看最新 [release记录](https://github.com/mengshukeji/Luckysheet/releases) 或者 [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json) 的`version`字段。
如果不方便访问 jsdelivr.net,还可以采用本地方式引入
diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md
index f20295c..aaa59b8 100644
--- a/docs/zh/guide/api.md
+++ b/docs/zh/guide/api.md
@@ -6,6 +6,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
1. script全局引入时,所有API均挂载到window.luckysheet对象下面,可以在浏览器控制台打印看到;npm引入时,API也全部挂载在luckysheet对象下
2. `success`回调函数第一个参数为API方法的返回值
3. 需要新的API请到github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose)中提交,根据点赞数决定是否开放新API
+4. API方法中所需的`order`参数为工作表对象中的`order`的值,而不是`index`
## 单元格操作
@@ -320,6 +321,18 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
冻结行列操作
特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。
+
+ 如果想在工作簿初始化后使用此API设置冻结,可以在工作簿创建后的钩子函数中执行,比如:
+ ```js
+ luckysheet.create({
+ hook:{
+ workbookCreateAfter:function(){
+ luckysheet.setBothFrozen(false);
+ }
+ }
+ });
+
+ ```
- **示例**:
diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md
index 8aa22ad..c30f4c5 100644
--- a/docs/zh/guide/config.md
+++ b/docs/zh/guide/config.md
@@ -1007,7 +1007,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
------------
### rangePasteBefore
-(TODO)
+
- 类型:Function
- 默认值:null
- 作用:选区粘贴前
diff --git a/package.json b/package.json
index 5f0cdbe..c8c0db0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "luckysheet",
- "version": "2.1.11",
+ "version": "2.1.12",
"main": "dist/luckysheet.cjs.js",
"module": "dist/luckysheet.esm.js",
"browser": "dist/luckysheet.umd.js",
diff --git a/src/controllers/constant.js b/src/controllers/constant.js
index 7063f95..081e089 100644
--- a/src/controllers/constant.js
+++ b/src/controllers/constant.js
@@ -7,7 +7,7 @@ const gridHTML = function(){
const _locale = locale();
const locale_info = _locale.info;
const locale_print = _locale.print;
- const userInfo = luckysheetConfigsetting.userInfo === true ? ' Lucky' : luckysheetConfigsetting.userInfo; // When true, use the default HTML string
+ const userInfo = luckysheetConfigsetting.userInfo === true ? ' Lucky' : luckysheetConfigsetting.userInfo; // When true, use the default HTML string. The rendering of userInfo below uses nested template strings. Otherwise, when display is used and the image path is not passed in, there will be an undefined request
return `
@@ -23,14 +23,15 @@ const gridHTML = function(){
${locale_info.detailUpdate}
${locale_info.wait}
-
\${functionButton}
- ${userInfo}
-
+ \${functionButton}
+
+ ${getObjType(userInfo) === 'string' ? `
+ ${userInfo}
` : ''}
-
\${functionButton}
-

-
${userInfo.userName}
-
+ ${getObjType(userInfo) === 'object' ? `
+

+
${userInfo.userName}
+
` : ''}
\${menu}
diff --git a/src/controllers/handler.js b/src/controllers/handler.js
index 98d5885..dd983f6 100644
--- a/src/controllers/handler.js
+++ b/src/controllers/handler.js
@@ -5294,6 +5294,12 @@ export default function luckysheetHandler() {
const locale_fontjson = locale().fontjson;
+
+ // hook
+ if(!method.createHookFunction('rangePasteBefore',Store.luckysheet_select_save,txtdata)){
+ return;
+ }
+
if (txtdata.indexOf("luckysheet_copy_action_table") > - 1 && Store.luckysheet_copy_save["copyRange"] != null && Store.luckysheet_copy_save["copyRange"].length > 0 && isEqual) {
//剪切板内容 和 luckysheet本身复制的内容 一致
if (Store.luckysheet_paste_iscut) {
diff --git a/src/controllers/postil.js b/src/controllers/postil.js
index b417634..68b1aac 100644
--- a/src/controllers/postil.js
+++ b/src/controllers/postil.js
@@ -229,7 +229,7 @@ const luckysheetPostil = {
let html = '' +
'
' +
- '
'+ value +'
' +
+ '
'+ _this.htmlEscape(value) +'
' +
'
';
$(html).appendTo($("#luckysheet-cell-main"));
@@ -391,8 +391,8 @@ const luckysheetPostil = {
'' +
'' +
'' +
@@ -563,8 +563,8 @@ const luckysheetPostil = {
'' +
'' +
'' +
@@ -685,8 +685,8 @@ const luckysheetPostil = {
'' +
'' +
'' +
@@ -809,8 +809,8 @@ const luckysheetPostil = {
'' +
'' +
'' +
@@ -924,6 +924,25 @@ const luckysheetPostil = {
$("#" + id).hide();
}
});
+ },
+ htmlEscape: function(text){
+ return text.replace(/[<>"&]/g, function(match, pos, originalText){
+ console.log(match, pos, originalText)
+ switch(match){
+ case '<': {
+ return '<';
+ }
+ case '>': {
+ return '>';
+ }
+ case '&': {
+ return '&';
+ }
+ case '\"': {
+ return '"';
+ }
+ }
+ })
}
}
diff --git a/src/controllers/server.js b/src/controllers/server.js
index 8ff6650..813fc50 100644
--- a/src/controllers/server.js
+++ b/src/controllers/server.js
@@ -154,7 +154,12 @@ const server = {
let _this = this;
if('WebSocket' in window){
- _this.websocket = new WebSocket(_this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey));
+ let wxUrl = _this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey);
+ if(_this.updateUrl.indexOf('?') > -1){
+ wxUrl = _this.updateUrl + "&t=111&g=" + encodeURIComponent(_this.gridKey);
+ }
+
+ _this.websocket = new WebSocket(wxUrl);
//连接建立时触发
_this.websocket.onopen = function() {
@@ -163,7 +168,7 @@ const server = {
_this.wxErrorCount = 0;
//防止websocket长时间不发送消息导致断连
- _this.retryTimer = setInterval(function(){
+ _this.retryTimer = setInterval(function(){
_this.websocket.send("rub");
}, 60000);
}
@@ -322,13 +327,13 @@ const server = {
//连接关闭时触发
_this.websocket.onclose = function(e){
- console.info(locale().websocket.close);
- if(e.code === 1000){
- clearInterval(_this.retryTimer)
- _this.retryTimer = null
- }else{
- alert(locale().websocket.contact);
- }
+ console.info(locale().websocket.close);
+ if(e.code === 1000){
+ clearInterval(_this.retryTimer)
+ _this.retryTimer = null
+ }else{
+ alert(locale().websocket.contact);
+ }
}
}
else{
@@ -648,19 +653,42 @@ const server = {
let rc = item.rc,
st_i = value.index,
len = value.len,
- addData = value.data,
+ addData = value.data,
+ direction = value.direction,
mc = value.mc,
borderInfo = value.borderInfo;
- let data = file.data;
+ let data = $.extend(true, [], file.data);
if(rc == "r"){
- file["row"] += len;
+ file["row"] += len;
+
+ //空行模板
+ let row = [];
+ for(let c = 0; c < data[0].length; c++){
+ row.push(null);
+ }
let arr = [];
for(let i = 0; i < len; i++){
- arr.push(JSON.stringify(addData[i]));
- }
- new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data);
+ if(addData[i] == null){
+ arr.push(JSON.stringify(row));
+ }
+ else{
+ arr.push(JSON.stringify(addData[i]));
+ }
+ }
+
+ if(direction == "lefttop"){
+ if(st_i == 0){
+ new Function("data","return " + 'data.unshift(' + arr.join(",") + ')')(data);
+ }
+ else{
+ new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data);
+ }
+ }
+ else{
+ new Function("data","return " + 'data.splice(' + (st_i + 1) + ', 0, ' + arr.join(",") + ')')(data);
+ }
}
else{
file["column"] += len;
@@ -675,6 +703,7 @@ const server = {
data[r][c].mc = mc[x];
}
+ file.data = data;
file["config"].merge = mc;
file["config"].borderInfo = borderInfo;
diff --git a/src/controllers/sheetmanage.js b/src/controllers/sheetmanage.js
index 10ff74e..a9457dd 100644
--- a/src/controllers/sheetmanage.js
+++ b/src/controllers/sheetmanage.js
@@ -942,6 +942,7 @@ const sheetmanage = {
storeSheetParam: function() {
let index = this.getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[index];
+ file["config"] = Store.config;
file["visibledatarow"] = Store.visibledatarow;
file["visibledatacolumn"] = Store.visibledatacolumn;
file["ch_width"] = Store.ch_width;
diff --git a/src/css/luckysheet-core.css b/src/css/luckysheet-core.css
index e84596c..c995f00 100644
--- a/src/css/luckysheet-core.css
+++ b/src/css/luckysheet-core.css
@@ -122,7 +122,7 @@
.luckysheet_info_detail_save {
color: #828282;
font-size: 12px;
- margin-left: 5px;
+ margin:0 5px;
}
.luckysheet-share-logo {
@@ -522,64 +522,6 @@
/* opacity: .54; */
}
-
-/* .luckysheet-icon-img {
- background: url(menuSprite.svg);
- content: url(menuSprite.svg);
-}
-
-.luckysheet-icon-img-container {
- height: 424px;
- position: absolute;
- width: 590px;
-}
-
-.luckysheet-icon-img-container {
- height: 1886px;
- position: absolute;
- width: 108px;
-}
-
-
-.luckysheet-icon-img {
- background: url(sprite38.svg);
- content: url(sprite38.svg);
-}
-
-.luckysheet-icon-print {
- left: -54px;
- top: -90px;
-}
-
-.luckysheet-icon-undo {
- left: -90px;
- top: -1642px;
-}
-
-.luckysheet-icon-redo {
- left: 0;
- top: -1188px;
-}
-
-.luckysheet-icon-paintformat {
- left: -90px;
- top: -550px;
-}
-
-.luckysheet-icon-decimal-decrease {
- left: -36px;
- top: -1444px;
-} */
-
-/* .toolbar-decimal-icon {
- margin-bottom: -4px;
-} */
-
-/* .luckysheet-icon-decimal-increase {
- left: -36px;
- top: -1660px;
-} */
-
#luckysheet-icon-fmt-other .luckysheet-toolbar-menu-button-caption {
overflow: hidden;
text-overflow: ellipsis;
diff --git a/src/function/functionImplementation.js b/src/function/functionImplementation.js
index e67b850..2007878 100644
--- a/src/function/functionImplementation.js
+++ b/src/function/functionImplementation.js
@@ -3256,7 +3256,7 @@ const functionImplementation = {
return 0;
}
- criteria = data_criteria.data;
+ criteria = data_criteria.data.v;
}
else{
criteria = data_criteria;
diff --git a/src/global/api.js b/src/global/api.js
index 4fbefe3..5efcb6b 100644
--- a/src/global/api.js
+++ b/src/global/api.js
@@ -344,7 +344,7 @@ export function setCellFormat(row, column, attr, value, options = {}) {
if(targetSheetData.length == 0){
targetSheetData = sheetmanage.buildGridData(file);
}
-
+
let cellData = targetSheetData[row][column] || {};
let cfg = $.extend(true, {}, file.config);
@@ -484,10 +484,33 @@ export function find(content, options = {}) {
*/
export function replace(content, replaceContent, options = {}) {
let matchCells = find(content, options)
+ let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
+ let {
+ order = curSheetOrder,
+ } = {...options}
+
+ let file = Store.luckysheetfile[order];
+
+ if(file == null){
+ return tooltip.info("The order parameter is invalid.", "");
+ }
+ let sheetData = $.extend(true, [], file.data);
+
matchCells.forEach(cell => {
cell.m = replaceContent;
- setCellValue(cell.row, cell.column, replaceContent, options);
+ setCellValue(cell.row, cell.column, replaceContent, {order: order, isRefresh: false});
})
+
+ let fileData = $.extend(true, [], file.data);
+ file.data.length = 0;
+ file.data.push(...sheetData);
+
+ if(file.index == Store.currentSheetIndex){
+ jfrefreshgrid(fileData, undefined, undefined, true, false);
+ }
+
+ luckysheetrefreshgrid();
+
if (options.success && typeof options.success === 'function') {
options.success(matchCells)
}
@@ -509,14 +532,14 @@ export function exitEditMode(options = {}){
}
else {
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
- Store.luckysheet_select_save = [{
- "row": [Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[0]],
- "column": [Store.luckysheetCellUpdate[1], Store.luckysheetCellUpdate[1]],
- "row_focus": Store.luckysheetCellUpdate[0],
- "column_focus": Store.luckysheetCellUpdate[1]
+ Store.luckysheet_select_save = [{
+ "row": [Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[0]],
+ "column": [Store.luckysheetCellUpdate[1], Store.luckysheetCellUpdate[1]],
+ "row_focus": Store.luckysheetCellUpdate[0],
+ "column_focus": Store.luckysheetCellUpdate[1]
}];
}
-
+
//若有参数弹出框,隐藏
if($("#luckysheet-search-formula-parm").is(":visible")){
$("#luckysheet-search-formula-parm").hide();
@@ -2554,6 +2577,7 @@ export function setRangeShow(range, options = {}) {
* @param {Array[Array]} data 要赋值的单元格二维数组数据,每个单元格的值,可以为字符串或数字,或为符合Luckysheet格式的对象
* @param {Object} options 可选参数
* @param {Object | String} options.range 选区范围,支持选区的格式为"A1:B2"、"sheetName!A1:B2"或者{row:[0,1],column:[0,1]},只能为单个选区;默认为当前选区
+ * @param {Boolean} options.isRefresh 是否刷新界面;默认为true
* @param {Number} options.order 工作表索引;默认值为当前工作表索引
* @param {Function} options.success 操作结束的回调函数
*/
@@ -2562,6 +2586,7 @@ export function setRangeValue(data, options = {}) {
let curRange = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let {
range = curRange,
+ isRefresh = true,
order = curSheetOrder,
success
} = {...options}
@@ -2585,14 +2610,36 @@ export function setRangeValue(data, options = {}) {
return tooltip.info('The data to be set does not match the selection.', '')
}
+ let file = Store.luckysheetfile[order];
+
+ if(file == null){
+ return tooltip.info("The order parameter is invalid.", "");
+ }
+ let sheetData = $.extend(true, [], file.data);
+
for (let i = 0; i < rowCount; i++) {
for (let j = 0; j < columnCount; j++) {
let row = range.row[0] + i,
column = range.column[0] + j;
- setCellValue(row, column, data[i][j], {order: order})
+ setCellValue(row, column, data[i][j], {order: order, isRefresh: false})
}
}
+ let fileData = $.extend(true, [], file.data);
+ file.data.length = 0;
+ file.data.push(...sheetData);
+
+ if(file.index == Store.currentSheetIndex){
+ jfrefreshgrid(fileData, [{
+ row: range.row,
+ column: range.column,
+ }], undefined, true, false);
+ }
+
+ if(isRefresh) {
+ luckysheetrefreshgrid();
+ }
+
if (success && typeof success === 'function') {
success();
}
@@ -6029,7 +6076,7 @@ export function insertImage(src, options = {}){
visibledatarow.push(rh_height);
continue;
}
-
+
rh_height += Math.round((rowlen + 1) * zoomRatio);
visibledatarow.push(rh_height); //行的临时长度分布
@@ -6180,7 +6227,7 @@ export function deleteImage(options = {}){
$("#luckysheet-modal-dialog-cropping").hide();
$("#luckysheet-modal-dialog-slider-imageCtrl").hide();
}
-
+
imageCtrl.images = images;
imageCtrl.allImagesShow();
imageCtrl.init();
@@ -6309,7 +6356,7 @@ export function changLang(lang = 'zh'){
/**
- * 关闭websocket连接
+ * 关闭websocket连接
*/
export function closeWebsocket(){
if(server.websocket == null){
diff --git a/src/global/getdata.js b/src/global/getdata.js
index 21b0151..3e35867 100644
--- a/src/global/getdata.js
+++ b/src/global/getdata.js
@@ -493,19 +493,19 @@ export function checkstatusByCell(cell, a){
foucsStatus = "1";
}
}
- else if(a == "vt"){
+ else if(a == "vt"){//默认垂直居中
if(foucsStatus == null){
- foucsStatus = "2";
+ foucsStatus = "0";
}
else{
foucsStatus = foucsStatus[a];
if(foucsStatus == null){
- foucsStatus = "2";
+ foucsStatus = "0";
}
}
if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){
- foucsStatus = "2";
+ foucsStatus = "0";
}
}
else if(a == "ct"){
diff --git a/src/global/method.js b/src/global/method.js
index f576ba4..9d7eab8 100644
--- a/src/global/method.js
+++ b/src/global/method.js
@@ -491,6 +491,9 @@ const method = {
dataVerificationCtrl[key] = defaultDataVerification[key];
}
}
+
+ // remove proxy
+ Store.asyncLoad = ['core'];
},
editorChart:function(c){
let chart_selection_color = luckyColor[0];
diff --git a/src/index.html b/src/index.html
index d463da7..a64c409 100644
--- a/src/index.html
+++ b/src/index.html
@@ -71,7 +71,7 @@
loadUrl: location.origin + "/luckysheet/api/load",
loadSheetUrl: location.origin + "/luckysheet/api/loadsheet"
}
- }else{
+ }else{
// http://localhost:3000/
options = {
container: 'luckysheet',
@@ -165,6 +165,10 @@
workbookCreateAfter:function(json){
// console.info(json)
},
+ rangePasteBefore:function(range,data){
+ // console.info('rangePasteBefore',range,data)
+ // return false; //Can intercept paste
+ },
},