Browse Source

Merge branches 'master' and 'master' of https://github.com/mikeungers/Luckysheet

master
Mike Ungers 4 years ago
parent
commit
dbd50f18e0
  1. 17
      README-zh.md
  2. 4
      README.md
  3. 3
      docs/about/sponsor.md
  4. 3
      docs/zh/about/sponsor.md
  5. 56
      docs/zh/guide/config.md
  6. 1
      src/config.js
  7. 21
      src/controllers/imageUpdateCtrl.js
  8. 44
      src/controllers/postil.js
  9. 4
      src/controllers/protection.js
  10. 38
      src/controllers/resize.js
  11. 4
      src/controllers/rowColumnOperation.js
  12. 24
      src/controllers/searchReplace.js
  13. 36
      src/controllers/server.js
  14. 2
      src/core.js
  15. 2
      src/demoData/sheetCell.js
  16. 2
      src/expendPlugins/chart/plugin.js
  17. 31
      src/global/border.js
  18. 15
      src/global/format.js
  19. 21
      src/global/refresh.js
  20. 7
      src/global/setdata.js
  21. 5
      src/index.html

17
README-zh.md

@ -136,22 +136,18 @@ npm run build
## 合作项目
- [鲁班h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)
- [Furion](https://gitee.com/monksoul/Furion)
## 交流
- [Github 论坛](https://github.com/mengshukeji/Luckysheet/discussions)
- 添加小编微信,拉你进Luckysheet开发者交流微信群,备注:加
- 以下扫码加入官方微信群或者QQ
<img src="/docs/.vuepress/public/img/%E5%BE%AE%E4%BF%A1%E4%BA%8C%E7%BB%B4%E7%A0%81.jpg" width = "200" alt="微信群" align="center" />
或者
- 加入Luckysheet开发者交流QQ群
| 官方微信群 | 群满则加小编微信,备注:加群 | QQ群 |
|---|---|---|
| <img src="https://minio.cnbabylon.com/public/luckysheet/luckysheet_wechat_group.png" width="200" /> | <img src="https://minio.cnbabylon.com/public/luckysheet/dushusir_wechat.jpg" width="200" />| <img src="https://minio.cnbabylon.com/public/luckysheet/luckysheet_qq_group.jpg" width="200" /> |
<img src="/docs/.vuepress/public/img/QQ%E7%BE%A4%E4%BA%8C%E7%BB%B4%E7%A0%81.jpg" width = "200" alt="微信群" align="center" />
[英文社群](./README.md)
@ -165,7 +161,7 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
| PayPal | 微信 | 支付宝 |
|---|---|---|
| [Paypal Me](https://www.paypal.me/wbfsa) | <img src="https://minio.cnbabylon.com/public/luckysheet/wechat.jpg" width="140" />| <img src="https://minio.cnbabylon.com/public/luckysheet/alipay.jpg" width="130" /> |
| [Paypal Me](https://www.paypal.me/wbfsa) | <img src="https://minio.cnbabylon.com/public/luckysheet/wechat.jpg" width="200" />| <img src="https://minio.cnbabylon.com/public/luckysheet/alipay.jpg" width="200" /> |
### Patreon和OpenCollective有什么区别?
@ -195,6 +191,9 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- Quentin ¥ 20
- 周宇凡 ¥ 100
- *超 ¥ 10
- 维宁 ¥ 100
- hyy ¥ 20
- 雨亭寒江月 ¥ 50
## 贡献者和感谢

4
README.md

@ -129,7 +129,6 @@ npm run build
## Partner project
- [luban-h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)
- [Furion](https://gitee.com/monksoul/Furion)
@ -179,6 +178,9 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- Quentin ¥ 20
- 周宇凡 ¥ 100
- *超 ¥ 10
- 维宁 ¥ 100
- hyy ¥ 20
- 雨亭寒江月 ¥ 50
## Authors and acknowledgment

3
docs/about/sponsor.md

@ -46,3 +46,6 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- Quentin ¥ 20
- 周宇凡 ¥ 100
- *超 ¥ 10
- 维宁 ¥ 100
- hyy ¥ 20
- 雨亭寒江月 ¥ 50

3
docs/zh/about/sponsor.md

@ -46,3 +46,6 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- Quentin ¥ 20
- 周宇凡 ¥ 100
- *超 ¥ 10
- 维宁 ¥ 100
- hyy ¥ 20
- 雨亭寒江月 ¥ 50

56
docs/zh/guide/config.md

@ -743,10 +743,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
@ -761,10 +761,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
@ -921,10 +921,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
@ -939,10 +939,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
@ -957,10 +957,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true
+ {Boolean} [functionResizeStatus]:工具栏拖动
@ -993,10 +993,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true
+ {Boolean} [functionResizeStatus]:工具栏拖动
@ -1046,10 +1046,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
+ {Number} [start_r]:单元格左上角的垂直坐标
+ {Number} [start_c]:单元格左上角的水平坐标
+ {Number} [end_r]:单元格右下角的垂直坐标
+ {Number} [end_c]:单元格右下角的水平坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
- {Object} [event]: 当前事件对象

1
src/config.js

@ -66,4 +66,5 @@ export default {
showstatisticBarConfig:{}, //自定义计数栏
cellRightClickConfig:{}, //自定义单元格右键菜单
sheetRightClickConfig:{}, //自定义底部sheet页右击菜单
imageUpdateMethodConfig:{}, //自定义图片同步方式
}

21
src/controllers/imageUpdateCtrl.js

@ -0,0 +1,21 @@
// 自定义图片的更新方法例如: customImageUpdate("POST", "http://127.0.0.1:8000/luckysheetimageprocess/", d)
function customImageUpdate(method, url, obj) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP");
xhr.open(method, url);
xhr.send(JSON.stringify(obj)); // 发送 POST/GET 数据
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
resolve(xhr.responseText);
} else {
reject("error");
}
}
};
});
}
export {
customImageUpdate
}

