@leankylin-sheet/react 5.2.14 → 5.2.15

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
@@ -3561,12 +3561,12 @@ var DropDownList = function DropDownList() {
3561
3561
  };
3562
3562
 
3563
3563
  var CellOptions = function CellOptions() {
3564
- var _context$cellOptions;
3565
3564
  var _useContext = useContext(WorkbookContext),
3566
3565
  context = _useContext.context,
3567
3566
  refs = _useContext.refs,
3568
3567
  settings = _useContext.settings;
3569
- var cellOptions = (_context$cellOptions = context.cellOptions) !== null && _context$cellOptions !== void 0 ? _context$cellOptions : [];
3568
+ var currentSheet = context.luckysheetfile[getSheetIndex(context, context.currentSheetId)];
3569
+ var cellOptions = currentSheet.cellOptions;
3570
3570
  return /*#__PURE__*/React.createElement("div", {
3571
3571
  className: "leankylin-cell-option"
3572
3572
  }, cellOptions === null || cellOptions === void 0 ? void 0 : cellOptions.map(function (item) {
@@ -10011,6 +10011,8 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
10011
10011
  setCellOptions: function setCellOptions(cellOptions) {
10012
10012
  return setContext(function (ctx) {
10013
10013
  ctx.cellOptions = cellOptions;
10014
+ var index = getSheetIndex(ctx, context.currentSheetId);
10015
+ ctx.luckysheetfile[index].cellOptions = cellOptions;
10014
10016
  });
10015
10017
  },
10016
10018
  applyOp: function applyOp(ops) {
package/dist/index.js CHANGED
@@ -3571,12 +3571,12 @@ var DropDownList = function DropDownList() {
3571
3571
  };
3572
3572
 
3573
3573
  var CellOptions = function CellOptions() {
3574
- var _context$cellOptions;
3575
3574
  var _useContext = React.useContext(WorkbookContext),
3576
3575
  context = _useContext.context,
3577
3576
  refs = _useContext.refs,
3578
3577
  settings = _useContext.settings;
3579
- var cellOptions = (_context$cellOptions = context.cellOptions) !== null && _context$cellOptions !== void 0 ? _context$cellOptions : [];
3578
+ var currentSheet = context.luckysheetfile[core.getSheetIndex(context, context.currentSheetId)];
3579
+ var cellOptions = currentSheet.cellOptions;
3580
3580
  return /*#__PURE__*/React__default['default'].createElement("div", {
3581
3581
  className: "leankylin-cell-option"
3582
3582
  }, cellOptions === null || cellOptions === void 0 ? void 0 : cellOptions.map(function (item) {
@@ -10021,6 +10021,8 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
10021
10021
  setCellOptions: function setCellOptions(cellOptions) {
10022
10022
  return setContext(function (ctx) {
10023
10023
  ctx.cellOptions = cellOptions;
10024
+ var index = core.getSheetIndex(ctx, context.currentSheetId);
10025
+ ctx.luckysheetfile[index].cellOptions = cellOptions;
10024
10026
  });
10025
10027
  },
10026
10028
  applyOp: function applyOp(ops) {
package/dist/index.umd.js CHANGED
@@ -42175,7 +42175,6 @@
42175
42175
  * @returns {*}
42176
42176
  */
42177
42177
  function toNumber(number) {
42178
- var _result;
42179
42178
  var result;
42180
42179
  if (number === true) {
42181
42180
  return 1;
@@ -42185,7 +42184,7 @@
42185
42184
  } else if (typeof number === 'string') {
42186
42185
  result = number.indexOf('.') > -1 ? parseFloat(number) : parseInt(number, 10);
42187
42186
  }
42188
- return (_result = result) !== null && _result !== void 0 ? _result : 0;
42187
+ return result || 0;
42189
42188
  }
42190
42189
 
42191
42190
  /**
@@ -42198,7 +42197,7 @@
42198
42197
  return -1 * toNumber(number);
42199
42198
  }
42200
42199
  function toNumberNotNaN(number) {
42201
- var _result2;
42200
+ var _result;
42202
42201
  var result;
42203
42202
  if (number === true) {
42204
42203
  return 1;
@@ -42211,7 +42210,7 @@
42211
42210
  if (isNaN(result)) {
42212
42211
  return 0;
42213
42212
  }
42214
- return (_result2 = result) !== null && _result2 !== void 0 ? _result2 : 0;
42213
+ return (_result = result) !== null && _result !== void 0 ? _result : 0;
42215
42214
  }
42216
42215
 
42217
42216
  var ERROR$1 = 'ERROR';
@@ -42328,6 +42327,9 @@
42328
42327
  } else if (type === ">=") {
42329
42328
  return tsValue(exp1) >= tsValue(exp2);
42330
42329
  } else if (type === "=") {
42330
+ if (exp1 === 0 || exp2 === 0) {
42331
+ return (exp1 || 0) === (exp2 || 0);
42332
+ }
42331
42333
  return tsValue(exp1) === tsValue(exp2);
42332
42334
  }
42333
42335
  }
@@ -42365,6 +42367,7 @@
42365
42367
  foundFormula = true;
42366
42368
  params = tsParams(symbolParts[0], params);
42367
42369
  result = formulajs[symbolParts[0]].apply(formulajs, _toConsumableArray$1(params));
42370
+ result = tsResult(symbolParts[0], result);
42368
42371
  }
42369
42372
  } else {
42370
42373
  var length = symbolParts.length;
@@ -42423,6 +42426,17 @@
42423
42426
  }
42424
42427
  return params;
42425
42428
  }
42429
+ function tsResult(fnName, result) {
42430
+ if (fnName === 'UNIQUE') {
42431
+ if (Array.isArray(result) && Array.isArray(result[0])) {
42432
+ var uniResult = _toConsumableArray$1(new Set(result[0].flat()));
42433
+ return uniResult === null || uniResult === void 0 ? void 0 : uniResult.map(function (item) {
42434
+ return [[item]];
42435
+ });
42436
+ }
42437
+ }
42438
+ return result;
42439
+ }
42426
42440
 
42427
42441
  var SYMBOL$5 = '>';
42428
42442
  function func$5(exp1, exp2) {
@@ -80577,7 +80591,12 @@
80577
80591
  formulaError = _ctx$formulaCache$par.error;
80578
80592
  if (!lodash.isNil(r) && !lodash.isNil(c)) {
80579
80593
  if (isrefresh) {
80580
- execFunctionGroup(ctx, r, c, lodash.isNil(formulaError) ? result : formulaError, id);
80594
+ var _data$r;
80595
+ var data = getFlowdata(ctx, id);
80596
+ var cell = data === null || data === void 0 ? void 0 : (_data$r = data[r]) === null || _data$r === void 0 ? void 0 : _data$r[c];
80597
+ if ((cell === null || cell === void 0 ? void 0 : cell.v) !== result) {
80598
+ execFunctionGroup(ctx, r, c, lodash.isNil(formulaError) ? result : formulaError, id);
80599
+ }
80581
80600
  }
80582
80601
  if (!notInsertFunc) {
80583
80602
  insertUpdateFunctionGroup(ctx, r, c, id);
@@ -88978,7 +88997,7 @@
88978
88997
  rs: rs,
88979
88998
  cs: cs
88980
88999
  };
88981
- } else if (index === c) {
89000
+ } else if (index === c && cs !== 1) {
88982
89001
  if (direction === "lefttop") {
88983
89002
  merge_new["".concat(r, "_").concat(c + count)] = {
88984
89003
  r: r,
@@ -90872,11 +90891,6 @@
90872
90891
  console.time("calcTime:".concat(id));
90873
90892
  var index$1 = getSheetIndex(ctx, id);
90874
90893
  var luckysheetfile = ctx.luckysheetfile;
90875
- var file = luckysheetfile[index$1];
90876
- var calcChain = file.calcChain;
90877
- if (lodash.isNil(calcChain)) {
90878
- calcChain = [];
90879
- }
90880
90894
  if (!ctx.luckysheetfile[index$1].data) return;
90881
90895
  for (var r = 0; r < ctx.luckysheetfile[index$1].data.length; r += 1) {
90882
90896
  for (var c = 0; c < ctx.luckysheetfile[index$1].data[r].length; c += 1) {
@@ -90884,13 +90898,7 @@
90884
90898
  if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
90885
90899
  continue;
90886
90900
  }
90887
- var cc = {
90888
- r: r,
90889
- c: c,
90890
- id: id
90891
- };
90892
- calcChain.push(cc);
90893
- var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, undefined, true);
90901
+ var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, false, true);
90894
90902
  var newV = result[1];
90895
90903
  if (newV === cell.v) {
90896
90904
  continue;
@@ -90900,12 +90908,32 @@
90900
90908
  });
90901
90909
  }
90902
90910
  }
90903
- file.calcChain = lodash.uniqBy(calcChain, function (item) {
90904
- return item.r + item.c + item.id;
90905
- });
90906
90911
  ctx.luckysheetfile = luckysheetfile;
90907
90912
  console.timeEnd("calcTime:".concat(id));
90908
90913
  }
90914
+ function updateFunctionGroup(ctx) {
90915
+ var luckysheetfile = ctx.luckysheetfile;
90916
+ for (var index = 0; index < luckysheetfile.length; index++) {
90917
+ var file = luckysheetfile[index];
90918
+ var calcChain = [];
90919
+ if (!ctx.luckysheetfile[index].data) return;
90920
+ for (var r = 0; r < ctx.luckysheetfile[index].data.length; r += 1) {
90921
+ for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
90922
+ var cell = ctx.luckysheetfile[index].data[r][c];
90923
+ if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
90924
+ continue;
90925
+ }
90926
+ var cc = {
90927
+ r: r,
90928
+ c: c,
90929
+ id: file.id
90930
+ };
90931
+ calcChain.push(cc);
90932
+ }
90933
+ }
90934
+ file.calcChain = calcChain;
90935
+ }
90936
+ }
90909
90937
  function parseCellReferences(expression) {
90910
90938
  if (typeof expression !== "string" || expression.trim() === "") {
90911
90939
  return [];
@@ -100599,6 +100627,7 @@
100599
100627
  showSheet: showSheet,
100600
100628
  copySheet: copySheet,
100601
100629
  calculateSheetFromula: calculateSheetFromula,
100630
+ updateFunctionGroup: updateFunctionGroup,
100602
100631
  calculateSheetByCells: calculateSheetByCells,
100603
100632
  addSheet: addSheet$1,
100604
100633
  deleteSheet: deleteSheet$1,
@@ -100621,6 +100650,7 @@
100621
100650
  renderEditorSelector: undefined,
100622
100651
  copyRich: false,
100623
100652
  renderCalcInfo: undefined,
100653
+ renderCellOptions: undefined,
100624
100654
  renderFreezeCol: undefined,
100625
100655
  renderFreezeRow: undefined,
100626
100656
  renderFilter: undefined,
@@ -108410,12 +108440,12 @@
108410
108440
  };
108411
108441
 
108412
108442
  var CellOptions = function CellOptions() {
108413
- var _context$cellOptions;
108414
108443
  var _useContext = React.useContext(WorkbookContext),
108415
108444
  context = _useContext.context,
108416
108445
  refs = _useContext.refs,
108417
108446
  settings = _useContext.settings;
108418
- var cellOptions = (_context$cellOptions = context.cellOptions) !== null && _context$cellOptions !== void 0 ? _context$cellOptions : [];
108447
+ var currentSheet = context.luckysheetfile[getSheetIndex(context, context.currentSheetId)];
108448
+ var cellOptions = currentSheet.cellOptions;
108419
108449
  return /*#__PURE__*/React__default['default'].createElement("div", {
108420
108450
  className: "leankylin-cell-option"
108421
108451
  }, cellOptions === null || cellOptions === void 0 ? void 0 : cellOptions.map(function (item) {
@@ -114860,6 +114890,8 @@
114860
114890
  setCellOptions: function setCellOptions(cellOptions) {
114861
114891
  return setContext(function (ctx) {
114862
114892
  ctx.cellOptions = cellOptions;
114893
+ var index = getSheetIndex(ctx, context.currentSheetId);
114894
+ ctx.luckysheetfile[index].cellOptions = cellOptions;
114863
114895
  });
114864
114896
  },
114865
114897
  applyOp: function applyOp(ops) {