@leankylin-sheet/react 4.0.30 → 4.0.31

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.umd.js CHANGED
@@ -32405,27 +32405,28 @@
32405
32405
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32406
32406
  }
32407
32407
 
32408
- /**
32409
- * Convert value into number.
32410
- *
32411
- * @param {String|Number} number
32412
- * @returns {*}
32408
+ /**
32409
+ * Convert value into number.
32410
+ *
32411
+ * @param {String|Number} number
32412
+ * @returns {*}
32413
32413
  */
32414
32414
  function toNumber(number) {
32415
+ var _result;
32415
32416
  var result;
32416
32417
  if (typeof number === 'number') {
32417
32418
  result = number;
32418
32419
  } else if (typeof number === 'string') {
32419
32420
  result = number.indexOf('.') > -1 ? parseFloat(number) : parseInt(number, 10);
32420
32421
  }
32421
- return result;
32422
+ return (_result = result) !== null && _result !== void 0 ? _result : 0;
32422
32423
  }
32423
32424
 
32424
- /**
32425
- * Invert provided number.
32426
- *
32427
- * @param {Number} number
32428
- * @returns {Number} Returns inverted number.
32425
+ /**
32426
+ * Invert provided number.
32427
+ *
32428
+ * @param {Number} number
32429
+ * @returns {Number} Returns inverted number.
32429
32430
  */
32430
32431
  function invertNumber(number) {
32431
32432
  return -1 * toNumber(number);
@@ -32441,11 +32442,11 @@
32441
32442
  var ERROR_VALUE = 'VALUE';
32442
32443
  var errors = _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, ERROR, '#ERROR!'), ERROR_DIV_ZERO, '#DIV/0!'), ERROR_NAME, '#NAME?'), ERROR_NOT_AVAILABLE, '#N/A'), ERROR_NULL, '#NULL!'), ERROR_NUM, '#NUM!'), ERROR_REF, '#REF!'), ERROR_VALUE, '#VALUE!');
32443
32444
 
32444
- /**
32445
- * Return error type based on provided error id.
32446
- *
32447
- * @param {String} type Error type.
32448
- * @returns {String|null} Returns error id.
32445
+ /**
32446
+ * Return error type based on provided error id.
32447
+ *
32448
+ * @param {String} type Error type.
32449
+ * @returns {String|null} Returns error id.
32449
32450
  */
32450
32451
  function error$1(type) {
32451
32452
  var result;
@@ -32456,11 +32457,11 @@
32456
32457
  return result ? result : null;
32457
32458
  }
32458
32459
 
32459
- /**
32460
- * Check if error type is strict valid with knows errors.
32461
- *
32462
- * @param {String} Error type.
32463
- * @return {Boolean}
32460
+ /**
32461
+ * Check if error type is strict valid with knows errors.
32462
+ *
32463
+ * @param {String} Error type.
32464
+ * @return {Boolean}
32464
32465
  */
