@fileverse-dev/fortune-core 1.1.69 → 1.1.71

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,6 +504,9 @@ 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
+ }
507
510
  var index = getSheetIndex(ctx, ctx.currentSheetId);
508
511
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
509
512
  if (!_.isNil(dataVerification)) {
@@ -23,7 +23,7 @@ import _ from "lodash";
23
23
  import { getFlowdata } from "../context";
24
24
  import { columnCharToIndex, escapeScriptTag, getSheetIndex, indexToColumnChar, getSheetIdByName, escapeHTMLTag } from "../utils";
25
25
  import { getcellFormula, getRangetxt, mergeMoveMain, setCellValue } from "./cell";
26
- import { customErrorMessage, error, detectErrorFromValue } from "./validation";
26
+ import { error, detectErrorFromValue } from "./validation";
27
27
  import { locale } from "../locale";
28
28
  import { colors } from "./color";
29
29
  import { colLocation, mousePosition, rowLocation } from "./location";
@@ -740,7 +740,7 @@ export function execfunction(ctx, txt, r, c, id, calcChainSet, isrefresh, notIns
740
740
  } else {
741
741
  clearCellError(ctx, r, c);
742
742
  }
743
- return [true, !isError ? finalResult : customErrorMessage(formulaError), txt];
743
+ return [true, !isError ? finalResult : "#ERROR", txt];
744
744
  }
745
745
  function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
746
746
  var r = dynamicArrayItem.r,
@@ -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
  }
@@ -11,7 +11,6 @@ export declare const error: {
11
11
  };
12
12
  export declare const errorMessagesFromValue: Record<string, string>;
13
13
  export declare function detectErrorFromValue(input: string): string;
14
- export declare function customErrorMessage(errorMessage: string): string;
15
14
  export declare function valueIsError(value: string): boolean;
16
15
  export declare function isRealNull(val: any): boolean;
17
16
  export declare function isHexValue(str: string): boolean;
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import dayjs from "dayjs";
3
3
  import _ from "lodash";
4
- import { error as cellErrorMessages, ERROR_NAME, ERROR_DIV_ZERO, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, ERROR } from "@fileverse-dev/formula-parser";
4
+ import { ERROR_NAME, ERROR_DIV_ZERO, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, ERROR } from "@fileverse-dev/formula-parser";
5
5
  import { hasChinaword } from "./text";
6
6
  export var error = {
7
7
  v: "#VALUE!",
@@ -17,12 +17,6 @@ export var errorMessagesFromValue = (_a = {}, _a[ERROR_DIV_ZERO] = "Invalid calc
17
17
  export function detectErrorFromValue(input) {
18
18
  return errorMessagesFromValue[input];
19
19
  }
20
- export function customErrorMessage(errorMessage) {
21
- if (errorMessage === cellErrorMessages(ERROR_NAME)) {
22
- return "#ERROR";
23
- }
24
- return errorMessage;
25
- }
26
20
  var errorValues = Object.values(error);
27
21
  export function valueIsError(value) {
28
22
  return errorValues.includes(value);
@@ -537,6 +537,9 @@ 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
+ }
540
543
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
541
544
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
542
545
  if (!_lodash.default.isNil(dataVerification)) {
@@ -770,7 +770,7 @@ function execfunction(ctx, txt, r, c, id, calcChainSet, isrefresh, notInsertFunc
770
770
  } else {
771
771
  (0, _2.clearCellError)(ctx, r, c);
772
772
  }
773
- return [true, !isError ? finalResult : (0, _validation.customErrorMessage)(formulaError), txt];
773
+ return [true, !isError ? finalResult : "#ERROR", txt];
774
774
  }
775
775
  function insertUpdateDynamicArray(ctx, dynamicArrayItem) {
776
776
  var r = dynamicArrayItem.r,
@@ -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
  }
@@ -11,7 +11,6 @@ export declare const error: {
11
11
  };
12
12
  export declare const errorMessagesFromValue: Record<string, string>;
13
13
  export declare function detectErrorFromValue(input: string): string;
14
- export declare function customErrorMessage(errorMessage: string): string;
15
14
  export declare function valueIsError(value: string): boolean;
16
15
  export declare function isRealNull(val: any): boolean;
17
16
  export declare function isHexValue(str: string): boolean;
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.customErrorMessage = customErrorMessage;
7
6
  exports.detectErrorFromValue = detectErrorFromValue;
8
7
  exports.diff = diff;
9
8
  exports.errorMessagesFromValue = exports.error = void 0;
@@ -35,12 +34,6 @@ var errorMessagesFromValue = exports.errorMessagesFromValue = (_a = {}, _a[_form
35
34
  function detectErrorFromValue(input) {
36
35
  return errorMessagesFromValue[input];
37
36
  }
38
- function customErrorMessage(errorMessage) {
39
- if (errorMessage === (0, _formulaParser.error)(_formulaParser.ERROR_NAME)) {
40
- return "#ERROR";
41
- }
42
- return errorMessage;
43
- }
44
37
  var errorValues = Object.values(error);
45
38
  function valueIsError(value) {
46
39
  return errorValues.includes(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.69",
3
+ "version": "1.1.71",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",