@fileverse-dev/fortune-core 1.1.52 → 1.1.53

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.
@@ -355,7 +355,7 @@ export function handleArrowKey(ctx, e) {
355
355
  var spans = doc.querySelectorAll("span");
356
356
  var lastSpan = spans[spans.length - 1];
357
357
  var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
358
- if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
358
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) || /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
359
359
  return;
360
360
  }
361
361
  }
@@ -178,7 +178,7 @@ export function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, containe
178
178
  var spans = doc.querySelectorAll("span");
179
179
  var firstSpan = spans[0];
180
180
  var lastSpan = spans[spans.length - 1];
181
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) {
181
+ if ((ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) && lastSpan && ctx.luckysheetCellUpdate.length === 2) {
182
182
  var rowseleted = [row_index, row_index_ed];
183
183
  var columnseleted = [col_index, col_index_ed];
184
184
  var left = col_pre;
@@ -28,6 +28,7 @@ import { locale } from "../locale";
28
28
  import { colors } from "./color";
29
29
  import { colLocation, mousePosition, rowLocation } from "./location";
30
30
  import { cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult } from ".";
31
+ import { isLetterNumberPattern, removeLastSpan } from "./../utils/index";
31
32
  var functionHTMLIndex = 0;
32
33
  var rangeIndexes = [];
33
34
  var operatorPriority = {
@@ -1246,7 +1247,9 @@ export function setCaretPosition(ctx, textDom, children, pos) {
1246
1247
  el.focus();
1247
1248
  } catch (err) {
1248
1249
  console.error(err);
1249
- moveCursorToEnd(textDom);
1250
+ setTimeout(function () {
1251
+ moveCursorToEnd(textDom);
1252
+ }, 10);
1250
1253
  }
1251
1254
  }
1252
1255
  function functionRange(ctx, obj, v, vp) {
@@ -1948,6 +1951,14 @@ export function functionStrChange(txt, type, rc, orient, stindex, step) {
1948
1951
  }
1949
1952
  export function rangeSetValue(ctx, cellInput, selected, fxInput) {
1950
1953
  var _a, _b, _c, _d, _e;
1954
+ var parser = new DOMParser();
1955
+ var doc = parser.parseFromString("<div>".concat(cellInput.innerHTML, "</div>"), "text/html");
1956
+ var spans = doc.querySelectorAll("span");
1957
+ var lastSpan = spans[spans.length - 1];
1958
+ if (lastSpan && isLetterNumberPattern(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
1959
+ var htmlR = removeLastSpan(cellInput.innerHTML);
1960
+ cellInput.innerHTML = "".concat(htmlR);
1961
+ }
1951
1962
  var $editor = cellInput;
1952
1963
  var $copyTo = fxInput;
1953
1964
  if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === "luckysheet-functionbox-cell") {
package/es/utils/index.js CHANGED
@@ -286,7 +286,6 @@ export function processArray(cellReferences, d, flowData) {
286
286
  var parsed = parseCellReference(cell);
287
287
  if (parsed) {
288
288
  coordinates.push([parsed.row, parsed.col]);
289
- console.log("".concat(cell, " -> [").concat(parsed.row, ", ").concat(parsed.col, "]"));
290
289
  }
291
290
  });
292
291
  var formated;
@@ -365,7 +365,7 @@ function handleArrowKey(ctx, e) {
365
365
  var spans = doc.querySelectorAll("span");
366
366
  var lastSpan = spans[spans.length - 1];
367
367
  var notFunctionInit = !((_b = document.getElementById("luckysheet-rich-text-editor")) === null || _b === void 0 ? void 0 : _b.innerText.includes("("));
368
- if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
368
+ if ((lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")")) || (lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes('"')) || notFunctionInit && /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) && !_lodash.default.includes(["="], lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText) || /^[a-zA-Z]+$/.test(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
369
369
  return;
370
370
  }
371
371
  }
@@ -197,7 +197,7 @@ function handleCellAreaMouseDown(ctx, globalCache, e, cellInput, container, fxIn
197
197
  var spans = doc.querySelectorAll("span");
198
198
  var firstSpan = spans[0];
199
199
  var lastSpan = spans[spans.length - 1];
200
- if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || (0, _modules.israngeseleciton)(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) {
200
+ if ((ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || (0, _modules.israngeseleciton)(ctx) || (firstSpan === null || firstSpan === void 0 ? void 0 : firstSpan.innerText.includes("=")) && !(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText.includes(")"))) && lastSpan && ctx.luckysheetCellUpdate.length === 2) {
201
201
  var rowseleted = [row_index, row_index_ed];
202
202
  var columnseleted = [col_index, col_index_ed];
203
203
  var left = col_pre;
@@ -38,6 +38,7 @@ var _locale = require("../locale");
38
38
  var _color = require("./color");
39
39
  var _location = require("./location");
40
40
  var _2 = require(".");
41
+ var _index = require("./../utils/index");
41
42
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
43
  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); }
43
44
  var __assign = void 0 && (void 0).__assign || function () {
@@ -1276,7 +1277,9 @@ function setCaretPosition(ctx, textDom, children, pos) {
1276
1277
  el.focus();
1277
1278
  } catch (err) {
1278
1279
  console.error(err);
1279
- moveCursorToEnd(textDom);
1280
+ setTimeout(function () {
1281
+ moveCursorToEnd(textDom);
1282
+ }, 10);
1280
1283
  }
1281
1284
  }
1282
1285
  function functionRange(ctx, obj, v, vp) {
@@ -1978,6 +1981,14 @@ function functionStrChange(txt, type, rc, orient, stindex, step) {
1978
1981
  }
1979
1982
  function rangeSetValue(ctx, cellInput, selected, fxInput) {
1980
1983
  var _a, _b, _c, _d, _e;
1984
+ var parser = new DOMParser();
1985
+ var doc = parser.parseFromString("<div>".concat(cellInput.innerHTML, "</div>"), "text/html");
1986
+ var spans = doc.querySelectorAll("span");
1987
+ var lastSpan = spans[spans.length - 1];
1988
+ if (lastSpan && (0, _index.isLetterNumberPattern)(lastSpan === null || lastSpan === void 0 ? void 0 : lastSpan.innerText)) {
1989
+ var htmlR = (0, _index.removeLastSpan)(cellInput.innerHTML);
1990
+ cellInput.innerHTML = "".concat(htmlR);
1991
+ }
1981
1992
  var $editor = cellInput;
1982
1993
  var $copyTo = fxInput;
1983
1994
  if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.id) === "luckysheet-functionbox-cell") {
@@ -354,7 +354,6 @@ function processArray(cellReferences, d, flowData) {
354
354
  var parsed = parseCellReference(cell);
355
355
  if (parsed) {
356
356
  coordinates.push([parsed.row, parsed.col]);
357
- console.log("".concat(cell, " -> [").concat(parsed.row, ", ").concat(parsed.col, "]"));
358
357
  }
359
358
  });
360
359
  var formated;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.52",
3
+ "version": "1.1.53",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",