Browse Source

Merge branch 'master' of https://github.com/mengshukeji/Luckysheet into master

master
wbfsa 5 years ago
parent
commit
adc2d32029
  1. 4
      README-zh.md
  2. 4
      README.md
  3. 20
      docs/guide/api.md
  4. 24
      docs/guide/sheet.md
  5. 21
      docs/zh/guide/api.md
  6. 26
      docs/zh/guide/sheet.md
  7. 30
      src/controllers/constant.js
  8. 3
      src/controllers/handler.js
  9. 65
      src/controllers/imageCtrl.js
  10. 19
      src/controllers/keyboard.js
  11. 2
      src/controllers/luckysheetConfigsetting.js
  12. 18
      src/controllers/matrixOperation.js
  13. 6
      src/controllers/menuButton.js
  14. 8
      src/controllers/resize.js
  15. 2
      src/controllers/selection.js
  16. 11
      src/controllers/sheetmanage.js
  17. 2
      src/core.js
  18. 2
      src/css/iconCustom.css
  19. 41
      src/css/luckysheet-core.css
  20. 37
      src/global/api.js
  21. 4
      src/global/createdom.js
  22. 2
      src/index.html
  23. 4
      src/locale/en.js
  24. 2
      src/locale/zh.js

4
README-zh.md

