diff --git a/src/controllers/filter.js b/src/controllers/filter.js
index 93a5cfb..26d1152 100644
--- a/src/controllers/filter.js
+++ b/src/controllers/filter.js
@@ -728,7 +728,13 @@ function initialFilterHandler(){
}
}
}
- $("#luckysheet-filter-byvalue-select").append("
");
+
+ // 适配小屏设备
+ let containerH = winH - toffset.top - 350
+ if (containerH < 0) containerH = 100
+ //$("#luckysheet-filter-byvalue-select").html("
");
+
+ $("#luckysheet-filter-byvalue-select").append("
");
loadingObj.close();
}, 1);
diff --git a/src/controllers/freezen.js b/src/controllers/freezen.js
index 6e74c7d..2f2ce7a 100644
--- a/src/controllers/freezen.js
+++ b/src/controllers/freezen.js
@@ -262,7 +262,6 @@ const luckysheetFreezen = {
let column_px = Store.visibledatacolumn[column], freezen_px = Store.visibledatacolumn[freezen_colindex];
if (column_px <= freezen_px+top) {
- console.log(1111);
setTimeout(function () { $("#luckysheet-scrollbar-x").scrollLeft(0); }, 100);
}
}
diff --git a/src/controllers/handler.js b/src/controllers/handler.js
index ee9747e..61724a7 100644
--- a/src/controllers/handler.js
+++ b/src/controllers/handler.js
@@ -5408,7 +5408,6 @@ export default function luckysheetHandler() {
let $td = $(this);
let cell = {};
let txt = $td.text();
-
if ($.trim(txt).length == 0) {
cell.v = null;
cell.m = "";
@@ -5621,6 +5620,7 @@ export default function luckysheetHandler() {
}
}
else if($(e.target).closest('#luckysheet-rich-text-editor').length > 0) {
+
// 阻止默认粘贴
e.preventDefault();
@@ -5629,7 +5629,6 @@ export default function luckysheetHandler() {
clipboardData = e.originalEvent.clipboardData;
}
let text = clipboardData.getData('text/plain');
-
// 插入
document.execCommand("insertText", false, text);
}
diff --git a/src/controllers/pivotTable.js b/src/controllers/pivotTable.js
index c665e6d..90e0f4c 100644
--- a/src/controllers/pivotTable.js
+++ b/src/controllers/pivotTable.js
@@ -534,8 +534,15 @@ const pivotTable = {
}
}
- $("#luckysheet-pivotTableFilter-byvalue-select").append("
" + item.join("") + "
");
+ // 适配小屏设备
+ let containerH = winH - toffset.top - 350
+ if (containerH < 0) containerH = 100
+ //$("#luckysheet-pivotTableFilter-byvalue-select").html("
" + item.join("") + "
");
+
+
+ $("#luckysheet-pivotTableFilter-byvalue-select").append("
" + item.join("") + "
");
loadingObj.close()
+
}, 1);
showrightclickmenu($menu, toffset.left - 250, toffset.top);
diff --git a/src/controllers/protection.js b/src/controllers/protection.js
index 81cebf6..2867e4e 100644
--- a/src/controllers/protection.js
+++ b/src/controllers/protection.js
@@ -723,7 +723,7 @@ export function closeProtectionModal(){
-function checkProtectionLockedSqref(r, c, aut, local_protection, isOpenAlert=true){
+function checkProtectionLockedSqref(r, c, aut, local_protection, isOpenAlert=true, isLock=true){
let isPass = false;
let rangeAut = aut.allowRangeList;
if(rangeAut!=null && rangeAut.length>0){
@@ -763,7 +763,7 @@ function checkProtectionLockedSqref(r, c, aut, local_protection, isOpenAlert=tru
}
}
}
-
+ if (!isPass && !isLock) isPass = true
if(!isPass && isOpenAlert){
let ht;
if(aut.hintText != null && aut.hintText.length>0){
@@ -909,7 +909,7 @@ export function checkProtectionLocked(r, c, sheetIndex){
return true;
}
- if(cell && !cell.lo){
+ if(cell && cell.lo === 0){ // lo为0的时候才是可编辑
return true;
}
@@ -945,11 +945,8 @@ export function checkProtectionCellHidden(r, c, sheetIndex){
//cell range locked state
export function checkProtectionLockedRangeList(rangeList, sheetIndex){
- //EPM-BUDGET-START
- if (rangeList[0].column[0] !== rangeList[0].column[1]) return true
- //EPM-BUDGET-END
-
let sheetFile = sheetmanage.getSheetByIndex(sheetIndex);
+
if(sheetFile==null){
return true;
}
@@ -968,13 +965,6 @@ export function checkProtectionLockedRangeList(rangeList, sheetIndex){
return true;
}
- //EPM-BUDGET-START
- let cell = sheetFile.data[rangeList[0].row[0]][rangeList[0].column[0]]
- if(cell&& !cell.lo){
- return true;
- }
- //EPM-BUDGET-END
-
const _locale = locale();
const local_protection = _locale.protection;
@@ -984,8 +974,9 @@ export function checkProtectionLockedRangeList(rangeList, sheetIndex){
for(let r=r1;r<=r2;r++){
for(let c=c1;c<=c2;c++){
- let isPass = checkProtectionLockedSqref(r, c , aut, local_protection);
- if(isPass==false){
+ let isLock = sheetFile.data[r][c].lo === undefined || sheetFile.data[r][c].lo === 1, // 单元格是否锁定
+ isPass = checkProtectionLockedSqref(r, c , aut, local_protection, true, isLock);
+ if(!isPass){
return false;
}
}
@@ -1014,7 +1005,7 @@ export function checkProtectionSelectLockedOrUnLockedCells(r, c, sheetIndex){
return true;
}
- if(cell && !cell.lo){//unlocked
+ if(cell && cell.lo === 0){ // lo为0的时候才是可编辑
if(aut.selectunLockedCells==1 || aut.selectunLockedCells==null){
return true;
}
diff --git a/src/controllers/selection.js b/src/controllers/selection.js
index e4d5164..d0045a8 100644
--- a/src/controllers/selection.js
+++ b/src/controllers/selection.js
@@ -514,26 +514,26 @@ const selection = {
Store.iscopyself = true;
if (!clipboardData) {
- // let textarea = $("#luckysheet-copy-content");
- // textarea.html(cpdata);
- // textarea.focus();
- // textarea.select();
- // document.execCommand("selectAll");
- // document.execCommand("Copy");
+ 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);
-
- var oInput = document.createElement('input');
- oInput.setAttribute('readonly', 'readonly');
- oInput.value = cpdata;
- document.body.appendChild(oInput);
- oInput.select(); // 选择对象
- document.execCommand("Copy");
- oInput.style.display='none';
- document.body.removeChild(oInput);
+ setTimeout(function () {
+ $("#luckysheet-copy-content").blur();
+ }, 10);
+
+ // var oInput = document.createElement('input');
+ // oInput.setAttribute('readonly', 'readonly');
+ // oInput.value = cpdata;
+ // document.body.appendChild(oInput);
+ // oInput.select(); // 选择对象
+ // document.execCommand("Copy");
+ // oInput.style.display='none';
+ // document.body.removeChild(oInput);
}
else {
clipboardData.setData('Text', cpdata);
diff --git a/src/css/luckysheet-core.css b/src/css/luckysheet-core.css
index 9dcbc28..571c41f 100644
--- a/src/css/luckysheet-core.css
+++ b/src/css/luckysheet-core.css
@@ -1021,6 +1021,8 @@
}
.luckysheet-sheet-area {
+ width: 100%;
+ box-sizing: border-box;
position: absolute;
right: 0;
bottom: 0;
@@ -1034,6 +1036,26 @@
-webkit-touch-callout: none;
cursor: default;
transition: .3s ease all;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+#luckysheet-sheet-content {
+ width: 0;
+ flex: 3;
+ display: flex;
+ align-items: center;
+}
+#luckysheet-sheet-content .lucky-button-custom {
+}
+
+#luckysheet-bottom-pager {
+ width: 0;
+ background-color: #fafafc;
+ z-index: 1;
+ flex: 2;
+ text-align: right;
+ white-space: nowrap;
}
.luckysheet-sheet-area>div,
@@ -1111,8 +1133,9 @@ div.luckysheet-sheets-m:hover {
padding: 0px 0px;
margin-left: 0px;
position: relative;
- max-width: 50%;
+ max-width: 70%;
vertical-align: bottom;
+ display: inline-block;
}
.luckysheet-sheet-area div.luckysheet-sheet-container div.luckysheet-sheet-container-c {
@@ -2266,6 +2289,8 @@ body:not(.ewa-ipad) .luckysheet-rows-h-cell-sel:hover {
}
.luckysheet-cols-menu {
+ max-height: 100%;
+ overflow-y: auto;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
diff --git a/src/global/api.js b/src/global/api.js
index 048bcc2..d1d75e7 100644
--- a/src/global/api.js
+++ b/src/global/api.js
@@ -21,7 +21,7 @@ import { isRealNull, valueIsError, isRealNum, isEditMode, hasPartMC } from "./va
import { isdatetime, diff } from "./datecontroll";
import { getBorderInfoCompute } from './border';
import { luckysheetDrawMain } from './draw';
-
+import pivotTable from '../controllers/pivotTable';
import server from "../controllers/server";
import menuButton from '../controllers/menuButton';
import selection from "../controllers/selection";
@@ -2850,10 +2850,6 @@ export function setRangeFormat(attr, value, options = {}) {
let file = Store.luckysheetfile[order];
- if(file == null){
- return tooltip.info("The order parameter is invalid.", "");
- }
- let sheetData = $.extend(true, [], file.data);
let result = []
for (let i = 0; i < range.length; i++) {
@@ -2877,7 +2873,6 @@ export function setRangeFormat(attr, value, options = {}) {
luckysheetrefreshgrid();
if (success && typeof success === 'function') {
- success()
}
}
@@ -6617,16 +6612,20 @@ export function getTxtByRange(range=Store.luckysheet_select_save){
* @param {Number} config.total 总条数
*/
export function pagerInit (config) {
+ const {prevPage, nextPage, total} = locale().button;
$('#luckysheet-bottom-pager').remove()
- $('#luckysheet-sheet-area').append('')
+ $('#luckysheet-sheet-content').after('')
$("#luckysheet-bottom-pager").sPage({
page: config.pageIndex, //当前页码,必填
total: config.total, //数据总条数,必填
selectOption: config.selectOption, // 选择每页的行数,
pageSize: config.pageSize, //每页显示多少条数据,默认10条
- showTotal: true, // 是否显示总数
- showSkip: config.showSkip || true, //是否显示跳页,默认关闭:false
- showPN: config.showPN || true, //是否显示上下翻页,默认开启:true
+ showTotal: config.showTotal, // 是否显示总数,默认关闭:false
+ showSkip: config.showSkip, //是否显示跳页,默认关闭:false
+ showPN: config.showPN, //是否显示上下翻页,默认开启:true
+ prevPage: config.prevPage || prevPage, //上翻页文字描述,默认"上一页"
+ nextPage: config.nextPage || nextPage, //下翻页文字描述,默认"下一页"
+ totalTxt: config.totalTxt || total + config.total, // 数据总条数文字描述,{total}为占位符,默认"总共:{total}"
backFun: function (page) {
page.pageIndex = page.page
if(!method.createHookFunction("onTogglePager", page)){ return; }
@@ -6648,6 +6647,53 @@ export function refreshFormula (success) {
})
}
+/**
+ * 更新sheet数据
+ * @param {Array} data 工作簿配置,可以包含多个表
+ * @param {Object} options 可选参数
+ * @param {Function} options.success 操作结束的回调函数
+ *
+ */
+export function updataSheet (options = {}) {
+ let {data, success} = options
+ let files = Store.luckysheetfile
+ for (let i = 0; i < data.length; i++) {
+ for (let j = 0; j < files.length; j++) {
+ if (files[j].index === data[i].index) {
+ files[j] = data[i]
+ }
+ }
+ }
+ let file = files[sheetmanage.getSheetIndex(Store.currentSheetIndex)],
+ sheetData = sheetmanage.buildGridData(file);
+ file.data = sheetData
+
+ if (!!file.isPivotTable) {
+ Store.luckysheetcurrentisPivotTable = true;
+ if (!isPivotInitial) {
+ pivotTable.changePivotTable(index);
+ }
+ }
+ else{
+ Store.luckysheetcurrentisPivotTable = false;
+ $("#luckysheet-modal-dialog-slider-pivot").hide();
+ luckysheetsizeauto(false);
+ }
+ sheetmanage.mergeCalculation(file["index"]);
+ sheetmanage.setSheetParam();
+ setTimeout(function () {
+ sheetmanage.showSheet();
+ sheetmanage.restoreCache();
+ formula.execFunctionGroupForce(luckysheetConfigsetting.forceCalculation);
+ sheetmanage.restoreSheetAll(Store.currentSheetIndex);
+ luckysheetrefreshgrid();
+ if (success && typeof success === 'function') {
+ success();
+ }
+ }, 1);
+ server.saveParam("shs", null, Store.currentSheetIndex);
+}
+
/**
* 刷新状态栏的状态
* @param {Array} data 操作数据
diff --git a/src/global/extend.js b/src/global/extend.js
index 087415e..f1f3a84 100644
--- a/src/global/extend.js
+++ b/src/global/extend.js
@@ -627,9 +627,12 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
}
//空行模板
- let row = [];
+ let row = [],
+ curRow = [...d][index]
for(let c = 0; c < d[0].length; c++){
- row.push(null);
+ let cell = curRow[c],
+ templateCell = cell ? {...cell, v: '', m: ''} : Store.defaultCell;
+ row.push(templateCell);
}
//边框
@@ -779,9 +782,12 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
}
//空列模板
- let col = [];
+ let col = [],
+ curd= [...d];
for(let r = 0; r < d.length; r++){
- col.push(null);
+ let cell = curd[r][index],
+ templateCell = cell ? {...cell, v: '', m: ''} : Store.defaultCell;
+ col.push(templateCell);
}
//边框
@@ -892,6 +898,7 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
newDataVerification,
newHyperlink
);
+
}
else{
file.data = d;
diff --git a/src/global/format.js b/src/global/format.js
index 7fdcefd..a50781f 100644
--- a/src/global/format.js
+++ b/src/global/format.js
@@ -1766,7 +1766,18 @@ export function genarate(value) {//万 单位格式增加!!!
return null;
}
- if(value.toString().substr(0, 1) === "'"){
+ if (/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(value)) { // 表述金额的字符串,如:12,000.00 或者 -12,000.00
+ m = value
+ v = Number(value.split('.')[0].replace(',', ''))
+ let fa = "#,##0"
+ if (value.split('.')[1]) {
+ fa = "#,##0."
+ for (let i = 0; i < value.split('.')[1].length; i++) {
+ fa += 0
+ }
+ }
+ ct= {fa, t: "n"}
+ } else if(value.toString().substr(0, 1) === "'"){
m = value.toString().substr(1);
ct = { "fa": "@", "t": "s" };
}
@@ -1790,7 +1801,6 @@ export function genarate(value) {//万 单位格式增加!!!
}
else if(isRealNum(value) && Math.abs(parseFloat(value)) > 0 && (Math.abs(parseFloat(value)) >= 1e+11 || Math.abs(parseFloat(value)) < 1e-9)){
v = numeral(value).value();
-
var str = v.toExponential();
if(str.indexOf(".") > -1){
var strlen = str.split(".")[1].split("e")[0].length;
diff --git a/src/global/refresh.js b/src/global/refresh.js
index 1ecbecc..72bab91 100644
--- a/src/global/refresh.js
+++ b/src/global/refresh.js
@@ -99,9 +99,8 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
Store.jfredo.push({
"type": "datachange",
"data": Store.flowdata,
- "curdata": data,
+ "curData": data,
"sheetIndex": Store.currentSheetIndex,
- "range": range,
"config": $.extend(true, {}, Store.config),
"curConfig": curConfig,
"cdformat": $.extend(true, [], file["luckysheet_conditionformat_save"]),
@@ -111,7 +110,8 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
"curDataVerification": curDataVerification,
"dynamicArray": $.extend(true, [], file["dynamicArray"]),
"curDynamicArray": curDynamicArray,
- "dataRange": [...file.luckysheet_select_save]
+ "range": range,
+ "dataRange": [...file.luckysheet_select_save]// 保留操作时的选区
});
}
@@ -344,7 +344,7 @@ function jfrefreshrange(data, range, cdformat) {
Store.jfredo.push({
"type": "rangechange",
"data": Store.flowdata,
- "curdata": data,
+ "curData": data,
"range": range,
"sheetIndex": Store.currentSheetIndex,
"cdformat": $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]),
@@ -452,7 +452,8 @@ function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf,
"curDataVerification": dataVerification,
"hyperlink": $.extend(true, {}, file.hyperlink),
"curHyperlink": hyperlink,
- "dataRange": [...file.luckysheet_select_save]
+ "range": file.luckysheet_select_save,
+ "dataRange": [...file.luckysheet_select_save]// 保留操作时的选区
});
}
@@ -688,7 +689,8 @@ function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf, dataVeri
"curDataVerification": dataVerification,
"hyperlink": $.extend(true, {}, file.hyperlink),
"curHyperlink": hyperlink,
- "dataRange": [...file.luckysheet_select_save]
+ "range": file.luckysheet_select_save,
+ "dataRange": [...file.luckysheet_select_save] // 保留操作时的选区
});
}
diff --git a/src/locale/en.js b/src/locale/en.js
index 0d54e47..9b4f1dd 100644
--- a/src/locale/en.js
+++ b/src/locale/en.js
@@ -8919,6 +8919,9 @@ export default {
update:"Update",
delete:"Delete",
insert:"Insert",
+ prevPage: "Previous",
+ nextPage: "Next",
+ total: "total:"
},
paint:{
start: 'Paint format start',
diff --git a/src/locale/es.js b/src/locale/es.js
index 34d3bda..9e93056 100644
--- a/src/locale/es.js
+++ b/src/locale/es.js
@@ -8918,6 +8918,9 @@ export default {
update:"Actualizar",
delete:"Eliminar",
insert:"Insertar",
+ prevPage: "Previous",
+ nextPage: "Next",
+ total: "total:"
},
paint:{
start: 'Inicio clonar formato',
diff --git a/src/locale/zh.js b/src/locale/zh.js
index 8f68130..949d61d 100644
--- a/src/locale/zh.js
+++ b/src/locale/zh.js
@@ -9144,6 +9144,9 @@ export default {
update:"Update",
delete:"Delete",
insert:"新建",
+ prevPage: "上一页",
+ nextPage: "下一页",
+ total: "总共:"
},
paint: {
start: '格式刷开启',
diff --git a/src/locale/zh_tw.js b/src/locale/zh_tw.js
index fcd3582..90e394c 100644
--- a/src/locale/zh_tw.js
+++ b/src/locale/zh_tw.js
@@ -9140,6 +9140,9 @@ export default {
update : "Update",
delete : "Delete",
insert : "新建",
+ prevPage: "上一頁",
+ nextPage: "下一頁",
+ total: "總共:"
},
paint: {
start : '格式刷開啟',
diff --git a/src/plugins/jquery.sPage.css b/src/plugins/jquery.sPage.css
index 2224334..b7cf6fa 100644
--- a/src/plugins/jquery.sPage.css
+++ b/src/plugins/jquery.sPage.css
@@ -1,7 +1,3 @@
-#luckysheet-bottom-pager {
- margin-right: 10px;
- float: right;
-}
.spage-total {
display: inline-block;
margin-right: 10px;
diff --git a/src/plugins/js/jquery.sPage.min.js b/src/plugins/js/jquery.sPage.min.js
index fffd2e9..9bab055 100644
--- a/src/plugins/js/jquery.sPage.min.js
+++ b/src/plugins/js/jquery.sPage.min.js
@@ -6,7 +6,7 @@
pageSize: 200,
total: 0,
showTotal: false,
- totalTxt: "共{total}条",
+ totalTxt: '',
noData: false,
showSkip: false,
showPN: true,
@@ -50,7 +50,7 @@
this.pageTatol = e;
this.pageNum = t.page;
if (t.showTotal) {
- a.push('
' + t.totalTxt.replace(/\{(\w+)\}/gi, t.total) + "
")
+ a.push('
' + t.totalTxt + "
")
}
a.push('
');
this.pageList = [];
diff --git a/src/store/index.js b/src/store/index.js
index 0297768..9ff77d7 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -151,6 +151,20 @@ const Store = {
// Resources that currently need to be loaded asynchronously, especially plugins. 'Core' marks the core rendering process.
asyncLoad:['core'],
+ // 默认单元格
+ defaultCell: {
+ bg: null,
+ bl: 0,
+ ct: {fa: "General", t: "n"},
+ fc: "rgb(51, 51, 51)",
+ ff: 0,
+ fs: 11,
+ ht: 1,
+ it: 0,
+ vt: 1,
+ m: '',
+ v: ''
+ }
}