@fileverse-dev/fortune-core 1.1.70 → 1.1.72

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.
@@ -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
  }
@@ -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",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",