@ -21,6 +21,10 @@
- excel导入导出库: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel)
- 图表插件: [chartMix](https://github.com/mengshukeji/chartMix)
## 支持
Luckysheet是MIT许可的开源项目,其持续的开发完全有赖于许多出色支持者的支持。如果您想加入他们,请考虑:
- [kickstarter](https://www.kickstarter.com/projects/luckysheet/luckysheet)
## 特性
### 🛠️格式设置

4
README.md

@ -27,6 +27,10 @@ English| [简体中文](./README-zh.md)
- Excel import and export library: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel)
- Chart plugin: [chartMix](https://github.com/mengshukeji/chartMix)
## Support
Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of many awesome backers. If you'd like to join them, please consider:
- [kickstarter](https://www.kickstarter.com/projects/luckysheet/luckysheet)
## Features
### 🛠️Formatting

20
docs/guide/api.md

@ -2026,6 +2026,26 @@ Use note:
------------
### scroll([setting])
[todo]
- **参数**
- {PlainObject} [setting]: optional parameters
+ {Number} [scrollWidth]: horizontal scroll value. The default is the current horizontal scroll position.
+ {Number} [scrollHeight]: Vertical scroll value. The default is the current vertical scroll position.
+ {Number} [targetRow]: Scroll vertically to the specified row number. The default is the current vertical scroll position.
+ {Number} [targetColumn]: scroll horizontally to the specified column number. The default is the current horizontal scroll position.
+ {Function} [success]: The callback function after the table is refreshed successfully
- **说明**
Scroll current worksheet position
------------
### resize([setting])
- **Parameter**

24
docs/guide/sheet.md

@ -17,6 +17,8 @@ eg: options.data:
"hide": 0,//Whether worksheet hide
"row": 36, //the number of rows in a sheet
"column": 18, //the number of columns in a sheet
"defaultRowHeight": 19, //Customized default row height
"defaultColWidth": 73, //Customized default column width
"celldata": [], //Initial the cell data
"config": {
"merge":{}, //merged cells
@ -76,9 +78,9 @@ eg: options.data:
------------
### index
- type:Number
- default:0
- usage:Worksheet index, starting from 0
- type:String
- default:""
- usage:The worksheet index is used as a unique key value, and a random string is automatically assigned when a worksheet is added. Note that `index` is not the order of worksheets, and is distinguished from `order`.
------------
### status
@ -90,7 +92,7 @@ eg: options.data:
### order
- type:Number
- default:0
- usage: The index of the worksheets is starting from 0. it will increase when a worksheet is added.
- usage:The subscript of the worksheet represents the order in which the worksheet is displayed in the sheet bar at the bottom. It will increase when a worksheet is added, starting from 0
------------
### hide
@ -108,7 +110,19 @@ eg: options.data:
### column
- type:Number
- default:18
- usage: The number of cell columns
- usage: Number of cell columns
------------
### defaultRowHeight
- type:Number
- default:19
- usage: Customized default row height, unit is px
------------
### defaultColWidth
- type:Number
- default:73
- usage: Customized default column width, unit is px
------------
### celldata

21
docs/zh/guide/api.md

@ -1973,6 +1973,26 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
### scroll([setting])
[todo]
- **参数**
- {PlainObject} [setting]: 可选参数
+ {Number} [scrollWidth]:横向滚动值。默认为当前横向滚动位置。
+ {Number} [scrollHeight]:纵向滚动值。默认为当前纵向滚动位置。
+ {Number} [targetRow]:纵向滚动到指定的行号。默认为当前纵向滚动位置。
+ {Number} [targetColumn]:横向滚动到指定的列号。默认为当前横向滚动位置。
+ {Function} [success]: 表格刷新成功后的回调函数
- **说明**
滚动当前工作表位置
------------
### resize([setting])
- **参数**
@ -2278,6 +2298,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
按照scrollWidth, scrollHeight刷新canvas展示数据。
> 推荐使用新API: [scroll](#scroll([setting]))
------------
### setcellvalue(r, c, d, v)

26
docs/zh/guide/sheet.md

@ -13,10 +13,12 @@ options.data示例如下:
"color": "", //工作表颜色
"index": 0, //工作表索引
"status": 1, //激活状态
"order": 0, //工作表的顺序
"order": 0, //工作表的下标
"hide": 0,//是否隐藏
"row": 36, //行数
"column": 18, //列数
"defaultRowHeight": 19, //自定义行高
"defaultColWidth": 73, //自定义列宽
"celldata": [], //初始化使用的单元格数据
"config": {
"merge":{}, //合并单元格
@ -77,9 +79,9 @@ options.data示例如下:
------------
### index
- 类型:Number
- 默认值:0
- 作用:工作表索引,从0开始
- 类型:String
- 默认值:""
- 作用:工作表索引,作为唯一key值使用,新增工作表时会自动赋值一个随机字符串。注意`index`不是工作表顺序,和`order`区分开。
------------
### status
@ -91,7 +93,7 @@ options.data示例如下:
### order
- 类型:Number
- 默认值:0
- 作用: 工作表的索引,新增工作表时会递增,从0开始
- 作用: 工作表的下标,代表工作表在底部sheet栏展示的顺序,新增工作表时会递增,从0开始
------------
### hide
@ -111,6 +113,18 @@ options.data示例如下:
- 默认值:18
- 作用: 单元格列数
------------
### defaultRowHeight
- 类型:Number
- 默认值:19
- 作用: 自定义的默认行高,单位为px
------------
### defaultColWidth
- 类型:Number
- 默认值:73
- 作用: 自定义的默认列宽,单位为px
------------
### celldata
- 类型:Array
@ -1263,7 +1277,7 @@ Luckysheet在初始化完成之后进行的一系列操作,会将更多本地
"color": "", //工作表颜色
"index": 0, //工作表索引
"status": 1, //激活状态
"order": 0, //工作表的顺序
"order": 0, //工作表的下标
"hide": 0,//是否隐藏
"row": 36, //行数
"column": 18, //列数

30
src/controllers/constant.js

@ -315,7 +315,7 @@ function rightclickHTML(){
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
<span class="luckysheet-cols-rows-shift-word luckysheet-mousedown-cancel">${rightclick.column}</span>
<span class="luckysheet-cols-rows-shift-size luckysheet-mousedown-cancel">${rightclick.width}</span>
<input type="number" class="luckysheet-mousedown-cancel rcsize" min="0" max="255" placeholder="${rightclick.number}" value="" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;margin-left:5px;">
<input type="number" class="luckysheet-mousedown-cancel rcsize" min="0" max="255" placeholder="${rightclick.number}" value="" style="width:50px;height:20px;box-sizing:border-box;text-align: center;;margin-left:5px;">
px
</div>
</div>
@ -360,12 +360,11 @@ function rightclickHTML(){
</div>
</div>
<div id="luckysheetcopyfor_sub" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
Json
<button id="luckysheet-copy-json-head" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="btn btn-primary luckysheet-copy-btn luckysheet-mousedown-cancel" style="margin-left:5px;padding:2px 3px;line-height:12px;font-size:12px;">${rightclick.firstLineTitle}</button>
<button id="luckysheet-copy-json-nohead" class="btn btn-primary luckysheet-copy-btn luckysheet-mousedown-cancel" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" style="margin-left:5px;padding:2px 3px;line-height:12px;font-size:12px;">${rightclick.untitled}</button>
</div>
<div id="luckysheet-copy-json-head" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">Json ${rightclick.firstLineTitle}</div>
</div>
<div id="luckysheet-copy-json-nohead" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">Json ${rightclick.untitled}</div>
</div>
<div id="luckysheet-copy-array1" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.array1}</div>
@ -373,15 +372,12 @@ function rightclickHTML(){
<div id="luckysheet-copy-array2" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.array2}</div>
</div>
<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheet-copy-arraymore-confirm" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
<div class="luckysheet-mousedown-cancel">${rightclick.array3}</div>
<div>
<input type="number" id="luckysheet-copy-arraymore-row" min="1" class="luckysheet-mousedown-cancel" placeholder="${rightclick.row}" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;"/>
<span class="luckysheet-mousedown-cancel">${rightclick.array3}</span>
<input type="number" id="luckysheet-copy-arraymore-row" min="1" class="luckysheet-mousedown-cancel" placeholder="${rightclick.row}" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;"/>
×
<input type="number" id="luckysheet-copy-arraymore-col" min="1" class="luckysheet-mousedown-cancel" placeholder="${rightclick.column}" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;"/>
<button id="luckysheet-copy-arraymore-confirm" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="btn btn-primary luckysheet-copy-btn luckysheet-mousedown-cancel" style="margin-left:5px;padding:2px 3px;line-height:12px;font-size:12px;">${rightclick.confirm}</button>
</div>
</div>
</div>
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>
@ -391,12 +387,11 @@ function rightclickHTML(){
<div id="luckysheet-copy-antidiagonal" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.antiDiagonal}</div>
</div>
<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheet-copy-diagonaloffset" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.diagonalOffset}
<input type="number" id="luckysheet-copy-diagonaloffset-value" class="luckysheet-mousedown-cancel" placeholder="${rightclick.offset}" value="1" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;margin-left:5px;"/>
${rightclick.column}
<button id="luckysheet-copy-diagonaloffset" class="btn btn-primary luckysheet-copy-btn luckysheet-mousedown-cancel" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" style="margin-left:5px;padding:2px 3px;line-height:12px;font-size:12px;">${rightclick.confirm}</button>
</div>
</div>
<div id="luckysheet-copy-boolvalue" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" class="luckysheet-cols-menuitem luckysheet-copy-btn luckysheet-mousedown-cancel">
@ -498,11 +493,11 @@ function rightclickHTML(){
<div id="luckysheet-matrix-turn-trans" class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.transpose}</div>
</div>
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>
<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheet-matrix-cal-confirm" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
<div class="luckysheet-mousedown-cancel">${rightclick.matrixCalculation}</div>
<div class="luckysheet-mousedown-cancel">
<select id="luckysheet-matrix-cal-type" class="luckysheet-mousedown-cancel" style="height:24px;">
<select id="luckysheet-matrix-cal-type" class="luckysheet-mousedown-cancel" style="height:20px;">
<option value="plus">${rightclick.plus}</option>
<option value="minus">${rightclick.minus}</option>
<option value="multiply">${rightclick.multiply}</option>
@ -512,7 +507,6 @@ function rightclickHTML(){
<option value="log">${rightclick.log}</option>
</select>
<input type="number" id="luckysheet-matrix-cal-value" class="luckysheet-mousedown-cancel" placeholder="${rightclick.number}" value="2" style="width:40px;height:20px;box-sizing:border-box;text-align: center;;margin-left:5px;"/>
<button id="luckysheet-matrix-cal-confirm" class="btn btn-primary luckysheet-mousedown-cancel" style="margin-left:5px;padding:2px 3px;line-height:12px;font-size:12px;">${rightclick.confirm}</button>
</div>
</div>
</div>

3
src/controllers/handler.js

@ -4853,6 +4853,9 @@ export default function luckysheetHandler() {
selection.pasteHandlerOfCopyPaste(Store.luckysheet_copy_save);
}
}
else if(txtdata.indexOf("luckysheet_copy_action_image") > - 1){
imageCtrl.pasteImgItem();
}
else {
if (txtdata.indexOf("table") > -1) {
$("#luckysheet-copy-content").html(txtdata);

65
src/controllers/imageCtrl.js

@ -48,7 +48,10 @@ const imageCtrl = {
cropChange: null,
cropChangeXY: null,
cropChangeObj: null,
copyImgItemObj: null,
inserImg: function(src){
let _this = this;
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];
@ -67,7 +70,7 @@ const imageCtrl = {
originHeight: height
}
imageCtrl.addImgItem(img);
_this.addImgItem(img);
}
image.src = src;
},
@ -615,6 +618,8 @@ const imageCtrl = {
"top": -imgItem.border.width,
"bottom": -imgItem.border.width,
})
_this.currentImgId = null;
},
addImgItem: function(img) {
let _this = this;
@ -855,6 +860,64 @@ const imageCtrl = {
_this.ref();
},
copyImgItem: function(e) {
let _this = this;
_this.copyImgItemObj = $.extend(true, {}, _this.images[_this.currentImgId]);
let clipboardData = window.clipboardData; //for IE
if (!clipboardData) { // for chrome
clipboardData = e.originalEvent.clipboardData;
}
let cpdata = '<table data-type="luckysheet_copy_action_image"><tr><td><td></tr></table>';
if (!clipboardData) {
let textarea = $("#luckysheet-copy-content");
textarea.html(cpdata);
textarea.focus();
textarea.select();
document.execCommand("selectAll");
document.execCommand("Copy");
// 等50毫秒,keyPress事件发生了再去处理数据
setTimeout(function () {
$("#luckysheet-copy-content").blur();
}, 10);
}
else {
clipboardData.setData('Text', cpdata);
return false;//否则设不生效
}
},
pasteImgItem: function() {
let _this = this;
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];
let top = rowIndex == 0 ? 0 : Store.visibledatarow[rowIndex - 1];
let img = $.extend(true, {}, _this.copyImgItemObj);
img.default.left = left - img.crop.offsetLeft;
img.default.top = top - img.crop.offsetTop;
let scrollTop = $("#luckysheet-cell-main").scrollTop(),
scrollLeft = $("#luckysheet-cell-main").scrollLeft();
img.fixedLeft = img.default.left - scrollLeft + Store.rowHeaderWidth;
img.fixedTop = img.default.top - scrollTop + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight;
let id = _this.generateRandomId();
let modelHtml = _this.modelHtml(id, img);
$("#luckysheet-image-showBoxs .img-list").append(modelHtml);
_this.images[id] = img;
_this.ref();
_this.init();
},
allImagesShow: function() {
let _this = this;

19
src/controllers/keyboard.js

@ -14,6 +14,7 @@ import { selectHightlightShow, selectIsOverlap } from './select';
import selection from './selection';
import searchReplace from './searchReplace';
import controlHistory from './controlHistory';
import imageCtrl from './imageCtrl';
import {
getByteLen,
@ -313,8 +314,6 @@ export function keyboardInitial(){
return;
}
let $inputbox = $("#luckysheet-input-box");
@ -433,6 +432,11 @@ export function keyboardInitial(){
$("#luckysheet-icon-bold").click();
}
else if (kcode == 67) {//Ctrl + C 复制
if(imageCtrl.currentImgId != null){
imageCtrl.copyImgItem(event);
return;
}
//复制时存在格式刷状态,取消格式刷
if(menuButton.luckysheetPaintModelOn){
menuButton.cancelPaintModel();
@ -749,10 +753,19 @@ export function keyboardInitial(){
selectHightlightShow();
}
else if (kcode == keycode.DELETE) {
$("#luckysheet-delete-text").click();
if(imageCtrl.currentImgId != null){
imageCtrl.removeImgItem();
}
else{
$("#luckysheet-delete-text").click();
}
event.preventDefault();
}
else if(kcode == 8 && imageCtrl.currentImgId != null){
imageCtrl.removeImgItem();
event.preventDefault();
}
else if (kcode == keycode.UP) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus") || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;

2
src/controllers/luckysheetConfigsetting.js

@ -26,6 +26,8 @@ const luckysheetConfigsetting = {
editMode: false,
beforeCreateDom: null,
workbookCreateBefore: null,
workbookCreateAfter: null,
fireMousedown: null,
plugins:[],
forceCalculation:false,//强制刷新公式,公式较多会有性能问题,慎用

18
src/controllers/matrixOperation.js

@ -269,6 +269,12 @@ export function initialMatrixOperation(){
//复制为多维数组
$("#luckysheet-copy-arraymore-confirm").click(function (event) {
// Click input element, don't comfirm
if(event.target.nodeName === 'INPUT'){
return;
}
$("body .luckysheet-cols-menu").hide();
if(Store.luckysheet_select_save.length > 1){
@ -509,6 +515,12 @@ export function initialMatrixOperation(){
//复制为对角偏移n列
$("#luckysheet-copy-diagonaloffset").click(function (event) {
// Click input element, don't comfirm
if(event.target.nodeName === 'INPUT'){
return;
}
$("body .luckysheet-cols-menu").hide();
luckysheetContainerFocus();
@ -870,6 +882,12 @@ export function initialMatrixOperation(){
//矩阵操作选区 矩阵计算
$("#luckysheet-matrix-cal-confirm").click(function (event) {
// Click input element, don't comfirm
if(event.target.nodeName === 'INPUT' || event.target.nodeName === 'SELECT'){
return;
}
$("body .luckysheet-cols-menu").hide();
luckysheetContainerFocus();

6
src/controllers/menuButton.js

@ -40,7 +40,7 @@ import locale from '../locale/locale';
const menuButton = {
"menu": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton ${subclass} luckysheet-mousedown-cancel" id="luckysheet-icon-${id}-menuButton">${item}</div>',
// "item": '<div itemvalue="${value}" itemname="${name}" class="luckysheet-cols-menuitem ${sub} luckysheet-mousedown-cancel"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="padding: 3px 0px 3px 1px;"><span style="margin-right:3px;width:13px;display:inline-block;" class="icon luckysheet-mousedown-cancel"></span> ${name} <span class="luckysheet-submenu-arrow luckysheet-mousedown-cancel" style="user-select: none;">${example}</span></div></div>',
"item": '<div itemvalue="${value}" itemname="${name}" class="luckysheet-cols-menuitem ${sub} luckysheet-mousedown-cancel"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="padding: 3px 0px 3px 1px;"><span style="margin-right:3px;width:13px;display:inline-block;" class="icon luckysheet-mousedown-cancel"></span> ${name} <span class="luckysheet-submenu-arrow luckysheet-mousedown-cancel ${iconClass}" style="user-select: none;"></span></div></div>',
"item": '<div itemvalue="${value}" itemname="${name}" class="luckysheet-cols-menuitem ${sub} luckysheet-mousedown-cancel"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="padding: 3px 0px 3px 1px;"><span style="margin-right:3px;width:13px;display:inline-block;" class="icon luckysheet-mousedown-cancel"></span> ${name} <span class="luckysheet-submenu-arrow luckysheet-mousedown-cancel ${iconClass}" style="user-select: none;">${example}</span></div></div>',
"split": '<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>',
"color": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-rightgclick-menu-sub luckysheet-mousedown-cancel luckysheet-menuButton ${sub}" id="${id}"><div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-color-reset"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${resetColor}</div></div> <div class="luckysheet-mousedown-cancel"> <div class="luckysheet-mousedown-cancel"> <input type="text" class="luckysheet-color-selected" /> </div> </div> <div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div> ${coloritem}</div>',
"coloritem": '<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel ${class}"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${name}</div></div>',
@ -79,11 +79,11 @@ const menuButton = {
else{
if(item.example=="more"){
// itemset += replaceHtml(_this.item, {"value": item.value, "name": item.text, "example": "►", "sub": "luckysheet-cols-submenu"});
itemset += replaceHtml(_this.item, {"value": item.value, "name": item.text, "sub": "luckysheet-cols-submenu", "iconClass": "iconfont icon-youjiantou"});
itemset += replaceHtml(_this.item, {"value": item.value, "name": item.text, "example": "", "sub": "luckysheet-cols-submenu", "iconClass": "iconfont icon-youjiantou"});
}
else{
itemset += replaceHtml(_this.item, {"value": item.value, "name": item.text, "example": item.example, "sub": ""});
itemset += replaceHtml(_this.item, {"value": item.value, "name": item.text, "example": item.example, "sub": "", "iconClass": ""});
}
}
}

8
src/controllers/resize.js

@ -139,13 +139,17 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
// 找到应该隐藏的起始元素位置
for (let index = toobarWidths.length - 1; index >= 0; index--) {
// #luckysheet-icon-morebtn button width plus right is 83px
if(toobarWidths[index] < gridW - 90){
moreButtonIndex = index;
ismore = true;
if(moreButtonIndex !== 33){
ismore = true;
}
break;
}
}
// 从起始位置开始,后面的元素统一挪到下方隐藏DIV中
for (let index = moreButtonIndex; index < toobarElements.length; index++) {
const element = toobarElements[index];

2
src/controllers/selection.js

@ -533,7 +533,7 @@ const selection = {
copybyformat: function (e, txt) {//copy事件
let clipboardData = window.clipboardData; //for IE
if (!clipboardData) { // for chrome
clipboardData = e.originalEvent.clipboardData;
clipboardData = e.originalEvent && e.originalEvent.clipboardData;
}
Store.luckysheet_selection_range = [{ "row": Store.luckysheet_select_save[0].row, "column": Store.luckysheet_select_save[0].column }];

11
src/controllers/sheetmanage.js

@ -25,7 +25,7 @@ import { selectHightlightShow, selectionCopyShow } from './select';
import Store from '../store';
import locale from '../locale/locale';
import { renderChartShow } from '../expendPlugins/chart/plugin';
import {changeSheetContainerSize} from './resize';
import {changeSheetContainerSize, menuToolBarWidth} from './resize';
import {zoomNumberDomBind} from './zoom';
import menuButton from './menuButton';
@ -739,6 +739,10 @@ const sheetmanage = {
else {
Store.luckysheetcurrentisPivotTable = false;
$("#luckysheet-modal-dialog-slider-pivot").hide();
// Store toolbar button width value
menuToolBarWidth();
luckysheetsizeauto();
//等待滚动条dom宽高加载完成后 初始化滚动位置
@ -757,10 +761,15 @@ const sheetmanage = {
}
}
//钩子函数 表格创建之前触发
if(typeof luckysheetConfigsetting.beforeCreateDom == "function" ){
luckysheetConfigsetting.beforeCreateDom(luckysheet);
}
if(typeof luckysheetConfigsetting.workbookCreateBefore == "function"){
luckysheetConfigsetting.workbookCreateBefore(luckysheet);
}
if(luckysheetConfigsetting.pointEdit){
setTimeout(function(){
$("#luckysheetloadingdata").remove();

2
src/core.js

@ -95,6 +95,8 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.editMode = extendsetting.editMode;
luckysheetConfigsetting.beforeCreateDom = extendsetting.beforeCreateDom;
luckysheetConfigsetting.workbookCreateBefore = extendsetting.workbookCreateBefore;
luckysheetConfigsetting.workbookCreateAfter = extendsetting.workbookCreateAfter;
luckysheetConfigsetting.fireMousedown = extendsetting.fireMousedown;
luckysheetConfigsetting.forceCalculation = extendsetting.forceCalculation;

2
src/css/iconCustom.css

@ -41,7 +41,7 @@
}
#luckysheet-icon-morebtn{
padding: 0 13px 0 5px;
padding: 2px 13px 0 5px;
}
#luckysheet-icon-morebtn .iconfont{
top:-9px;

41
src/css/luckysheet-core.css

@ -774,10 +774,10 @@
margin-right: 0px;
}
.luckysheet-icon-autofilter {
/* .luckysheet-icon-autofilter {
left: -36px;
top: -406px;
}
} */
#luckysheet-icon-pivotTable .luckysheet-toolbar-menu-button-caption {
color: #0188fb;
@ -2614,7 +2614,7 @@ body:not(.ewa-ipad) .luckysheet-rows-h-cell-sel:hover {
padding: 4px 8px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
border-radius: 2px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@ -2730,29 +2730,35 @@ fieldset[disabled] .btn-default.focus {
.btn-primary {
color: #ffffff;
background-color: #337ab7;
border-color: #2e6da4;
/* background-color: #337ab7; */
background-color: #2D7FF9;
/* border-color: #2e6da4; */
border-color:transparent;
}
.btn-primary:focus,
.btn-primary.focus {
color: #ffffff;
background-color: #286090;
border-color: #122b40;
/* border-color: #122b40; */
border-color:transparent;
}
.btn-primary:hover {
color: #ffffff;
background-color: #286090;
border-color: #204d74;
/* background-color: #286090; */
background-color: #5391ff;
/* border-color: #204d74; */
border-color:transparent;
}
.btn-primary:active,
.btn-primary.active,
.open>.dropdown-toggle.btn-primary {
color: #ffffff;
background-color: #286090;
border-color: #204d74;
/* background-color: #286090; */
background-color: #5391ff;
/* border-color: #204d74; */
}
.btn-primary:active:hover,
@ -2766,7 +2772,8 @@ fieldset[disabled] .btn-default.focus {
.open>.dropdown-toggle.btn-primary.focus {
color: #ffffff;
background-color: #204d74;
border-color: #122b40;
/* border-color: #122b40; */
border-color:transparent;
}
.btn-primary:active,
@ -2794,7 +2801,8 @@ fieldset[disabled] .btn-primary:active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #337ab7;
border-color: #2e6da4;
/* border-color: #2e6da4; */
border-color:transparent;
}
.btn-primary .badge {
@ -2808,13 +2816,16 @@ fieldset[disabled] .btn-primary.active {
.list-group-item.active:hover,
.list-group-item.active:focus {
background: #0188FB;
border-color: #726EFE;
/* border-color: #726EFE; */
border-color:transparent;
}
.btn-primary:hover,
.btn-primary:focus {
background: #388cf5;
border-color: #6864FE;
/* background: #388cf5; */
background: #5391ff;
/* border-color: #6864FE; */
border-color:transparent;
}

37
src/global/api.js

@ -93,20 +93,26 @@ export function getCellValue(row, column, options = {}) {
* @param {Function} options.success 操作结束的回调函数
*/
export function setCellValue(row, column, value, options = {}) {
if (row == null && column == null) {
return tooltip.info('Arguments row or column cannot be null or undefined.', '')
if (getObjType(row) != "number" || getObjType(column) != "number") {
return tooltip.info('The row or column parameter is invalid.', '');
}
let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
let {
index = Store.currentSheetIndex,
order = curSheetOrder,
order = getSheetIndex(Store.currentSheetIndex),
isRefresh = true,
success
} = {...options}
let file = Store.luckysheetfile[order];
if(file == null){
return tooltip.info("The order parameter is invalid.", "");
}
let luckysheetfile = getluckysheetfile();
let arrayIndex = getSheetIndex(index);
let data = luckysheetfile[arrayIndex].data;
let data = $.extend(true, [], file.data);
if(data.length == 0){
data = sheetmanage.buildGridData(file);
}
// luckysheetformula.updatecell(row, column, value);
let formatList = {
@ -130,7 +136,12 @@ export function setCellValue(row, column, value, options = {}) {
//f: 1, //formula
qp:1 //quotePrefix, show number as string
}
if(value instanceof Object){
if(value == null || value.toString().length == 0){
formula.delFunctionGroup(row, column);
setcellvalue(row, column, data, value);
}
else if(value instanceof Object){
let curv = {};
if(value.f!=null && value.v==null){
curv.f = value.f;
@ -163,22 +174,20 @@ export function setCellValue(row, column, value, options = {}) {
}
}
else{
if(value.substr(0,1)=="=" || value.substr(0,5)=="<span"){
if(value.toString().substr(0,1)=="=" || value.toString().substr(0,5)=="<span"){
data = luckysheetformula.updatecell(row, column, value, false).data;//update formula value or convert inline string html to object
}
else{
formula.delFunctionGroup(row, column);
setcellvalue(row, column, data, value);
}
}
if(isRefresh){
if(file.index == Store.currentSheetIndex && isRefresh){
jfrefreshgrid(data, [{ "row": [row, row], "column": [column, column] }]);//update data, meanwhile refresh canvas and store data to history
}
else{
luckysheetfile[arrayIndex] = data;//only update data
file.data = data;//only update data
}
if (success && typeof success === 'function') {

4
src/global/createdom.js

@ -19,7 +19,6 @@ import rhchInit from './rhchInit';
import { replaceHtml } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';
import {menuToolBarWidth} from '../controllers/resize'
export default function luckysheetcreatedom(colwidth, rowheight, data, menu, title) {
// //最少30行
@ -99,9 +98,6 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
$("#" + Store.container).append(gh);
//统计工具栏按钮宽度值
menuToolBarWidth();
$("#luckysheet-scrollbar-x div").width(Store.ch_width);
$("#luckysheet-scrollbar-y div").height(Store.rh_height + Store.columeHeaderHeight - Store.cellMainSrollBarSize - 3);

2
src/index.html

@ -35,7 +35,7 @@
$(function () {
luckysheet.create({
container: 'luckysheet',
lang: 'en',
lang: 'zh',
allowEdit:true,
forceCalculation:true,
plugins: ['chart'],

4
src/locale/en.js

@ -528,8 +528,8 @@ export default {
sortSelection: 'Sort',
filterSelection: 'Filter',
chartGeneration: 'Create chart',
firstLineTitle: 'First line title',
untitled: 'Untitled',
firstLineTitle: 'first line title',
untitled: 'untitled',
array1: 'One-dimensional array',
array2: 'Two-dimensional array',
array3: 'Multidimensional Arrays',

2
src/locale/zh.js

@ -415,7 +415,7 @@ export default {
"clip":"截断",
},
rotation:{
"none":"无选装",
"none":"无旋转",
"angleup":"向上倾斜",
"angledown":"向下倾斜",
"vertical":"竖排文字",

Loading…
Cancel
Save