@leankylin-sheet/core 4.0.28 → 4.0.29

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/index.esm.js CHANGED
@@ -36918,18 +36918,26 @@ function isfreezonFuc(txt) {
36918
36918
  }
36919
36919
  return ret;
36920
36920
  }
36921
- function functionStrChange_range(txt, type, rc, orient, stindex, step) {
36921
+ function functionStrChange_range(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
36922
36922
  var val = txt.split("!");
36923
36923
  var rangetxt;
36924
36924
  var prefix = "";
36925
+ var fSheetName = "";
36925
36926
  if (val.length > 1) {
36926
36927
  var _val3 = _slicedToArray(val, 2);
36928
+ fSheetName = _val3[0];
36927
36929
  rangetxt = _val3[1];
36928
- prefix = "".concat(val[0], "!");
36930
+ prefix = "".concat(fSheetName, "!");
36929
36931
  } else {
36930
36932
  var _val4 = _slicedToArray(val, 1);
36931
36933
  rangetxt = _val4[0];
36932
36934
  }
36935
+ if (isCurrentSheet && fSheetName) {
36936
+ return txt;
36937
+ }
36938
+ if (!isCurrentSheet && fSheetName !== sheetName) {
36939
+ return txt;
36940
+ }
36933
36941
  var r1;
36934
36942
  var r2;
36935
36943
  var c1;
@@ -37144,7 +37152,7 @@ function israngeseleciton(ctx, istooltip) {
37144
37152
  }
37145
37153
  return false;
37146
37154
  }
37147
- function functionStrChange(txt, type, rc, orient, stindex, step) {
37155
+ function functionStrChange(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
37148
37156
  if (!txt) {
37149
37157
  return "";
37150
37158
  }
@@ -37163,6 +37171,20 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37163
37171
  };
37164
37172
  while (i < funcstack.length) {
37165
37173
  var s = funcstack[i];
37174
+ var nextS = funcstack[i + 1];
37175
+ if (s === "{" && nextS === "{") {
37176
+ var nextI = funcstack === null || funcstack === void 0 ? void 0 : funcstack.findIndex(function (_, index) {
37177
+ if (i < index && funcstack[index] === "}" && funcstack[index + 1] === "}") {
37178
+ return true;
37179
+ }
37180
+ return false;
37181
+ });
37182
+ if (nextI !== -1) {
37183
+ function_str += txt.substring(i, nextI + 2);
37184
+ i = nextI + 2;
37185
+ continue;
37186
+ }
37187
+ }
37166
37188
  if (s === "(" && matchConfig.dquote === 0) {
37167
37189
  matchConfig.bracket += 1;
37168
37190
  if (str.length > 0) {
@@ -37173,7 +37195,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37173
37195
  str = "";
37174
37196
  } else if (s === ")" && matchConfig.dquote === 0) {
37175
37197
  matchConfig.bracket -= 1;
37176
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ")");
37198
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ")");
37177
37199
  str = "";
37178
37200
  } else if (s === '"' && matchConfig.squote === 0) {
37179
37201
  if (matchConfig.dquote > 0) {
@@ -37185,11 +37207,11 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37185
37207
  str += '"';
37186
37208
  }
37187
37209
  } else if (s === "," && matchConfig.dquote === 0) {
37188
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ",");
37210
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ",");
37189
37211
  str = "";
37190
37212
  } else if (s === "&" && matchConfig.dquote === 0) {
37191
37213
  if (str.length > 0) {
37192
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), "&");
37214
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), "&");
37193
37215
  str = "";
37194
37216
  } else {
37195
37217
  function_str += "&";
@@ -37208,7 +37230,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37208
37230
  }