32465
32466
  function isValidStrict(type) {
32466
32467
  var valid = false;
@@ -32637,12 +32638,12 @@
32637
32638
 
32638
32639
  var availableOperators = Object.create(null);
32639
32640
 
32640
- /**
32641
- * Evaluate values by operator id.git
32642
- *
32643
- * @param {String} operator Operator id.
32644
- * @param {Array} [params=[]] Arguments to evaluate.
32645
- * @returns {*}
32641
+ /**
32642
+ * Evaluate values by operator id.git
32643
+ *
32644
+ * @param {String} operator Operator id.
32645
+ * @param {Array} [params=[]] Arguments to evaluate.
32646
+ * @returns {*}
32646
32647
  */
32647
32648
  function evaluateByOperator(operator) {
32648
32649
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -32653,11 +32654,11 @@
32653
32654
  return availableOperators[operator].apply(availableOperators, _toConsumableArray$1(params));
32654
32655
  }
32655
32656
 
32656
- /**
32657
- * Register operator.
32658
- *
32659
- * @param {String|Array} symbol Symbol to register.
32660
- * @param {Function} func Logic to register for this symbol.
32657
+ /**
32658
+ * Register operator.
32659
+ *
32660
+ * @param {String|Array} symbol Symbol to register.
32661
+ * @param {Function} func Logic to register for this symbol.
32661
32662
  */
32662
32663
  function registerOperation(symbol, func) {
32663
32664
  if (!Array.isArray(symbol)) {
@@ -34093,12 +34094,12 @@
34093
34094
  parser.Parser = Parser;
34094
34095
 
34095
34096
  /* eslint-disable import/prefer-default-export */
34096
- /**
34097
- * Trim value by cutting character starting from the beginning and ending at the same time.
34098
- *
34099
- * @param {String} string String to trimming.
34100
- * @param {Number} [margin=1] Number of character to cut.
34101
- * @returns {String}
34097
+ /**
34098
+ * Trim value by cutting character starting from the beginning and ending at the same time.
34099
+ *
34100
+ * @param {String} string String to trimming.
34101
+ * @param {Number} [margin=1] Number of character to cut.
34102
+ * @returns {String}
34102
34103
  */
34103
34104
  function trimEdges(string) {
34104
34105
  var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
@@ -34106,11 +34107,11 @@
34106
34107
  return string;
34107
34108
  }
34108
34109
 
34109
- /**
34110
- * Convert row label to index.
34111
- *
34112
- * @param {String} label Row label (eq. '1', '5')
34113
- * @returns {Number} Returns -1 if label is not recognized otherwise proper row index.
34110
+ /**
34111
+ * Convert row label to index.
34112
+ *
34113
+ * @param {String} label Row label (eq. '1', '5')
34114
+ * @returns {Number} Returns -1 if label is not recognized otherwise proper row index.
34114
34115
  */
34115
34116
  function rowLabelToIndex(label) {
34116
34117
  var result = parseInt(label, 10);
@@ -34122,11 +34123,11 @@
34122
34123
  return result;
34123
34124
  }
34124
34125
 
34125
- /**
34126
- * Convert row index to label.
34127
- *
34128
- * @param {Number} row Row index.
34129
- * @returns {String} Returns row label (eq. '1', '7').
34126
+ /**
34127
+ * Convert row index to label.
34128
+ *
34129
+ * @param {Number} row Row index.
34130
+ * @returns {String} Returns row label (eq. '1', '7').
34130
34131
  */
34131
34132
  function rowIndexToLabel(row) {
34132
34133
  var result = "";
@@ -34138,11 +34139,11 @@
34138
34139
  var COLUMN_LABEL_BASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
34139
34140
  var COLUMN_LABEL_BASE_LENGTH = COLUMN_LABEL_BASE.length;
34140
34141
 
34141
- /**
34142
- * Convert column label to index.
34143
- *
34144
- * @param {String} label Column label (eq. 'ABB', 'CNQ')
34145
- * @returns {Number} Returns -1 if label is not recognized otherwise proper column index.
34142
+ /**
34143
+ * Convert column label to index.
34144
+ *
34145
+ * @param {String} label Column label (eq. 'ABB', 'CNQ')
34146
+ * @returns {Number} Returns -1 if label is not recognized otherwise proper column index.
34146
34147
  */
34147
34148
  function columnLabelToIndex(label) {
34148
34149
  var result = 0;
@@ -34156,11 +34157,11 @@
34156
34157
  return result;
34157
34158
  }
34158
34159
 
34159
- /**
34160
- * Convert column index to label.
34161
- *
34162
- * @param {Number} column Column index.
34163
- * @returns {String} Returns column label (eq. 'ABB', 'CNQ').
34160
+ /**
34161
+ * Convert column index to label.
34162
+ *
34163
+ * @param {Number} column Column index.
34164
+ * @returns {String} Returns column label (eq. 'ABB', 'CNQ').
34164
34165
  */
34165
34166
  function columnIndexToLabel(column) {
34166
34167
  var result = "";
@@ -34175,11 +34176,11 @@
34175
34176
  var sheetNameRegexp$1 = "(".concat(simpleSheetName$1, "|").concat(quotedSheetName$1, ")!");
34176
34177
  var LABEL_EXTRACT_REGEXP = new RegExp("^(?:".concat(sheetNameRegexp$1, ")?([$])?([A-Za-z]*)([$])?([0-9]*)$"));
34177
34178
 
34178
- /**
34179
- * Extract cell coordinates.
34180
- *
34181
- * @param {String} label Cell coordinates (eq. 'A1', '$B6', '$N$98').
34182
- * @returns {Array} Returns an array of objects.
34179
+ /**
34180
+ * Extract cell coordinates.
34181
+ *
34182
+ * @param {String} label Cell coordinates (eq. 'A1', '$B6', '$N$98').
34183
+ * @returns {Array} Returns an array of objects.
34183
34184
  */
34184
34185
  function extractLabel(label) {
34185
34186
  if (typeof label !== "string" || !LABEL_EXTRACT_REGEXP.test(label)) {
@@ -34205,12 +34206,12 @@
34205
34206
  }, sheetName];
34206
34207
  }
34207
34208
 
34208
- /**
34209
- * Convert row and column indexes into cell label.
34210
- *
34211
- * @param {Object} row Object with `index` and `isAbsolute` properties.
34212
- * @param {Object} column Object with `index` and `isAbsolute` properties.
34213
- * @returns {String} Returns cell label.
34209
+ /**
34210
+ * Convert row and column indexes into cell label.
34211
+ *
34212
+ * @param {Object} row Object with `index` and `isAbsolute` properties.
34213
+ * @param {Object} column Object with `index` and `isAbsolute` properties.
34214
+ * @returns {String} Returns cell label.
34214
34215
  */
34215
34216
  function toLabel(row, column) {
34216
34217
  var rowLabel = (row.isAbsolute ? "$" : "") + rowIndexToLabel(row.index);
@@ -34218,8 +34219,8 @@
34218
34219
  return columnLabel + rowLabel;
34219
34220
  }
34220
34221
 
34221
- /**
34222
- * @class Parser
34222
+ /**
34223
+ * @class Parser
34223
34224
  */
34224
34225
  var Parser$1 = /*#__PURE__*/function (_Emitter) {
34225
34226
  function Parser$1() {
@@ -34255,13 +34256,13 @@
34255
34256
  return _this;
34256
34257
  }
34257
34258
 
34258
- /**
34259
- * Parse formula expression.
34260
- *
34261
- * @param {string} expression to parse.
34262
- * @param {object} options additional params.
34263
- * @param {string} options.sheetId id of sheet which the formula expression belongs to.
34264
- * @return {*} Returns an object with tow properties `error` and `result`.
34259
+ /**
34260
+ * Parse formula expression.
34261
+ *
34262
+ * @param {string} expression to parse.
34263
+ * @param {object} options additional params.
34264
+ * @param {string} options.sheetId id of sheet which the formula expression belongs to.
34265
+ * @return {*} Returns an object with tow properties `error` and `result`.
34265
34266
  */
34266
34267
  _inherits(Parser$1, _Emitter);
34267
34268
  return _createClass(Parser$1, [{
@@ -34294,12 +34295,12 @@
34294
34295
  };
34295
34296
  }
34296
34297
 
34297
- /**
34298
- * Set predefined variable name which can be visible while parsing formula expression.
34299
- *
34300
- * @param {String} name Variable name.
34301
- * @param {*} value Variable value.
34302
- * @returns {Parser}
34298
+ /**
34299
+ * Set predefined variable name which can be visible while parsing formula expression.
34300
+ *
34301
+ * @param {String} name Variable name.
34302
+ * @param {*} value Variable value.
34303
+ * @returns {Parser}
34303
34304
  */
34304
34305
  }, {
34305
34306
  key: "setVariable",
@@ -34312,11 +34313,11 @@
34312
34313
  value: function replaceVariables(variables) {
34313
34314
  this.variables = variables;
34314
34315
  }
34315
- /**
34316
- * Get variable name.
34317
- *
34318
- * @param {String} name Variable name.
34319
- * @returns {*}
34316
+ /**
34317
+ * Get variable name.
34318
+ *
34319
+ * @param {String} name Variable name.
34320
+ * @returns {*}
34320
34321
  */
34321
34322
  }, {
34322
34323
  key: "getVariable",
@@ -34324,12 +34325,12 @@
34324
34325
  return this.variables[name];
34325
34326
  }
34326
34327
 
34327
- /**
34328
- * Retrieve variable value by its name.
34329
- *
34330
- * @param name Variable name.
34331
- * @returns {*}
34332
- * @private
34328
+ /**
34329
+ * Retrieve variable value by its name.
34330
+ *
34331
+ * @param name Variable name.
34332
+ * @returns {*}
34333
+ * @private
34333
34334
  */
34334
34335
  }, {
34335
34336
  key: "_callVariable",
@@ -34346,12 +34347,12 @@
34346
34347
  return value;
34347
34348
  }
34348
34349
 
34349
- /**
34350
- * Set custom function which can be visible while parsing formula expression.
34351
- *
34352
- * @param {String} name Custom function name.
34353
- * @param {Function} fn Custom function.
34354
- * @returns {Parser}
34350
+ /**
34351
+ * Set custom function which can be visible while parsing formula expression.
34352
+ *
34353
+ * @param {String} name Custom function name.
34354
+ * @param {Function} fn Custom function.
34355
+ * @returns {Parser}
34355
34356
  */
34356
34357
  }, {
34357
34358
  key: "setFunction",
@@ -34360,11 +34361,11 @@
34360
34361
  return this;
34361
34362
  }
34362
34363
 
34363
- /**
34364
- * Get custom function.
34365
- *
34366
- * @param {String} name Custom function name.
34367
- * @returns {*}
34364
+ /**
34365
+ * Get custom function.
34366
+ *
34367
+ * @param {String} name Custom function name.
34368
+ * @returns {*}
34368
34369
  */
34369
34370
  }, {
34370
34371
  key: "getFunction",
@@ -34372,13 +34373,13 @@
34372
34373
  return this.functions[name];
34373
34374
  }
34374
34375
 
34375
- /**
34376
- * Call function with provided params.
34377
- *
34378
- * @param name Function name.
34379
- * @param params Function params.
34380
- * @returns {*}
34381
- * @private
34376
+ /**
34377
+ * Call function with provided params.
34378
+ *
34379
+ * @param name Function name.
34380
+ * @param params Function params.
34381
+ * @returns {*}
34382
+ * @private
34382
34383
  */
34383
34384
  }, {
34384
34385
  key: "_callFunction",
@@ -34397,12 +34398,12 @@
34397
34398
  return value === void 0 ? evaluateByOperator(name, params) : value;
34398
34399
  }
34399
34400
 
34400
- /**
34401
- * Retrieve value by its label (`B3`, `B$3`, `B$3`, `$B$3`).
34402
- *
34403
- * @param {String} label Coordinates.
34404
- * @returns {*}
34405
- * @private
34401
+ /**
34402
+ * Retrieve value by its label (`B3`, `B$3`, `B$3`, `$B$3`).
34403
+ *
34404
+ * @param {String} label Coordinates.
34405
+ * @returns {*}
34406
+ * @private
34406
34407
  */
34407
34408
  }, {
34408
34409
  key: "_callCellValue",
@@ -34432,13 +34433,13 @@
34432
34433
  return value;
34433
34434
  }
