Browse Source

Merge branch 'master' into master

master
Dushusir 4 years ago
committed by GitHub
parent
commit
af9fbcf408
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 30
      .github/ISSUE_TEMPLATE/bug_report_zh.md
  3. 12
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 13
      .github/ISSUE_TEMPLATE/feature_request_zh.md
  5. 4
      .gitignore
  6. 10
      docs/guide/config.md
  7. 12
      docs/zh/guide/config.md
  8. 4
      docs/zh/guide/sheet.md
  9. 10
      gulpfile.js
  10. 11
      src/controllers/constant.js
  11. 42
      src/controllers/dataVerificationCtrl.js
  12. 22
      src/controllers/handler.js
  13. 4
      src/controllers/imageCtrl.js
  14. 2
      src/controllers/protection.js
  15. 16
      src/controllers/resize.js
  16. 43
      src/controllers/rowColumnOperation.js
  17. 4
      src/controllers/select.js
  18. 15
      src/controllers/selection.js
  19. 2
      src/controllers/server.js
  20. 43
      src/controllers/sheetBar.js
  21. 28
      src/controllers/toolbar.js
  22. 2
      src/controllers/updateCell.js
  23. 3
      src/core.js
  24. 35
      src/css/luckysheet-core.css
  25. 99
      src/global/api.js
  26. 16
      src/global/formula.js
  27. 129
      src/global/getRowlen.js
  28. 23
      src/global/location.js
  29. 21
      src/global/rhchInit.js
  30. 8
      src/index.html
  31. 1
      src/locale/en.js
  32. 1
      src/locale/es.js
  33. 1
      src/locale/zh.js
  34. 1
      src/locale/zh_tw.js
  35. 38
      yarn.lock

30
.github/ISSUE_TEMPLATE/bug_report.md

@ -7,26 +7,32 @@ assignees: ''
---
<!--- Thank you for your attention and submit the issue, we hope that besides submitting the issue, you can also help us to understand your user case of Luckysheet, please help fill out the following solicitation form -->
<!-- Wanted: Who is using Luckysheet https://github.com/mengshukeji/Luckysheet/issues/230 -->
<!-- The following is the issues template -->
**Describe the bug**
A clear and concise description of what the bug is.
<!--- A clear and concise description of what the bug is. -->
**To Reproduce**
Steps to reproduce the behavior:
1. The first step
2. The second step
3. The third step
4. See error
<!--- Steps to reproduce the behavior. -->
1. The first step:
2. The second step:
3. The third step:
4. See error:
**What is expected?**
A clear and concise description of what you expected to happen.
<!--- A clear and concise description of what you expected to happen. -->
**Screenshots or demo**
If applicable, add screenshots or online demo to help explain your problem.We will be more accurate when we retest.
<!--- If applicable, add screenshots or online demo to help explain your problem.We will be more accurate when we retest. -->
**Environment**
- OS: [e.g. Windows,Mac,Linux]
- Browser Version: [e.g. Chrome Version 84.0.4147.105 (Official Build) (64-bit), Safari,Firefox,Edge]
- Luckysheet Version: [e.g. 1.0.1,latest]
- OS: <!--- [e.g. Windows,Mac,Linux] -->
- Browser Version: <!---[e.g. Chrome Version 84.0.4147.105 (Official Build) (64-bit), Safari,Firefox,Edge] -->
- Luckysheet Version: <!---[e.g. 1.0.1,latest] -->
**Additional context**
Add any other context about the problem here.
<!--- Add any other context about the problem here. -->

30
.github/ISSUE_TEMPLATE/bug_report_zh.md

@ -7,26 +7,32 @@ assignees: ''
---
<!--- 感谢您的关注并发现问题,我们希望除了提交问题,还能帮助我们对您使用Luckysheet做进一步的了解,请帮忙填写以下征集表 -->
<!-- 征求:谁在使用Luckysheet https://github.com/mengshukeji/Luckysheet/issues/230 -->
<!-- 以下是issues正文模板 -->
**描述错误**
清楚简洁地描述错误是什么。
<!--- 清楚简洁地描述错误是什么 -->
**重现**
重现错误的步骤:
1.第一步操作
2.第二步操作
3.第三步操作
4.最后看到了什么错误
<!--- 重现错误的步骤 -->
1. 第一步操作:
2. 第二步操作:
3. 第三步操作:
4. 最后看到了什么错误:
**期望的结果**
对您期望发生的结果简洁明了的描述。
<!--- 对您期望发生的结果简洁明了的描述 -->
**屏幕截图或演示**
方便的话,贴上屏幕截图或在线链接复现问题,我们复测时会更精准
<!--- 方便的话,贴上屏幕截图或在线链接复现问题,我们复测时会更精准 -->
**环境:**
-操作系统:[例如 Windows,Mac,Linux]
-浏览器 版本号:[例如 Chrome 版本 84.0.4147.105(正式版本) (64 位),Safari,Firefox,Edge]
-Luckysheet版本:[例如 1.0.1,最新]
- 操作系统:<!--- [例如 Windows,Mac,Linux] -->
- 浏览器 版本号:<!--- [例如 Chrome 版本 84.0.4147.105(正式版本) (64 位),Safari,Firefox,Edge] -->
- Luckysheet版本:<!--- [例如 1.0.1,最新] -->
**备注**
其他说明
<!--- 其他说明 -->

12
.github/ISSUE_TEMPLATE/feature_request.md

@ -7,11 +7,17 @@ assignees: ''
---
<!--- Thank you for your attention and submit the issue, we hope that besides submitting the issue, you can also help us to understand your user case of Luckysheet, please help fill out the following solicitation form -->
<!-- Wanted: Who is using Luckysheet https://github.com/mengshukeji/Luckysheet/issues/230 -->
<!-- The following is the issues template -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
<!--- A clear and concise description of what the problem is. -->
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
<!--- A clear and concise description of what you want to happen. -->
**Additional context**
Add any other context or screenshots about the feature request here.
<!--- Add any other context or screenshots about the feature request here. -->

13
.github/ISSUE_TEMPLATE/feature_request_zh.md

@ -7,11 +7,18 @@ assignees: ''
---
<!--- 感谢您的关注并发现问题,我们希望除了提交问题,还能帮助我们对您使用Luckysheet做进一步的了解,请帮忙填写以下征集表 -->
<!-- 征求:谁在使用Luckysheet https://github.com/mengshukeji/Luckysheet/issues/230 -->
<!-- 以下是issues正文模板 -->
**您的功能请求与问题有关吗?**
清楚简洁地说明问题。
<!--- 清楚简洁地说明问题 -->
**描述您想要的解决方案**
对您想要的功能效果简洁明了的描述。
<!--- 对您想要的功能效果简洁明了的描述 -->
**其他内容**
其他说明
<!--- 其他说明 -->