37209
37231
  if (s + s_next in operatorjson) {
37210
37232
  if (str.length > 0) {
37211
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s + s_next;
37233
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s + s_next;
37212
37234
  str = "";
37213
37235
  } else {
37214
37236
  function_str += s + s_next;
@@ -37218,7 +37240,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37218
37240
  str += s;
37219
37241
  } else {
37220
37242
  if (str.length > 0) {
37221
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s;
37243
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s;
37222
37244
  str = "";
37223
37245
  } else {
37224
37246
  function_str += s;
@@ -37229,7 +37251,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37229
37251
  }
37230
37252
  if (i === funcstack.length - 1) {
37231
37253
  if (iscelldata(_.trim(str))) {
37232
- function_str += functionStrChange_range(_.trim(str), type, rc, orient, stindex, step);
37254
+ function_str += functionStrChange_range(_.trim(str), type, rc, orient, stindex, step, sheetName, isCurrentSheet);
37233
37255
  } else {
37234
37256
  function_str += _.trim(str);
37235
37257
  }
@@ -44416,6 +44438,7 @@ function insertRowCol(ctx, op) {
44416
44438
  if (curOrder == null) return;
44417
44439
  var file = ctx.luckysheetfile[curOrder];
44418
44440
  if (!file) return;
44441
+ var sheetName = file.name;
44419
44442
  var d = file.data;
44420
44443
  if (!d) return;
44421
44444
  var cfg = file.config || {};
@@ -44576,7 +44599,7 @@ function insertRowCol(ctx, op) {
44576
44599
  var calc_funcStr = getcellFormula(ctx, calc_r, calc_c, calc_i);
44577
44600
  if (type === "row" && SheetIndex === curOrder) {
44578
44601
  var _d$calc_r, _d$calc_r$calc_c;
44579
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
44602
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, curOrder === i));
44580
44603
  if (((_d$calc_r = d[calc_r]) === null || _d$calc_r === void 0 ? void 0 : (_d$calc_r$calc_c = _d$calc_r[calc_c]) === null || _d$calc_r$calc_c === void 0 ? void 0 : _d$calc_r$calc_c.f) === calc_funcStr) {
44581
44604
  d[calc_r][calc_c].f = functionStr;
44582
44605
  }
@@ -44592,13 +44615,13 @@ function insertRowCol(ctx, op) {
44592
44615
  newCalcChain.push(calc);
44593
44616
  } else if (type === "row") {
44594
44617
  var _data$calc_r, _data$calc_r$calc_c;
44595
- var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
44618
+ var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, curOrder === i));
44596
44619
  if (((_data$calc_r = data[calc_r]) === null || _data$calc_r === void 0 ? void 0 : (_data$calc_r$calc_c = _data$calc_r[calc_c]) === null || _data$calc_r$calc_c === void 0 ? void 0 : _data$calc_r$calc_c.f) === calc_funcStr) {
44597
44620
  data[calc_r][calc_c].f = _functionStr;
44598
44621
  }
44599
44622
  } else if (type === "column" && SheetIndex === curOrder) {
44600
44623
  var _d$calc_r2, _d$calc_r2$calc_c;
44601
- var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
44624
+ var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, curOrder === i));
44602
44625
  if (((_d$calc_r2 = d[calc_r]) === null || _d$calc_r2 === void 0 ? void 0 : (_d$calc_r2$calc_c = _d$calc_r2[calc_c]) === null || _d$calc_r2$calc_c === void 0 ? void 0 : _d$calc_r2$calc_c.f) === calc_funcStr) {
44603
44626
  d[calc_r][calc_c].f = _functionStr2;
44604
44627
  }
@@ -44614,7 +44637,7 @@ function insertRowCol(ctx, op) {
44614
44637
  newCalcChain.push(calc);
44615
44638
  } else if (type === "column") {
44616
44639
  var _data$calc_r2, _data$calc_r2$calc_c;
44617
- var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
44640
+ var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, curOrder === i));
44618
44641
  if (((_data$calc_r2 = data[calc_r]) === null || _data$calc_r2 === void 0 ? void 0 : (_data$calc_r2$calc_c = _data$calc_r2[calc_c]) === null || _data$calc_r2$calc_c === void 0 ? void 0 : _data$calc_r2$calc_c.f) === calc_funcStr) {
44619
44642
  data[calc_r][calc_c].f = _functionStr3;
44620
44643
  }