34434
34435
 
34435
- /**
34436
- * Retrieve value by its label (`B3:A1`, `B$3:A1`, `B$3:$A1`, `$B$3:A$1`).
34437
- *
34438
- * @param {String} startLabel Coordinates of the first cell.
34439
- * @param {String} endLabel Coordinates of the last cell.
34440
- * @returns {Array} Returns an array of mixed values.
34441
- * @private
34436
+ /**
34437
+ * Retrieve value by its label (`B3:A1`, `B$3:A1`, `B$3:$A1`, `$B$3:A$1`).
34438
+ *
34439
+ * @param {String} startLabel Coordinates of the first cell.
34440
+ * @param {String} endLabel Coordinates of the last cell.
34441
+ * @returns {Array} Returns an array of mixed values.
34442
+ * @private
34442
34443
  */
34443
34444
  }, {
34444
34445
  key: "_callRangeValue",
@@ -34483,12 +34484,12 @@
34483
34484
  return value;
34484
34485
  }
34485
34486
 
34486
- /**
34487
- * Try to throw error by its name.
34488
- *
34489
- * @param {String} errorName Error name.
34490
- * @returns {String}
34491
- * @private
34487
+ /**
34488
+ * Try to throw error by its name.
34489
+ *
34490
+ * @param {String} errorName Error name.
34491
+ * @returns {String}
34492
+ * @private
34492
34493
  */
