@fileverse-dev/fortune-core 1.1.70 → 1.1.72-hotfix-1

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/es/api/sheet.js CHANGED
@@ -2,7 +2,7 @@ import _ from "lodash";
2
2
  import { v4 as uuidv4 } from "uuid";
3
3
  import { dataToCelldata, getSheet } from "./common";
4
4
  import { getSheetIndex } from "../utils";
5
- import { api, execfunction, insertUpdateFunctionGroup, locale } from "..";
5
+ import { api, execfunction, getFlowdata, insertUpdateFunctionGroup, locale, spillSortResult } from "..";
6
6
  export function getAllSheets(ctx) {
7
7
  return ctx.luckysheetfile;
8
8
  }
@@ -121,7 +121,16 @@ export function calculateSheetFromula(ctx, id) {
121
121
  continue;
122
122
  }
123
123
  var result = execfunction(ctx, (_c = ctx.luckysheetfile[index].data[r][c]) === null || _c === void 0 ? void 0 : _c.f, r, c, id);
124
- api.setCellValue(ctx, r, c, result[1], null);
124
+ var isValueArray = Array.isArray(result[1]);
125
+ if (isValueArray) {
126
+ var value = {
127
+ f: result[2],
128
+ v: result[1]
129
+ };
130
+ spillSortResult(ctx, r, c, value, getFlowdata(ctx));
131
+ } else {
132
+ api.setCellValue(ctx, r, c, result[1], null);
133
+ }
125
134
  insertUpdateFunctionGroup(ctx, r, c, id);
126
135
  }
127
136
  }
@@ -504,9 +504,6 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
504
504
  var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
505
505
  var flowdata = getFlowdata(ctx);
506
506
  if (!flowdata) return;
507
- if (!(value === null || value === void 0 ? void 0 : value.toString())) {
508
- clearCellError(ctx, r, c);
509
- }
510
507
  var index = getSheetIndex(ctx, ctx.currentSheetId);
511
508
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
512
509
  if (!_.isNil(dataVerification)) {
@@ -563,6 +560,10 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
563
560
  }
564
561
  }
565
562
  value = value || ($input === null || $input === void 0 ? void 0 : $input.innerText);
563
+ var shouldClearError = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.f) ? oldValue.f !== value : (oldValue === null || oldValue === void 0 ? void 0 : oldValue.v) !== value;
564
+ if (shouldClearError) {
565
+ clearCellError(ctx, r, c);
566
+ }
566
567
  if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
567
568
  cancelNormalSelected(ctx);
568
569
  return;
@@ -20,6 +20,7 @@ import { hasPartMC } from "./validation";
20
20
  import { update } from "./format";
21
21
  import SSF from "./ssf";
22
22
  import { CFSplitRange } from "./ConditionFormat";
23
+ import { clearCellError } from "./error-state-helpers";
23
24
  export var selectionCache = {
24
25
  isPasteAction: false
25
26
  };
@@ -1536,6 +1537,7 @@ export function deleteSelectedCellText(ctx) {
1536
1537
  cell === null || cell === void 0 ? true : delete cell.baseValue;
1537
1538
  cell === null || cell === void 0 ? true : delete cell.baseCurrency;
1538
1539
  }
1540
+ clearCellError(ctx, r, c);
1539
1541
  } else {
1540
1542
  d[r][c] = null;
1541
1543
  }
package/lib/api/sheet.js CHANGED
@@ -138,7 +138,16 @@ function calculateSheetFromula(ctx, id) {
138
138
  continue;
139
139
  }
140
140
  var result = (0, _2.execfunction)(ctx, (_c = ctx.luckysheetfile[index].data[r][c]) === null || _c === void 0 ? void 0 : _c.f, r, c, id);
141
- _2.api.setCellValue(ctx, r, c, result[1], null);
141
+ var isValueArray = Array.isArray(result[1]);
142
+ if (isValueArray) {
143
+ var value = {
144
+ f: result[2],
145
+ v: result[1]
146
+ };
147
+ (0, _2.spillSortResult)(ctx, r, c, value, (0, _2.getFlowdata)(ctx));
148
+ } else {
149
+ _2.api.setCellValue(ctx, r, c, result[1], null);
150
+ }
142
151
  (0, _2.insertUpdateFunctionGroup)(ctx, r, c, id);
143
152
  }
144
153
  }
@@ -537,9 +537,6 @@ function updateCell(ctx, r, c, $input, value, canvas) {
537
537
  var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
538
538
  var flowdata = (0, _context.getFlowdata)(ctx);
539
539
  if (!flowdata) return;
540
- if (!(value === null || value === void 0 ? void 0 : value.toString())) {
541
- (0, _api.clearCellError)(ctx, r, c);
542
- }
543
540
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
544
541
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
545
542
  if (!_lodash.default.isNil(dataVerification)) {
@@ -596,6 +593,10 @@ function updateCell(ctx, r, c, $input, value, canvas) {
596
593
  }
597
594
  }
598
595
  value = value || ($input === null || $input === void 0 ? void 0 : $input.innerText);
596
+ var shouldClearError = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.f) ? oldValue.f !== value : (oldValue === null || oldValue === void 0 ? void 0 : oldValue.v) !== value;
597
+ if (shouldClearError) {
598
+ (0, _api.clearCellError)(ctx, r, c);
599
+ }
599
600
  if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
600
601
  cancelNormalSelected(ctx);
601
602
  return;
@@ -42,6 +42,7 @@ var _validation = require("./validation");
42
42
  var _format = require("./format");
43
43
  var _ssf = _interopRequireDefault(require("./ssf"));
44
44
  var _ConditionFormat = require("./ConditionFormat");
45
+ var _errorStateHelpers = require("./error-state-helpers");
45
46
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
47
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
47
48
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
@@ -1571,6 +1572,7 @@ function deleteSelectedCellText(ctx) {
1571
1572
  cell === null || cell === void 0 ? true : delete cell.baseValue;
1572
1573
  cell === null || cell === void 0 ? true : delete cell.baseCurrency;
1573
1574
  }
1575
+ (0, _errorStateHelpers.clearCellError)(ctx, r, c);
1574
1576
  } else {
1575
1577
  d[r][c] = null;
1576
1578
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.70",
3
+ "version": "1.1.72-hotfix-1",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",