@@ -45388,6 +45411,7 @@ function deleteRowCol(ctx, op) {
45388
45411
  if (curOrder == null) return;
45389
45412
  var file = ctx.luckysheetfile[curOrder];
45390
45413
  if (!file) return;
45414
+ var sheetName = file.name;
45391
45415
  var cfg = file.config || {};
45392
45416
  if (type === "row") {
45393
45417
  for (var r = start; r <= end; r += 1) {
@@ -45541,7 +45565,7 @@ function deleteRowCol(ctx, op) {
45541
45565
  if (type === "row" && SheetIndex === curOrder) {
45542
45566
  if (calc_r < start || calc_r > end) {
45543
45567
  var _data$calc_r3, _data$calc_r3$calc_c;
45544
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
45568
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, curOrder === i));
45545
45569
  if (((_data$calc_r3 = data[calc_r]) === null || _data$calc_r3 === void 0 ? void 0 : (_data$calc_r3$calc_c = _data$calc_r3[calc_c]) === null || _data$calc_r3$calc_c === void 0 ? void 0 : _data$calc_r3$calc_c.f) === calc_funcStr) {
45546
45570
  data[calc_r][calc_c].f = functionStr;
45547
45571
  }
@@ -45552,14 +45576,14 @@ function deleteRowCol(ctx, op) {
45552
45576
  }
45553
45577
  } else if (type === "row") {
45554
45578
  var _data$calc_r4, _data$calc_r4$calc_c;
45555
- var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
45579
+ var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, curOrder === i));
45556
45580
  if (((_data$calc_r4 = data[calc_r]) === null || _data$calc_r4 === void 0 ? void 0 : (_data$calc_r4$calc_c = _data$calc_r4[calc_c]) === null || _data$calc_r4$calc_c === void 0 ? void 0 : _data$calc_r4$calc_c.f) === calc_funcStr) {
45557
45581
  data[calc_r][calc_c].f = _functionStr4;
45558
45582
  }
45559
45583
  } else if (type === "column" && SheetIndex === curOrder) {
45560
45584
  if (calc_c < start || calc_c > end) {
45561
45585
  var _data$calc_r5, _data$calc_r5$calc_c;
45562
- var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
45586
+ var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, curOrder === i));
45563
45587
  if (((_data$calc_r5 = data[calc_r]) === null || _data$calc_r5 === void 0 ? void 0 : (_data$calc_r5$calc_c = _data$calc_r5[calc_c]) === null || _data$calc_r5$calc_c === void 0 ? void 0 : _data$calc_r5$calc_c.f) === calc_funcStr) {
45564
45588
  data[calc_r][calc_c].f = _functionStr5;
45565
45589
  }
@@ -45570,7 +45594,7 @@ function deleteRowCol(ctx, op) {
45570
45594
  }
45571
45595
  } else if (type === "column") {
45572
45596
  var _data$calc_r6, _data$calc_r6$calc_c;
45573
- var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
45597
+ var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, curOrder === i));
45574
45598
  if (((_data$calc_r6 = data[calc_r]) === null || _data$calc_r6 === void 0 ? void 0 : (_data$calc_r6$calc_c = _data$calc_r6[calc_c]) === null || _data$calc_r6$calc_c === void 0 ? void 0 : _data$calc_r6$calc_c.f) === calc_funcStr) {
45575
45599
  data[calc_r][calc_c].f = _functionStr6;
45576
45600
  }
@@ -46603,6 +46627,23 @@ function editSheetName(ctx, editable) {
46603
46627
  }
46604
46628
  }
46605
46629
  ctx.luckysheetfile[index].name = txt;