34493
34494
  }, {
34494
34495
  key: "_throwError",
@@ -68327,13 +68328,13 @@
68327
68328
  return general_fmt_num_base;
68328
68329
  }();
68329
68330
  SSF._general_num = general_fmt_num;
68330
- /*
68331
- "General" rules:
68332
- - text is passed through ("@")
68333
- - booleans are rendered as TRUE/FALSE
68334
- - "up to 11 characters" displayed for numbers
68335
- - Default date format (code 14) used for Dates
68336
- TODO: technically the display depends on the width of the cell
68331
+ /*
68332
+ "General" rules:
68333
+ - text is passed through ("@")
68334
+ - booleans are rendered as TRUE/FALSE
68335
+ - "up to 11 characters" displayed for numbers
68336
+ - Default date format (code 14) used for Dates
68337
+ TODO: technically the display depends on the width of the cell
68337
68338
  */
68338
68339
  function general_fmt(v, opts) {
68339
68340
  switch (_typeof(v)) {
@@ -70835,14 +70836,14 @@
70835
70836
  }
70836
70837
  }
70837
70838
  for (var _j2 = 0; _j2 < formulaTextArray.length; _j2 += 1) {
70838
- var t = formulaTextArray[_j2];
70839
+ var t = lodash.trim(formulaTextArray[_j2]);
70839
70840
  if (t.length <= 1) {
70840
70841
  continue;
70841
70842
  }
70842
70843
  if (t.substring(0, 1) === '"' && t.substring(t.length - 1, 1) === '"' || !iscelldata(t)) {
70843
70844
  continue;
70844
70845
  }
70845
- var range = getcellrange(ctx, lodash.trim(t), formulaCell.id);
70846
+ var range = getcellrange(ctx, t, formulaCell.id);
70846
70847
  if (lodash.isNil(range)) {
70847
70848
  continue;
70848
70849
  }
@@ -71471,18 +71472,26 @@
71471
71472
  }