44
src/controllers/postil.js

@ -227,9 +227,15 @@ const luckysheetPostil = {
let size = _this.getArrowCanvasSize(fromX, fromY, toX, toY);
let commentDivs = '';
let valueLines = value.split('\n');
for (let line of valueLines) {
commentDivs += '<div>' + _this.htmlEscape(line) + '</div>';
}
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;">'+ _this.htmlEscape(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;">'+ commentDivs +'</div>' +
'</div>';
$(html).appendTo($("#luckysheet-cell-main"));
@ -371,6 +377,12 @@ const luckysheetPostil = {
let size = _this.getArrowCanvasSize(left, top, toX, toY);
let commentDivs = '';
let valueLines = value.split('\n');
for (let line of valueLines) {
commentDivs += '<div>' + _this.htmlEscape(line) + '</div>';
}
let html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show">' +
'<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 class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' +
@ -392,7 +404,7 @@ const luckysheetPostil = {
'</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">' +
_this.htmlEscape(value) +
commentDivs +
'</div>' +
'</div>' +
'</div>' +
@ -543,6 +555,12 @@ const luckysheetPostil = {
let size = _this.getArrowCanvasSize(left, top, toX, toY);
let commentDivs = '';
let valueLines = value.split('\n');
for (let line of valueLines) {
commentDivs += '<div>' + _this.htmlEscape(line) + '</div>';
}
let html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show luckysheet-postil-show-active">' +
'<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 class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' +
@ -564,7 +582,7 @@ const luckysheetPostil = {
'</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">' +
_this.htmlEscape(value) +
commentDivs +
'</div>' +
'</div>' +
'</div>' +
@ -664,7 +682,11 @@ const luckysheetPostil = {
}
let size = _this.getArrowCanvasSize(left, top, toX, toY);
let commentDivs = '';
let valueLines = value.split('\n');
for (let line of valueLines) {
commentDivs += '<div>' + _this.htmlEscape(line) + '</div>';
}
let html = '<div id="luckysheet-postil-show_'+ r +'_'+ c +'" class="luckysheet-postil-show">' +
'<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 class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' +
@ -686,7 +708,7 @@ const luckysheetPostil = {
'</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">' +
_this.htmlEscape(value) +
commentDivs +
'</div>' +
'</div>' +
'</div>' +
@ -789,6 +811,12 @@ const luckysheetPostil = {
let size = _this.getArrowCanvasSize(left, top, toX, toY);
let commentDivs = '';
let valueLines = value.split('\n');
for (let line of valueLines) {
commentDivs += '<div>' + _this.htmlEscape(line) + '</div>';
}
let html = '<div id="luckysheet-postil-show_'+ rowIndex +'_'+ colIndex +'" class="luckysheet-postil-show">' +
'<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 class="luckysheet-postil-show-main" style="width:'+ width +'px;height:'+ height +'px;color:#000;padding:5px;border:1px solid #000;background-color:rgb(255,255,225);position:absolute;left:'+ left +'px;top:'+ top +'px;box-sizing:border-box;z-index:100;">' +
@ -810,7 +838,7 @@ const luckysheetPostil = {
'</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">' +
_this.htmlEscape(value) +
commentDivs +
'</div>' +
'</div>' +
'</div>' +
@ -840,8 +868,8 @@ const luckysheetPostil = {
let r = id.split("luckysheet-postil-show_")[1].split("_")[0];
let c = id.split("luckysheet-postil-show_")[1].split("_")[1];
let value = $("#" + id).find(".formulaInputFocus").text();
// interpret <div> as new line
let value = $("#" + id).find(".formulaInputFocus").html().replaceAll('<div>', '\n').replaceAll(/<(.*)>.*?|<(.*) \/>/g, '').trim();
// Hook function
if(!method.createHookFunction('commentUpdateBefore',r,c,value)){
return;

4
src/controllers/protection.js

@ -892,7 +892,7 @@ export function checkProtectionNotEnable(sheetIndex){
}
//cell locked state
export function checkProtectionLocked(r, c, sheetIndex){
export function checkProtectionLocked(r, c, sheetIndex, isOpenAlert=true, isLock=true){
let sheetFile = sheetmanage.getSheetByIndex(sheetIndex);
if(sheetFile==null){
@ -916,7 +916,7 @@ export function checkProtectionLocked(r, c, sheetIndex){
const _locale = locale();
const local_protection = _locale.protection;
return checkProtectionLockedSqref(r, c , aut, local_protection);
return checkProtectionLockedSqref(r, c , aut, local_protection, isOpenAlert, isLock);
}
//cell hidden state

38
src/controllers/resize.js

@ -5,6 +5,7 @@ import Store from '../store';
import locale from '../locale/locale';
import sheetmanage from './sheetmanage';
import tooltip from '../global/tooltip'
import { $$ } from "../utils/util";
let gridW = 0,
gridH = 0;
@ -100,13 +101,15 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
</div>
</div>
</div>`,
morediv = '<div id="luckysheet-icon-morebtn-div" class="luckysheet-wa-editor" style="position:absolute;top:'+ (Store.infobarHeight + Store.toolbarHeight + $("#" + Store.container).offset().top + $("body").scrollTop()) +'px; right:0px;z-index:1003;padding:5.5px;display:none;height:auto;white-space:initial;"></div>';
// Add style left:$$('.luckysheet') left, when the worksheet does not fill the full screen
morediv = '<div id="luckysheet-icon-morebtn-div" class="luckysheet-wa-editor" style="position:absolute;top:'+ (Store.infobarHeight + Store.toolbarHeight + $("#" + Store.container).offset().top + $("body").scrollTop()) +'px;right:0px;z-index:1003;padding:5.5px;visibility:hidden;height:auto;white-space:initial;"></div>';
if($("#luckysheet-icon-morebtn-div").length == 0){
$("body").append(morediv);
}
$("#luckysheet-icon-morebtn-div").hide();
// $("#luckysheet-icon-morebtn-div").hide();
$$("#luckysheet-icon-morebtn-div").style.visibility = 'hidden';
// $("#luckysheet-icon-morebtn-div > div").appendTo($("#luckysheet-wa-editor"));
$("#luckysheet-icon-morebtn-div > div").each(function(){
@ -158,8 +161,31 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
$("#luckysheet-wa-editor").append(morebtn);
$("#luckysheet-icon-morebtn").click(function(){
//When resize, change the width of the more button container in real time
$$('#luckysheet-icon-morebtn-div').style.left = '';//reset
const containerLeft = $$('#luckysheet').getBoundingClientRect().left;
const morebtnLeft = $$('#luckysheet-icon-morebtn-div').getBoundingClientRect().left;//get real left info
if(morebtnLeft < containerLeft){
$$('#luckysheet-icon-morebtn-div').style.left = containerLeft + 'px';
}
let right = $(window).width() - $("#luckysheet-icon-morebtn").offset().left - $("#luckysheet-icon-morebtn").width()+ $("body").scrollLeft();
$("#luckysheet-icon-morebtn-div").toggle().css("right", right < 0 ? 0 : right);
// $("#luckysheet-icon-morebtn-div").toggle().css("right", right < 0 ? 0 : right);
// use native js operation
$$('#luckysheet-icon-morebtn-div').style.right = right < 0 ? 0 : right + 'px';
// change to visibility,morebtnLeft will get the actual value
if($$('#luckysheet-icon-morebtn-div').style.visibility === 'hidden'){
$$('#luckysheet-icon-morebtn-div').style.visibility = 'visible';
}else{
$$('#luckysheet-icon-morebtn-div').style.visibility = 'hidden';
}
let $txt = $(this).find(".luckysheet-toolbar-menu-button-caption");
if($txt.text().indexOf(locale_toolbar.toolMore) > -1){
@ -559,6 +585,12 @@ export function menuToolBarWidth() {
});
//If the container does not occupy the full screen, we need to subtract the left margin
const containerLeft = $('#' + Store.container).offset().left;
toobarWidths.forEach((item,i)=>{
toobarWidths[i] -= containerLeft;
})
}
/**

4
src/controllers/rowColumnOperation.js

@ -2045,7 +2045,9 @@ export function rowColumnOperationInitial(){
jfrefreshgrid(d, Store.luckysheet_select_save);
$("#luckysheet-functionbox-cell").html("");
// 清空编辑框的内容
// 备注:在functionInputHanddler方法中会把该标签的内容拷贝到 #luckysheet-functionbox-cell
$("#luckysheet-rich-text-editor").html("");
}
});

24
src/controllers/searchReplace.js

@ -12,6 +12,8 @@ import tooltip from '../global/tooltip';
import func_methods from '../global/func_methods';
import Store from '../store';
import locale from '../locale/locale';
import {checkProtectionLockedRangeList,checkProtectionAllSelected,checkProtectionSelectLockedOrUnLockedCells,checkProtectionNotEnable,checkProtectionLocked} from './protection';
//查找替换
const luckysheetSearchReplace = {
@ -575,6 +577,10 @@ const luckysheetSearchReplace = {
let v = replaceText;
if(!checkProtectionLocked(r, c, Store.currentSheetIndex)){
return;
}
setcellvalue(r, c, d, v);
}
else{
@ -589,6 +595,10 @@ const luckysheetSearchReplace = {
r = searchIndexArr[count].r;
c = searchIndexArr[count].c;
if(!checkProtectionLocked(r, c, Store.currentSheetIndex)){
return;
}
let v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
setcellvalue(r, c, d, v);
@ -695,17 +705,22 @@ const luckysheetSearchReplace = {
let replaceText = $("#luckysheet-search-replace #replaceInput input").val();
let d = editor.deepCopyFlowData(Store.flowdata);
let replaceCount = 0;
if(wordCheck){
for(let i = 0; i < searchIndexArr.length; i++){
let r = searchIndexArr[i].r;
let c = searchIndexArr[i].c;
if(!checkProtectionLocked(r, c, Store.currentSheetIndex, false)){
continue;
}
let v = replaceText;
setcellvalue(r, c, d, v);
range.push({ "row": [r, r], "column": [c, c] });
replaceCount++;
}
}
else{
@ -721,11 +736,16 @@ const luckysheetSearchReplace = {
let r = searchIndexArr[i].r;
let c = searchIndexArr[i].c;
if(!checkProtectionLocked(r, c, Store.currentSheetIndex, false)){
continue;
}
let v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
setcellvalue(r, c, d, v);
range.push({ "row": [r, r], "column": [c, c] });
replaceCount++;
}
}
@ -739,7 +759,7 @@ const luckysheetSearchReplace = {
selectHightlightShow();
let succeedInfo = replaceHtml(locale_findAndReplace.successTip, {
"xlength": searchIndexArr.length
"xlength": replaceCount
});
if(isEditMode()){
alert(succeedInfo);

36
src/controllers/server.js

@ -18,6 +18,8 @@ import { collaborativeEditBox } from './select'
import locale from '../locale/locale';
import dayjs from "dayjs";
import json from '../global/json';
import luckysheetConfigsetting from './luckysheetConfigsetting';
import {customImageUpdate} from './imageUpdateCtrl';
const server = {
gridKey: null,
@ -141,11 +143,31 @@ const server = {
// d.s = params.s;
}
let msg = pako.gzip(encodeURIComponent(JSON.stringify(d)), { to: "string" });
// TODO 配置自定义方式同步图片
const customImageUpdateMethodConfig = luckysheetConfigsetting.imageUpdateMethodConfig
if (JSON.stringify(customImageUpdateMethodConfig) !== "{}") {
if ("images" != d.k) {
let msg = pako.gzip(encodeURIComponent(JSON.stringify(d)), {to: "string"});
if(_this.websocket!=null){
if (_this.websocket != null) {
_this.websocket.send(msg);
}
} else {
customImageUpdate(customImageUpdateMethodConfig.method, customImageUpdateMethodConfig.url, d)
.then((data) => {
console.log(data);
})
.catch((err) => {
console.log(err);
});
}
} else {
let msg = pako.gzip(encodeURIComponent(JSON.stringify(d)), {to: "string"});
if (_this.websocket != null) {
_this.websocket.send(msg);
}
}
},
websocket: null,
@ -706,13 +728,13 @@ const server = {
file["column"] += len;
for(let i = 0; i < data.length; i++){
// data[i].splice(st_i, 0, addData[i]);
// 备注:区分插入的位置(可能是左侧插入或者右侧插入)
/* 在每一行的指定位置都插入一列 */
for (let j = 0; j < len; j++) {
if(direction == "lefttop"){
data[i].splice(st_i, 0, addData[i]);
data[i].splice(st_i, 0, addData[j]);
}else{
data[i].splice(st_i + 1, 0, addData[i]);
data[i].splice(st_i + 1, 0, addData[j]);
}
}
}
}

2
src/core.js

@ -140,6 +140,8 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.initShowsheetbarConfig = false;
luckysheetConfigsetting.imageUpdateMethodConfig = extendsetting.imageUpdateMethodConfig;
if (Store.lang === 'zh') flatpickr.localize(Mandarin.zh);
// Store the currently used plugins for monitoring asynchronous loading

2
src/demoData/sheetCell.js

File diff suppressed because one or more lines are too long

2
src/expendPlugins/chart/plugin.js

@ -1109,6 +1109,7 @@ function createLuckyChart(width, height, left, top) {
}
jfgird_select_save[0]["row"] = [shiftpositon_row, shiftpositon_row];
jfgird_select_save[0].row_focus =shiftpositon_row;
luckysheet.setluckysheet_select_save(jfgird_select_save);
chartInfo.luckysheet_shiftpositon = $.extend(true, {}, jfgird_select_save[0]);
@ -1145,6 +1146,7 @@ function createLuckyChart(width, height, left, top) {
}
jfgird_select_save[0]["column"] = [shiftpositon_col, shiftpositon_col];
jfgird_select_save[0].column_focus = shiftpositon_col;
luckysheet.setluckysheet_select_save(jfgird_select_save);
chartInfo.luckysheet_shiftpositon = $.extend(true, {}, jfgird_select_save[0]);

31
src/global/border.js

@ -77,6 +77,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r + "_" + bd_c_left].r = { "color": borderColor, "style": borderStyle };
}
}
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_c1 <= c + cs - 1 && bd_c1 > c && bd_r >= r && bd_r <= r + rs -1){
borderInfoCompute[bd_r + "_" + bd_c1].l = null;
}
}
}
}
else if(borderType == "border-right"){
@ -107,6 +115,13 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r + "_" + bd_c_right].l = { "color": borderColor, "style": borderStyle };
}
}
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_c2 < c + cs - 1 && bd_c2 >= c && bd_r >= r && bd_r <= r + rs -1){
borderInfoCompute[bd_r + "_" + bd_c2].r = null;
}
}
}
}
else if(borderType == "border-top"){
@ -137,6 +152,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r_top + "_" + bd_c].b = { "color": borderColor, "style": borderStyle };
}
}
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_r1 <= r + rs - 1 && bd_r1 > r && bd_c >= c && bd_c <= c + cs -1){
borderInfoCompute[bd_r1 + "_" + bd_c].t = null;
}
}
}
}
else if(borderType == "border-bottom"){
@ -167,6 +190,14 @@ function getBorderInfoComputeRange(dataset_row_st,dataset_row_ed,dataset_col_st,
borderInfoCompute[bd_r_bottom + "_" + bd_c].t = { "color": borderColor, "style": borderStyle };
}
}
let mc = cfg["merge"] || {};
for (const key in mc) {
let {c,r,cs,rs} = mc[key];
if(bd_r2 < r + rs - 1 && bd_r2 >= r && bd_c >= c && bd_c <= c + cs -1){
borderInfoCompute[bd_r2 + "_" + bd_c].b = null;
}
}
}
}
else if(borderType == "border-all"){

15
src/global/format.js

@ -934,7 +934,6 @@ var make_ssf = function make_ssf(SSF) {
SSF.is_date = fmt_is_date;
function eval_fmt(fmt, v, opts, flen) {
let tempV = v;
var out = [],
o = "",
i = 0,
@ -1351,17 +1350,9 @@ var make_ssf = function make_ssf(SSF) {
out[i].v = write_num(out[i].t, out[i].v, myv);
out[i].t = 't';
}
// var retval = "";
var retval = tempV === 0 ? "0" : "";
// for (i = 0; i !== out.length; ++i)
// if (out[i] != null) retval += out[i].v;
for (i = 0; i !== out.length; ++i){
if (out[i] != null && out[i].v.startsWith(".")){
retval += out[i].v;
}else{
retval = out[i].v || retval;
}
}
var retval = "";
for (i = 0; i !== out.length; ++i)
if (out[i] != null) retval += out[i].v;
return retval;
}

21
src/global/refresh.js

@ -635,18 +635,33 @@ function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf, dataVeri
data[r][c] = {};
}
// if(r == mc.r && c == mc.c){
// data[r][c].mc = mc;
// }
// else{
// data[r][c].mc = { "r": mc.r, "c": mc.c };
// }
// mcData.push({ "r": r, "c": c });
if(r == mc.r && c == mc.c){
if(JSON.stringify(data[r][c].mc) !=JSON.stringify(mc)){
data[r][c].mc = mc;
mcData.push({ "r": r, "c": c });
}
else{
data[r][c].mc = { "r": mc.r, "c": mc.c };
}
else{
let tempMc = { "r": mc.r, "c": mc.c };
if(JSON.stringify(data[r][c].mc) != JSON.stringify(tempMc)){
data[r][c].mc = tempMc;
mcData.push({ "r": r, "c": c });
}
}
}
}
}
}
//公式链中公式范围改变对应单元格值的改变
let funcData = [];

7
src/global/setdata.js

@ -174,7 +174,12 @@ function setcellvalue(r, c, d, v) {
else{
if(isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)){
if(typeof vupdate === "string"){
let flag = vupdate.split("").every(ele=>ele == "0" || ele == ".");
if(flag){
vupdate = parseFloat(vupdate);
}
}
cell.v = vupdate; /* 备注:如果使用parseFloat,1.1111111111111111会转换为1.1111111111111112 ? */
cell.ct = { "fa": "General", "t": "n" };
if(cell.v == Infinity || cell.v == -Infinity){

5
src/index.html

@ -20,6 +20,11 @@
</head>
<body>
<!-- Non-full screen test -->
<!-- <div style="position: relative;width: 100%;height: 100%;">
<div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:80%;height:500px;left: 20%;top: 200px;bottom:0;right: 0;"></div>
</div> -->
<div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:100%;left: 0px;top: 0px;"></div>
<!-- demo feature, non-production use -->
<script src="./demoData/demoFeature.js"></script>

Loading…
Cancel
Save