46630
+ for (var SheetIndex = 0; SheetIndex < ctx.luckysheetfile.length; SheetIndex += 1) {
46631
+ if (_.isNil(ctx.luckysheetfile[SheetIndex].calcChain) || ctx.luckysheetfile.length === 0) {
46632
+ continue;
46633
+ }
46634
+ var calcChain = ctx.luckysheetfile[SheetIndex].calcChain;
46635
+ var data = ctx.luckysheetfile[SheetIndex].data;
46636
+ for (var _i = 0; _i < calcChain.length; _i += 1) {
46637
+ var _data$calc_r, _data$calc_r$calc_c;
46638
+ var calc = _.cloneDeep(calcChain[_i]);
46639
+ var calc_r = calc.r;
46640
+ var calc_c = calc.c;
46641
+ var f = data === null || data === void 0 ? void 0 : (_data$calc_r = data[calc_r]) === null || _data$calc_r === void 0 ? void 0 : (_data$calc_r$calc_c = _data$calc_r[calc_c]) === null || _data$calc_r$calc_c === void 0 ? void 0 : _data$calc_r$calc_c.f;
46642
+ if (f && f.indexOf("".concat(oldtxt, "!"))) {
46643
+ data[calc_r][calc_c].f = f === null || f === void 0 ? void 0 : f.replaceAll("".concat(oldtxt, "!"), "".concat(txt, "!"));
46644
+ }
46645
+ }
46646
+ }
46606
46647
  if (ctx.hooks.afterUpdateSheetName) {
46607
46648
  setTimeout(function () {
46608
46649
  var _ctx$hooks$afterUpdat, _ctx$hooks8;
package/dist/index.js CHANGED
@@ -36928,18 +36928,26 @@ function isfreezonFuc(txt) {
36928
36928
  }
36929
36929
  return ret;
36930
36930
  }
36931
- function functionStrChange_range(txt, type, rc, orient, stindex, step) {
36931
+ function functionStrChange_range(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
36932
36932
  var val = txt.split("!");
36933
36933
  var rangetxt;
36934
36934
  var prefix = "";
36935
+ var fSheetName = "";
36935
36936
  if (val.length > 1) {
36936
36937
  var _val3 = _slicedToArray(val, 2);
36938
+ fSheetName = _val3[0];
36937
36939
  rangetxt = _val3[1];
36938
- prefix = "".concat(val[0], "!");
36940
+ prefix = "".concat(fSheetName, "!");
36939
36941
  } else {
36940
36942
  var _val4 = _slicedToArray(val, 1);
36941
36943
  rangetxt = _val4[0];
36942
36944
  }
36945
+ if (isCurrentSheet && fSheetName) {
36946
+ return txt;
36947
+ }
36948
+ if (!isCurrentSheet && fSheetName !== sheetName) {
36949
+ return txt;
36950
+ }
36943
36951
  var r1;
36944
36952
  var r2;
36945
36953
  var c1;
@@ -37154,7 +37162,7 @@ function israngeseleciton(ctx, istooltip) {
37154
37162
  }
37155
37163
  return false;
37156
37164
  }
37157
- function functionStrChange(txt, type, rc, orient, stindex, step) {
37165
+ function functionStrChange(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
37158
37166
  if (!txt) {
37159
37167
  return "";
37160
37168
  }
@@ -37173,6 +37181,20 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37173
37181
  };
37174
37182
  while (i < funcstack.length) {
37175
37183
  var s = funcstack[i];
37184
+ var nextS = funcstack[i + 1];
37185
+ if (s === "{" && nextS === "{") {
37186
+ var nextI = funcstack === null || funcstack === void 0 ? void 0 : funcstack.findIndex(function (_, index) {
37187
+ if (i < index && funcstack[index] === "}" && funcstack[index + 1] === "}") {
37188
+ return true;
37189
+ }
37190
+ return false;
37191
+ });
37192
+ if (nextI !== -1) {
37193
+ function_str += txt.substring(i, nextI + 2);
37194
+ i = nextI + 2;
37195
+ continue;
37196
+ }
37197
+ }
37176
37198
  if (s === "(" && matchConfig.dquote === 0) {
37177
37199
  matchConfig.bracket += 1;
37178
37200
  if (str.length > 0) {
@@ -37183,7 +37205,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37183
37205
  str = "";
37184
37206
  } else if (s === ")" && matchConfig.dquote === 0) {
37185
37207
  matchConfig.bracket -= 1;
37186
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ")");
37208
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ")");
37187
37209
  str = "";
37188
37210
  } else if (s === '"' && matchConfig.squote === 0) {
37189
37211
  if (matchConfig.dquote > 0) {
@@ -37195,11 +37217,11 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37195
37217
  str += '"';
37196
37218
  }
37197
37219
  } else if (s === "," && matchConfig.dquote === 0) {
37198
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ",");
37220
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ",");
37199
37221
  str = "";
37200
37222
  } else if (s === "&" && matchConfig.dquote === 0) {
37201
37223
  if (str.length > 0) {
37202
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), "&");
37224
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), "&");
37203
37225
  str = "";