71472
71473
  return ret;
71473
71474
  }
71474
- function functionStrChange_range(txt, type, rc, orient, stindex, step) {
71475
+ function functionStrChange_range(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
71475
71476
  var val = txt.split("!");
71476
71477
  var rangetxt;
71477
71478
  var prefix = "";
71479
+ var fSheetName = "";
71478
71480
  if (val.length > 1) {
71479
71481
  var _val3 = _slicedToArray$2(val, 2);
71482
+ fSheetName = _val3[0];
71480
71483
  rangetxt = _val3[1];
71481
- prefix = "".concat(val[0], "!");
71484
+ prefix = "".concat(fSheetName, "!");
71482
71485
  } else {
71483
71486
  var _val4 = _slicedToArray$2(val, 1);
71484
71487
  rangetxt = _val4[0];
71485
71488
  }
71489
+ if (isCurrentSheet && fSheetName) {
71490
+ return txt;
71491
+ }
71492
+ if (!isCurrentSheet && fSheetName !== sheetName) {
71493
+ return txt;
71494
+ }
71486
71495
  var r1;
71487
71496
  var r2;
71488
71497
  var c1;
@@ -71697,7 +71706,7 @@
71697
71706
  }
71698
71707
  return false;
71699
71708
  }
71700
- function functionStrChange(txt, type, rc, orient, stindex, step) {
71709
+ function functionStrChange(txt, type, rc, orient, stindex, step, sheetName, isCurrentSheet) {
71701
71710
  if (!txt) {
71702
71711
  return "";
71703
71712
  }
@@ -71716,6 +71725,20 @@
71716
71725
  };
71717
71726
  while (i < funcstack.length) {
71718
71727
  var s = funcstack[i];
71728
+ var nextS = funcstack[i + 1];
71729
+ if (s === "{" && nextS === "{") {
71730
+ var nextI = funcstack === null || funcstack === void 0 ? void 0 : funcstack.findIndex(function (_, index) {
71731
+ if (i < index && funcstack[index] === "}" && funcstack[index + 1] === "}") {
71732
+ return true;
71733
+ }
71734
+ return false;
71735
+ });
71736
+ if (nextI !== -1) {
71737
+ function_str += txt.substring(i, nextI + 2);
71738
+ i = nextI + 2;
71739
+ continue;
71740
+ }
71741
+ }
71719
71742
  if (s === "(" && matchConfig.dquote === 0) {
71720
71743
  matchConfig.bracket += 1;
71721
71744
  if (str.length > 0) {
@@ -71726,7 +71749,7 @@
71726
71749
  str = "";
71727
71750
  } else if (s === ")" && matchConfig.dquote === 0) {
71728
71751
  matchConfig.bracket -= 1;
71729
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ")");
71752
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ")");
71730
71753
  str = "";
71731
71754
  } else if (s === '"' && matchConfig.squote === 0) {
71732
71755
  if (matchConfig.dquote > 0) {
@@ -71738,11 +71761,11 @@
71738
71761
  str += '"';
71739
71762
  }
71740
71763
  } else if (s === "," && matchConfig.dquote === 0) {
71741
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), ",");
71764
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), ",");
71742
71765
  str = "";
71743
71766
  } else if (s === "&" && matchConfig.dquote === 0) {
71744
71767
  if (str.length > 0) {
71745
- function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step), "&");
71768
+ function_str += "".concat(functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet), "&");
71746
71769
  str = "";
71747
71770
  } else {
71748
71771
  function_str += "&";
@@ -71761,7 +71784,7 @@
71761
71784
  }