4
.gitignore

@ -2,4 +2,6 @@
node_modules
package-lock.json
dist
docs/.vuepress/dist
docs/.vuepress/dist
.idea

10
docs/guide/config.md

@ -1169,6 +1169,16 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
------------
## Cooperative
### cooperativeMessage
- Type:Function
- Default:null
- Usage:Receive the cooperation message, secondary development. Expanding cooperative message instruction set
- Params:
- {Object} : Receives the entire collaboration message body object sent by the server
## Image
### imageInsertBefore

12
docs/zh/guide/config.md

@ -1470,6 +1470,18 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- {Number} [canvasHeight]: 滚动容器的高度
------------
## 协作消息
### cooperativeMessage
- 类型:Function
- 默认值:null
- 作用:接受协作消息,二次开发。拓展协作消息指令集
- 参数:
- {Object} : 收到服务器发送的整个协作消息体对象
## 图片
### imageInsertBefore

4
docs/zh/guide/sheet.md

@ -1344,8 +1344,10 @@ options.data示例如下:
+ `"date"`(日期)
+ `"validity"`(有效性);
+ {String | Null} [type2]: 条件类型;
+ 类型`type`值为`"dropdown"/"checkbox"`时,`type2`值可为
+ 类型`type`值为`"checkbox"`时,`type2`值可为
+ `null`
+ 类型`type`值为`"dropdown"`时,`type2`值可为
+ `true` (多选) `false` (单选)
+ 类型`type`值为`"number"/"number_integer"/"number_decimal"/"text_length"`时,`type2`值可为
+ `"bw"`(介于)
+ `"nb"`(不介于)

10
gulpfile.js

@ -32,6 +32,13 @@ const babel = require('@rollup/plugin-babel').default;
// Distinguish development and production environments
const production = process.env.NODE_ENV === 'production' ? true : false;
const pkg = require('./package.json');
const banner = `/*! @preserve
* ${pkg.name}
* version: ${pkg.version}
* https://github.com/mengshukeji/Luckysheet
*/`;
// uglify js Compression configuration https://github.com/mishoo/UglifyJS#minify-options
const uglifyOptions = {
compress: {
@ -192,7 +199,7 @@ async function core() {
name: 'luckysheet',
sourcemap: true,
inlineDynamicImports:true,
banner: banner
});
if(production){
@ -202,6 +209,7 @@ async function core() {
name: 'luckysheet',
sourcemap: true,
inlineDynamicImports:true,
banner: banner
});
}

11
src/controllers/constant.js

