@leankylin-sheet/core 5.2.32 → 5.2.33
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/index.esm.js +300 -45
- package/dist/index.js +300 -45
- package/dist/modules/formula.d.ts +1 -1
- package/package.json +2 -2
package/dist/api/cell.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export declare function getCellValue(ctx: Context, row: number, column: number,
|
|
|
5
5
|
type?: keyof Cell;
|
|
6
6
|
}): any;
|
|
7
7
|
export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
|
|
8
|
+
export declare function setCellValueInBatch(ctx: Context, sheet: any, row: number, column: number, value: any, cellInput: HTMLDivElement | null, formulaCells: Array<{
|
|
9
|
+
r: number;
|
|
10
|
+
c: number;
|
|
11
|
+
f: string;
|
|
12
|
+
ct?: any;
|
|
13
|
+
}>): void;
|
|
8
14
|
export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
|
|
9
15
|
export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
|
|
10
16
|
export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
|
package/dist/index.esm.js
CHANGED
|
@@ -36162,7 +36162,7 @@ function execfunction(ctx, txt, r, c, id, isrefresh, notInsertFunc) {
|
|
|
36162
36162
|
f: txt
|
|
36163
36163
|
};else data[r][c].f = txt;
|
|
36164
36164
|
}
|
|
36165
|
-
execFunctionGroup(ctx, r, c, _.isNil(formulaError) ? result : formulaError, id);
|
|
36165
|
+
execFunctionGroup(ctx, r, c, _.isNil(formulaError) ? result : formulaError, id, false, notInsertFunc);
|
|
36166
36166
|
if (!hadFormulaField && data && data[r] && data[r][c]) {
|
|
36167
36167
|
delete data[r][c].f;
|
|
36168
36168
|
}
|
|
@@ -36226,6 +36226,7 @@ function groupValuesRefresh(ctx) {
|
|
|
36226
36226
|
}
|
|
36227
36227
|
function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
36228
36228
|
var isForce = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
36229
|
+
var notInsertFunc = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
36229
36230
|
if (_.isNil(data)) {
|
|
36230
36231
|
data = getFlowdata(ctx);
|
|
36231
36232
|
}
|
|
@@ -36510,13 +36511,14 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36510
36511
|
if (_ret === 0) continue;
|
|
36511
36512
|
}
|
|
36512
36513
|
formulaRunList.reverse();
|
|
36514
|
+
console.time('formulaRunList');
|
|
36513
36515
|
for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
|
|
36514
36516
|
var formulaCell = formulaRunList[_i14];
|
|
36515
36517
|
if (formulaCell.level === Math.max) {
|
|
36516
36518
|
continue;
|
|
36517
36519
|
}
|
|
36518
36520
|
var calc_funcStr = formulaCell.calc_funcStr;
|
|
36519
|
-
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id);
|
|
36521
|
+
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
|
|
36520
36522
|
ctx.groupValuesRefreshData.push({
|
|
36521
36523
|
r: formulaCell.r,
|
|
36522
36524
|
c: formulaCell.c,
|
|
@@ -36530,6 +36532,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36530
36532
|
f: v[2]
|
|
36531
36533
|
};
|
|
36532
36534
|
}
|
|
36535
|
+
console.timeEnd('formulaRunList');
|
|
36533
36536
|
ctx.formulaCache.execFunctionExist = undefined;
|
|
36534
36537
|
}
|
|
36535
36538
|
function findrangeindex(ctx, v, vp) {
|
|
@@ -40495,7 +40498,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40495
40498
|
} else {
|
|
40496
40499
|
var _d$r3;
|
|
40497
40500
|
delFunctionGroup(ctx, r, c);
|
|
40498
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40501
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40499
40502
|
curv = _.cloneDeep((d === null || d === void 0 ? void 0 : (_d$r3 = d[r]) === null || _d$r3 === void 0 ? void 0 : _d$r3[c]) || {});
|
|
40500
40503
|
curv.v = value;
|
|
40501
40504
|
delete curv.f;
|
|
@@ -40554,7 +40557,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40554
40557
|
}
|
|
40555
40558
|
} else {
|
|
40556
40559
|
delFunctionGroup(ctx, r, c);
|
|
40557
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40560
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40558
40561
|
}
|
|
40559
40562
|
}
|
|
40560
40563
|
setCellValue(ctx, r, c, d, value);
|
|
@@ -42536,7 +42539,7 @@ function copy(ctx) {
|
|
|
42536
42539
|
}
|
|
42537
42540
|
cpString += "</tr>";
|
|
42538
42541
|
}
|
|
42539
|
-
var result = "<table border=\"1\" style=\"border-collapse:collapse\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42542
|
+
var result = "<table border=\"1\" style=\"border-collapse:collapse; font-size: 13px\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42540
42543
|
clipboard.writeHtml(result);
|
|
42541
42544
|
}
|
|
42542
42545
|
function copy2(ctx) {
|
|
@@ -47619,6 +47622,7 @@ function runExecFunction(ctx, range, index, data) {
|
|
|
47619
47622
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
47620
47623
|
execFunctionGroup(ctx, null, null, null, null, data);
|
|
47621
47624
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
47625
|
+
updateFunctionGroup(ctx);
|
|
47622
47626
|
}
|
|
47623
47627
|
function jfrefreshgrid(ctx, data, range) {
|
|
47624
47628
|
var isRunExecFunction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
@@ -48894,8 +48898,9 @@ function autoSelectionFormula(ctx, cellInput, fxInput, formula, cache) {
|
|
|
48894
48898
|
});
|
|
48895
48899
|
if (!isfalse) {
|
|
48896
48900
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
48897
|
-
execFunctionGroup(ctx, null, null, null, null, flowdata);
|
|
48901
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, false);
|
|
48898
48902
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
48903
|
+
updateFunctionGroup(ctx);
|
|
48899
48904
|
}
|
|
48900
48905
|
}
|
|
48901
48906
|
function cancelPaintModel(ctx) {
|
|
@@ -55926,6 +55931,23 @@ function getSheetWithLatestCelldata(ctx) {
|
|
|
55926
55931
|
});
|
|
55927
55932
|
}
|
|
55928
55933
|
|
|
55934
|
+
var FORMAT_LIST = {
|
|
55935
|
+
bg: 1,
|
|
55936
|
+
ff: 1,
|
|
55937
|
+
fc: 1,
|
|
55938
|
+
bl: 1,
|
|
55939
|
+
it: 1,
|
|
55940
|
+
fs: 1,
|
|
55941
|
+
cl: 1,
|
|
55942
|
+
un: 1,
|
|
55943
|
+
vt: 1,
|
|
55944
|
+
ht: 1,
|
|
55945
|
+
mc: 1,
|
|
55946
|
+
tr: 1,
|
|
55947
|
+
tb: 1,
|
|
55948
|
+
rt: 1,
|
|
55949
|
+
qp: 1
|
|
55950
|
+
};
|
|
55929
55951
|
function getCellValue$1(ctx, row, column) {
|
|
55930
55952
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
55931
55953
|
if (!_.isNumber(row) || !_.isNumber(column)) {
|
|
@@ -55965,23 +55987,7 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55965
55987
|
}
|
|
55966
55988
|
var sheet = getSheet(ctx, options);
|
|
55967
55989
|
var data = sheet.data;
|
|
55968
|
-
var formatList =
|
|
55969
|
-
bg: 1,
|
|
55970
|
-
ff: 1,
|
|
55971
|
-
fc: 1,
|
|
55972
|
-
bl: 1,
|
|
55973
|
-
it: 1,
|
|
55974
|
-
fs: 1,
|
|
55975
|
-
cl: 1,
|
|
55976
|
-
un: 1,
|
|
55977
|
-
vt: 1,
|
|
55978
|
-
ht: 1,
|
|
55979
|
-
mc: 1,
|
|
55980
|
-
tr: 1,
|
|
55981
|
-
tb: 1,
|
|
55982
|
-
rt: 1,
|
|
55983
|
-
qp: 1
|
|
55984
|
-
};
|
|
55990
|
+
var formatList = FORMAT_LIST;
|
|
55985
55991
|
if (value == null || value.toString().length === 0) {
|
|
55986
55992
|
delFunctionGroup(ctx, row, column);
|
|
55987
55993
|
setCellValue(ctx, row, column, data, value);
|
|
@@ -56058,6 +56064,165 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
56058
56064
|
}
|
|
56059
56065
|
}
|
|
56060
56066
|
}
|
|
56067
|
+
function setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells) {
|
|
56068
|
+
var data = sheet.data;
|
|
56069
|
+
var sheetId = sheet.id;
|
|
56070
|
+
if (value == null || value.toString().length === 0) {
|
|
56071
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56072
|
+
setCellValue(ctx, row, column, data, value);
|
|
56073
|
+
return;
|
|
56074
|
+
}
|
|
56075
|
+
if (value instanceof Object) {
|
|
56076
|
+
var _data$row2;
|
|
56077
|
+
var curv = {};
|
|
56078
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56079
|
+
var needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56080
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56081
|
+
length: needAddRow
|
|
56082
|
+
}).map(function () {
|
|
56083
|
+
return [];
|
|
56084
|
+
})));
|
|
56085
|
+
}
|
|
56086
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row2 = data[row]) === null || _data$row2 === void 0 ? void 0 : _data$row2[column]) == null) {
|
|
56087
|
+
data[row][column] = {};
|
|
56088
|
+
}
|
|
56089
|
+
var cell = data[row][column];
|
|
56090
|
+
if (value.f != null && value.v == null) {
|
|
56091
|
+
curv.f = value.f;
|
|
56092
|
+
if (value.ct != null) {
|
|
56093
|
+
curv.ct = value.ct;
|
|
56094
|
+
}
|
|
56095
|
+
Object.assign(cell, curv);
|
|
56096
|
+
if (_.isString(value.f)) {
|
|
56097
|
+
formulaCells.push({
|
|
56098
|
+
r: row,
|
|
56099
|
+
c: column,
|
|
56100
|
+
f: value.f,
|
|
56101
|
+
ct: value.ct
|
|
56102
|
+
});
|
|
56103
|
+
} else {
|
|
56104
|
+
updateCell(ctx, row, column, cellInput, curv);
|
|
56105
|
+
}
|
|
56106
|
+
} else {
|
|
56107
|
+
var needupdateFdev = false;
|
|
56108
|
+
var needUpdateM = false;
|
|
56109
|
+
var oldF = cell.f;
|
|
56110
|
+
var nf = value.f;
|
|
56111
|
+
var oldV = cell.v;
|
|
56112
|
+
var nv = value.v;
|
|
56113
|
+
if (value.ct != null) {
|
|
56114
|
+
curv.ct = value.ct;
|
|
56115
|
+
}
|
|
56116
|
+
if (value.f != null) {
|
|
56117
|
+
curv.f = value.f;
|
|
56118
|
+
}
|
|
56119
|
+
if (value.v != null) {
|
|
56120
|
+
curv.v = value.v;
|
|
56121
|
+
} else {
|
|
56122
|
+
curv.v = cell.v;
|
|
56123
|
+
}
|
|
56124
|
+
if (value.m != null) {
|
|
56125
|
+
curv.m = value.m;
|
|
56126
|
+
}
|
|
56127
|
+
if (nf !== undefined && nf !== oldF) {
|
|
56128
|
+
needupdateFdev = true;
|
|
56129
|
+
needUpdateM = true;
|
|
56130
|
+
}
|
|
56131
|
+
if (nv !== undefined && String(nv) !== String(oldV)) {
|
|
56132
|
+
needUpdateM = true;
|
|
56133
|
+
}
|
|
56134
|
+
if (needupdateFdev) {
|
|
56135
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56136
|
+
}
|
|
56137
|
+
if (needUpdateM) {
|
|
56138
|
+
setCellValue(ctx, row, column, data, curv);
|
|
56139
|
+
}
|
|
56140
|
+
}
|
|
56141
|
+
_.forEach(value, function (v, attr) {
|
|
56142
|
+
if (attr in FORMAT_LIST) {
|
|
56143
|
+
var foucsStatus = v;
|
|
56144
|
+
if (attr === "ht") {
|
|
56145
|
+
if (foucsStatus === "left") {
|
|
56146
|
+
foucsStatus = "1";
|
|
56147
|
+
} else if (foucsStatus === "center") {
|
|
56148
|
+
foucsStatus = "0";
|
|
56149
|
+
} else if (foucsStatus === "right") {
|
|
56150
|
+
foucsStatus = "2";
|
|
56151
|
+
}
|
|
56152
|
+
} else if (attr === "vt") {
|
|
56153
|
+
if (foucsStatus === "top") {
|
|
56154
|
+
foucsStatus = "1";
|
|
56155
|
+
} else if (foucsStatus === "middle") {
|
|
56156
|
+
foucsStatus = "0";
|
|
56157
|
+
} else if (foucsStatus === "bottom") {
|
|
56158
|
+
foucsStatus = "2";
|
|
56159
|
+
}
|
|
56160
|
+
} else if (attr === "tb") {
|
|
56161
|
+
if (foucsStatus === "overflow") {
|
|
56162
|
+
foucsStatus = "1";
|
|
56163
|
+
} else if (foucsStatus === "clip") {
|
|
56164
|
+
foucsStatus = "0";
|
|
56165
|
+
} else if (foucsStatus === "wrap") {
|
|
56166
|
+
foucsStatus = "2";
|
|
56167
|
+
}
|
|
56168
|
+
} else if (attr === "tr") {
|
|
56169
|
+
if (foucsStatus === "none") {
|
|
56170
|
+
foucsStatus = "0";
|
|
56171
|
+
} else if (foucsStatus === "angleup") {
|
|
56172
|
+
foucsStatus = "1";
|
|
56173
|
+
} else if (foucsStatus === "angledown") {
|
|
56174
|
+
foucsStatus = "2";
|
|
56175
|
+
} else if (foucsStatus === "vertical") {
|
|
56176
|
+
foucsStatus = "3";
|
|
56177
|
+
} else if (foucsStatus === "rotation-up") {
|
|
56178
|
+
foucsStatus = "4";
|
|
56179
|
+
} else if (foucsStatus === "rotation-down") {
|
|
56180
|
+
foucsStatus = "5";
|
|
56181
|
+
}
|
|
56182
|
+
}
|
|
56183
|
+
if (cell && _.isPlainObject(cell)) {
|
|
56184
|
+
if (cell.ct != null && Array.isArray(cell.ct.s) && _.isPlainObject(cell.ct.s[0])) {
|
|
56185
|
+
cell.ct.s.forEach(function (item) {
|
|
56186
|
+
item[attr] = foucsStatus;
|
|
56187
|
+
});
|
|
56188
|
+
}
|
|
56189
|
+
cell[attr] = foucsStatus;
|
|
56190
|
+
}
|
|
56191
|
+
} else {
|
|
56192
|
+
cell[attr] = v;
|
|
56193
|
+
}
|
|
56194
|
+
});
|
|
56195
|
+
data[row][column] = cell;
|
|
56196
|
+
} else {
|
|
56197
|
+
var text = value.toString();
|
|
56198
|
+
if (text.substr(0, 1) === "=" && text.length > 1) {
|
|
56199
|
+
var _data$row3;
|
|
56200
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56201
|
+
var _needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56202
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56203
|
+
length: _needAddRow
|
|
56204
|
+
}).map(function () {
|
|
56205
|
+
return [];
|
|
56206
|
+
})));
|
|
56207
|
+
}
|
|
56208
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row3 = data[row]) === null || _data$row3 === void 0 ? void 0 : _data$row3[column]) == null) {
|
|
56209
|
+
data[row][column] = {};
|
|
56210
|
+
}
|
|
56211
|
+
var _cell = data[row][column];
|
|
56212
|
+
_cell.f = text;
|
|
56213
|
+
formulaCells.push({
|
|
56214
|
+
r: row,
|
|
56215
|
+
c: column,
|
|
56216
|
+
f: text
|
|
56217
|
+
});
|
|
56218
|
+
} else if (text.substr(0, 5) === "<span") {
|
|
56219
|
+
updateCell(ctx, row, column, cellInput, value);
|
|
56220
|
+
} else {
|
|
56221
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56222
|
+
setCellValue(ctx, row, column, data, value);
|
|
56223
|
+
}
|
|
56224
|
+
}
|
|
56225
|
+
}
|
|
56061
56226
|
function clearCell(ctx, row, column) {
|
|
56062
56227
|
var _sheet$data, _sheet$data$row;
|
|
56063
56228
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -56378,7 +56543,7 @@ function setSelection(ctx, range, options) {
|
|
|
56378
56543
|
function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
56379
56544
|
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
56380
56545
|
var setMerge = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
56381
|
-
if (data == null) {
|
|
56546
|
+
if (data == null || !Array.isArray(data)) {
|
|
56382
56547
|
throw INVALID_PARAMS;
|
|
56383
56548
|
}
|
|
56384
56549
|
if (range instanceof Array) {
|
|
@@ -56387,27 +56552,45 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56387
56552
|
if (!_.isPlainObject(range)) {
|
|
56388
56553
|
throw INVALID_PARAMS;
|
|
56389
56554
|
}
|
|
56390
|
-
var
|
|
56391
|
-
var
|
|
56392
|
-
if (
|
|
56555
|
+
var rangeRow = range.row;
|
|
56556
|
+
var rangeColumn = range.column;
|
|
56557
|
+
if (!Array.isArray(rangeRow) || !Array.isArray(rangeColumn) || rangeRow.length < 2 || rangeColumn.length < 2 || !_.isNumber(rangeRow[0]) || !_.isNumber(rangeRow[1]) || !_.isNumber(rangeColumn[0]) || !_.isNumber(rangeColumn[1])) {
|
|
56558
|
+
throw INVALID_PARAMS;
|
|
56559
|
+
}
|
|
56560
|
+
var rowStart = rangeRow[0];
|
|
56561
|
+
var rowEnd = rangeRow[1];
|
|
56562
|
+
var colStart = rangeColumn[0];
|
|
56563
|
+
var colEnd = rangeColumn[1];
|
|
56564
|
+
if (rowStart < 0 || colStart < 0 || rowEnd < rowStart || colEnd < colStart) {
|
|
56565
|
+
throw INVALID_PARAMS;
|
|
56566
|
+
}
|
|
56567
|
+
var rowCount = rowEnd - rowStart + 1;
|
|
56568
|
+
var columnCount = colEnd - colStart + 1;
|
|
56569
|
+
if (!Array.isArray(data[0]) || data.length !== rowCount || data[0].length !== columnCount) {
|
|
56393
56570
|
throw new Error("data size does not match range");
|
|
56394
56571
|
}
|
|
56395
56572
|
var sheet = getSheet(ctx, options);
|
|
56573
|
+
var flowdata = sheet.data;
|
|
56574
|
+
if (!Array.isArray(flowdata)) {
|
|
56575
|
+
throw SHEET_NOT_FOUND;
|
|
56576
|
+
}
|
|
56396
56577
|
var cfg = sheet.config || {};
|
|
56397
56578
|
if (cfg.merge == null) {
|
|
56398
56579
|
cfg.merge = {};
|
|
56399
56580
|
}
|
|
56581
|
+
var formulaCells = [];
|
|
56400
56582
|
for (var i = 0; i < rowCount; i += 1) {
|
|
56401
56583
|
for (var j = 0; j < columnCount; j += 1) {
|
|
56402
|
-
var row =
|
|
56403
|
-
var column =
|
|
56404
|
-
|
|
56584
|
+
var row = rowStart + i;
|
|
56585
|
+
var column = colStart + j;
|
|
56586
|
+
var value = data[i][j];
|
|
56587
|
+
setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
|
|
56405
56588
|
if (setMerge) {
|
|
56406
|
-
var
|
|
56407
|
-
var r1 =
|
|
56408
|
-
var c1 =
|
|
56409
|
-
var rs =
|
|
56410
|
-
var cs =
|
|
56589
|
+
var _value$mc, _value$mc2, _value$mc3, _value$mc4;
|
|
56590
|
+
var r1 = value === null || value === void 0 ? void 0 : (_value$mc = value.mc) === null || _value$mc === void 0 ? void 0 : _value$mc.r;
|
|
56591
|
+
var c1 = value === null || value === void 0 ? void 0 : (_value$mc2 = value.mc) === null || _value$mc2 === void 0 ? void 0 : _value$mc2.c;
|
|
56592
|
+
var rs = value === null || value === void 0 ? void 0 : (_value$mc3 = value.mc) === null || _value$mc3 === void 0 ? void 0 : _value$mc3.rs;
|
|
56593
|
+
var cs = value === null || value === void 0 ? void 0 : (_value$mc4 = value.mc) === null || _value$mc4 === void 0 ? void 0 : _value$mc4.cs;
|
|
56411
56594
|
if (rs > 1 || cs > 1) {
|
|
56412
56595
|
cfg.merge["".concat(r1, "_").concat(c1)] = {
|
|
56413
56596
|
r: r1,
|
|
@@ -56422,18 +56605,84 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56422
56605
|
if (setMerge) {
|
|
56423
56606
|
sheet.config = cfg;
|
|
56424
56607
|
}
|
|
56608
|
+
if (formulaCells.length > 0) {
|
|
56609
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56610
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56611
|
+
var fc = formulaCells[k];
|
|
56612
|
+
var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
|
|
56613
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56614
|
+
v: v[1],
|
|
56615
|
+
f: v[2]
|
|
56616
|
+
});
|
|
56617
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56618
|
+
r: fc.r,
|
|
56619
|
+
c: fc.c,
|
|
56620
|
+
i: sheet.id
|
|
56621
|
+
});
|
|
56622
|
+
}
|
|
56623
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56624
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
|
|
56625
|
+
groupValuesRefresh(ctx);
|
|
56626
|
+
updateFunctionGroup(ctx);
|
|
56627
|
+
}
|
|
56425
56628
|
}
|
|
56426
56629
|
function setCellValues(ctx, data, cellInput) {
|
|
56630
|
+
var _data$, _data$2;
|
|
56427
56631
|
if (data == null) {
|
|
56428
56632
|
throw INVALID_PARAMS;
|
|
56429
56633
|
}
|
|
56430
|
-
|
|
56431
|
-
var
|
|
56432
|
-
|
|
56433
|
-
|
|
56434
|
-
|
|
56435
|
-
|
|
56436
|
-
|
|
56634
|
+
var pickSheet = function pickSheet(ops) {
|
|
56635
|
+
var _ops$index, _ops$id;
|
|
56636
|
+
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];
|
|
56637
|
+
};
|
|
56638
|
+
var first = pickSheet((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.ops);
|
|
56639
|
+
var canBatch = data.every(function (item) {
|
|
56640
|
+
var _pickSheet = pickSheet(item === null || item === void 0 ? void 0 : item.ops),
|
|
56641
|
+
_pickSheet2 = _slicedToArray(_pickSheet, 2),
|
|
56642
|
+
index = _pickSheet2[0],
|
|
56643
|
+
id = _pickSheet2[1];
|
|
56644
|
+
return index === first[0] && id === first[1];
|
|
56645
|
+
});
|
|
56646
|
+
if (!canBatch) {
|
|
56647
|
+
for (var j = 0; j < data.length; j += 1) {
|
|
56648
|
+
var _data$j = data[j],
|
|
56649
|
+
r = _data$j.r,
|
|
56650
|
+
c = _data$j.c,
|
|
56651
|
+
v = _data$j.v,
|
|
56652
|
+
ops = _data$j.ops;
|
|
56653
|
+
setCellValue$1(ctx, r, c, v, cellInput, ops);
|
|
56654
|
+
}
|
|
56655
|
+
return;
|
|
56656
|
+
}
|
|
56657
|
+
var sheet = getSheet(ctx, ((_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.ops) || {});
|
|
56658
|
+
var flowdata = sheet.data;
|
|
56659
|
+
if (!Array.isArray(flowdata)) {
|
|
56660
|
+
throw SHEET_NOT_FOUND;
|
|
56661
|
+
}
|
|
56662
|
+
var formulaCells = [];
|
|
56663
|
+
for (var _j = 0; _j < data.length; _j += 1) {
|
|
56664
|
+
var _data$_j = data[_j],
|
|
56665
|
+
_r = _data$_j.r,
|
|
56666
|
+
_c = _data$_j.c,
|
|
56667
|
+
_v = _data$_j.v;
|
|
56668
|
+
setCellValueInBatch(ctx, sheet, _r, _c, _v, cellInput, formulaCells);
|
|
56669
|
+
}
|
|
56670
|
+
if (formulaCells.length > 0) {
|
|
56671
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56672
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56673
|
+
var fc = formulaCells[k];
|
|
56674
|
+
var val = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, false);
|
|
56675
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56676
|
+
v: val[1],
|
|
56677
|
+
f: val[2]
|
|
56678
|
+
});
|
|
56679
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56680
|
+
r: fc.r,
|
|
56681
|
+
c: fc.c,
|
|
56682
|
+
i: sheet.id
|
|
56683
|
+
});
|
|
56684
|
+
}
|
|
56685
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56437
56686
|
}
|
|
56438
56687
|
}
|
|
56439
56688
|
function setCellFormatByRange(ctx, attr, value, range) {
|
|
@@ -56540,6 +56789,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56540
56789
|
celldataToData: celldataToData,
|
|
56541
56790
|
getCellValue: getCellValue$1,
|
|
56542
56791
|
setCellValue: setCellValue$1,
|
|
56792
|
+
setCellValueInBatch: setCellValueInBatch,
|
|
56543
56793
|
clearCell: clearCell,
|
|
56544
56794
|
setCellFormat: setCellFormat,
|
|
56545
56795
|
autoFillCell: autoFillCell,
|
|
@@ -58944,6 +59194,7 @@ function postPasteCut(ctx, source, target, RowlChange) {
|
|
|
58944
59194
|
ctx.luckysheetfile[getSheetIndex(ctx, target.sheetId)].dataVerification = target.curDataVerification;
|
|
58945
59195
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
58946
59196
|
execFunctionGroup(ctx, null, null, null, null, target.curData);
|
|
59197
|
+
updateFunctionGroup(ctx);
|
|
58947
59198
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
58948
59199
|
storeSheetParamALL(ctx);
|
|
58949
59200
|
}
|
|
@@ -60438,6 +60689,7 @@ function _handlePasteByLeanklin() {
|
|
|
60438
60689
|
}
|
|
60439
60690
|
return _context2.abrupt("return");
|
|
60440
60691
|
case 6:
|
|
60692
|
+
console.time('handlePasteByLeanklin');
|
|
60441
60693
|
rows = selectRange.row;
|
|
60442
60694
|
columns = selectRange.column;
|
|
60443
60695
|
_getClipboardData = getClipboardData(ctx, e, copyRich, rows[0], columns[0]), copyData = _getClipboardData.data, borderInfo = _getClipboardData.borderInfo, merge = _getClipboardData.merge;
|
|
@@ -60474,14 +60726,17 @@ function _handlePasteByLeanklin() {
|
|
|
60474
60726
|
column: column
|
|
60475
60727
|
};
|
|
60476
60728
|
if (isAllowEdit(ctx, [range])) {
|
|
60477
|
-
_context2.next =
|
|
60729
|
+
_context2.next = 25;
|
|
60478
60730
|
break;
|
|
60479
60731
|
}
|
|
60480
60732
|
return _context2.abrupt("return");
|
|
60481
|
-
case
|
|
60733
|
+
case 25:
|
|
60734
|
+
console.time('setCellValuesByRange');
|
|
60482
60735
|
setCellValuesByRange(ctx, pasteData, range, null);
|
|
60736
|
+
console.timeEnd('setCellValuesByRange');
|
|
60483
60737
|
ctx.luckysheet_select_save = [range];
|
|
60484
|
-
|
|
60738
|
+
console.timeEnd('handlePasteByLeanklin');
|
|
60739
|
+
case 30:
|
|
60485
60740
|
case "end":
|
|
60486
60741
|
return _context2.stop();
|
|
60487
60742
|
}
|
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,7 @@ 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;
|
|
36239
36240
|
if (___default['default'].isNil(data)) {
|
|
36240
36241
|
data = getFlowdata(ctx);
|
|
36241
36242
|
}
|
|
@@ -36520,13 +36521,14 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36520
36521
|
if (_ret === 0) continue;
|
|
36521
36522
|
}
|
|
36522
36523
|
formulaRunList.reverse();
|
|
36524
|
+
console.time('formulaRunList');
|
|
36523
36525
|
for (var _i14 = 0; _i14 < formulaRunList.length; _i14 += 1) {
|
|
36524
36526
|
var formulaCell = formulaRunList[_i14];
|
|
36525
36527
|
if (formulaCell.level === Math.max) {
|
|
36526
36528
|
continue;
|
|
36527
36529
|
}
|
|
36528
36530
|
var calc_funcStr = formulaCell.calc_funcStr;
|
|
36529
|
-
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id);
|
|
36531
|
+
var v = execfunction(ctx, calc_funcStr, formulaCell.r, formulaCell.c, formulaCell.id, false, notInsertFunc);
|
|
36530
36532
|
ctx.groupValuesRefreshData.push({
|
|
36531
36533
|
r: formulaCell.r,
|
|
36532
36534
|
c: formulaCell.c,
|
|
@@ -36540,6 +36542,7 @@ function execFunctionGroup(ctx, origin_r, origin_c, value, id, data) {
|
|
|
36540
36542
|
f: v[2]
|
|
36541
36543
|
};
|
|
36542
36544
|
}
|
|
36545
|
+
console.timeEnd('formulaRunList');
|
|
36543
36546
|
ctx.formulaCache.execFunctionExist = undefined;
|
|
36544
36547
|
}
|
|
36545
36548
|
function findrangeindex(ctx, v, vp) {
|
|
@@ -40505,7 +40508,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40505
40508
|
} else {
|
|
40506
40509
|
var _d$r3;
|
|
40507
40510
|
delFunctionGroup(ctx, r, c);
|
|
40508
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40511
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40509
40512
|
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
40513
|
curv.v = value;
|
|
40511
40514
|
delete curv.f;
|
|
@@ -40564,7 +40567,7 @@ function updateCell(ctx, r, c, $input, value, canvas, sheetId) {
|
|
|
40564
40567
|
}
|
|
40565
40568
|
} else {
|
|
40566
40569
|
delFunctionGroup(ctx, r, c);
|
|
40567
|
-
execFunctionGroup(ctx, r, c, value);
|
|
40570
|
+
execFunctionGroup(ctx, r, c, value, undefined, undefined, false, false);
|
|
40568
40571
|
}
|
|
40569
40572
|
}
|
|
40570
40573
|
setCellValue(ctx, r, c, d, value);
|
|
@@ -42546,7 +42549,7 @@ function copy(ctx) {
|
|
|
42546
42549
|
}
|
|
42547
42550
|
cpString += "</tr>";
|
|
42548
42551
|
}
|
|
42549
|
-
var result = "<table border=\"1\" style=\"border-collapse:collapse\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42552
|
+
var result = "<table border=\"1\" style=\"border-collapse:collapse; font-size: 13px\" data-type=\"leankylin-copy-action-table\">".concat(cpString, "</table>");
|
|
42550
42553
|
clipboard.writeHtml(result);
|
|
42551
42554
|
}
|
|
42552
42555
|
function copy2(ctx) {
|
|
@@ -47629,6 +47632,7 @@ function runExecFunction(ctx, range, index, data) {
|
|
|
47629
47632
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
47630
47633
|
execFunctionGroup(ctx, null, null, null, null, data);
|
|
47631
47634
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
47635
|
+
updateFunctionGroup(ctx);
|
|
47632
47636
|
}
|
|
47633
47637
|
function jfrefreshgrid(ctx, data, range) {
|
|
47634
47638
|
var isRunExecFunction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
@@ -48904,8 +48908,9 @@ function autoSelectionFormula(ctx, cellInput, fxInput, formula, cache) {
|
|
|
48904
48908
|
});
|
|
48905
48909
|
if (!isfalse) {
|
|
48906
48910
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
48907
|
-
execFunctionGroup(ctx, null, null, null, null, flowdata);
|
|
48911
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, false);
|
|
48908
48912
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
48913
|
+
updateFunctionGroup(ctx);
|
|
48909
48914
|
}
|
|
48910
48915
|
}
|
|
48911
48916
|
function cancelPaintModel(ctx) {
|
|
@@ -55936,6 +55941,23 @@ function getSheetWithLatestCelldata(ctx) {
|
|
|
55936
55941
|
});
|
|
55937
55942
|
}
|
|
55938
55943
|
|
|
55944
|
+
var FORMAT_LIST = {
|
|
55945
|
+
bg: 1,
|
|
55946
|
+
ff: 1,
|
|
55947
|
+
fc: 1,
|
|
55948
|
+
bl: 1,
|
|
55949
|
+
it: 1,
|
|
55950
|
+
fs: 1,
|
|
55951
|
+
cl: 1,
|
|
55952
|
+
un: 1,
|
|
55953
|
+
vt: 1,
|
|
55954
|
+
ht: 1,
|
|
55955
|
+
mc: 1,
|
|
55956
|
+
tr: 1,
|
|
55957
|
+
tb: 1,
|
|
55958
|
+
rt: 1,
|
|
55959
|
+
qp: 1
|
|
55960
|
+
};
|
|
55939
55961
|
function getCellValue$1(ctx, row, column) {
|
|
55940
55962
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
55941
55963
|
if (!___default['default'].isNumber(row) || !___default['default'].isNumber(column)) {
|
|
@@ -55975,23 +55997,7 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55975
55997
|
}
|
|
55976
55998
|
var sheet = getSheet(ctx, options);
|
|
55977
55999
|
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
|
-
};
|
|
56000
|
+
var formatList = FORMAT_LIST;
|
|
55995
56001
|
if (value == null || value.toString().length === 0) {
|
|
55996
56002
|
delFunctionGroup(ctx, row, column);
|
|
55997
56003
|
setCellValue(ctx, row, column, data, value);
|
|
@@ -56068,6 +56074,165 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
56068
56074
|
}
|
|
56069
56075
|
}
|
|
56070
56076
|
}
|
|
56077
|
+
function setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells) {
|
|
56078
|
+
var data = sheet.data;
|
|
56079
|
+
var sheetId = sheet.id;
|
|
56080
|
+
if (value == null || value.toString().length === 0) {
|
|
56081
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56082
|
+
setCellValue(ctx, row, column, data, value);
|
|
56083
|
+
return;
|
|
56084
|
+
}
|
|
56085
|
+
if (value instanceof Object) {
|
|
56086
|
+
var _data$row2;
|
|
56087
|
+
var curv = {};
|
|
56088
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56089
|
+
var needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56090
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56091
|
+
length: needAddRow
|
|
56092
|
+
}).map(function () {
|
|
56093
|
+
return [];
|
|
56094
|
+
})));
|
|
56095
|
+
}
|
|
56096
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row2 = data[row]) === null || _data$row2 === void 0 ? void 0 : _data$row2[column]) == null) {
|
|
56097
|
+
data[row][column] = {};
|
|
56098
|
+
}
|
|
56099
|
+
var cell = data[row][column];
|
|
56100
|
+
if (value.f != null && value.v == null) {
|
|
56101
|
+
curv.f = value.f;
|
|
56102
|
+
if (value.ct != null) {
|
|
56103
|
+
curv.ct = value.ct;
|
|
56104
|
+
}
|
|
56105
|
+
Object.assign(cell, curv);
|
|
56106
|
+
if (___default['default'].isString(value.f)) {
|
|
56107
|
+
formulaCells.push({
|
|
56108
|
+
r: row,
|
|
56109
|
+
c: column,
|
|
56110
|
+
f: value.f,
|
|
56111
|
+
ct: value.ct
|
|
56112
|
+
});
|
|
56113
|
+
} else {
|
|
56114
|
+
updateCell(ctx, row, column, cellInput, curv);
|
|
56115
|
+
}
|
|
56116
|
+
} else {
|
|
56117
|
+
var needupdateFdev = false;
|
|
56118
|
+
var needUpdateM = false;
|
|
56119
|
+
var oldF = cell.f;
|
|
56120
|
+
var nf = value.f;
|
|
56121
|
+
var oldV = cell.v;
|
|
56122
|
+
var nv = value.v;
|
|
56123
|
+
if (value.ct != null) {
|
|
56124
|
+
curv.ct = value.ct;
|
|
56125
|
+
}
|
|
56126
|
+
if (value.f != null) {
|
|
56127
|
+
curv.f = value.f;
|
|
56128
|
+
}
|
|
56129
|
+
if (value.v != null) {
|
|
56130
|
+
curv.v = value.v;
|
|
56131
|
+
} else {
|
|
56132
|
+
curv.v = cell.v;
|
|
56133
|
+
}
|
|
56134
|
+
if (value.m != null) {
|
|
56135
|
+
curv.m = value.m;
|
|
56136
|
+
}
|
|
56137
|
+
if (nf !== undefined && nf !== oldF) {
|
|
56138
|
+
needupdateFdev = true;
|
|
56139
|
+
needUpdateM = true;
|
|
56140
|
+
}
|
|
56141
|
+
if (nv !== undefined && String(nv) !== String(oldV)) {
|
|
56142
|
+
needUpdateM = true;
|
|
56143
|
+
}
|
|
56144
|
+
if (needupdateFdev) {
|
|
56145
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56146
|
+
}
|
|
56147
|
+
if (needUpdateM) {
|
|
56148
|
+
setCellValue(ctx, row, column, data, curv);
|
|
56149
|
+
}
|
|
56150
|
+
}
|
|
56151
|
+
___default['default'].forEach(value, function (v, attr) {
|
|
56152
|
+
if (attr in FORMAT_LIST) {
|
|
56153
|
+
var foucsStatus = v;
|
|
56154
|
+
if (attr === "ht") {
|
|
56155
|
+
if (foucsStatus === "left") {
|
|
56156
|
+
foucsStatus = "1";
|
|
56157
|
+
} else if (foucsStatus === "center") {
|
|
56158
|
+
foucsStatus = "0";
|
|
56159
|
+
} else if (foucsStatus === "right") {
|
|
56160
|
+
foucsStatus = "2";
|
|
56161
|
+
}
|
|
56162
|
+
} else if (attr === "vt") {
|
|
56163
|
+
if (foucsStatus === "top") {
|
|
56164
|
+
foucsStatus = "1";
|
|
56165
|
+
} else if (foucsStatus === "middle") {
|
|
56166
|
+
foucsStatus = "0";
|
|
56167
|
+
} else if (foucsStatus === "bottom") {
|
|
56168
|
+
foucsStatus = "2";
|
|
56169
|
+
}
|
|
56170
|
+
} else if (attr === "tb") {
|
|
56171
|
+
if (foucsStatus === "overflow") {
|
|
56172
|
+
foucsStatus = "1";
|
|
56173
|
+
} else if (foucsStatus === "clip") {
|
|
56174
|
+
foucsStatus = "0";
|
|
56175
|
+
} else if (foucsStatus === "wrap") {
|
|
56176
|
+
foucsStatus = "2";
|
|
56177
|
+
}
|
|
56178
|
+
} else if (attr === "tr") {
|
|
56179
|
+
if (foucsStatus === "none") {
|
|
56180
|
+
foucsStatus = "0";
|
|
56181
|
+
} else if (foucsStatus === "angleup") {
|
|
56182
|
+
foucsStatus = "1";
|
|
56183
|
+
} else if (foucsStatus === "angledown") {
|
|
56184
|
+
foucsStatus = "2";
|
|
56185
|
+
} else if (foucsStatus === "vertical") {
|
|
56186
|
+
foucsStatus = "3";
|
|
56187
|
+
} else if (foucsStatus === "rotation-up") {
|
|
56188
|
+
foucsStatus = "4";
|
|
56189
|
+
} else if (foucsStatus === "rotation-down") {
|
|
56190
|
+
foucsStatus = "5";
|
|
56191
|
+
}
|
|
56192
|
+
}
|
|
56193
|
+
if (cell && ___default['default'].isPlainObject(cell)) {
|
|
56194
|
+
if (cell.ct != null && Array.isArray(cell.ct.s) && ___default['default'].isPlainObject(cell.ct.s[0])) {
|
|
56195
|
+
cell.ct.s.forEach(function (item) {
|
|
56196
|
+
item[attr] = foucsStatus;
|
|
56197
|
+
});
|
|
56198
|
+
}
|
|
56199
|
+
cell[attr] = foucsStatus;
|
|
56200
|
+
}
|
|
56201
|
+
} else {
|
|
56202
|
+
cell[attr] = v;
|
|
56203
|
+
}
|
|
56204
|
+
});
|
|
56205
|
+
data[row][column] = cell;
|
|
56206
|
+
} else {
|
|
56207
|
+
var text = value.toString();
|
|
56208
|
+
if (text.substr(0, 1) === "=" && text.length > 1) {
|
|
56209
|
+
var _data$row3;
|
|
56210
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
56211
|
+
var _needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
56212
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
56213
|
+
length: _needAddRow
|
|
56214
|
+
}).map(function () {
|
|
56215
|
+
return [];
|
|
56216
|
+
})));
|
|
56217
|
+
}
|
|
56218
|
+
if ((data === null || data === void 0 ? void 0 : (_data$row3 = data[row]) === null || _data$row3 === void 0 ? void 0 : _data$row3[column]) == null) {
|
|
56219
|
+
data[row][column] = {};
|
|
56220
|
+
}
|
|
56221
|
+
var _cell = data[row][column];
|
|
56222
|
+
_cell.f = text;
|
|
56223
|
+
formulaCells.push({
|
|
56224
|
+
r: row,
|
|
56225
|
+
c: column,
|
|
56226
|
+
f: text
|
|
56227
|
+
});
|
|
56228
|
+
} else if (text.substr(0, 5) === "<span") {
|
|
56229
|
+
updateCell(ctx, row, column, cellInput, value);
|
|
56230
|
+
} else {
|
|
56231
|
+
delFunctionGroup(ctx, row, column, sheetId);
|
|
56232
|
+
setCellValue(ctx, row, column, data, value);
|
|
56233
|
+
}
|
|
56234
|
+
}
|
|
56235
|
+
}
|
|
56071
56236
|
function clearCell(ctx, row, column) {
|
|
56072
56237
|
var _sheet$data, _sheet$data$row;
|
|
56073
56238
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -56388,7 +56553,7 @@ function setSelection(ctx, range, options) {
|
|
|
56388
56553
|
function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
56389
56554
|
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
56390
56555
|
var setMerge = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
56391
|
-
if (data == null) {
|
|
56556
|
+
if (data == null || !Array.isArray(data)) {
|
|
56392
56557
|
throw INVALID_PARAMS;
|
|
56393
56558
|
}
|
|
56394
56559
|
if (range instanceof Array) {
|
|
@@ -56397,27 +56562,45 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56397
56562
|
if (!___default['default'].isPlainObject(range)) {
|
|
56398
56563
|
throw INVALID_PARAMS;
|
|
56399
56564
|
}
|
|
56400
|
-
var
|
|
56401
|
-
var
|
|
56402
|
-
if (
|
|
56565
|
+
var rangeRow = range.row;
|
|
56566
|
+
var rangeColumn = range.column;
|
|
56567
|
+
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])) {
|
|
56568
|
+
throw INVALID_PARAMS;
|
|
56569
|
+
}
|
|
56570
|
+
var rowStart = rangeRow[0];
|
|
56571
|
+
var rowEnd = rangeRow[1];
|
|
56572
|
+
var colStart = rangeColumn[0];
|
|
56573
|
+
var colEnd = rangeColumn[1];
|
|
56574
|
+
if (rowStart < 0 || colStart < 0 || rowEnd < rowStart || colEnd < colStart) {
|
|
56575
|
+
throw INVALID_PARAMS;
|
|
56576
|
+
}
|
|
56577
|
+
var rowCount = rowEnd - rowStart + 1;
|
|
56578
|
+
var columnCount = colEnd - colStart + 1;
|
|
56579
|
+
if (!Array.isArray(data[0]) || data.length !== rowCount || data[0].length !== columnCount) {
|
|
56403
56580
|
throw new Error("data size does not match range");
|
|
56404
56581
|
}
|
|
56405
56582
|
var sheet = getSheet(ctx, options);
|
|
56583
|
+
var flowdata = sheet.data;
|
|
56584
|
+
if (!Array.isArray(flowdata)) {
|
|
56585
|
+
throw SHEET_NOT_FOUND;
|
|
56586
|
+
}
|
|
56406
56587
|
var cfg = sheet.config || {};
|
|
56407
56588
|
if (cfg.merge == null) {
|
|
56408
56589
|
cfg.merge = {};
|
|
56409
56590
|
}
|
|
56591
|
+
var formulaCells = [];
|
|
56410
56592
|
for (var i = 0; i < rowCount; i += 1) {
|
|
56411
56593
|
for (var j = 0; j < columnCount; j += 1) {
|
|
56412
|
-
var row =
|
|
56413
|
-
var column =
|
|
56414
|
-
|
|
56594
|
+
var row = rowStart + i;
|
|
56595
|
+
var column = colStart + j;
|
|
56596
|
+
var value = data[i][j];
|
|
56597
|
+
setCellValueInBatch(ctx, sheet, row, column, value, cellInput, formulaCells);
|
|
56415
56598
|
if (setMerge) {
|
|
56416
|
-
var
|
|
56417
|
-
var r1 =
|
|
56418
|
-
var c1 =
|
|
56419
|
-
var rs =
|
|
56420
|
-
var cs =
|
|
56599
|
+
var _value$mc, _value$mc2, _value$mc3, _value$mc4;
|
|
56600
|
+
var r1 = value === null || value === void 0 ? void 0 : (_value$mc = value.mc) === null || _value$mc === void 0 ? void 0 : _value$mc.r;
|
|
56601
|
+
var c1 = value === null || value === void 0 ? void 0 : (_value$mc2 = value.mc) === null || _value$mc2 === void 0 ? void 0 : _value$mc2.c;
|
|
56602
|
+
var rs = value === null || value === void 0 ? void 0 : (_value$mc3 = value.mc) === null || _value$mc3 === void 0 ? void 0 : _value$mc3.rs;
|
|
56603
|
+
var cs = value === null || value === void 0 ? void 0 : (_value$mc4 = value.mc) === null || _value$mc4 === void 0 ? void 0 : _value$mc4.cs;
|
|
56421
56604
|
if (rs > 1 || cs > 1) {
|
|
56422
56605
|
cfg.merge["".concat(r1, "_").concat(c1)] = {
|
|
56423
56606
|
r: r1,
|
|
@@ -56432,18 +56615,84 @@ function setCellValuesByRange(ctx, data, range, cellInput) {
|
|
|
56432
56615
|
if (setMerge) {
|
|
56433
56616
|
sheet.config = cfg;
|
|
56434
56617
|
}
|
|
56618
|
+
if (formulaCells.length > 0) {
|
|
56619
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56620
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56621
|
+
var fc = formulaCells[k];
|
|
56622
|
+
var v = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, true);
|
|
56623
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56624
|
+
v: v[1],
|
|
56625
|
+
f: v[2]
|
|
56626
|
+
});
|
|
56627
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56628
|
+
r: fc.r,
|
|
56629
|
+
c: fc.c,
|
|
56630
|
+
i: sheet.id
|
|
56631
|
+
});
|
|
56632
|
+
}
|
|
56633
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56634
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata, false, true);
|
|
56635
|
+
groupValuesRefresh(ctx);
|
|
56636
|
+
updateFunctionGroup(ctx);
|
|
56637
|
+
}
|
|
56435
56638
|
}
|
|
56436
56639
|
function setCellValues(ctx, data, cellInput) {
|
|
56640
|
+
var _data$, _data$2;
|
|
56437
56641
|
if (data == null) {
|
|
56438
56642
|
throw INVALID_PARAMS;
|
|
56439
56643
|
}
|
|
56440
|
-
|
|
56441
|
-
var
|
|
56442
|
-
|
|
56443
|
-
|
|
56444
|
-
|
|
56445
|
-
|
|
56446
|
-
|
|
56644
|
+
var pickSheet = function pickSheet(ops) {
|
|
56645
|
+
var _ops$index, _ops$id;
|
|
56646
|
+
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];
|
|
56647
|
+
};
|
|
56648
|
+
var first = pickSheet((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.ops);
|
|
56649
|
+
var canBatch = data.every(function (item) {
|
|
56650
|
+
var _pickSheet = pickSheet(item === null || item === void 0 ? void 0 : item.ops),
|
|
56651
|
+
_pickSheet2 = _slicedToArray(_pickSheet, 2),
|
|
56652
|
+
index = _pickSheet2[0],
|
|
56653
|
+
id = _pickSheet2[1];
|
|
56654
|
+
return index === first[0] && id === first[1];
|
|
56655
|
+
});
|
|
56656
|
+
if (!canBatch) {
|
|
56657
|
+
for (var j = 0; j < data.length; j += 1) {
|
|
56658
|
+
var _data$j = data[j],
|
|
56659
|
+
r = _data$j.r,
|
|
56660
|
+
c = _data$j.c,
|
|
56661
|
+
v = _data$j.v,
|
|
56662
|
+
ops = _data$j.ops;
|
|
56663
|
+
setCellValue$1(ctx, r, c, v, cellInput, ops);
|
|
56664
|
+
}
|
|
56665
|
+
return;
|
|
56666
|
+
}
|
|
56667
|
+
var sheet = getSheet(ctx, ((_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.ops) || {});
|
|
56668
|
+
var flowdata = sheet.data;
|
|
56669
|
+
if (!Array.isArray(flowdata)) {
|
|
56670
|
+
throw SHEET_NOT_FOUND;
|
|
56671
|
+
}
|
|
56672
|
+
var formulaCells = [];
|
|
56673
|
+
for (var _j = 0; _j < data.length; _j += 1) {
|
|
56674
|
+
var _data$_j = data[_j],
|
|
56675
|
+
_r = _data$_j.r,
|
|
56676
|
+
_c = _data$_j.c,
|
|
56677
|
+
_v = _data$_j.v;
|
|
56678
|
+
setCellValueInBatch(ctx, sheet, _r, _c, _v, cellInput, formulaCells);
|
|
56679
|
+
}
|
|
56680
|
+
if (formulaCells.length > 0) {
|
|
56681
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
56682
|
+
for (var k = 0; k < formulaCells.length; k += 1) {
|
|
56683
|
+
var fc = formulaCells[k];
|
|
56684
|
+
var val = execfunction(ctx, fc.f, fc.r, fc.c, sheet.id, false, false);
|
|
56685
|
+
setCellValue(ctx, fc.r, fc.c, flowdata, {
|
|
56686
|
+
v: val[1],
|
|
56687
|
+
f: val[2]
|
|
56688
|
+
});
|
|
56689
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
56690
|
+
r: fc.r,
|
|
56691
|
+
c: fc.c,
|
|
56692
|
+
i: sheet.id
|
|
56693
|
+
});
|
|
56694
|
+
}
|
|
56695
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
56447
56696
|
}
|
|
56448
56697
|
}
|
|
56449
56698
|
function setCellFormatByRange(ctx, attr, value, range) {
|
|
@@ -56550,6 +56799,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56550
56799
|
celldataToData: celldataToData,
|
|
56551
56800
|
getCellValue: getCellValue$1,
|
|
56552
56801
|
setCellValue: setCellValue$1,
|
|
56802
|
+
setCellValueInBatch: setCellValueInBatch,
|
|
56553
56803
|
clearCell: clearCell,
|
|
56554
56804
|
setCellFormat: setCellFormat,
|
|
56555
56805
|
autoFillCell: autoFillCell,
|
|
@@ -58954,6 +59204,7 @@ function postPasteCut(ctx, source, target, RowlChange) {
|
|
|
58954
59204
|
ctx.luckysheetfile[getSheetIndex(ctx, target.sheetId)].dataVerification = target.curDataVerification;
|
|
58955
59205
|
ctx.formulaCache.execFunctionExist.reverse();
|
|
58956
59206
|
execFunctionGroup(ctx, null, null, null, null, target.curData);
|
|
59207
|
+
updateFunctionGroup(ctx);
|
|
58957
59208
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
58958
59209
|
storeSheetParamALL(ctx);
|
|
58959
59210
|
}
|
|
@@ -60448,6 +60699,7 @@ function _handlePasteByLeanklin() {
|
|
|
60448
60699
|
}
|
|
60449
60700
|
return _context2.abrupt("return");
|
|
60450
60701
|
case 6:
|
|
60702
|
+
console.time('handlePasteByLeanklin');
|
|
60451
60703
|
rows = selectRange.row;
|
|
60452
60704
|
columns = selectRange.column;
|
|
60453
60705
|
_getClipboardData = getClipboardData(ctx, e, copyRich, rows[0], columns[0]), copyData = _getClipboardData.data, borderInfo = _getClipboardData.borderInfo, merge = _getClipboardData.merge;
|
|
@@ -60484,14 +60736,17 @@ function _handlePasteByLeanklin() {
|
|
|
60484
60736
|
column: column
|
|
60485
60737
|
};
|
|
60486
60738
|
if (isAllowEdit(ctx, [range])) {
|
|
60487
|
-
_context2.next =
|
|
60739
|
+
_context2.next = 25;
|
|
60488
60740
|
break;
|
|
60489
60741
|
}
|
|
60490
60742
|
return _context2.abrupt("return");
|
|
60491
|
-
case
|
|
60743
|
+
case 25:
|
|
60744
|
+
console.time('setCellValuesByRange');
|
|
60492
60745
|
setCellValuesByRange(ctx, pasteData, range, null);
|
|
60746
|
+
console.timeEnd('setCellValuesByRange');
|
|
60493
60747
|
ctx.luckysheet_select_save = [range];
|
|
60494
|
-
|
|
60748
|
+
console.timeEnd('handlePasteByLeanklin');
|
|
60749
|
+
case 30:
|
|
60495
60750
|
case "end":
|
|
60496
60751
|
return _context2.stop();
|
|
60497
60752
|
}
|
|
@@ -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.33",
|
|
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.33",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|