37204
37226
  } else {
37205
37227
  function_str += "&";
@@ -37218,7 +37240,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37218
37240
  }
37219
37241
  if (s + s_next in operatorjson) {
37220
37242
  if (str.length > 0) {
37221
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s + s_next;
37243
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s + s_next;
37222
37244
  str = "";
37223
37245
  } else {
37224
37246
  function_str += s + s_next;
@@ -37228,7 +37250,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37228
37250
  str += s;
37229
37251
  } else {
37230
37252
  if (str.length > 0) {
37231
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s;
37253
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s;
37232
37254
  str = "";
37233
37255
  } else {
37234
37256
  function_str += s;
@@ -37239,7 +37261,7 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
37239
37261
  }
37240
37262
  if (i === funcstack.length - 1) {
37241
37263
  if (iscelldata(___default['default'].trim(str))) {
37242
- function_str += functionStrChange_range(___default['default'].trim(str), type, rc, orient, stindex, step);
37264
+ function_str += functionStrChange_range(___default['default'].trim(str), type, rc, orient, stindex, step, sheetName, isCurrentSheet);
37243
37265
  } else {
37244
37266
  function_str += ___default['default'].trim(str);
37245
37267
  }
@@ -44426,6 +44448,7 @@ function insertRowCol(ctx, op) {
44426
44448
  if (curOrder == null) return;
44427
44449
  var file = ctx.luckysheetfile[curOrder];
44428
44450
  if (!file) return;
44451
+ var sheetName = file.name;
44429
44452
  var d = file.data;
44430
44453
  if (!d) return;
44431
44454
  var cfg = file.config || {};
@@ -44586,7 +44609,7 @@ function insertRowCol(ctx, op) {
44586
44609
  var calc_funcStr = getcellFormula(ctx, calc_r, calc_c, calc_i);
44587
44610
  if (type === "row" && SheetIndex === curOrder) {
44588
44611
  var _d$calc_r, _d$calc_r$calc_c;
44589
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
44612
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, curOrder === i));
44590
44613
  if (((_d$calc_r = d[calc_r]) === null || _d$calc_r === void 0 ? void 0 : (_d$calc_r$calc_c = _d$calc_r[calc_c]) === null || _d$calc_r$calc_c === void 0 ? void 0 : _d$calc_r$calc_c.f) === calc_funcStr) {
44591
44614
  d[calc_r][calc_c].f = functionStr;
44592
44615
  }
@@ -44602,13 +44625,13 @@ function insertRowCol(ctx, op) {
44602
44625
  newCalcChain.push(calc);
44603
44626
  } else if (type === "row") {
44604
44627
  var _data$calc_r, _data$calc_r$calc_c;
44605
- var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
44628
+ var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, curOrder === i));
44606
44629
  if (((_data$calc_r = data[calc_r]) === null || _data$calc_r === void 0 ? void 0 : (_data$calc_r$calc_c = _data$calc_r[calc_c]) === null || _data$calc_r$calc_c === void 0 ? void 0 : _data$calc_r$calc_c.f) === calc_funcStr) {
44607
44630
  data[calc_r][calc_c].f = _functionStr;
44608
44631
  }
44609
44632
  } else if (type === "column" && SheetIndex === curOrder) {
44610
44633
  var _d$calc_r2, _d$calc_r2$calc_c;
44611
- var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
44634
+ var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, curOrder === i));
44612
44635
  if (((_d$calc_r2 = d[calc_r]) === null || _d$calc_r2 === void 0 ? void 0 : (_d$calc_r2$calc_c = _d$calc_r2[calc_c]) === null || _d$calc_r2$calc_c === void 0 ? void 0 : _d$calc_r2$calc_c.f) === calc_funcStr) {
44613
44636
  d[calc_r][calc_c].f = _functionStr2;
44614
44637
  }
@@ -44624,7 +44647,7 @@ function insertRowCol(ctx, op) {
44624
44647
  newCalcChain.push(calc);
44625
44648
  } else if (type === "column") {
44626
44649
  var _data$calc_r2, _data$calc_r2$calc_c;
44627
- var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
44650
+ var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, curOrder === i));
44628
44651
  if (((_data$calc_r2 = data[calc_r]) === null || _data$calc_r2 === void 0 ? void 0 : (_data$calc_r2$calc_c = _data$calc_r2[calc_c]) === null || _data$calc_r2$calc_c === void 0 ? void 0 : _data$calc_r2$calc_c.f) === calc_funcStr) {
44629
44652
  data[calc_r][calc_c].f = _functionStr3;
44630
44653
  }