@ -45,7 +45,7 @@ const gridHTML = function(){
</div>
</div>
<div class="luckysheet-wa-calculate-help-tool">
<i class="fa fa-caret-down" aria-hidden="true" style="margin-top: 7px;"></i>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</div>
</div>
<div id="luckysheet-wa-functionbox-cancel" class="luckysheet-wa-functionbox">
@ -289,6 +289,14 @@ function rightclickHTML(){
dataMenuseparator = false;
}
const customsButtons = (config.customs || [{title: 'test'}]).map((item, index) => `
<div data-index="${index}" class="luckysheetColsRowsHandleAdd_custom luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${item.title}
</div>
</div>`
).join("");
const rightclickContainer = `<div id="luckysheet-rightclick-menu" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-mousedown-cancel">
<div id="luckysheet-copy-btn" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-copy-btn" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" style="display:${config.copy ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.copy}</div>
@ -423,6 +431,7 @@ function rightclickHTML(){
<div id="luckysheetCellFormatRightClickMenu" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.cellFormat ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${toolbar.cellFormat}</div>
</div>
${customsButtons}
</div>
</div>
<div id="luckysheetcopyfor_sub" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-mousedown-cancel">

42
src/controllers/dataVerificationCtrl.js

@ -114,6 +114,10 @@ const dataVerificationCtrl = {
<input class="formulaInputFocus data-verification-value1" placeholder="${dvText.placeholder1}" spellcheck="false">
<i class="fa fa-table" aria-hidden="true" title="${dvText.selectCellRange}"></i>
</div>
<div class="multi">
<input type="checkbox" id="data-verification-multi" class="data-verification-multi">
<label for="data-verification-multi">${dvText.allowMultiSelect}</label>
</div>
</div>
<div class="show-box-item show-box-item-checkbox">
<div class="check-box">
@ -257,9 +261,16 @@ const dataVerificationCtrl = {
e.stopPropagation();
});
$(document).off("click.dropdownListItem").on("click.dropdownListItem", "#luckysheet-dataVerification-dropdown-List .dropdown-List-item", function(e) {
$("#luckysheet-dataVerification-dropdown-List").hide();
var $item = $(this);
let value = e.target.innerText;
if ($item.hasClass('multi')) {
$item.toggleClass('checked');
value = $.map($("#luckysheet-dataVerification-dropdown-List").children().filter('.checked'), function(el) {
return el.innerText;
}).join(',');
} else {
$("#luckysheet-dataVerification-dropdown-List").hide();
}
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let rowIndex = last.row_focus;
let colIndex = last.column_focus;
@ -437,6 +448,8 @@ const dataVerificationCtrl = {
}
$("#luckysheet-dataVerification-dialog .show-box-item-dropdown .data-verification-value1").val(value1);
$('#luckysheet-dataVerification-dialog #data-verification-multi').prop('checked', item.type2 ? true : false);
}
else if(value == 'checkbox'){
$("#luckysheet-dataVerification-dialog .show-box .show-box-item-checkbox").show();
@ -635,6 +648,7 @@ const dataVerificationCtrl = {
tooltip.info('<i class="fa fa-exclamation-triangle"></i>', dvText.tooltipInfo1);
return;
}
type2 = $("#luckysheet-dataVerification-dialog #data-verification-multi").is(':checked');
}
else if(type == 'checkbox'){
value1 = $("#luckysheet-dataVerification-dialog .show-box-item-checkbox .data-verification-value1").val().trim();
@ -839,6 +853,7 @@ const dataVerificationCtrl = {
if(item.type == 'dropdown'){
$("#luckysheet-dataVerification-dialog .show-box .show-box-item-dropdown").show();
$("#luckysheet-dataVerification-dialog .show-box-item-dropdown .data-verification-value1").val(item.value1);
$('#luckysheet-dataVerification-dialog #data-verification-multi').prop('checked', item.type2 ? true : false);
}
else if(item.type == 'checkbox'){
$("#luckysheet-dataVerification-dialog .show-box .show-box-item-checkbox").show();
@ -1270,6 +1285,13 @@ const dataVerificationCtrl = {
if(type == 'dropdown'){
let list = _this.getDropdownList(value1);
// 多选的情况 检查每个都在下拉列表中
if(type2 && cellValue){
return cellValue.split(',').every(function (i) {
return list.indexOf(i) !== -1;
});
}
let result = false;
for(let i = 0; i < list.length; i++){
@ -1464,9 +1486,19 @@ const dataVerificationCtrl = {
let list = _this.getDropdownList(item.value1);
let optionHtml = '';
list.forEach(i => {
optionHtml += `<div class="dropdown-List-item luckysheet-mousedown-cancel">${i}</div>`;
})
if (item.type === 'dropdown' && item.type2) {
// 下拉多选的情况下 将已经选择的标出来
let cellValue = getcellvalue(rowIndex, colIndex, null);
let valueArr = isRealNull(cellValue) ? [] : cellValue.split(',');
list.forEach(i => {
let checked = valueArr.indexOf(i) !== -1;
optionHtml += `<div class="dropdown-List-item luckysheet-mousedown-cancel multi${checked ? ' checked': ''}">${i}</div>`;
});
} else {
list.forEach(i => {
optionHtml += `<div class="dropdown-List-item luckysheet-mousedown-cancel">${i}</div>`;
});
}
$("#luckysheet-dataVerification-dropdown-List")
.html(optionHtml)

22
src/controllers/handler.js

@ -5326,7 +5326,7 @@ export default function luckysheetHandler() {
for(let c = copy_c1; c <= copy_c2; c++){
let cell = d[r][c];
let isInlineStr = false
if(cell != null && cell.mc != null && cell.mc.rs == null){
continue;
}
@ -5344,13 +5344,27 @@ export default function luckysheetHandler() {
v = "";
}
if(v == null && d[r][c] && d[r][c].ct && d[r][c].ct.t == 'inlineStr') {
v = d[r][c].ct.s.map(val=>val.v).join('');
isInlineStr = true;
}
if(v == null){
v = "";
v = "";
}
if(cpDataArr[r - copy_r1][c - copy_c1] != v){
if(isInlineStr){
const cpData = $(cpDataArr[r - copy_r1][c - copy_c1]).text().replace(/\s|\n/g,' ')
const storeValue = v.replace(/\n/g,'').replace(/\s/g,' ')
if(cpData != storeValue){
isEqual = false;
break;
}
}
else{
if(cpDataArr[r - copy_r1][c - copy_c1] != v){
isEqual = false;
break;
}
}
}
}

4
src/controllers/imageCtrl.js

@ -895,6 +895,10 @@ const imageCtrl = {
pasteImgItem: function() {
let _this = this;
if(_this.images == null){
_this.images = {};
}
let rowIndex = Store.luckysheet_select_save[0].row_focus || 0;
let colIndex = Store.luckysheet_select_save[0].column_focus || 0;
let left = colIndex == 0 ? 0 : Store.visibledatacolumn[colIndex - 1];

2
src/controllers/protection.js

@ -922,7 +922,7 @@ export function checkProtectionLocked(r, c, sheetIndex, isOpenAlert=true, isLock
//cell hidden state
export function checkProtectionCellHidden(r, c, sheetIndex){
let sheetFile = sheetmanage.getSheetByIndex(sheetIndex);
if(!sheetFile || !sheetFile.data[r] || !sheetFile.data[r][c]){
if(!sheetFile || (sheetFile.data && !sheetFile.data[r]) || (sheetFile.data && !sheetFile.data[r][c])){
return true;
}

16
src/controllers/resize.js

@ -89,17 +89,17 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
const locale_toolbar = _locale.toolbar;
let ismore = false,
toolbarW = 0,
morebtn = `<div class="luckysheet-toolbar-button luckysheet-inline-block" data-tips="${locale_toolbar.toolMoreTip}" id="luckysheet-icon-morebtn" role="button" style="user-select: none;">
<div class="luckysheet-toolbar-button-outer-box luckysheet-inline-block" style="user-select: none;">
morebtn = `<div class="luckysheet-toolbar-button luckysheet-inline-block" data-tips="${locale_toolbar.toolMoreTip}" id="luckysheet-icon-morebtn" role="button" style="user-select: none;">
<div class="luckysheet-toolbar-button-outer-box luckysheet-inline-block" style="user-select: none;">
<div class="luckysheet-toolbar-button-inner-box luckysheet-inline-block" style="user-select: none;">
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block" style="user-select: none;">
${locale_toolbar.toolMore}
</div>
</div>
<div class="luckysheet-toolbar-menu-button-dropdown luckysheet-inline-block iconfont luckysheet-iconfont-xiayige" style="user-select: none;font-size:12px;">
</div>
</div>
</div>
</div>
</div>`,
// Add style left:$$('.luckysheet') left, when the worksheet does not fill the full screen
@ -118,6 +118,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
const $container = $("#luckysheet-wa-editor")[0];
$container.appendChild(document.createTextNode(" "));
$container.appendChild($t);
});
@ -194,7 +195,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
const toolCloseHTML = `
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block" style="user-select: none;">
${locale_toolbar.toolClose}
</div>
</div>
<div class="luckysheet-toolbar-menu-button-dropdown luckysheet-inline-block iconfont luckysheet-iconfont-shangyige" style="user-select: none;font-size:12px;">
</div>
`
@ -205,7 +206,7 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
const toolMoreHTML = `
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block" style="user-select: none;">
${locale_toolbar.toolMore}
</div>
</div>
<div class="luckysheet-toolbar-menu-button-dropdown luckysheet-inline-block iconfont luckysheet-iconfont-xiayige" style="user-select: none;font-size:12px;">
</div>
`
@ -392,6 +393,7 @@ export function menuToolBarWidth() {
if (JSON.stringify(showtoolbarConfig) !== '{}') {
if(showtoolbarConfig.hasOwnProperty('undoRedo')){
config.undo = config.redo = showtoolbarConfig.undoRedo;
}
Object.assign(config, showtoolbarConfig);
@ -401,6 +403,7 @@ export function menuToolBarWidth() {
current = defaultToolbar[i];
next = defaultToolbar[i + 1];
if (current !== '|' && config[current]) {
obj[current] = {
ele: toolbarIdMap[current],
index: index++
@ -436,7 +439,6 @@ export function menuToolBarWidth() {
return -1;
}
}
toobarElements.forEach((curr,index,arr)=>{
arr[index] = curr.ele;

43
src/controllers/rowColumnOperation.js

@ -4,6 +4,7 @@ import luckysheetPostil from './postil';
import imageCtrl from './imageCtrl';
import menuButton from './menuButton';
import server from './server';
import method from '../global/method';
import { selectHightlightShow, luckysheet_count_show,selectHelpboxFill } from './select';
import {
getObjType,
@ -1103,7 +1104,10 @@ export function rowColumnOperationInitial(){
}
let st_index = Store.luckysheet_select_save[0][Store.luckysheetRightHeadClickIs][0];
luckysheetextendtable(Store.luckysheetRightHeadClickIs, st_index, value, "lefttop");
if(!method.createHookFunction("rowInsertBefore", st_index, value, "lefttop")){
return;
}
luckysheetextendtable(Store.luckysheetRightHeadClickIs, st_index, value, "lefttop");
});
@ -1117,6 +1121,9 @@ export function rowColumnOperationInitial(){
}
let st_index = Store.luckysheet_select_save[0].row[0];
if(!method.createHookFunction("rowInsertBefore", st_index, 1, "lefttop")){
return;
}
luckysheetextendtable('row', st_index, 1, "lefttop");
@ -1134,6 +1141,29 @@ export function rowColumnOperationInitial(){
})
// custom right-click a cell buttton click
$(".luckysheetColsRowsHandleAdd_custom").click(function (clickEvent) {
$("#luckysheet-rightclick-menu").hide();
const cellRightClickConfig =
luckysheetConfigsetting.cellRightClickConfig;
const rowIndex = Store.luckysheet_select_save[0].row[0];
const columnIndex = Store.luckysheet_select_save[0].column[0];
if (
cellRightClickConfig.customs[
Number(clickEvent.currentTarget.dataset.index)
]
) {
try {
cellRightClickConfig.customs[
Number(clickEvent.currentTarget.dataset.index)
].onClick(clickEvent, event, { rowIndex, columnIndex });
} catch (e) {
console.error("custom click error", e);
}
}
});
// Add the row up, and click the text area to trigger the confirmation instead of clicking the confirmation button to enhance the experience
// $("#luckysheet-addTopRows").click(function (event) {
// $("#luckysheetColsRowsHandleAdd_sub .luckysheet-cols-menuitem:first-child").click(function (event) {
@ -1307,6 +1337,9 @@ export function rowColumnOperationInitial(){
}
let st_index = Store.luckysheet_select_save[0][Store.luckysheetRightHeadClickIs][1];
if(!method.createHookFunction("rowInsertBefore", st_index, value, "rightbottom")){
return;
}
luckysheetextendtable(Store.luckysheetRightHeadClickIs, st_index, value, "rightbottom");
});
@ -1453,7 +1486,10 @@ export function rowColumnOperationInitial(){
let st_index = Store.luckysheet_select_save[0][Store.luckysheetRightHeadClickIs][0],
ed_index = Store.luckysheet_select_save[0][Store.luckysheetRightHeadClickIs][1];
luckysheetdeletetable(Store.luckysheetRightHeadClickIs, st_index, ed_index);
if(!method.createHookFunction("rowDeleteBefore", st_index, ed_index)){
return;
}
luckysheetdeletetable(Store.luckysheetRightHeadClickIs, st_index, ed_index);
});
$("#luckysheet-delRows").click(function (event) {
$("#luckysheet-rightclick-menu").hide();
@ -1483,6 +1519,9 @@ export function rowColumnOperationInitial(){
let st_index = Store.luckysheet_select_save[0].row[0],
ed_index = Store.luckysheet_select_save[0].row[1];
if(!method.createHookFunction("rowDeleteBefore", st_index, ed_index)){
return;
}
luckysheetdeletetable('row', st_index, ed_index);
})
$("#luckysheet-delCols").click(function (event) {

4
src/controllers/select.js

@ -403,10 +403,10 @@ function collaborativeEditBox() {
if (Object.keys(range).length > 0 ) {
let flag_sure_merge = false
if(range.v.length > 1) {
flag_sure_merge = Object.keys(range.v[1][0]).length > 0
flag_sure_merge = range.v[1][0] == null || Object.keys(range.v[1][0]).length > 0
}
if(range.v[0].length > 1) {
flag_sure_merge = Object.keys(range.v[0][1]).length > 0
flag_sure_merge = range.v[0][1] == null || Object.keys(range.v[0][1]).length > 0
}
if(flag_sure_merge) {
// 合并成一个时执行

15
src/controllers/selection.js

@ -15,6 +15,7 @@ import { getSheetIndex } from '../methods/get';
import { replaceHtml, getObjType, luckysheetfontformat } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';
import imageCtrl from './imageCtrl';
const selection = {
clearcopy: function (e) {
@ -438,6 +439,17 @@ const selection = {
if(c_value == null){
c_value = getcellvalue(r, c, d);
}
if(c_value == null && d[r][c] && d[r][c].ct && d[r][c].ct.t == 'inlineStr') {
c_value = d[r][c].ct.s.map(val=>{
const font = $('<font></font>')
val.fs && font.css('font-size',val.fs)
val.bl && font.css('font-weight',val.border)
val.it && font.css('font-style',val.italic)
val.cl==1 && font.css('text-decoration','underline')
font.text(val.v)
return font[0].outerHTML
}).join('');
}
if(c_value == null){
c_value = "";
@ -596,6 +608,9 @@ const selection = {
_this.pasteHandlerOfCopyPaste(Store.luckysheet_copy_save);
}
}
else if(data.indexOf("luckysheet_copy_action_image") > - 1){
imageCtrl.pasteImgItem();
}
else if (triggerType != "btn") {
_this.pasteHandler(data);
}

2
src/controllers/server.js

@ -20,6 +20,7 @@ import dayjs from "dayjs";
import json from '../global/json';
import luckysheetConfigsetting from './luckysheetConfigsetting';
import {customImageUpdate} from './imageUpdateCtrl';
import method from '../global/method';
const server = {
gridKey: null,
@ -199,6 +200,7 @@ const server = {
_this.websocket.onmessage = function(result){
Store.result = result
let data = new Function("return " + result.data)();
method.createHookFunction('cooperativeMessage', data)
console.info(data);
let type = data.type;
let {message,id} = data;

43
src/controllers/sheetBar.js

@ -2,9 +2,9 @@
import sheetmanage from './sheetmanage';
import server from './server';
import { sheetselectlistitemHTML, sheetselectlistHTML, keycode } from './constant';
import {
import {
replaceHtml,
mouseclickposition,
mouseclickposition,
} from '../utils/util';
import { getSheetIndex } from '../methods/get';
import { isEditMode } from '../global/validate';
@ -67,10 +67,10 @@ function showsheetconfigmenu() {
let redo = {};
redo["type"] = "sheetColor";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldcolor"] = oldcolor;
redo["color"] = color;
Store.jfundo.length = 0;
Store.jfredo.push(redo);
}
@ -92,7 +92,7 @@ function showsheetconfigmenu() {
let redo = {};
redo["type"] = "sheetColor";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldcolor"] = oldcolor;
redo["color"] = null;
@ -162,6 +162,7 @@ let luckysheetsheetrightclick = function ($t, $cur, e) {
export function initialSheetBar(){
const _locale = locale();
const locale_sheetconfig = _locale.sheetconfig;
isInitialSheetConfig = false
$("#luckysheet-sheet-area").on("mousedown", "div.luckysheet-sheets-item", function (e) {
if(isEditMode()){
@ -183,7 +184,7 @@ export function initialSheetBar(){
Store.luckysheet_sheet_move_status = true;
Store.luckysheet_sheet_move_data = {};
Store.luckysheet_sheet_move_data.widthlist = [];
$("#luckysheet-sheet-area div.luckysheet-sheets-item:visible").each(function (i) {
if (i == 0) {
Store.luckysheet_sheet_move_data.widthlist.push(parseInt($(this).outerWidth()));
@ -205,12 +206,12 @@ export function initialSheetBar(){
}, 200);
}
}).on("click", "div.luckysheet-sheets-item", function (e) {
if(isEditMode()){
// alert("非编辑模式下不允许该操作!");
return;
}
let $t = $(this), $cur = $(e.target);
luckysheetsheetrightclick($t, $cur, e);
server.keepHighLightBox()
@ -242,7 +243,7 @@ export function initialSheetBar(){
if(Store.limitSheetNameLength === false){
return
}
let maxLength = Store.defaultSheetNameMaxLength;
if(maxLength === 0){
return
@ -250,29 +251,29 @@ export function initialSheetBar(){
setTimeout( ()=> {
if (compositionFlag) {
if ($(this).text().length >= maxLength) { /* 检查:值是否越界 */
setTimeout(() => {
$(this).text($(this).text().substring(0, maxLength));
let range = window.getSelection();
range.selectAllChildren(this);
let range = window.getSelection();
range.selectAllChildren(this);
range.collapseToEnd();
}, 0);
}
}
}
}, 0);
});
$("#luckysheet-sheet-area").on("blur", "span.luckysheet-sheets-item-name", function (e) {
if(Store.allowEdit===false){
return;
}
if(0 === $(this).text().length){
tooltip.info("", locale_sheetconfig.sheetNamecannotIsEmptyError);
setTimeout(()=>{
$(this).text(oldSheetFileName);
luckysheetsheetnameeditor($(this));
@ -317,7 +318,7 @@ export function initialSheetBar(){
let redo = {};
redo["type"] = "sheetName";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldtxt"] = oldtxt;
redo["txt"] = txt;
@ -334,7 +335,7 @@ export function initialSheetBar(){
let $t = $(this);
if (kcode == keycode.ENTER) {
let index = getSheetIndex(Store.currentSheetIndex);
oldSheetFileName = Store.luckysheetfile[index].name || oldSheetFileName;
oldSheetFileName = Store.luckysheetfile[index].name || oldSheetFileName;
Store.luckysheetfile[index].name = $t.text();
$t.attr("contenteditable", "false");
}
@ -389,7 +390,7 @@ export function initialSheetBar(){
tooltip.confirm(locale_sheetconfig.confirmDelete+"【" + Store.luckysheetfile[index].name + "】?", "<span style='color:#9e9e9e;font-size:12px;'>"+locale_sheetconfig.redoDelete+"</span>", function () {
sheetmanage.deleteSheet(luckysheetcurrentSheetitem.data("index"));
}, null);
$("#luckysheet-input-box").removeAttr("style");
});
@ -430,7 +431,7 @@ export function initialSheetBar(){
let $c = $("#luckysheet-sheet-container-c");
sheetscrollstart = $c.scrollLeft();
sheetscrollend = $c.scrollLeft() - sheetscrollstep;
if (sheetscrollend <= 0) {
$("#luckysheet-sheet-container .docs-sheet-fade-left").hide();
}
@ -455,7 +456,7 @@ export function initialSheetBar(){
$("#luckysheet-sheet-container .docs-sheet-fade-right").hide();
}
$("#luckysheet-sheet-container .docs-sheet-fade-left").show();
clearInterval(sheetscrollani);
sheetscrollani = setInterval(function () {
sheetscrollstart += 4;

28
src/controllers/toolbar.js

@ -666,7 +666,7 @@ export function createToolbarHtml() {
style="user-select: none;">
<div class="luckysheet-toolbar-menu-button-inner-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
@ -675,7 +675,7 @@ export function createToolbarHtml() {
</div>
</div>
</div>
</div>
</div>
</div>
@ -714,7 +714,7 @@ export function createToolbarHtml() {
style="user-select: none;">
<div class="luckysheet-toolbar-menu-button-inner-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-autofilter iconfont luckysheet-iconfont-geshitiaojian"
style="user-select: none;">
@ -783,7 +783,7 @@ export function createToolbarHtml() {
style="user-select: none;">
<div class="luckysheet-toolbar-button-inner-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-autofilter iconfont luckysheet-iconfont-sousuo"
style="user-select: none;">
@ -818,7 +818,7 @@ export function createToolbarHtml() {
style="user-select: none;">
<div class="luckysheet-toolbar-button-inner-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-autofilter iconfont luckysheet-iconfont-dayin"
style="user-select: none;">
@ -846,9 +846,12 @@ export function createToolbarHtml() {
let i = 0;
showtoolbarConfig.forEach(function(key, i) {
if (key === '|') {
buttonHTML.push(
`<div id="toolbar-separator-${camel2split(key)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
);
const nameKeys = showtoolbarConfig[i - 1]
if(nameKeys !== '|') {
buttonHTML.push(
`<div id="toolbar-separator-${camel2split(nameKeys)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
);
}
} else {
buttonHTML.push(htmlMap[key]);
}
@ -886,9 +889,12 @@ export function createToolbarHtml() {
continue;
}
if (key === '|') {
buttonHTML.push(
`<div id="toolbar-separator-${camel2split(key)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
);
const nameKeys = defaultToolbar[i - 1]
if(nameKeys !== '|') {
buttonHTML.push(
`<div id="toolbar-separator-${camel2split(nameKeys)}" class="luckysheet-toolbar-separator luckysheet-inline-block" style="user-select: none;"></div>`
);
}
} else {
buttonHTML.push(htmlMap[key]);
}

2
src/controllers/updateCell.js

@ -217,7 +217,7 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
if((value == null || value.toString() == "") && !cover){
value = "<br/>";
}
value = formula.xssDeal(value);
if(!checkProtectionCellHidden(row_index, col_index, Store.currentSheetIndex) && value.length>0 && value.substr(0, 63)=='<span dir="auto" class="luckysheet-formula-text-color">=</span>'){
$("#luckysheet-rich-text-editor").html("");
}

3
src/core.js

@ -38,6 +38,7 @@ import * as api from './global/api';
import flatpickr from 'flatpickr'
import Mandarin from 'flatpickr/dist/l10n/zh.js'
import { initListener } from './controllers/listener';
import { luckysheetextendData } from './global/extend.js';
let luckysheet = {};
@ -245,6 +246,8 @@ luckysheet.selectHightlightShow = selectHightlightShow;
// Reset parameters after destroying the table
luckysheet.destroy = method.destroy;
luckysheet.luckysheetextendData = luckysheetextendData;
export {
luckysheet
}

35
src/css/luckysheet-core.css

@ -860,7 +860,8 @@
left: 0;
position: absolute;
right: 0;
top: 6px;
top: 50%;
transform: translateY(-50%);
resize: none;
/* border: 1px #b9b9b9 solid; */
font-family: arial, sans, sans-serif;
@ -897,6 +898,12 @@
border-left: 1px solid transparent;
border-right: 1px solid transparent;
}
.luckysheet-wa-calculate-help-tool .fa-caret-down {
position: absolute;
top: 50%;
left: 3px;
transform: translateY(-50%);
}
.luckysheet-wa-calculate-help-tool:hover {
background: #EFEFEF;
@ -7200,6 +7207,14 @@ fieldset[disabled] .btn-danger.focus {
cursor: pointer;
color: #6598F3;
}
#luckysheet-dataVerification-dialog .box-item .multi {
margin-top: 10px;
line-height: 30px;
font-size: 12px;
}
#luckysheet-dataVerification-dialog .box-item .multi input {
vertical-align: text-top;
}
#luckysheet-dataVerification-dialog .box-item .show-box{
margin-top: 10px;
}
@ -7303,6 +7318,24 @@ fieldset[disabled] .btn-danger.focus {
box-sizing: border-box;
cursor: pointer;
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item.multi {
padding-left: 0;
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item.multi:before{
content: "";
width: 14px;
font-family: "iconfont" !important;
font-size: 12px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: inline-block;
margin-right: 2px;
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item.multi.checked:before{
content: "\e7c8";
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item:hover{
background-color: #E1E1E1;
}

99
src/global/api.js

@ -1082,7 +1082,62 @@ export function insertRowOrColumn(type, index = 0, options = {}) {
success();
}
}
/**
* 在第index行或列的位置插入number行或列
* @param {String} type 插入行或列 row- column-
* @param {Number} index 在第几行插入空白行从0开始
* @param {Object} options 可选参数
* @param {Number} options.number 插入的空白行数默认为 1
* @param {Number} options.order 工作表索引默认值为当前工作表索引
* @param {Function} options.success 操作结束的回调函数
*/
export function insertRowBottomOrColumnRight(type, index = 0, options = {}) {
if(!isRealNum(index)){
return tooltip.info('The index parameter is invalid.', '');
}
let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
let {
number = 1,
order = curSheetOrder,
success
} = {...options}
let _locale = locale();
let locale_info = _locale.info;
if (!isRealNum(number)) {
if(isEditMode()){
alert(locale_info.tipInputNumber);
} else{
tooltip.info(locale_info.tipInputNumber, "");
}
return;
}
number = parseInt(number);
if (number < 1 || number > 100) {
if(isEditMode()){
alert(locale_info.tipInputNumberLimit);
} else{
tooltip.info(locale_info.tipInputNumberLimit, "");
}
return;
}
// 默认在行上方增加行,列左侧增加列
let sheetIndex;
if(order){
if(Store.luckysheetfile[order]){
sheetIndex = Store.luckysheetfile[order].index;
}
}
luckysheetextendtable(type, index, number, "rightbottom", sheetIndex);
if (success && typeof success === 'function') {
success();
}
}
/**
* 在第row行的位置插入number行空白行
* @param {Number} row 在第几行插入空白行从0开始
@ -1094,7 +1149,17 @@ export function insertRowOrColumn(type, index = 0, options = {}) {
export function insertRow(row = 0, options = {}) {
insertRowOrColumn('row', row, options)
}
/**
* 在第row行的位置插入number行空白行
* @param {Number} row 在第几行插入空白行从0开始
* @param {Object} options 可选参数
* @param {Number} options.number 插入的空白行数默认为 1
* @param {Number} options.order 工作表索引默认值为当前工作表索引
* @param {Function} options.success 操作结束的回调函数
*/
export function insertRowBottom(row = 0, options = {}) {
insertRowBottomOrColumnRight('row', row, options)
}
/**
* 在第column列的位置插入number列空白列
* @param {Number} column 在第几列插入空白列从0开始
@ -1106,7 +1171,17 @@ export function insertRow(row = 0, options = {}) {
export function insertColumn(column = 0, options = {}) {
insertRowOrColumn('column', column, options)
}
/**
* 在第column列的位置插入number列空白列
* @param {Number} column 在第几列插入空白列从0开始
* @param {Object} options 可选参数
* @param {Number} options.number 插入的空白列数默认为 1
* @param {Number} options.order 工作表索引默认值为当前工作表索引
* @param {Function} options.success 操作结束的回调函数
*/
export function insertColumnRight(column = 0, options = {}) {
insertRowBottomOrColumnRight('column', column, options)
}
/**
* 删除指定的行或列删除行列之后行列的序号并不会变化下面的行右侧的列会补充到上注意观察数据是否被正确删除即可
* @param {String} type 删除行或列 row- column-
@ -1332,7 +1407,7 @@ export function showColumn(startIndex, endIndex, options = {}) {
/**
* 设置指定行的高度
* 设置指定行的高度优先级最高高于默认行高和用户自定义行高
* @param {Object} rowInfo 行数和高度对应关系
* @param {Object} options 可选参数
* @param {Number} options.order 工作表索引默认值为当前工作表索引
@ -1363,8 +1438,12 @@ export function setRowHeight(rowInfo, options = {}) {
if(parseInt(r) >= 0){
let len = rowInfo[r];
if(Number(len) >= 0){
cfg['rowlen'][parseInt(r)] = Number(len);
if (len === 'auto') {
cfg['rowlen'][parseInt(r)] = len
} else {
if(Number(len) >= 0){
cfg['rowlen'][parseInt(r)] = Number(len);
}
}
}
}
@ -1416,8 +1495,12 @@ export function setColumnWidth(columnInfo, options = {}) {
if(parseInt(c) >= 0){
let len = columnInfo[c];
if(Number(len) >= 0){
cfg['columnlen'][parseInt(c)] = Number(len);
if (len === 'auto') {
cfg['columnlen'][parseInt(c)] = len
} else {
if(Number(len) >= 0){
cfg['columnlen'][parseInt(c)] = Number(len);
}
}
}
}
@ -6741,4 +6824,4 @@ export function checkTheStatusOfTheSelectedCells(type,status){
})
return flag;
}
}

16
src/global/formula.js

@ -321,7 +321,11 @@ const luckysheetformula = {
sheetmanage.changeSheetExec(_this.rangetosheet);
}
},
fucntionboxshow: function (r, c) {
xssDeal: function(str) {
if (typeof str !== 'string') return str;
return str.replace(/<script>/g, '&lt;script&gt;').replace(/<\/script>/, '&lt;/script&gt;');
},
fucntionboxshow: function(r, c) {
if (!checkProtectionCellHidden(r, c, Store.currentSheetIndex)) {
$("#luckysheet-functionbox-cell").html("");
@ -346,7 +350,7 @@ const luckysheetformula = {
value = valueShowEs(r, c, d);
}
}
value = this.xssDeal(value);
_this.oldvalue = value;
$("#luckysheet-functionbox-cell").html(value);
},
@ -3331,11 +3335,11 @@ const luckysheetformula = {
$editer = $input;
let value1 = $editer.html(),
value1txt = $editer.text();
setTimeout(function () {
let xssDeal = this.xssDeal
setTimeout(function() {
let value = $editer.text(),
valuetxt = value;
value = xssDeal(value);
if (value.length > 0 && value.substr(0, 1) == "=" && (kcode != 229 || value.length == 1)) {
value = _this.functionHTMLGenerate(value);
value1 = _this.functionHTMLGenerate(value1txt);
@ -5942,4 +5946,4 @@ const luckysheetformula = {
data_parm_index: 0 //选择公式后参数索引标记
}
export default luckysheetformula;
export default luckysheetformula;

129
src/global/getRowlen.js

@ -1,12 +1,21 @@
import { luckysheetfontformat } from '../utils/util';
import {luckysheetfontformat} from '../utils/util';
import menuButton from '../controllers/menuButton';
import { getcellvalue,checkstatusByCell } from './getdata';
import { colLocationByIndex } from './location';
import { hasChinaword, isRealNull,checkWordByteLength } from './validate';
import { isInlineStringCell } from '../controllers/inlineString';
import {checkstatusByCell} from './getdata';
import {colLocationByIndex,colSpanLocationByIndex} from './location';
import {checkWordByteLength, hasChinaword, isRealNull} from './validate';
import {isInlineStringCell} from '../controllers/inlineString';
import Store from '../store';
//计算范围行高
/**
* 计算范围行高
*
* @param d 原始数据
* @param r1 起始行
* @param r2 截至行
* @param cfg 配置
* @returns 计算后的配置
*/
function rowlenByRange(d, r1, r2, cfg) {
let cfg_clone = $.extend(true, {}, cfg);
if(cfg_clone["rowlen"] == null){
@ -77,12 +86,105 @@ function rowlenByRange(d, r1, r2, cfg) {
if(currentRowLen != Store.defaultrowlen){
cfg_clone["rowlen"][r] = currentRowLen;
}else{
if(cfg["rowlen"][r]){
cfg_clone["rowlen"][r] = cfg["rowlen"][r]
}
}
}
return cfg_clone;
}
//根据内容计算行高
function computeRowlenByContent(d, r) {
let currentRowLen = 0;
let canvas = $("#luckysheetTableContent").get(0).getContext("2d");
canvas.textBaseline = 'top'; //textBaseline以top计算
for(let c = 0; c < d[r].length; c++){
let cell = d[r][c];
if (cell == null) {
continue;
}
if (cell.mc != null) {
if (1 !== cell.mc.rs) {
continue;
}
}
if(cell != null && (cell.v != null || isInlineStringCell(cell)) ){
let cellWidth = computeCellWidth(cell, c);
let textInfo = getCellTextInfo(cell, canvas,{
r:r,
c:c,
cellWidth:cellWidth
});
let computeRowlen = 0;
if (textInfo != null) {
computeRowlen = textInfo.textHeightAll + 2;
}
//比较计算高度和当前高度取最大高度
if (computeRowlen > currentRowLen) {
currentRowLen = computeRowlen;
}
}
}
return currentRowLen;
}
function computeCellWidth(cell, col_index) {
let colLocationArr = colLocationByIndex(col_index);
if (cell.mc && cell.mc.c !== cell.mc.cs) {
colLocationArr = colSpanLocationByIndex(col_index, cell.mc.cs);
}
return colLocationArr[1] - colLocationArr[0] - 2;
}
function computeColWidthByContent(d, c, rh) {
let currentColLen = 0;
let rowlenArr = computeRowlenArr(rh, c)
let canvas = $("#luckysheetTableContent").get(0).getContext("2d");
canvas.textBaseline = 'top'; //textBaseline以top计算
for (var i = 0; i < d.length; i++) {
var cell = d[i][c]
if (cell != null && (cell.v != null || isInlineStringCell(cell))) {
let cellHeight = rowlenArr[c];
let textInfo = getCellTextInfo(cell, canvas, {
r: i,
c: c,
cellHeight: cellHeight
});
let computeCollen = 0;
if (textInfo != null) {
computeCollen = textInfo.textWidthAll + 2;
}
//比较计算高度和当前高度取最大高度
if (computeCollen > currentColLen) {
currentColLen = computeCollen;
}
}
}
return currentColLen;
}
//计算表格行高数组
function computeRowlenArr(rowHeight, cfg) {
let rowlenArr = [];
@ -373,7 +475,6 @@ function getCellTextInfo(cell , ctx, option){
}
similarIndex++;
}
isInline = true;
}
@ -400,14 +501,6 @@ function getCellTextInfo(cell , ctx, option){
}
}
// let measureText = getMeasureText(value, ctx);
// //luckysheetTableContent.measureText(value);
// let textWidth = measureText.width;
// let textHeight = measureText.actualBoundingBoxDescent + measureText.actualBoundingBoxAscent;
if(tr=="3"){//vertical text
ctx.textBaseline = 'top';
@ -916,7 +1009,7 @@ function getCellTextInfo(cell , ctx, option){
if(preMeasureText!=null){
spaceOrTwoByte = {
index:i,
str:preStr,
str:preStr + lastWord,
width:preTextWidth,
height:preTextHeight,
asc:preMeasureText.actualBoundingBoxAscent,
@ -1624,9 +1717,11 @@ function drawLineInfo(wordGroup, cancelLine,underLine,option){
export {
computeColWidthByContent,
rowlenByRange,
computeRowlenByContent,
computeRowlenArr,
getCellTextSplitArr,
getMeasureText,
getCellTextInfo
}
}

23
src/global/location.js

@ -24,12 +24,12 @@ function rowLocation(y) {
else if (row_index == -1 && y <= 0) {
row_index = 0;
}
return rowLocationByIndex(row_index);
}
function colLocationByIndex(col_index){
let col = 0, col_pre = 0;
let col = 0, col_pre = 0;
col = Store.visibledatacolumn[col_index];
if (col_index == 0) {
@ -42,6 +42,20 @@ function colLocationByIndex(col_index){
return [col_pre, col, col_index];
}
function colSpanLocationByIndex(col_index, span){
let col = 0, col_pre = 0;
col = Store.visibledatacolumn[col_index + span - 1];
if (col_index == 0) {
col_pre = 0;
}
else {
col_pre = Store.visibledatacolumn[col_index - 1];
}
return [col_pre, col, col_index];
}
function colLocation(x) {
let col_index = luckysheet_searcharray(Store.visibledatacolumn, x);
@ -57,7 +71,7 @@ function colLocation(x) {
function mouseposition(x, y) {
let container_offset = $("#" + Store.container).offset();
let newX = x - container_offset.left - Store.rowHeaderWidth,
newY = y - container_offset.top - Store.infobarHeight - Store.toolbarHeight - Store.calculatebarHeight - Store.columnHeaderHeight;
@ -68,6 +82,7 @@ export {
rowLocationByIndex,
rowLocation,
colLocationByIndex,
colSpanLocationByIndex,
colLocation,
mouseposition,
}
}

21
src/global/rhchInit.js

@ -1,4 +1,5 @@
import Store from '../store';
import { computeRowlenByContent,computeColWidthByContent } from './getRowlen';
import luckysheetConfigsetting from '../controllers/luckysheetConfigsetting';
export default function rhchInit(rowheight, colwidth) {
@ -19,19 +20,23 @@ export default function rhchInit(rowheight, colwidth) {
Store.visibledatarow.push(Store.rh_height);
continue;
}
// 自动行高计算
if (rowlen === 'auto') {
rowlen = computeRowlenByContent(Store.flowdata, r);
}
Store.rh_height += Math.round((rowlen + 1) * Store.zoomRatio);
Store.visibledatarow.push(Store.rh_height); //行的临时长度分布
}
// 如果增加行和回到顶部按钮隐藏,则减少底部空白区域,但是预留足够空间给单元格下拉按钮
if(!luckysheetConfigsetting.enableAddRow && !luckysheetConfigsetting.enableAddBackTop){
if (!luckysheetConfigsetting.enableAddRow && !luckysheetConfigsetting.enableAddBackTop) {
Store.rh_height += 29;
}else{
} else {
Store.rh_height += 80; //最底部增加空白
}
}
//列宽
@ -71,6 +76,10 @@ export default function rhchInit(rowheight, colwidth) {
continue;
}
// 自动行高计算
if (firstcolumnlen === 'auto') {
firstcolumnlen = computeColWidthByContent(Store.flowdata, c, rowheight);
}
Store.ch_width += Math.round((firstcolumnlen + 1)*Store.zoomRatio);
Store.visibledatacolumn.push(Store.ch_width);//列的临时长度分布
@ -79,7 +88,7 @@ export default function rhchInit(rowheight, colwidth) {
// maxColumnlen = firstcolumnlen + 1;
// }
}
// Store.ch_width += 120;
Store.ch_width += maxColumnlen;
}
@ -93,4 +102,4 @@ export function zoomSetting(){
$("#luckysheet-rows-h").width((Store.rowHeaderWidth-1.5));
$("#luckysheet-cols-h-c").height((Store.columnHeaderHeight-1.5));
$("#luckysheet-left-top").css({width:Store.rowHeaderWidth-1.5, height:Store.columnHeaderHeight-1.5});
}
}

8
src/index.html

@ -1883,6 +1883,14 @@
},
imageClass:"loadingAnimation"
}
options.cellRightClickConfig = {
customs: [{
title: 'test',
onClick: function (clickEvent, event, params) {
console.log('function test click', clickEvent, event, params)
}
}]
}
luckysheet.create(options);
})
</script>

1
src/locale/en.js

@ -9733,6 +9733,7 @@ export default {
selectCellRange: 'Click to select a cell range',
selectCellRange2: 'Please select a range of cells',
verificationCondition: 'Verification condition',
allowMultiSelect: "Allow multiple selection",
dropdown: 'drop-down list',
checkbox: 'Checkbox',
number: 'Number',

1
src/locale/es.js

@ -9716,6 +9716,7 @@ export default {
selectCellRange: 'Haz clic para seleccionar un rango de celdas',
selectCellRange2: 'Selecciona un rango de celdas',
verificationCondition: 'Condición de verificación',
allowMultiSelect: "Permitir selección múltiple",
dropdown: 'lista desplegable',
checkbox: 'Casilla de verificación',
number: 'Número',

1
src/locale/zh.js

@ -9976,6 +9976,7 @@ export default {
selectCellRange: '点击选择单元格范围',
selectCellRange2: '请选择单元格范围',
verificationCondition: '验证条件',
allowMultiSelect: '是否允许多选',
dropdown: '下拉列表',
checkbox: '复选框',
number: '数字',

1
src/locale/zh_tw.js

@ -9969,6 +9969,7 @@ export default {
selectCellRange : '點擊選擇儲存格範圍',
selectCellRange2 : '請選擇儲存格範圍',
verificationCondition: '驗證條件',
allowMultiSelect : "是否允許多選",
dropdown : '下拉清單',
checkbox : '核取方塊',
number : '數位',

38
yarn.lock

@ -2166,10 +2166,10 @@ bluebird@^3.1.1, bluebird@^3.5.5:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0:
version "4.11.9"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9:
version "4.12.0"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
bn.js@^5.0.0, bn.js@^5.1.1:
version "5.1.3"
@ -2254,7 +2254,7 @@ braces@^3.0.1, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"
brorand@^1.0.1:
brorand@^1.0.1, brorand@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
@ -4165,17 +4165,17 @@ electron-to-chromium@^1.3.634:
integrity sha512-bwl6/U6xb3d3CNufQU9QeO1L32ueouFwW4bWANSwdXR7LVqyLzWjNbynoKNfuC38QFB5Qn7O0l2KLqBkcXnC3Q==
elliptic@^6.5.3:
version "6.5.3"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
version "6.5.4"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"
bn.js "^4.11.9"
brorand "^1.1.0"
hash.js "^1.0.0"
hmac-drbg "^1.0.0"
inherits "^2.0.1"
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
hmac-drbg "^1.0.1"
inherits "^2.0.4"
minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1"
emoji-regex@^7.0.1:
version "7.0.3"
@ -5624,7 +5624,7 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
hmac-drbg@^1.0.0:
hmac-drbg@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
@ -7296,7 +7296,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==
minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
@ -9887,9 +9887,9 @@ sshpk@^1.7.0:
tweetnacl "~0.14.0"
ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Loading…
Cancel
Save