71762
71785
  if (s + s_next in operatorjson) {
71763
71786
  if (str.length > 0) {
71764
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s + s_next;
71787
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s + s_next;
71765
71788
  str = "";
71766
71789
  } else {
71767
71790
  function_str += s + s_next;
@@ -71771,7 +71794,7 @@
71771
71794
  str += s;
71772
71795
  } else {
71773
71796
  if (str.length > 0) {
71774
- function_str += functionStrChange(str, type, rc, orient, stindex, step) + s;
71797
+ function_str += functionStrChange(str, type, rc, orient, stindex, step, sheetName, isCurrentSheet) + s;
71775
71798
  str = "";
71776
71799
  } else {
71777
71800
  function_str += s;
@@ -71782,7 +71805,7 @@
71782
71805
  }
71783
71806
  if (i === funcstack.length - 1) {
71784
71807
  if (iscelldata(lodash.trim(str))) {
71785
- function_str += functionStrChange_range(lodash.trim(str), type, rc, orient, stindex, step);
71808
+ function_str += functionStrChange_range(lodash.trim(str), type, rc, orient, stindex, step, sheetName, isCurrentSheet);
71786
71809
  } else {
71787
71810
  function_str += lodash.trim(str);
71788
71811
  }
@@ -75270,6 +75293,9 @@
75270
75293
  scrollTop = ctx.scrollTop;
75271
75294
  var winH = ctx.cellmainHeight;
75272
75295
  var winW = ctx.cellmainWidth;
75296
+ if (winW <= 0 || winH <= 0) {
75297
+ return;
75298
+ }
75273
75299
  var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
75274
75300
  var sheet = sheetIndex == null ? null : ctx.luckysheetfile[sheetIndex];
75275
75301
  if (!sheet) return;
@@ -75897,6 +75923,7 @@
75897
75923
  y: moveY
75898
75924
  };
75899
75925
  normalizeSelection(ctx, ctx.luckysheet_select_save);
75926
+ scrollToHighlightCell(ctx, row_index, col_index);
75900
75927
  } else if (type === "rangeOfFormula") {
75901
75928
  var _last = ctx.formulaCache.func_selectedrange;
75902
75929
  if (!_last) return;
@@ -78817,6 +78844,7 @@
78817
78844
  if (curOrder == null) return;
78818
78845
  var file = ctx.luckysheetfile[curOrder];
78819
78846
  if (!file) return;
78847
+ var sheetName = file.name;
78820
78848
  var d = file.data;
78821
78849
  if (!d) return;
78822
78850
  var cfg = file.config || {};
@@ -78977,7 +79005,7 @@
78977
79005
  var calc_funcStr = getcellFormula(ctx, calc_r, calc_c, calc_i);
78978
79006
  if (type === "row" && SheetIndex === curOrder) {
78979
79007
  var _d$calc_r, _d$calc_r$calc_c;
78980
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
79008
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, id === calc_i));
78981
79009
  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) {
78982
79010
  d[calc_r][calc_c].f = functionStr;
78983
79011
  }
@@ -78993,13 +79021,13 @@
78993
79021
  newCalcChain.push(calc);
78994
79022
  } else if (type === "row") {
78995
79023
  var _data$calc_r, _data$calc_r$calc_c;
78996
- var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count));
79024
+ var _functionStr = "=".concat(functionStrChange(calc_funcStr, "add", "row", direction, index, count, sheetName, id === calc_i));
78997
79025
  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) {
78998
79026
  data[calc_r][calc_c].f = _functionStr;
78999
79027
  }
79000
79028
  } else if (type === "column" && SheetIndex === curOrder) {
79001
79029
  var _d$calc_r2, _d$calc_r2$calc_c;
79002
- var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
79030
+ var _functionStr2 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, id === calc_i));
79003
79031
  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) {
79004
79032
  d[calc_r][calc_c].f = _functionStr2;
79005
79033
  }
@@ -79015,7 +79043,7 @@
79015
79043
  newCalcChain.push(calc);
79016
79044
  } else if (type === "column") {
79017
79045
  var _data$calc_r2, _data$calc_r2$calc_c;
79018
- var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count));
79046
+ var _functionStr3 = "=".concat(functionStrChange(calc_funcStr, "add", "col", direction, index, count, sheetName, id === calc_i));
79019
79047
  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) {
79020
79048
  data[calc_r][calc_c].f = _functionStr3;
79021
79049
  }
@@ -79789,6 +79817,7 @@
79789
79817
  if (curOrder == null) return;
79790
79818
  var file = ctx.luckysheetfile[curOrder];
79791
79819
  if (!file) return;
79820
+ var sheetName = file.name;
79792
79821
  var cfg = file.config || {};
79793
79822
  if (type === "row") {
79794
79823
  for (var r = start; r <= end; r += 1) {
@@ -79942,7 +79971,7 @@
79942
79971
  if (type === "row" && SheetIndex === curOrder) {
79943
79972
  if (calc_r < start || calc_r > end) {
79944
79973
  var _data$calc_r3, _data$calc_r3$calc_c;
79945
- var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
79974
+ var functionStr = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, id === calc_i));
79946
79975
  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) {
79947
79976
  data[calc_r][calc_c].f = functionStr;
79948
79977
  }
@@ -79953,14 +79982,14 @@
79953
79982
  }
79954
79983
  } else if (type === "row") {
79955
79984
  var _data$calc_r4, _data$calc_r4$calc_c;
79956
- var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen));
79985
+ var _functionStr4 = "=".concat(functionStrChange(calc_funcStr, "del", "row", null, start, slen, sheetName, id === calc_i));
79957
79986
  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) {
79958
79987
  data[calc_r][calc_c].f = _functionStr4;
79959
79988
  }
