Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(bug fix): #55 #50 #54
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Oct 9, 2020
1 parent a71c92a commit 5caf2b0
Show file tree
Hide file tree
Showing 7 changed files with 1,747 additions and 24 deletions.
18 changes: 15 additions & 3 deletions src/controllers/dropCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2323,9 +2323,21 @@ const luckysheetDropCell = {
let lastTxt = _this.isExtendNumber(last)[1];
let lastNum = _this.isExtendNumber(last)[2];

let num = Math.abs(Number(lastNum) + step * i);
d["v"] = lastTxt + num.toString();
d["m"] = lastTxt + num.toString();
if(lastNum==""){
let num = Math.abs(Number(lastTxt) + step * i);
if(lastTxt.substr(0,1)=="0"){
if(lastTxt.length>num.toString().length){
num = "0" + num.toString();
}
}
d["v"] = num.toString();
d["m"] = num.toString();
}
else{
let num = Math.abs(Number(lastNum) + step * i);
d["v"] = lastTxt + num.toString();
d["m"] = lastTxt + num.toString();
}

applyData.push(d);
}
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,25 @@ export default function luckysheetHandler() {

clearTimeout(mousewheelArrayUniqueTimeout);

if(Store.visibledatacolumn.length!=visibledatacolumn_c.length){
// if(Store.visibledatacolumn.length!=visibledatacolumn_c.length){
if(Store.visibledatacolumn_unique!=null){
visibledatacolumn_c = Store.visibledatacolumn_unique;
}
else{
visibledatacolumn_c = ArrayUnique(visibledatacolumn_c);
Store.visibledatacolumn_unique = visibledatacolumn_c;
}
}
// }

if(Store.visibledatarow.length!=visibledatarow_c.length){
// if(Store.visibledatarow.length!=visibledatarow_c.length){
if(Store.visibledatarow_unique!=null){
visibledatarow_c = Store.visibledatarow_unique;
}
else{
visibledatarow_c = ArrayUnique(visibledatarow_c);
Store.visibledatarow_unique = visibledatarow_c;
}
}
// }

// visibledatacolumn_c = ArrayUnique(visibledatacolumn_c);
// visibledatarow_c = ArrayUnique(visibledatarow_c);
Expand Down
17 changes: 15 additions & 2 deletions src/controllers/protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ function initialEvent(file){
}

if(aut.algorithmName!=null && aut.algorithmName!="None"){
password = CryptoApi.hash(aut.algorithmName, password);
if(aut.saltValue!=null && aut.saltValue.length>0){
var hasher = CryptoApi.getHasher(aut.algorithmName);
password =CryptoApi.hmac(aut.saltValue, password, hasher);
}
else{
password = CryptoApi.hash(aut.algorithmName, password);
}
}

if(password==aut.password){
Expand Down Expand Up @@ -829,7 +835,14 @@ function openRangePasswordModal(rangeAut) {
}

if(rangeAut.algorithmName!=null && rangeAut.algorithmName!="None"){
password = CryptoApi.hash(rangeAut.algorithmName, password);
// password = CryptoApi.hash(rangeAut.algorithmName, password);
if(rangeAut.saltValue!=null && rangeAut.saltValue.length>0){
var hasher = CryptoApi.getHasher(rangeAut.algorithmName);
password =CryptoApi.hmac(rangeAut.saltValue, password, hasher);
}
else{
password = CryptoApi.hash(rangeAut.algorithmName, password);
}
}

if(password==rangeAut.password){
Expand Down
29 changes: 20 additions & 9 deletions src/global/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,22 +688,23 @@ const luckysheetformula = {
return;
}

if(txt in this.cellTextToIndexList){
return this.cellTextToIndexList[txt];
}

let val = txt.split("!");

let sheettxt = "",
rangetxt = "",
sheetIndex = null,
sheetdata = null;

let luckysheetfile = getluckysheetfile();

if (val.length > 1) {
if (txt.indexOf("!") > -1) {
if(txt in this.cellTextToIndexList){
return this.cellTextToIndexList[txt];
}

let val = txt.split("!");
sheettxt = val[0];
rangetxt = val[1];



for (let i in luckysheetfile) {
if (sheettxt == luckysheetfile[i].name) {
Expand All @@ -718,11 +719,14 @@ const luckysheetformula = {
if(i==null){
i = Store.currentSheetIndex;
}
if(txt+"_" + i in this.cellTextToIndexList){
return this.cellTextToIndexList[txt+"_" + i];
}
let index = getSheetIndex(i);
sheettxt = luckysheetfile[index].name;
sheetIndex = luckysheetfile[index].index;
sheetdata = Store.flowdata;
rangetxt = val[0];
rangetxt = txt;
}

if (rangetxt.indexOf(":") == -1) {
Expand Down Expand Up @@ -4751,7 +4755,14 @@ const luckysheetformula = {
this.cellTextToIndexList = {};
}

this.cellTextToIndexList[txt] = infoObj;
if(txt.indexOf("!")>-1){
this.cellTextToIndexList[txt] = infoObj;
}
else{
this.cellTextToIndexList[txt+"_"+infoObj.sheetIndex] = infoObj;
}


},
addToSheetIndexList:function(formulaTxt, sheetIndex, obIndex){
if(formulaTxt==null || formulaTxt.length==0){
Expand Down
6 changes: 3 additions & 3 deletions src/global/getdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export function getdatabyselectionD(d, range) {
continue;
}

if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) {
continue;
}
// if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] != null) {
// continue;
// }

let row = [];

Expand Down
8 changes: 7 additions & 1 deletion src/global/setdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ function setcellvalue(r, c, d, v) {
}
else if(valueIsError(vupdate)){
cell.m = vupdate.toString();
cell.ct = { "fa": "General", "t": "e" };
// cell.ct = { "fa": "General", "t": "e" };
if(cell.ct!=null){
cell.ct.t = "e";
}
else{
cell.ct = { "fa": "General", "t": "e" };
}
cell.v = vupdate;
}
else{
Expand Down
Loading

0 comments on commit 5caf2b0

Please sign in to comment.