Browse Source

Merge branch 'master' into master

master
文顶顶 5 years ago
committed by GitHub
parent
commit
1ce7e8d290
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      CHANGELOG.md
  2. 11
      docs/guide/FAQ.md
  3. 6
      docs/guide/README.md
  4. 11
      docs/guide/api.md
  5. 13
      docs/zh/guide/FAQ.md
  6. 6
      docs/zh/guide/README.md
  7. 13
      docs/zh/guide/api.md
  8. 2
      docs/zh/guide/config.md
  9. 2
      package.json
  10. 17
      src/controllers/constant.js
  11. 6
      src/controllers/handler.js
  12. 37
      src/controllers/postil.js
  13. 59
      src/controllers/server.js
  14. 1
      src/controllers/sheetmanage.js
  15. 60
      src/css/luckysheet-core.css
  16. 2
      src/function/functionImplementation.js
  17. 71
      src/global/api.js
  18. 8
      src/global/getdata.js
  19. 3
      src/global/method.js
  20. 6
      src/index.html

17
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)

11
docs/guide/FAQ.md

@ -253,7 +253,7 @@ In this case, after Luckysheet is modified in real time, the changes can be seen
**<span style="font-size:20px;">A</span>** 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})
**<span style="font-size:20px;">A</span>** 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.
------------
## **<span style="font-size:20px;">Q</span>** How to add a custom toolbar?
**<span style="font-size:20px;">A</span>** 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
------------

6
docs/guide/README.md

@ -134,7 +134,11 @@ There are two ways to introduce dependencies
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
```
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

11
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

13
docs/zh/guide/FAQ.md

@ -254,7 +254,9 @@ Luckysheet教程里采用的CDN链接是 [jsdelivr](https://www.jsdelivr.com/pac
**<span style="font-size:20px;">A</span>** 需要引入图表插件才能使用,工作簿初始化的时候应该配置图表插件使用,参考
- 插件配置 [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})
**<span style="font-size:20px;">A</span>** 在源码的 [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js) 搜索`event.which == "3"`即可找到右键事件触发执行的代码。
------------
## **<span style="font-size:20px;">Q</span>** 如何添加自定义工具栏?
**<span style="font-size:20px;">A</span>** 暂未提供配置,可以参照工具栏打印按钮的实现来修改源码:
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) ,新增一个事件监听
------------

6
docs/zh/guide/README.md

@ -133,7 +133,11 @@ npm run build
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
```
注意,`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,还可以采用本地方式引入

13
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);
}
}
});
```
- **示例**:

2
docs/zh/guide/config.md

@ -1007,7 +1007,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
------------
### rangePasteBefore
(TODO)
- 类型:Function
- 默认值:null
- 作用:选区粘贴前

2
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",

17
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 ? '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky' : luckysheetConfigsetting.userInfo; // When true, use the default HTML string
const userInfo = luckysheetConfigsetting.userInfo === true ? '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> 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 `<div class="luckysheet">
<canvas id="luckysheetTableContentF" style="display:none;" class="luckysheetTableContent"></canvas>
@ -23,14 +23,15 @@ const gridHTML = function(){
<div id="luckysheet_info_detail_update" class="luckysheet_info_detail_update"> ${locale_info.detailUpdate} </div>
<div id="luckysheet_info_detail_save" class="luckysheet_info_detail_save"> ${locale_info.wait} </div>
<div class="luckysheet_info_detail_user" style="display:${getObjType(userInfo) === 'string' ? 'block' : 'none'};"> \${functionButton}
<span id="luckysheet_info_detail_user">${userInfo}</span>
</div>
\${functionButton}
${getObjType(userInfo) === 'string' ? `<div class="luckysheet_info_detail_user">
<span id="luckysheet_info_detail_user">${userInfo}</span></div>` : ''}
<div class="luckysheet_info_detail_user" style="display:${getObjType(userInfo) === 'object' ? 'block' : 'none'};"> \${functionButton}
<img src="${userInfo.userImage}" id="luckysheet_info_detail_user_img">
<span id="luckysheet_info_detail_user">${userInfo.userName}</span>
</div>
${getObjType(userInfo) === 'object' ? `<div class="luckysheet_info_detail_user">
<img src="${userInfo.userImage}" id="luckysheet_info_detail_user_img">
<span id="luckysheet_info_detail_user">${userInfo.userName}</span>
</div>` : ''}
</div>
<div id="luckysheet-wa-editor" class="luckysheet-wa-editor toolbar"> \${menu} </div>

6
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) {

37
src/controllers/postil.js

@ -229,7 +229,7 @@ const luckysheetPostil = {
let html = '<div id="luckysheet-postil-overshow">' +
'<canvas class="arrowCanvas" width="'+ size[2] +'" height="'+ size[3] +'" style="position:absolute;left:'+ size[0] +'px;top:'+ size[1] +'px;z-index:100;pointer-events:none;"></canvas>' +
'<div style="width:'+ (width - 12) +'px;min-height:'+ (height - 12) +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;z-index:100;">'+ value +'</div>' +
'<div style="width:'+ (width - 12) +'px;min-height:'+ (height - 12) +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ fromX +'px;top:'+ fromY +'px;z-index:100;">'+ _this.htmlEscape(value) +'</div>' +
'</div>';
$(html).appendTo($("#luckysheet-cell-main"));
@ -391,8 +391,8 @@ const luckysheetPostil = {
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' +
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
@ -563,8 +563,8 @@ const luckysheetPostil = {
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' +
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
@ -685,8 +685,8 @@ const luckysheetPostil = {
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' +
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
@ -809,8 +809,8 @@ const luckysheetPostil = {
'<div class="luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-rb" data-type="rb"></div>' +
'</div>' +
'<div style="width:100%;height:100%;overflow:hidden;">' +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;word-break:break-all;" spellcheck="false" contenteditable="true">' +
value +
'<div class="formulaInputFocus" style="width:'+ (width - 12) +'px;height:'+ (height - 12) +'px;line-height:20px;box-sizing:border-box;text-align: center;;word-break:break-all;" spellcheck="false" contenteditable="true">' +
_this.htmlEscape(value) +
'</div>' +
'</div>' +
'</div>' +
@ -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 '&lt';
}
case '>': {
return '&gt';
}
case '&': {
return '&amp';
}
case '\"': {
return '&quot;';
}
}
})
}
}

59
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;

1
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;

60
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;

2
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;

71
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){

8
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"){

3
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];

6
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
},
},

Loading…
Cancel
Save