@@ -45398,6 +45421,7 @@ function deleteRowCol(ctx, op) {
45398
45421
  if (curOrder == null) return;
45399
45422
  var file = ctx.luckysheetfile[curOrder];
45400
45423
  if (!file) return;
45424
+ var sheetName = file.name;
45401
45425
  var cfg = file.config || {};
45402
45426
  if (type === "row") {
45403
45427
  for (var r = start; r <= end; r += 1) {
@@ -45551,7 +45575,7 @@ function deleteRowCol(ctx, op) {
45551
45575
  if (type === "row" && SheetIndex === curOrder) {
45552
45576
  if (calc_r < start || calc_r > end) {
45553
45577
  var _data$calc_r3, _data$calc_r3$calc_c;
45554
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
45578
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, curOrder === i));
45555
45579
  if (((_data$calc_r3 = data[calc_r]) === null || _data$calc_r3 === void 0 ? void 0 : (_data$calc_r3$calc_c = _data$calc_r3[calc_c]) === null || _data$calc_r3$calc_c === void 0 ? void 0 : _data$calc_r3$calc_c.f) === calc_funcStr) {
45556
45580
  data[calc_r][calc_c].f = functionStr;
45557
45581
  }
@@ -45562,14 +45586,14 @@ function deleteRowCol(ctx, op) {
45562
45586
  }
45563
45587
  } else if (type === "row") {
45564
45588
  var _data$calc_r4, _data$calc_r4$calc_c;
45565
- var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
45589
+ var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, curOrder === i));
45566
45590
  if (((_data$calc_r4 = data[calc_r]) === null || _data$calc_r4 === void 0 ? void 0 : (_data$calc_r4$calc_c = _data$calc_r4[calc_c]) === null || _data$calc_r4$calc_c === void 0 ? void 0 : _data$calc_r4$calc_c.f) === calc_funcStr) {
45567
45591
  data[calc_r][calc_c].f = _functionStr4;
45568
45592
  }
45569
45593
  } else if (type === "column" && SheetIndex === curOrder) {
45570
45594
  if (calc_c < start || calc_c > end) {
45571
45595
  var _data$calc_r5, _data$calc_r5$calc_c;
45572
- var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
45596
+ var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, curOrder === i));
45573
45597
  if (((_data$calc_r5 = data[calc_r]) === null || _data$calc_r5 === void 0 ? void 0 : (_data$calc_r5$calc_c = _data$calc_r5[calc_c]) === null || _data$calc_r5$calc_c === void 0 ? void 0 : _data$calc_r5$calc_c.f) === calc_funcStr) {
45574
45598
  data[calc_r][calc_c].f = _functionStr5;
45575
45599
  }
@@ -45580,7 +45604,7 @@ function deleteRowCol(ctx, op) {
45580
45604
  }
45581
45605
  } else if (type === "column") {
45582
45606
  var _data$calc_r6, _data$calc_r6$calc_c;
45583
- var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
45607
+ var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, curOrder === i));
45584
45608
  if (((_data$calc_r6 = data[calc_r]) === null || _data$calc_r6 === void 0 ? void 0 : (_data$calc_r6$calc_c = _data$calc_r6[calc_c]) === null || _data$calc_r6$calc_c === void 0 ? void 0 : _data$calc_r6$calc_c.f) === calc_funcStr) {
45585
45609
  data[calc_r][calc_c].f = _functionStr6;
45586
45610
  }