79960
79989
  } else if (type === "column" && SheetIndex === curOrder) {
79961
79990
  if (calc_c < start || calc_c > end) {
79962
79991
  var _data$calc_r5, _data$calc_r5$calc_c;
79963
- var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
79992
+ var _functionStr5 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, id === calc_i));
79964
79993
  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) {
79965
79994
  data[calc_r][calc_c].f = _functionStr5;
79966
79995
  }
@@ -79971,7 +80000,7 @@
79971
80000
  }
79972
80001
  } else if (type === "column") {
79973
80002
  var _data$calc_r6, _data$calc_r6$calc_c;
79974
- var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen));
80003
+ var _functionStr6 = "=".concat(functionStrChange(calc_funcStr, "del", "col", null, start, slen, sheetName, id === calc_i));
79975
80004
  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) {
79976
80005
  data[calc_r][calc_c].f = _functionStr6;
79977
80006
  }
@@ -80985,6 +81014,23 @@
80985
81014
  }
80986
81015
  }
80987
81016
  ctx.luckysheetfile[index].name = txt;
81017
+ for (var SheetIndex = 0; SheetIndex < ctx.luckysheetfile.length; SheetIndex += 1) {
81018
+ if (lodash.isNil(ctx.luckysheetfile[SheetIndex].calcChain) || ctx.luckysheetfile.length === 0) {
81019
+ continue;
81020
+ }
81021
+ var calcChain = ctx.luckysheetfile[SheetIndex].calcChain;
81022
+ var data = ctx.luckysheetfile[SheetIndex].data;
81023
+ for (var _i = 0; _i < calcChain.length; _i += 1) {
81024
+ var _data$calc_r, _data$calc_r$calc_c;
81025
+ var calc = lodash.cloneDeep(calcChain[_i]);
81026
+ var calc_r = calc.r;
81027
+ var calc_c = calc.c;
81028
+ 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;
81029
+ if (f && f.indexOf("".concat(oldtxt, "!"))) {
81030
+ data[calc_r][calc_c].f = f === null || f === void 0 ? void 0 : f.replaceAll("".concat(oldtxt, "!"), "".concat(txt, "!"));
81031
+ }
81032
+ }
81033
+ }
80988
81034
  if (ctx.hooks.afterUpdateSheetName) {
80989
81035
  setTimeout(function () {
80990
81036
  var _ctx$hooks$afterUpdat, _ctx$hooks8;
@@ -90145,6 +90191,7 @@
90145
90191
  }
90146
90192
  function setCellValuesByRange(ctx, data, range, cellInput) {
90147
90193
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
90194
+ var setMerge = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
90148
90195
  if (data == null) {
90149
90196
  throw INVALID_PARAMS;
90150
90197
  }
@@ -90159,13 +90206,36 @@
90159
90206
  if (data.length !== rowCount || data[0].length !== columnCount) {
90160
90207
  throw new Error("data size does not match range");
90161
90208
  }
90209
+ var sheet = getSheet(ctx, options);
90210
+ var cfg = sheet.config || {};
90211
+ if (cfg.merge == null) {
90212
+ cfg.merge = {};
90213
+ }
90162
90214
  for (var i = 0; i < rowCount; i += 1) {
90163
90215
  for (var j = 0; j < columnCount; j += 1) {
90164
90216
  var row = range.row[0] + i;
90165
90217
  var column = range.column[0] + j;
90166
90218
  setCellValue$1(ctx, row, column, data[i][j], cellInput, options);
90219
+ if (setMerge) {
90220
+ var _data$i$j, _data$i$j$mc, _data$i$j2, _data$i$j2$mc, _data$i$j3, _data$i$j3$mc, _data$i$j4, _data$i$j4$mc;
90221
+ var r1 = (_data$i$j = data[i][j]) === null || _data$i$j === void 0 ? void 0 : (_data$i$j$mc = _data$i$j.mc) === null || _data$i$j$mc === void 0 ? void 0 : _data$i$j$mc.r;
90222
+ var c1 = (_data$i$j2 = data[i][j]) === null || _data$i$j2 === void 0 ? void 0 : (_data$i$j2$mc = _data$i$j2.mc) === null || _data$i$j2$mc === void 0 ? void 0 : _data$i$j2$mc.c;
90223
+ var rs = (_data$i$j3 = data[i][j]) === null || _data$i$j3 === void 0 ? void 0 : (_data$i$j3$mc = _data$i$j3.mc) === null || _data$i$j3$mc === void 0 ? void 0 : _data$i$j3$mc.rs;
90224
+ var cs = (_data$i$j4 = data[i][j]) === null || _data$i$j4 === void 0 ? void 0 : (_data$i$j4$mc = _data$i$j4.mc) === null || _data$i$j4$mc === void 0 ? void 0 : _data$i$j4$mc.cs;
90225
+ if (rs > 1 || cs > 1) {
90226
+ cfg.merge["".concat(r1, "_").concat(c1)] = {
90227
+ r: r1,
90228
+ c: c1,
90229
+ rs: rs,
90230
+ cs: cs
90231
+ };
90232
+ }
90233
+ }
90167
90234
  }
90168
90235
  }
90236
+ if (setMerge) {
90237
+ sheet.config = cfg;
90238
+ }
90169
90239
  }
90170
90240
  function setCellValues(ctx, data, cellInput) {
90171
90241
  if (data == null) {
@@ -92734,6 +92804,10 @@
92734
92804
  m: m || v,
92735
92805
  f: f || undefined
92736
92806
  }, domStyleToCellAttr(style));
92807
+ if (f) {
92808
+ delete mainCell.m;
92809
+ delete mainCell.v;
92810
+ }
92737
92811
  if (colspan > 1 || rowspan > 1) {
92738
92812
  mainCell.mc = {
92739
92813
  rs: rowspan,
@@ -92779,10 +92853,13 @@
92779
92853
  }
92780
92854
  offsetColIndex += colspan || 1;
92781
92855
  } else {
92782
- result[index].push({
92856
+ var item = f ? {
92857
+ f: f
92858
+ } : {
92783
92859
  m: m,
92784
92860
  v: v
92785
- });
92861
+ };
92862
+ result[index].push(item);
92786
92863
  }
92787
92864
  }
92788
92865
  }
