@fileverse-dev/fortune-core 1.2.96-maitra-feb6-patch-1 → 1.2.96-scroll

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.
@@ -309,7 +309,7 @@ export function setCellValue(ctx, r, c, d, v) {
309
309
  var flag = vupdate.split("").every(function (ele) {
310
310
  return ele === "0" || ele === ".";
311
311
  });
312
- if (flag || /^0+\d/.test(vupdate)) {
312
+ if (flag) {
313
313
  vupdate = parseFloat(vupdate);
314
314
  }
315
315
  }
@@ -568,18 +568,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
568
568
  var curv = flowdata[r][c];
569
569
  var oldValue = _.cloneDeep(curv);
570
570
  var isPrevInline = isInlineStringCell(curv);
571
- var isCurInline = false;
572
- if ((inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span") {
573
- var spans = ($input === null || $input === void 0 ? void 0 : $input.querySelectorAll("span")) || [];
574
- var hasMultipleSpans = spans.length > 1;
575
- var hasFormattingOrSpecialClasses = Array.from(spans).some(function (span) {
576
- var hasSpecialClass = span.className.includes("luckysheet") || span.className.includes("fortune");
577
- var cssText = span.style.cssText || "";
578
- var meaningfulCss = cssText.replace(/color:\s*rgb\(0,\s*0,\s*0\);?/gi, "").replace(/color:\s*#000000;?/gi, "").replace(/color:\s*black;?/gi, "").trim();
579
- return hasSpecialClass || meaningfulCss.length > 0;
580
- });
581
- isCurInline = hasMultipleSpans || hasFormattingOrSpecialClasses;
582
- }
571
+ var isCurInline = (inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span";
583
572
  var isCopyVal = false;
584
573
  if (!isCurInline && inputText && inputText.length > 0) {
585
574
  var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
@@ -124,7 +124,7 @@ var FormulaCache = function () {
124
124
  });
125
125
  }
126
126
  FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
127
- var _a, _b, _c, _d, _e, _f;
127
+ var _a, _b, _c, _d;
128
128
  var isCryptoDeno = typeof (cell === null || cell === void 0 ? void 0 : cell.m) === "string" ? ((_a = cell === null || cell === void 0 ? void 0 : cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell === null || cell === void 0 ? void 0 : cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell === null || cell === void 0 ? void 0 : cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC")) : false;
129
129
  if (isCryptoDeno && typeof (cell === null || cell === void 0 ? void 0 : cell.m) === "string") {
130
130
  var splitedNumberString = cell.m.split(" ")[0];
@@ -134,20 +134,6 @@ var FormulaCache = function () {
134
134
  var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
135
135
  return Number.isNaN(n) ? cell.v : n;
136
136
  }
137
- if (((_e = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _e === void 0 ? void 0 : _e.t) === "inlineStr" && Array.isArray((_f = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _f === void 0 ? void 0 : _f.s) && cell.ct.s.length > 0) {
138
- var inlineValue = cell.ct.s.map(function (segment) {
139
- return (segment === null || segment === void 0 ? void 0 : segment.v) || "";
140
- }).join("");
141
- var trimmedValue = inlineValue.trim();
142
- if (trimmedValue.length > 0) {
143
- var cleanedValue = trimmedValue.replace(/,/g, "");
144
- var n = Number(cleanedValue);
145
- if (!Number.isNaN(n)) {
146
- return n;
147
- }
148
- return inlineValue;
149
- }
150
- }
151
137
  return String(cell === null || cell === void 0 ? void 0 : cell.m).includes("%") ? cell === null || cell === void 0 ? void 0 : cell.m : cell === null || cell === void 0 ? void 0 : cell.v;
152
138
  };
153
139
  return FormulaCache;
@@ -25,7 +25,7 @@ export function isRealNull(val) {
25
25
  return _.isNil(val) || val.toString().replace(/\s/g, "") === "";
26
26
  }
27
27
  export function isHexValue(str) {
28
- return /^0x[a-fA-F0-9]+$/i.test(str);
28
+ return /^0x?[a-fA-F0-9]+$/.test(str);
29
29
  }
30
30
  export function isRealNum(val) {
31
31
  if (isHexValue(val === null || val === void 0 ? void 0 : val.toString())) {
@@ -342,7 +342,7 @@ function setCellValue(ctx, r, c, d, v) {
342
342
  var flag = vupdate.split("").every(function (ele) {
343
343
  return ele === "0" || ele === ".";
344
344
  });
345
- if (flag || /^0+\d/.test(vupdate)) {
345
+ if (flag) {
346
346
  vupdate = parseFloat(vupdate);
347
347
  }
348
348
  }
@@ -601,18 +601,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
601
601
  var curv = flowdata[r][c];
602
602
  var oldValue = _lodash.default.cloneDeep(curv);
603
603
  var isPrevInline = (0, _inlineString.isInlineStringCell)(curv);
604
- var isCurInline = false;
605
- if ((inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span") {
606
- var spans = ($input === null || $input === void 0 ? void 0 : $input.querySelectorAll("span")) || [];
607
- var hasMultipleSpans = spans.length > 1;
608
- var hasFormattingOrSpecialClasses = Array.from(spans).some(function (span) {
609
- var hasSpecialClass = span.className.includes("luckysheet") || span.className.includes("fortune");
610
- var cssText = span.style.cssText || "";
611
- var meaningfulCss = cssText.replace(/color:\s*rgb\(0,\s*0,\s*0\);?/gi, "").replace(/color:\s*#000000;?/gi, "").replace(/color:\s*black;?/gi, "").trim();
612
- return hasSpecialClass || meaningfulCss.length > 0;
613
- });
614
- isCurInline = hasMultipleSpans || hasFormattingOrSpecialClasses;
615
- }
604
+ var isCurInline = (inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span";
616
605
  var isCopyVal = false;
617
606
  if (!isCurInline && inputText && inputText.length > 0) {
618
607
  var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/&#13;&#10;/g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
@@ -155,7 +155,7 @@ var FormulaCache = exports.FormulaCache = function () {
155
155
  });
156
156
  }
157
157
  FormulaCache.prototype.tryGetCellAsNumber = function (cell) {
158
- var _a, _b, _c, _d, _e, _f;
158
+ var _a, _b, _c, _d;
159
159
  var isCryptoDeno = typeof (cell === null || cell === void 0 ? void 0 : cell.m) === "string" ? ((_a = cell === null || cell === void 0 ? void 0 : cell.m) === null || _a === void 0 ? void 0 : _a.includes("ETH")) || ((_b = cell === null || cell === void 0 ? void 0 : cell.m) === null || _b === void 0 ? void 0 : _b.includes("SOL")) || ((_c = cell === null || cell === void 0 ? void 0 : cell.m) === null || _c === void 0 ? void 0 : _c.includes("BTC")) : false;
160
160
  if (isCryptoDeno && typeof (cell === null || cell === void 0 ? void 0 : cell.m) === "string") {
161
161
  var splitedNumberString = cell.m.split(" ")[0];
@@ -165,20 +165,6 @@ var FormulaCache = exports.FormulaCache = function () {
165
165
  var n = Number(cell === null || cell === void 0 ? void 0 : cell.v);
166
166
  return Number.isNaN(n) ? cell.v : n;
167
167
  }
168
- if (((_e = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _e === void 0 ? void 0 : _e.t) === "inlineStr" && Array.isArray((_f = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _f === void 0 ? void 0 : _f.s) && cell.ct.s.length > 0) {
169
- var inlineValue = cell.ct.s.map(function (segment) {
170
- return (segment === null || segment === void 0 ? void 0 : segment.v) || "";
171
- }).join("");
172
- var trimmedValue = inlineValue.trim();
173
- if (trimmedValue.length > 0) {
174
- var cleanedValue = trimmedValue.replace(/,/g, "");
175
- var n = Number(cleanedValue);
176
- if (!Number.isNaN(n)) {
177
- return n;
178
- }
179
- return inlineValue;
180
- }
181
- }
182
168
  return String(cell === null || cell === void 0 ? void 0 : cell.m).includes("%") ? cell === null || cell === void 0 ? void 0 : cell.m : cell === null || cell === void 0 ? void 0 : cell.v;
183
169
  };
184
170
  return FormulaCache;
@@ -42,7 +42,7 @@ function isRealNull(val) {
42
42
  return _lodash.default.isNil(val) || val.toString().replace(/\s/g, "") === "";
43
43
  }
44
44
  function isHexValue(str) {
45
- return /^0x[a-fA-F0-9]+$/i.test(str);
45
+ return /^0x?[a-fA-F0-9]+$/.test(str);
46
46
  }
47
47
  function isRealNum(val) {
48
48
  if (isHexValue(val === null || val === void 0 ? void 0 : val.toString())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.96-maitra-feb6-patch-1",
3
+ "version": "1.2.96-scroll",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dev": "father-build --watch"
16
16
  },
17
17
  "dependencies": {
18
- "@fileverse-dev/formula-parser": "0.2.94-maitra-feb6-patch-1",
18
+ "@fileverse-dev/formula-parser": "0.2.94",
19
19
  "dayjs": "^1.11.0",
20
20
  "immer": "^9.0.12",
21
21
  "lodash": "^4.17.21",