@@ -46613,6 +46637,23 @@ function editSheetName(ctx, editable) {
46613
46637
  }
46614
46638
  }
46615
46639
  ctx.luckysheetfile[index].name = txt;
46640
+ for (var SheetIndex = 0; SheetIndex < ctx.luckysheetfile.length; SheetIndex += 1) {
46641
+ if (___default['default'].isNil(ctx.luckysheetfile[SheetIndex].calcChain) || ctx.luckysheetfile.length === 0) {
46642
+ continue;
46643
+ }
46644
+ var calcChain = ctx.luckysheetfile[SheetIndex].calcChain;
46645
+ var data = ctx.luckysheetfile[SheetIndex].data;
46646
+ for (var _i = 0; _i < calcChain.length; _i += 1) {
46647
+ var _data$calc_r, _data$calc_r$calc_c;
46648
+ var calc = ___default['default'].cloneDeep(calcChain[_i]);
46649
+ var calc_r = calc.r;
46650
+ var calc_c = calc.c;
46651
+ var f = data === null || data === void 0 ? void 0 : (_data$calc_r = data[calc_r]) === null || _data$calc_r === void 0 ? void 0 : (_data$calc_r$calc_c = _data$calc_r[calc_c]) === null || _data$calc_r$calc_c === void 0 ? void 0 : _data$calc_r$calc_c.f;
46652
+ if (f && f.indexOf("".concat(oldtxt, "!"))) {
46653
+ data[calc_r][calc_c].f = f === null || f === void 0 ? void 0 : f.replaceAll("".concat(oldtxt, "!"), "".concat(txt, "!"));
46654
+ }
46655
+ }
46656
+ }
46616
46657
  if (ctx.hooks.afterUpdateSheetName) {
46617
46658
  setTimeout(function () {
46618
46659
  var _ctx$hooks$afterUpdat, _ctx$hooks8;
@@ -45,7 +45,7 @@ export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivEl
45
45
  export declare function functionHTMLGenerate(txt: string): string;
46
46
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
47
47
  export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
48
- export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number): string;
48
+ export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number, sheetName: string, isCurrentSheet: boolean): string;
49
49
  export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
50
50
  export declare function onFormulaRangeDragEnd(ctx: Context): void;
51
51
  export declare function rangeDrag(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "4.0.28",
3
+ "version": "4.0.29",
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": "4.0.28",
16
+ "@leankylin-sheet/formula-parser": "4.0.29",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",