@@ -101390,6 +101467,8 @@
101390
101467
  var _useContext = React.useContext(WorkbookContext),
101391
101468
  context = _useContext.context,
101392
101469
  settings = _useContext.settings;
101470
+ var _locale = locale(context),
101471
+ pivotTable = _locale.pivotTable;
101393
101472
  var data = React.useMemo(function () {
101394
101473
  var _context$luckysheet_s;
101395
101474
  var firstSelection = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[0];
@@ -101433,11 +101512,11 @@
101433
101512
  };
101434
101513
  }, [context.luckysheet_select_save]);
101435
101514
  var labelMap = {
101436
- count: "计数",
101437
- sum: "总和",
101438
- average: "平均值",
101439
- max: "最大值",
101440
- min: "最小值"
101515
+ count: pivotTable.valueStatisticsCOUNTA,
101516
+ sum: pivotTable.valueStatisticsSUM,
101517
+ average: pivotTable.valueStatisticsAVERAGE,
101518
+ max: pivotTable.valueStatisticsMAX,
101519
+ min: pivotTable.valueStatisticsMIN
101441
101520
  };
101442
101521
  if (settings.renderCalcInfo) {
101443
101522
  return settings.renderCalcInfo(data, context.luckysheet_select_save);
@@ -102251,7 +102330,8 @@
102251
102330
  rightclick = _locale.rightclick,
102252
102331
  drag = _locale.drag,
102253
102332
  generalDialog = _locale.generalDialog,
102254
- info = _locale.info;
102333
+ info = _locale.info,
102334
+ comment = _locale.comment;
102255
102335
  var getMenuElement = React.useCallback(function (name, i) {
102256
102336
  var _context$luckysheet_s, _context$hooks, _context$hooks$showMe;
102257
102337
  var selection = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[0];
@@ -102274,19 +102354,23 @@
102274
102354
  var canDeletePs = hasPsValue;
102275
102355
  var canShowHidePs = hasPsValue;
102276
102356
  var itemData = [{
102277
- text: "新建说明",
102357
+ text: comment.insert,
102358
+ type: "insert",
102278
102359
  onClick: newComment,
102279
102360
  show: canAddPs
102280
102361
  }, {
102281
- text: "编辑说明",
102362
+ text: comment.edit,
102363
+ type: "edit",
102282
102364
  onClick: editComment,
102283
102365
  show: canEditPs
102284
102366
  }, {
102285
- text: "删除说明",
102367
+ text: comment.delete,
102368
+ type: "delete",
102286
102369
  onClick: deleteComment,
102287
102370
  show: canDeletePs
102288
102371
  }, {
102289
- text: "显示/隐藏说明",
102372
+ text: comment.showOne,
102373
+ type: "showOne",
102290
102374
  onClick: showHideComment,
102291
102375
  show: canShowHidePs
102292
102376
  }].filter(function (item) {