@leankylin-sheet/core 5.2.32 → 5.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/cell.d.ts +6 -0
- package/dist/api/sheet.d.ts +2 -1
- package/dist/index.esm.js +350 -69
- package/dist/index.js +350 -69
- package/dist/modules/formula.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36172,7 +36172,7 @@ function execfunction(ctx, txt, r, c, id, isrefresh, notInsertFunc) {
|
|
|
36172
36172
|
f: txt
|
|
36173
36173
|
};else data[r][c].f = txt;
|
|
36174
36174
|
}
|
|
36175
|
-
execFunctionGroup(ctx, r, c, ___default['default'].isNil(formulaError) ? result : formulaError, id);
|
|
36175
|
+
execFunctionGroup(ctx, r, c, ___default['default'].isNil(formulaError) ? result : formulaError, id, false, notInsertFunc);
|
|
36176
36176
|
if (!hadFormulaField && data && data[r] && data[r][c]) {
|
|
36177
36177
|
delete data[r][c].f;
|
|
36178
36178
|
}
|
|
@@ -36236,6 +36236,8 @@ function groupValuesRefresh(ctx) {
|
|
|
36236
36236
|
}
|
|
36237
36237
|
function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
36238
36238
|
var isForce = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
36239
|
+
var notInsertFunc = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
36240
|
+
console.time('execFunctionGroup-before');
|
|
36239
36241
|
if (___default['default'].isNil(data)) {
|
|
36240
36242
|
data = getFlowdata(ctx);
|
|
36241
36243
|
}
|
|
@@ -36273,6 +36275,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36273
36275
|
updateValueOjects[_key] = 1;
|
|
36274
36276
|
}
|
|
36275
36277
|
}
|
|
36278
|
+
console.time('arrayMatchCache');
|
|
36276
36279
|
var arrayMatchCache = {};
|
|
36277
36280
|
var arrayMatch = function arrayMatch(formulaArray, _formulaObjects, _updateValueOjects, func) {
|
|
36278
36281
|
for (var a = 0; a < formulaArray.length; a += 1) {
|
|
@@ -36305,6 +36308,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36305
36308
|
}
|
|
36306
36309
|
}
|
|
36307
36310
|
};
|
|
36311
|
+
console.timeEnd('arrayMatchCache');
|
|
36312
|
+
console.time('cache1');
|
|
36308
36313
|
var _loop = function _loop() {
|
|
36309
36314
|
var formulaCell = calcChains[_i12];
|
|
36310
36315
|
var key = "r".concat(formulaCell.r, "c").concat(formulaCell.c, "i").concat(formulaCell.id);
|
|
@@ -36407,6 +36412,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36407
36412
|
for (var _i12 = 0; _i12 < calcChains.length; _i12 += 1) {
|
|
36408
36413
|
if (_loop()) continue;
|
|
36409
36414
|
}
|
|
36415
|
+
console.timeEnd('cache1');
|
|
36416
|
+
console.time('cache2');
|
|
36410
36417
|
Object.keys(formulaObjects).forEach(function (key) {
|
|
36411
36418
|
var formulaObject = formulaObjects[key];
|
|
36412
36419
|
arrayMatch(formulaObject.formulaArray, formulaObjects, updateValueOjects, function (childKey) {
|
|
@@ -36423,6 +36430,8 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36423
36430
|
updateValueArray.push(formulaObject);
|
|
36424
36431
|
}
|
|
36425
36432
|
});
|
|
36433
|
+
console.timeEnd('cache2');
|
|
36434
|
+
console.time('dev');
|
|
36426
36435
|
var visited = {};
|
|
36427
36436
|
var inStack = {};
|
|
36428
36437
|
var circularNodes = {};
|
|
@@ -36485,6 +36494,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36485
36494
|
}
|
|
36486
36495
|
});
|
|
36487
36496
|
}
|
|
36497
|
+
console.timeEnd('dev');
|
|
36488
36498
|
var formulaRunList = [];
|
|
36489
36499
|
var stack = updateValueArray;
|
|
36490
36500
|
var existsFormulaRunList = {};
|
|
@@ -36520,13 +36530,16 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36520
36530
|
if (_ret === 0) continue;
|
|
36521
36531
|
}
|
|
36522
36532
|
formulaRunList.reverse();
|
|
36533
|
+
console.timeEnd('execFunctionGroup-before');
|
|
36534
|
+
console.time('formulaRunList');
|
|
36535
|
+
console.log('formulaRunList', formulaRunList);
|
|
36523
36536
|
for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
|
|
36524
36537
|
var formulaCell = formulaRunList[_i14];
|
|
36525
36538
|
if (formulaCell.level === Math.max) {
|
|
36526
36539
|
continue;
|
|
36527
36540
|
}
|
|
36528
36541
|
var calc_funcStr = formulaCell.calc_funcStr;
|
|
36529
|
-
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id);
|
|
36542
|
+
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
|
|
36530
36543
|
ctx.groupValuesRefreshData.push({
|
|
36531
36544
|
r: formulaCell.r,
|
|
36532
36545
|
c: formulaCell.c,
|
|
@@ -36540,6 +36553,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36540
36553
|
f: v[2]
|
|
36541
36554
|
};
|
|
36542
36555
|
}
|
|
36556
|
+
console.timeEnd('formulaRunList');
|
|
36543
36557
|
ctx.formulaCache.execFunctionExist = undefined;
|
|
36544
36558
|
}
|
|
36545
36559
|
function findrangeindex(ctx, v, vp) {
|
|
@@ -40505,7 +40519,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40505
40519
|
} else {
|
|
40506
40520
|
var _d$r3;
|
|
40507
40521
|
delFunctionGroup(ctx, r, c);
|
|
40508
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40522
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40509
40523
|
curv = ___default['default'].cloneDeep((d === null || d === void 0 ? void 0 : (_d$r3 = d[r]) === null || _d$r3 === void 0 ? void 0 : _d$r3[c]) || {});
|
|
40510
40524
|
curv.v = value;
|
|
40511
40525
|
delete curv.f;
|
|
@@ -40564,7 +40578,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40564
40578
|
}
|
|
40565
40579
|
} else {
|
|
40566
40580
|
delFunctionGroup(ctx, r, c);
|
|
40567
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40581
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40568
40582
|
}
|
|
40569
40583
|
}
|
|
40570
40584
|
setCellValue(ctx, r, c, d, value);
|
|
@@ -42546,7 +42560,7 @@ function copy(ctx) {
|
|
|
42546
42560
|
}
|
|
42547
42561
|
cpString += "</tr>";
|
|
42548
42562
|
}
|
|
42549
|
-
var result = "<table border=\"1\" style=\"border-collapse:collapse\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42563
|
+
var result = "<table border=\"1\" style=\"border-collapse:collapse; font-size: 13px\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42550
42564
|
clipboard.writeHtml(result);
|
|
42551
42565
|
}
|
|
42552
42566
|
function copy2(ctx) {
|
|
@@ -42620,9 +42634,7 @@ function deepClear(ctx) {
|
|
|
42620
42634
|
var _d$r2;
|
|
42621
42635
|
var cell = d === null || d === void 0 ? void 0 : (_d$r2 = d[r]) === null || _d$r2 === void 0 ? void 0 : _d$r2[c];
|
|
42622
42636
|
d[r][c] = null;
|
|
42623
|
-
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null)
|
|
42624
|
-
delFunctionGroup(ctx, r, c, ctx.currentSheetId);
|
|
42625
|
-
}
|
|
42637
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) ;
|
|
42626
42638
|
if (hyperlinkMap && hyperlinkMap["".concat(r, "_").concat(c)]) {
|
|
42627
42639
|
delete hyperlinkMap["".concat(r, "_").concat(c)];
|
|
42628
42640
|
}
|
|
@@ -42630,6 +42642,7 @@ function deepClear(ctx) {
|
|
|
42630
42642
|
}
|
|
42631
42643
|
}
|
|
42632
42644
|
}
|
|
42645
|
+
updateFunctionGroup(ctx);
|
|
42633
42646
|
return "success";
|
|
42634
42647
|
}
|
|
42635
42648
|
function deleteSelectedCellText(ctx, deep) {
|
|
@@ -42672,7 +42685,6 @@ function deleteSelectedCellText(ctx, deep) {
|
|
|
42672
42685
|
delete cell.v;
|
|
42673
42686
|
if (cell.f != null) {
|
|
42674
42687
|
delete cell.f;
|
|
42675
|
-
delFunctionGroup(ctx, r, c, ctx.currentSheetId);
|
|
42676
42688
|
delete cell.spl;
|
|
42677
42689
|
}
|
|
42678
42690
|
if (cell.ct != null && cell.ct.t === "inlineStr") {
|
|
@@ -42687,6 +42699,9 @@ function deleteSelectedCellText(ctx, deep) {
|
|
|
42687
42699
|
}
|
|
42688
42700
|
}
|
|
42689
42701
|
}
|
|
42702
|
+
console.time('deleteSelectedCellText');
|
|
42703
|
+
updateFunctionGroup(ctx);
|
|
42704
|
+
console.timeEnd('deleteSelectedCellText');
|
|
42690
42705
|
}
|
|
42691
42706
|
return "success";
|
|
42692
42707
|
}
|
|
@@ -46743,29 +46758,39 @@ function calculateSheetFromula(ctx, id, isrefresh) {
|
|
|
46743
46758
|
}
|
|
46744
46759
|
console.timeEnd("calcTime:".concat(id));
|
|
46745
46760
|
}
|
|
46746
|
-
function
|
|
46761
|
+
function updateFunctionGroupBySheetId(ctx, id) {
|
|
46762
|
+
var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3;
|
|
46747
46763
|
var luckysheetfile = ctx.luckysheetfile;
|
|
46748
|
-
|
|
46749
|
-
|
|
46750
|
-
|
|
46751
|
-
|
|
46752
|
-
|
|
46753
|
-
for (var
|
|
46754
|
-
|
|
46755
|
-
|
|
46756
|
-
|
|
46757
|
-
continue;
|
|
46758
|
-
}
|
|
46759
|
-
var cc = {
|
|
46760
|
-
r: r,
|
|
46761
|
-
c: c,
|
|
46762
|
-
id: file.id,
|
|
46763
|
-
f: cell === null || cell === void 0 ? void 0 : cell.f
|
|
46764
|
-
};
|
|
46765
|
-
calcChain.push(cc);
|
|
46764
|
+
var index = getSheetIndex(ctx, id);
|
|
46765
|
+
var file = luckysheetfile[index];
|
|
46766
|
+
var calcChain = [];
|
|
46767
|
+
var rows = (_ctx$luckysheetfile$i = (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2.data) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : _ctx$luckysheetfile$i3.length) !== null && _ctx$luckysheetfile$i !== void 0 ? _ctx$luckysheetfile$i : 0;
|
|
46768
|
+
for (var r = 0; r < rows; r += 1) {
|
|
46769
|
+
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
46770
|
+
var cell = ctx.luckysheetfile[index].data[r][c];
|
|
46771
|
+
if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
|
|
46772
|
+
continue;
|
|
46766
46773
|
}
|
|
46774
|
+
var cc = {
|
|
46775
|
+
r: r,
|
|
46776
|
+
c: c,
|
|
46777
|
+
id: file.id,
|
|
46778
|
+
f: cell === null || cell === void 0 ? void 0 : cell.f
|
|
46779
|
+
};
|
|
46780
|
+
calcChain.push(cc);
|
|
46767
46781
|
}
|
|
46768
|
-
|
|
46782
|
+
}
|
|
46783
|
+
file.calcChain = calcChain;
|
|
46784
|
+
}
|
|
46785
|
+
function updateFunctionGroup(ctx, id) {
|
|
46786
|
+
if (id) {
|
|
46787
|
+
updateFunctionGroupBySheetId(ctx, id);
|
|
46788
|
+
return;
|
|
46789
|
+
}
|
|
46790
|
+
var luckysheetfile = ctx.luckysheetfile;
|
|
46791
|
+
for (var index = 0; index < luckysheetfile.length; index++) {
|
|
46792
|
+
var file = luckysheetfile[index];
|
|
46793
|
+
updateFunctionGroupBySheetId(ctx, file.id);
|
|
46769
46794
|
}
|
|
46770
46795
|
}
|
|
46771
46796
|
function parseCellReferences(expression) {
|
|
@@ -47627,8 +47652,11 @@ function runExecFunction(ctx, range, index, data) {
|
|
|
47627
47652
|
}
|
|
47628
47653
|
}
|
|
47629
47654
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
47655
|
+
console.time('execFunctionGroup');
|
|
47630
47656
|
execFunctionGroup(ctx, null, null, null, null, data);
|
|
47657
|
+
console.timeEnd('execFunctionGroup');
|
|
47631
47658
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
47659
|
+
updateFunctionGroup(ctx);
|
|
47632
47660
|
}
|
|
47633
47661
|
function jfrefreshgrid(ctx, data, range) {
|
|
47634
47662
|
var isRunExecFunction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
@@ -47639,6 +47667,7 @@ function jfrefreshgrid(ctx, data, range) {
|
|
|
47639
47667
|
range = ctx.luckysheet_select_save;
|
|
47640
47668
|
if (range == null) return;
|
|
47641
47669
|
}
|
|
47670
|
+
console.log('isRunExecFunction', isRunExecFunction);
|
|
47642
47671
|
if (isRunExecFunction) {
|
|
47643
47672
|
runExecFunction(ctx, range, ctx.currentSheetId, data);
|
|
47644
47673
|
}
|
|
@@ -48904,8 +48933,9 @@ function autoSelectionFormula(ctx, cellInput, fxInput, formula, cache) {
|
|
|
48904
48933
|
});
|
|
48905
48934
|
if (!isfalse) {
|
|
48906
48935
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
48907
|
-
execFunctionGroup(ctx, null, null, null, null, flowdata);
|
|
48936
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, false);
|
|
48908
48937
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
48938
|
+
updateFunctionGroup(ctx);
|
|
48909
48939
|
}
|
|
48910
48940
|
}
|
|
48911
48941
|
function cancelPaintModel(ctx) {
|
|
@@ -55936,6 +55966,23 @@ function getSheetWithLatestCelldata(ctx) {
|
|
|
55936
55966
|
});
|
|
55937
55967
|
}
|
|
55938
55968
|
|
|
55969
|
+
var FORMAT_LIST = {
|
|
55970
|
+
bg: 1,
|
|
55971
|
+
ff: 1,
|
|
55972
|
+
fc: 1,
|
|
55973
|
+
bl: 1,
|
|
55974
|
+
it: 1,
|
|
55975
|
+
fs: 1,
|
|
55976
|
+
cl: 1,
|
|
55977
|
+
un: 1,
|
|
55978
|
+
vt: 1,
|
|
55979
|
+
ht: 1,
|
|
55980
|
+
mc: 1,
|
|
55981
|
+
tr: 1,
|
|
55982
|
+
tb: 1,
|
|
55983
|
+
rt: 1,
|
|
55984
|
+
qp: 1
|
|
55985
|
+
};
|
|
55939
55986
|
function getCellValue$1(ctx, row, column) {
|
|
55940
55987
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
55941
55988
|
if (!___default['default'].isNumber(row) || !___default['default'].isNumber(column)) {
|
|
@@ -55975,23 +56022,7 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55975
56022
|
}
|
|
55976
56023
|
var sheet = getSheet(ctx, options);
|
|
55977
56024
|
var data = sheet.data;
|
|
55978
|
-
var formatList =
|
|
55979
|
-
bg: 1,
|
|
55980
|
-
ff: 1,
|
|
55981
|
-
fc: 1,
|
|
55982
|
-
bl: 1,
|
|
55983
|
-
it: 1,
|
|
55984
|
-
fs: 1,
|
|
55985
|
-
cl: 1,
|
|
55986
|
-
un: 1,
|
|
55987
|
-
vt: 1,
|
|
55988
|
-
ht: 1,
|
|
55989
|
-
mc: 1,
|
|
55990
|
-
tr: 1,
|
|
55991
|
-
tb: 1,
|
|
55992
|
-
rt: 1,
|
|
55993
|
-
qp: 1
|
|
55994
|
-
};
|
|
56025
|
+
var formatList = FORMAT_LIST;
|
|
55995
56026
|
if (value == null || value.toString().length === 0) {
|
|
55996
56027
|
delFunctionGroup(ctx, row, column);
|
|
55997
56028
|
setCellValue(ctx, row, column, data, value);
|
|
@@ -56068,6 +56099,165 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
56068
56099
|
}
|
|
56069
56100
|
}
|
|
56070
56101
|
}
|
|
56102
|
+
function setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells) {
|
|
56103
|
+
var data = sheet.data;
|
|
56104
|
+
var sheetId = sheet.id;
|
|
56105
|
+
if (value == null || value.toString().length === 0) {
|
|
56106
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56107
|
+
setCellValue(ctx, row, column, data, value);
|
|
56108
|
+
return;
|
|
56109
|
+
}
|
|
56110
|
+
if (value instanceof Object) {
|
|
56111
|
+
var _data$row2;
|
|
56112
|
+
var curv = {};
|
|
56113
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56114
|
+
var needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56115
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56116
|
+
length: needAddRow
|
|
56117
|
+
}).map(function () {
|
|
56118
|
+
return [];
|
|
56119
|
+
})));
|
|
56120
|
+
}
|
|
56121
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row2 = data[row]) === null || _data$row2 === void 0 ? void 0 : _data$row2[column]) == null) {
|
|
56122
|
+
data[row][column] = {};
|
|
56123
|
+
}
|
|
56124
|
+
var cell = data[row][column];
|
|
56125
|
+
if (value.f != null && value.v == null) {
|
|
56126
|
+
curv.f = value.f;
|
|
56127
|
+
if (value.ct != null) {
|
|
56128
|
+
curv.ct = value.ct;
|
|
56129
|
+
}
|
|
56130
|
+
Object.assign(cell, curv);
|
|
56131
|
+
if (___default['default'].isString(value.f)) {
|
|
56132
|
+
formulaCells.push({
|
|
56133
|
+
r: row,
|
|
56134
|
+
c: column,
|
|
56135
|
+
f: value.f,
|
|
56136
|
+
ct: value.ct
|
|
56137
|
+
});
|
|
56138
|
+
} else {
|
|
56139
|
+
updateCell(ctx, row, column, cellInput, curv);
|
|
56140
|
+
}
|
|
56141
|
+
} else {
|
|
56142
|
+
var needupdateFdev = false;
|
|
56143
|
+
var needUpdateM = false;
|
|
56144
|
+
var oldF = cell.f;
|
|
56145
|
+
var nf = value.f;
|
|
56146
|
+
var oldV = cell.v;
|
|
56147
|
+
var nv = value.v;
|
|
56148
|
+
if (value.ct != null) {
|
|
56149
|
+
curv.ct = value.ct;
|
|
56150
|
+
}
|
|
56151
|
+
if (value.f != null) {
|
|
56152
|
+
curv.f = value.f;
|
|
56153
|
+
}
|
|
56154
|
+
if (value.v != null) {
|
|
56155
|
+
curv.v = value.v;
|
|
56156
|
+
} else {
|
|
56157
|
+
curv.v = cell.v;
|
|
56158
|
+
}
|
|
56159
|
+
if (value.m != null) {
|
|
56160
|
+
curv.m = value.m;
|
|
56161
|
+
}
|
|
56162
|
+
if (nf !== undefined && nf !== oldF) {
|
|
56163
|
+
needupdateFdev = true;
|
|
56164
|
+
needUpdateM = true;
|
|
56165
|
+
}
|
|
56166
|
+
if (nv !== undefined && String(nv) !== String(oldV)) {
|
|
56167
|
+
needUpdateM = true;
|
|
56168
|
+
}
|
|
56169
|
+
if (needupdateFdev) {
|
|
56170
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56171
|
+
}
|
|
56172
|
+
if (needUpdateM) {
|
|
56173
|
+
setCellValue(ctx, row, column, data, curv);
|
|
56174
|
+
}
|
|
56175
|
+
}
|
|
56176
|
+
___default['default'].forEach(value, function (v, attr) {
|
|
56177
|
+
if (attr in FORMAT_LIST) {
|
|
56178
|
+
var foucsStatus = v;
|
|
56179
|
+
if (attr === "ht") {
|
|
56180
|
+
if (foucsStatus === "left") {
|
|
56181
|
+
foucsStatus = "1";
|
|
56182
|
+
} else if (foucsStatus === "center") {
|
|
56183
|
+
foucsStatus = "0";
|
|
56184
|
+
} else if (foucsStatus === "right") {
|
|
56185
|
+
foucsStatus = "2";
|
|
56186
|
+
}
|
|
56187
|
+
} else if (attr === "vt") {
|
|
56188
|
+
if (foucsStatus === "top") {
|
|
56189
|
+
foucsStatus = "1";
|
|
56190
|
+
} else if (foucsStatus === "middle") {
|
|
56191
|
+
foucsStatus = "0";
|
|
56192
|
+
} else if (foucsStatus === "bottom") {
|
|
56193
|
+
foucsStatus = "2";
|
|
56194
|
+
}
|
|
56195
|
+
} else if (attr === "tb") {
|
|
56196
|
+
if (foucsStatus === "overflow") {
|
|
56197
|
+
foucsStatus = "1";
|
|
56198
|
+
} else if (foucsStatus === "clip") {
|
|
56199
|
+
foucsStatus = "0";
|
|
56200
|
+
} else if (foucsStatus === "wrap") {
|
|
56201
|
+
foucsStatus = "2";
|
|
56202
|
+
}
|
|
56203
|
+
} else if (attr === "tr") {
|
|
56204
|
+
if (foucsStatus === "none") {
|
|
56205
|
+
foucsStatus = "0";
|
|
56206
|
+
} else if (foucsStatus === "angleup") {
|
|
56207
|
+
foucsStatus = "1";
|
|
56208
|
+
} else if (foucsStatus === "angledown") {
|
|
56209
|
+
foucsStatus = "2";
|
|
56210
|
+
} else if (foucsStatus === "vertical") {
|
|
56211
|
+
foucsStatus = "3";
|
|
56212
|
+
} else if (foucsStatus === "rotation-up") {
|
|
56213
|
+
foucsStatus = "4";
|
|
56214
|
+
} else if (foucsStatus === "rotation-down") {
|
|
56215
|
+
foucsStatus = "5";
|
|
56216
|
+
}
|
|
56217
|
+
}
|
|
56218
|
+
if (cell && ___default['default'].isPlainObject(cell)) {
|
|
56219
|
+
if (cell.ct != null && Array.isArray(cell.ct.s) && ___default['default'].isPlainObject(cell.ct.s[0])) {
|
|
56220
|
+
cell.ct.s.forEach(function (item) {
|
|
56221
|
+
item[attr] = foucsStatus;
|
|
56222
|
+
});
|
|
56223
|
+
}
|
|
56224
|
+
cell[attr] = foucsStatus;
|
|
56225
|
+
}
|
|
56226
|
+
} else {
|
|
56227
|
+
cell[attr] = v;
|
|
56228
|
+
}
|
|
56229
|
+
});
|
|
56230
|
+
data[row][column] = cell;
|
|
56231
|
+
} else {
|
|
56232
|
+
var text = value.toString();
|
|
56233
|
+
if (text.substr(0, 1) === "=" && text.length > 1) {
|
|
56234
|
+
var _data$row3;
|
|
56235
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56236
|
+
var _needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56237
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56238
|
+
length: _needAddRow
|
|
56239
|
+
}).map(function () {
|
|
56240
|
+
return [];
|
|
56241
|
+
})));
|
|
56242
|
+
}
|
|
56243
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row3 = data[row]) === null || _data$row3 === void 0 ? void 0 : _data$row3[column]) == null) {
|
|
56244
|
+
data[row][column] = {};
|
|
56245
|
+
}
|
|
56246
|
+
var _cell = data[row][column];
|
|
56247
|
+
_cell.f = text;
|
|
56248
|
+
formulaCells.push({
|
|
56249
|
+
r: row,
|
|
56250
|
+
c: column,
|
|
56251
|
+
f: text
|
|
56252
|
+
});
|
|
56253
|
+
} else if (text.substr(0, 5) === "<span") {
|
|
56254
|
+
updateCell(ctx, row, column, cellInput, value);
|
|
56255
|
+
} else {
|
|
56256
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56257
|
+
setCellValue(ctx, row, column, data, value);
|
|
56258
|
+
}
|
|
56259
|
+
}
|
|
56260
|
+
}
|
|
56071
56261
|
function clearCell(ctx, row, column) {
|
|
56072
56262
|
var _sheet$data, _sheet$data$row;
|
|
56073
56263
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -56388,7 +56578,7 @@ function setSelection(ctx, range, options) {
|
|
|
56388
56578
|
function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
56389
56579
|
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
56390
56580
|
var setMerge = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
56391
|
-
if (data == null) {
|
|
56581
|
+
if (data == null || !Array.isArray(data)) {
|
|
56392
56582
|
throw INVALID_PARAMS;
|
|
56393
56583
|
}
|
|
56394
56584
|
if (range instanceof Array) {
|
|
@@ -56397,27 +56587,45 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56397
56587
|
if (!___default['default'].isPlainObject(range)) {
|
|
56398
56588
|
throw INVALID_PARAMS;
|
|
56399
56589
|
}
|
|
56400
|
-
var
|
|
56401
|
-
var
|
|
56402
|
-
if (
|
|
56590
|
+
var rangeRow = range.row;
|
|
56591
|
+
var rangeColumn = range.column;
|
|
56592
|
+
if (!Array.isArray(rangeRow) || !Array.isArray(rangeColumn) || rangeRow.length < 2 || rangeColumn.length < 2 || !___default['default'].isNumber(rangeRow[0]) || !___default['default'].isNumber(rangeRow[1]) || !___default['default'].isNumber(rangeColumn[0]) || !___default['default'].isNumber(rangeColumn[1])) {
|
|
56593
|
+
throw INVALID_PARAMS;
|
|
56594
|
+
}
|
|
56595
|
+
var rowStart = rangeRow[0];
|
|
56596
|
+
var rowEnd = rangeRow[1];
|
|
56597
|
+
var colStart = rangeColumn[0];
|
|
56598
|
+
var colEnd = rangeColumn[1];
|
|
56599
|
+
if (rowStart < 0 || colStart < 0 || rowEnd < rowStart || colEnd < colStart) {
|
|
56600
|
+
throw INVALID_PARAMS;
|
|
56601
|
+
}
|
|
56602
|
+
var rowCount = rowEnd - rowStart + 1;
|
|
56603
|
+
var columnCount = colEnd - colStart + 1;
|
|
56604
|
+
if (!Array.isArray(data[0]) || data.length !== rowCount || data[0].length !== columnCount) {
|
|
56403
56605
|
throw new Error("data size does not match range");
|
|
56404
56606
|
}
|
|
56405
56607
|
var sheet = getSheet(ctx, options);
|
|
56608
|
+
var flowdata = sheet.data;
|
|
56609
|
+
if (!Array.isArray(flowdata)) {
|
|
56610
|
+
throw SHEET_NOT_FOUND;
|
|
56611
|
+
}
|
|
56406
56612
|
var cfg = sheet.config || {};
|
|
56407
56613
|
if (cfg.merge == null) {
|
|
56408
56614
|
cfg.merge = {};
|
|
56409
56615
|
}
|
|
56616
|
+
var formulaCells = [];
|
|
56410
56617
|
for (var i = 0; i < rowCount; i += 1) {
|
|
56411
56618
|
for (var j = 0; j < columnCount; j += 1) {
|
|
56412
|
-
var row =
|
|
56413
|
-
var column =
|
|
56414
|
-
|
|
56619
|
+
var row = rowStart + i;
|
|
56620
|
+
var column = colStart + j;
|
|
56621
|
+
var value = data[i][j];
|
|
56622
|
+
setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
|
|
56415
56623
|
if (setMerge) {
|
|
56416
|
-
var
|
|
56417
|
-
var r1 =
|
|
56418
|
-
var c1 =
|
|
56419
|
-
var rs =
|
|
56420
|
-
var cs =
|
|
56624
|
+
var _value$mc, _value$mc2, _value$mc3, _value$mc4;
|
|
56625
|
+
var r1 = value === null || value === void 0 ? void 0 : (_value$mc = value.mc) === null || _value$mc === void 0 ? void 0 : _value$mc.r;
|
|
56626
|
+
var c1 = value === null || value === void 0 ? void 0 : (_value$mc2 = value.mc) === null || _value$mc2 === void 0 ? void 0 : _value$mc2.c;
|
|
56627
|
+
var rs = value === null || value === void 0 ? void 0 : (_value$mc3 = value.mc) === null || _value$mc3 === void 0 ? void 0 : _value$mc3.rs;
|
|
56628
|
+
var cs = value === null || value === void 0 ? void 0 : (_value$mc4 = value.mc) === null || _value$mc4 === void 0 ? void 0 : _value$mc4.cs;
|
|
56421
56629
|
if (rs > 1 || cs > 1) {
|
|
56422
56630
|
cfg.merge["".concat(r1, "_").concat(c1)] = {
|
|
56423
56631
|
r: r1,
|
|
@@ -56432,18 +56640,84 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56432
56640
|
if (setMerge) {
|
|
56433
56641
|
sheet.config = cfg;
|
|
56434
56642
|
}
|
|
56643
|
+
if (formulaCells.length > 0) {
|
|
56644
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56645
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56646
|
+
var fc = formulaCells[k];
|
|
56647
|
+
var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
|
|
56648
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56649
|
+
v: v[1],
|
|
56650
|
+
f: v[2]
|
|
56651
|
+
});
|
|
56652
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56653
|
+
r: fc.r,
|
|
56654
|
+
c: fc.c,
|
|
56655
|
+
i: sheet.id
|
|
56656
|
+
});
|
|
56657
|
+
}
|
|
56658
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56659
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
|
|
56660
|
+
groupValuesRefresh(ctx);
|
|
56661
|
+
updateFunctionGroup(ctx);
|
|
56662
|
+
}
|
|
56435
56663
|
}
|
|
56436
56664
|
function setCellValues(ctx, data, cellInput) {
|
|
56665
|
+
var _data$, _data$2;
|
|
56437
56666
|
if (data == null) {
|
|
56438
56667
|
throw INVALID_PARAMS;
|
|
56439
56668
|
}
|
|
56440
|
-
|
|
56441
|
-
var
|
|
56442
|
-
|
|
56443
|
-
|
|
56444
|
-
|
|
56445
|
-
|
|
56446
|
-
|
|
56669
|
+
var pickSheet = function pickSheet(ops) {
|
|
56670
|
+
var _ops$index, _ops$id;
|
|
56671
|
+
return [(_ops$index = ops === null || ops === void 0 ? void 0 : ops.index) !== null && _ops$index !== void 0 ? _ops$index : null, (_ops$id = ops === null || ops === void 0 ? void 0 : ops.id) !== null && _ops$id !== void 0 ? _ops$id : null];
|
|
56672
|
+
};
|
|
56673
|
+
var first = pickSheet((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.ops);
|
|
56674
|
+
var canBatch = data.every(function (item) {
|
|
56675
|
+
var _pickSheet = pickSheet(item === null || item === void 0 ? void 0 : item.ops),
|
|
56676
|
+
_pickSheet2 = _slicedToArray(_pickSheet, 2),
|
|
56677
|
+
index = _pickSheet2[0],
|
|
56678
|
+
id = _pickSheet2[1];
|
|
56679
|
+
return index === first[0] && id === first[1];
|
|
56680
|
+
});
|
|
56681
|
+
if (!canBatch) {
|
|
56682
|
+
for (var j = 0; j < data.length; j += 1) {
|
|
56683
|
+
var _data$j = data[j],
|
|
56684
|
+
r = _data$j.r,
|
|
56685
|
+
c = _data$j.c,
|
|
56686
|
+
v = _data$j.v,
|
|
56687
|
+
ops = _data$j.ops;
|
|
56688
|
+
setCellValue$1(ctx, r, c, v, cellInput, ops);
|
|
56689
|
+
}
|
|
56690
|
+
return;
|
|
56691
|
+
}
|
|
56692
|
+
var sheet = getSheet(ctx, ((_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.ops) || {});
|
|
56693
|
+
var flowdata = sheet.data;
|
|
56694
|
+
if (!Array.isArray(flowdata)) {
|
|
56695
|
+
throw SHEET_NOT_FOUND;
|
|
56696
|
+
}
|
|
56697
|
+
var formulaCells = [];
|
|
56698
|
+
for (var _j = 0; _j < data.length; _j += 1) {
|
|
56699
|
+
var _data$_j = data[_j],
|
|
56700
|
+
_r = _data$_j.r,
|
|
56701
|
+
_c = _data$_j.c,
|
|
56702
|
+
_v = _data$_j.v;
|
|
56703
|
+
setCellValueInBatch(ctx, sheet, _r, _c, _v, cellInput, formulaCells);
|
|
56704
|
+
}
|
|
56705
|
+
if (formulaCells.length > 0) {
|
|
56706
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56707
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56708
|
+
var fc = formulaCells[k];
|
|
56709
|
+
var val = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, false);
|
|
56710
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56711
|
+
v: val[1],
|
|
56712
|
+
f: val[2]
|
|
56713
|
+
});
|
|
56714
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56715
|
+
r: fc.r,
|
|
56716
|
+
c: fc.c,
|
|
56717
|
+
i: sheet.id
|
|
56718
|
+
});
|
|
56719
|
+
}
|
|
56720
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56447
56721
|
}
|
|
56448
56722
|
}
|
|
56449
56723
|
function setCellFormatByRange(ctx, attr, value, range) {
|
|
@@ -56550,6 +56824,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56550
56824
|
celldataToData: celldataToData,
|
|
56551
56825
|
getCellValue: getCellValue$1,
|
|
56552
56826
|
setCellValue: setCellValue$1,
|
|
56827
|
+
setCellValueInBatch: setCellValueInBatch,
|
|
56553
56828
|
clearCell: clearCell,
|
|
56554
56829
|
setCellFormat: setCellFormat,
|
|
56555
56830
|
autoFillCell: autoFillCell,
|
|
@@ -56581,6 +56856,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56581
56856
|
showSheet: showSheet,
|
|
56582
56857
|
copySheet: copySheet,
|
|
56583
56858
|
calculateSheetFromula: calculateSheetFromula,
|
|
56859
|
+
updateFunctionGroupBySheetId: updateFunctionGroupBySheetId,
|
|
56584
56860
|
updateFunctionGroup: updateFunctionGroup,
|
|
56585
56861
|
calculateSheetByCells: calculateSheetByCells,
|
|
56586
56862
|
addSheet: addSheet$1,
|
|
@@ -58954,6 +59230,7 @@ function postPasteCut(ctx, source, target, RowlChange) {
|
|
|
58954
59230
|
ctx.luckysheetfile[getSheetIndex(ctx, target.sheetId)].dataVerification = target.curDataVerification;
|
|
58955
59231
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
58956
59232
|
execFunctionGroup(ctx, null, null, null, null, target.curData);
|
|
59233
|
+
updateFunctionGroup(ctx);
|
|
58957
59234
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
58958
59235
|
storeSheetParamALL(ctx);
|
|
58959
59236
|
}
|
|
@@ -60448,6 +60725,7 @@ function _handlePasteByLeanklin() {
|
|
|
60448
60725
|
}
|
|
60449
60726
|
return _context2.abrupt("return");
|
|
60450
60727
|
case 6:
|
|
60728
|
+
console.time('handlePasteByLeanklin');
|
|
60451
60729
|
rows = selectRange.row;
|
|
60452
60730
|
columns = selectRange.column;
|
|
60453
60731
|
_getClipboardData = getClipboardData(ctx, e, copyRich, rows[0], columns[0]), copyData = _getClipboardData.data, borderInfo = _getClipboardData.borderInfo, merge = _getClipboardData.merge;
|
|
@@ -60484,14 +60762,17 @@ function _handlePasteByLeanklin() {
|
|
|
60484
60762
|
column: column
|
|
60485
60763
|
};
|
|
60486
60764
|
if (isAllowEdit(ctx, [range])) {
|
|
60487
|
-
_context2.next =
|
|
60765
|
+
_context2.next = 25;
|
|
60488
60766
|
break;
|
|
60489
60767
|
}
|
|
60490
60768
|
return _context2.abrupt("return");
|
|
60491
|
-
case
|
|
60769
|
+
case 25:
|
|
60770
|
+
console.time('setCellValuesByRange');
|
|
60492
60771
|
setCellValuesByRange(ctx, pasteData, range, null);
|
|
60772
|
+
console.timeEnd('setCellValuesByRange');
|
|
60493
60773
|
ctx.luckysheet_select_save = [range];
|
|
60494
|
-
|
|
60774
|
+
console.timeEnd('handlePasteByLeanklin');
|
|
60775
|
+
case 30:
|
|
60495
60776
|
case "end":
|
|
60496
60777
|
return _context2.stop();
|
|
60497
60778
|
}
|
|
@@ -34,7 +34,7 @@ export declare function delFunctionGroup(ctx: Context, r: number, c: number, id?
|
|
|
34
34
|
export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: number, id?: string): void;
|
|
35
35
|
export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, isrefresh?: boolean, notInsertFunc?: boolean): any[];
|
|
36
36
|
export declare function groupValuesRefresh(ctx: Context): void;
|
|
37
|
-
export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void;
|
|
37
|
+
export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean, notInsertFunc?: boolean): void;
|
|
38
38
|
export declare function createFormulaRangeSelect(ctx: Context, select: {
|
|
39
39
|
rangeIndex: number;
|
|
40
40
|
} & Rect): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.34",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "father-build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@leankylin-sheet/formula-parser": "5.2.
|
|
16
|
+
"@leankylin-sheet/formula-parser": "5.2.34",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|