@fileverse-dev/fortune-core 1.3.12 → 1.3.13-create-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.
Files changed (65) hide show
  1. package/es/events/keyboard.d.ts +2 -2
  2. package/es/events/keyboard.js +204 -30
  3. package/es/events/mouse.js +79 -44
  4. package/es/events/paste.js +177 -56
  5. package/es/locale/en.d.ts +3 -0
  6. package/es/locale/en.js +3 -0
  7. package/es/locale/es.d.ts +3 -0
  8. package/es/locale/es.js +3 -0
  9. package/es/locale/hi.d.ts +3 -0
  10. package/es/locale/hi.js +3 -0
  11. package/es/locale/index.d.ts +3 -0
  12. package/es/locale/zh.d.ts +3 -0
  13. package/es/locale/zh.js +3 -0
  14. package/es/locale/zh_tw.d.ts +3 -0
  15. package/es/locale/zh_tw.js +3 -0
  16. package/es/modules/ConditionFormat.js +26 -0
  17. package/es/modules/cell.d.ts +4 -1
  18. package/es/modules/cell.js +124 -15
  19. package/es/modules/clipboard.js +111 -2
  20. package/es/modules/format.js +12 -7
  21. package/es/modules/formula.d.ts +23 -0
  22. package/es/modules/formula.js +610 -51
  23. package/es/modules/hyperlink.js +18 -6
  24. package/es/modules/inline-string.js +21 -4
  25. package/es/modules/moveCells.js +52 -9
  26. package/es/modules/selection.d.ts +1 -0
  27. package/es/modules/selection.js +102 -16
  28. package/es/modules/validation.js +6 -3
  29. package/es/paste-helpers/calculate-range-cell-size.js +5 -4
  30. package/es/paste-table-helpers.d.ts +1 -1
  31. package/es/paste-table-helpers.js +170 -21
  32. package/es/types.d.ts +3 -0
  33. package/lib/events/keyboard.d.ts +2 -2
  34. package/lib/events/keyboard.js +203 -29
  35. package/lib/events/mouse.js +78 -43
  36. package/lib/events/paste.js +175 -54
  37. package/lib/locale/en.d.ts +3 -0
  38. package/lib/locale/en.js +3 -0
  39. package/lib/locale/es.d.ts +3 -0
  40. package/lib/locale/es.js +3 -0
  41. package/lib/locale/hi.d.ts +3 -0
  42. package/lib/locale/hi.js +3 -0
  43. package/lib/locale/index.d.ts +3 -0
  44. package/lib/locale/zh.d.ts +3 -0
  45. package/lib/locale/zh.js +3 -0
  46. package/lib/locale/zh_tw.d.ts +3 -0
  47. package/lib/locale/zh_tw.js +3 -0
  48. package/lib/modules/ConditionFormat.js +26 -0
  49. package/lib/modules/cell.d.ts +4 -1
  50. package/lib/modules/cell.js +123 -14
  51. package/lib/modules/clipboard.js +111 -2
  52. package/lib/modules/format.js +12 -7
  53. package/lib/modules/formula.d.ts +23 -0
  54. package/lib/modules/formula.js +623 -51
  55. package/lib/modules/hyperlink.js +18 -6
  56. package/lib/modules/inline-string.js +21 -4
  57. package/lib/modules/moveCells.js +52 -9
  58. package/lib/modules/selection.d.ts +1 -0
  59. package/lib/modules/selection.js +101 -15
  60. package/lib/modules/validation.js +6 -3
  61. package/lib/paste-helpers/calculate-range-cell-size.js +5 -4
  62. package/lib/paste-table-helpers.d.ts +1 -1
  63. package/lib/paste-table-helpers.js +170 -21
  64. package/lib/types.d.ts +3 -0
  65. package/package.json +1 -1
@@ -41,6 +41,7 @@ var _formula = require("./formula");
41
41
  var _inlineString = require("./inline-string");
42
42
  var _validation = require("./validation");
43
43
  var _text = require("./text");
44
+ var _locale = require("../locale");
44
45
  var _sort = require("./sort");
45
46
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
46
47
  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); }
@@ -102,6 +103,32 @@ function newlinesToBr(text) {
102
103
  if (!text) return "";
103
104
  return text.replace(/\r\n|\r|\n/g, "<br />");
104
105
  }
106
+ function closeUnclosedParenthesesInFormula(formula) {
107
+ if (!formula.startsWith("=") || formula.length <= 1) return formula;
108
+ var body = formula.slice(1);
109
+ var depth = 0;
110
+ var inString = false;
111
+ for (var i = 0; i < body.length; i += 1) {
112
+ var ch = body[i];
113
+ if (inString) {
114
+ if (ch === '"') {
115
+ if (body[i + 1] === '"') {
116
+ i += 1;
117
+ } else {
118
+ inString = false;
119
+ }
120
+ }
121
+ continue;
122
+ }
123
+ if (ch === '"') {
124
+ inString = true;
125
+ continue;
126
+ }
127
+ if (ch === "(") depth += 1;else if (ch === ")") depth = Math.max(0, depth - 1);
128
+ }
129
+ if (depth <= 0) return formula;
130
+ return "".concat(formula).concat(")".repeat(depth));
131
+ }
105
132
  function getCellValue(r, c, data, attr) {
106
133
  var _a;
107
134
  if (!attr) {
@@ -574,6 +601,8 @@ function cancelNormalSelected(ctx) {
574
601
  ctx.formulaCache.rangestart = false;
575
602
  ctx.formulaCache.rangedrag_column_start = false;
576
603
  ctx.formulaCache.rangedrag_row_start = false;
604
+ ctx.formulaCache.rangeSelectionActive = null;
605
+ ctx.formulaCache.formulaEditorOwner = null;
577
606
  }
578
607
  function updateCell(ctx, r, c, $input, value, canvas) {
579
608
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
@@ -649,6 +678,11 @@ function updateCell(ctx, r, c, $input, value, canvas) {
649
678
  }
650
679
  }
651
680
  value = value || inputText;
681
+ if (_lodash.default.isString(value) && value.startsWith("=") && value.length > 1) {
682
+ value = closeUnclosedParenthesesInFormula(value);
683
+ } else if (_lodash.default.isPlainObject(value) && _lodash.default.isString(value.f) && value.f.startsWith("=") && value.f.length > 1) {
684
+ value.f = closeUnclosedParenthesesInFormula(value.f);
685
+ }
652
686
  var shouldClearError = (oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.f) ? oldValue_1.f !== value : (oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.v) !== value;
653
687
  if (shouldClearError) {
654
688
  (0, _api.clearCellError)(ctx, r, c);
@@ -1074,7 +1108,7 @@ function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1074
1108
  if (key === "it" && valueNum !== 0) {
1075
1109
  style.fontStyle = "italic";
1076
1110
  }
1077
- if (key === "fs" && valueNum !== 10) {
1111
+ if (key === "fs" && !_lodash.default.isNil(value)) {
1078
1112
  style.fontSize = "".concat(valueNum, "pt");
1079
1113
  }
1080
1114
  if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
@@ -1098,14 +1132,13 @@ function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1098
1132
  return style;
1099
1133
  }
1100
1134
  function getStyleByCell(ctx, d, r, c) {
1101
- var _a;
1135
+ var _a, _b;
1102
1136
  var style = {};
1103
1137
  var checksAF = [];
1104
1138
  var cf_compute = (0, _ConditionFormat.getComputeMap)(ctx);
1105
1139
  var checksCF = (0, _ConditionFormat.checkCF)(r, c, cf_compute);
1106
1140
  var cell = (_a = d === null || d === void 0 ? void 0 : d[r]) === null || _a === void 0 ? void 0 : _a[c];
1107
1141
  if (!cell) return {};
1108
- var isInline = (0, _inlineString.isInlineStringCell)(cell);
1109
1142
  if ("bg" in cell) {
1110
1143
  var value = normalizedCellAttr(cell, "bg");
1111
1144
  if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
@@ -1136,7 +1169,9 @@ function getStyleByCell(ctx, d, r, c) {
1136
1169
  }
1137
1170
  if ("ff" in cell) {
1138
1171
  var value = normalizedCellAttr(cell, "ff");
1139
- style.fontFamily = value;
1172
+ var fontarray = (0, _locale.locale)(ctx).fontarray;
1173
+ var ffIndex = parseInt(value, 10);
1174
+ style.fontFamily = Number.isNaN(ffIndex) ? value : (_b = fontarray[ffIndex]) !== null && _b !== void 0 ? _b : value;
1140
1175
  }
1141
1176
  if ("vt" in cell) {
1142
1177
  var value = normalizedCellAttr(cell, "vt");
@@ -1146,12 +1181,52 @@ function getStyleByCell(ctx, d, r, c) {
1146
1181
  style.alignItems = "flex-end";
1147
1182
  }
1148
1183
  }
1149
- if (!isInline) {
1150
- style = _lodash.default.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
1151
- }
1184
+ style = _lodash.default.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
1152
1185
  return style;
1153
1186
  }
1154
- function getInlineStringHTML(r, c, data) {
1187
+ function normalizeInlineStringClipboardStyle(style) {
1188
+ var decorations = new Set();
1189
+ var normalizedStyle = {
1190
+ color: style.color || "#000000",
1191
+ fontFamily: style.fontFamily || "Arial",
1192
+ fontSize: style.fontSize || "11pt",
1193
+ fontStyle: style.fontStyle || "normal",
1194
+ fontWeight: style.fontWeight || "400"
1195
+ };
1196
+ var backgroundColor = style.backgroundColor || style.background;
1197
+ if (backgroundColor && backgroundColor !== "transparent" && backgroundColor !== "rgba(0, 0, 0, 0)") {
1198
+ normalizedStyle.backgroundColor = backgroundColor;
1199
+ }
1200
+ if (typeof style.textDecoration === "string") {
1201
+ style.textDecoration.split(/\s+/).filter(Boolean).forEach(function (decoration) {
1202
+ return decorations.add(decoration);
1203
+ });
1204
+ }
1205
+ if (style.borderBottom) {
1206
+ decorations.add("underline");
1207
+ normalizedStyle.textDecorationSkipInk = "none";
1208
+ }
1209
+ if (decorations.size > 0) {
1210
+ normalizedStyle.textDecoration = Array.from(decorations).join(" ");
1211
+ }
1212
+ return normalizedStyle;
1213
+ }
1214
+ function buildClipboardCompatibleInlineRuns(text, styleAttr) {
1215
+ var normalizedText = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
1216
+ var segments = normalizedText.split("\n");
1217
+ return segments.map(function (segment, index) {
1218
+ var html = "";
1219
+ if (segment.length > 0) {
1220
+ html += "<span style='".concat(styleAttr, "'>").concat(segment, "</span>");
1221
+ }
1222
+ if (index < segments.length - 1) {
1223
+ html += "<span style='".concat(styleAttr, "'><br></span>");
1224
+ }
1225
+ return html;
1226
+ }).join("");
1227
+ }
1228
+ function getInlineStringHTML(r, c, data, options) {
1229
+ var _a;
1155
1230
  var ct = getCellValue(r, c, data, "ct");
1156
1231
  if ((0, _inlineString.isInlineStringCT)(ct)) {
1157
1232
  var strings = ct.s;
@@ -1159,17 +1234,45 @@ function getInlineStringHTML(r, c, data) {
1159
1234
  for (var i = 0; i < strings.length; i += 1) {
1160
1235
  var strObj = strings[i];
1161
1236
  if (strObj.v) {
1162
- var style = getFontStyleByCell(strObj);
1237
+ var baseStyle = __assign(__assign({}, (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) ? (_a = options.inheritedStyle) !== null && _a !== void 0 ? _a : {} : {}), getFontStyleByCell(strObj));
1238
+ var style = (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) ? normalizeInlineStringClipboardStyle(baseStyle) : baseStyle;
1239
+ if (!style.fontWeight) {
1240
+ style.fontWeight = "400";
1241
+ }
1242
+ if (!style.fontStyle) {
1243
+ style.fontStyle = "normal";
1244
+ }
1245
+ if (!style.fontSize) {
1246
+ style.fontSize = "11pt";
1247
+ }
1248
+ if (!style.fontFamily) {
1249
+ style.fontFamily = "Arial";
1250
+ }
1163
1251
  var link = strObj.link;
1164
1252
  if ((link === null || link === void 0 ? void 0 : link.linkType) && (link === null || link === void 0 ? void 0 : link.linkAddress)) {
1165
1253
  style.color = style.color || "rgb(0, 0, 255)";
1166
- style.borderBottom = style.borderBottom || "1px solid rgb(0, 0, 255)";
1254
+ if (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) {
1255
+ style.textDecoration = style.textDecoration ? "".concat(style.textDecoration, " underline") : "underline";
1256
+ style.textDecorationSkipInk = "none";
1257
+ } else {
1258
+ style.borderBottom = style.borderBottom || "1px solid rgb(0, 0, 255)";
1259
+ }
1167
1260
  }
1168
- var styleStr = _lodash.default.map(style, function (v, key) {
1261
+ var styleStr = _lodash.default.toPairs(style).filter(function (_a) {
1262
+ var v = _a[1];
1263
+ return !_lodash.default.isNil(v) && v !== "" && v !== "undefined";
1264
+ }).map(function (_a) {
1265
+ var key = _a[0],
1266
+ v = _a[1];
1169
1267
  return "".concat(_lodash.default.kebabCase(key), ":").concat(_lodash.default.isNumber(v) ? "".concat(v, "px") : v, ";");
1170
- }).join("");
1171
- var dataAttrs = (link === null || link === void 0 ? void 0 : link.linkType) && (link === null || link === void 0 ? void 0 : link.linkAddress) ? " data-link-type='".concat(String(link.linkType).replace(/'/g, "&#39;"), "' data-link-address='").concat(String(link.linkAddress).replace(/'/g, "&#39;"), "'") : "";
1172
- value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'").concat(dataAttrs, ">").concat(strObj.v, "</span>");
1268
+ }).join(" ");
1269
+ var dataAttrs = !(options === null || options === void 0 ? void 0 : options.useSemanticMarkup) && (link === null || link === void 0 ? void 0 : link.linkType) && (link === null || link === void 0 ? void 0 : link.linkAddress) ? " data-link-type='".concat(String(link.linkType).replace(/'/g, "&#39;"), "' data-link-address='").concat(String(link.linkAddress).replace(/'/g, "&#39;"), "'") : "";
1270
+ if (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) {
1271
+ value += buildClipboardCompatibleInlineRuns(strObj.v, styleStr);
1272
+ } else {
1273
+ var segmentText = strObj.v.replace(/\r\n/g, "<br>").replace(/\n/g, "<br>");
1274
+ value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'").concat(dataAttrs, ">").concat(segmentText, "</span>");
1275
+ }
1173
1276
  }
1174
1277
  }
1175
1278
  return value;
@@ -1257,6 +1360,12 @@ function getdatabyselection(ctx, range, sheetId) {
1257
1360
  return data;
1258
1361
  }
1259
1362
  function luckysheetUpdateCell(ctx, row_index, col_index) {
1363
+ var _a;
1364
+ var flowdata = (0, _context.getFlowdata)(ctx);
1365
+ var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
1366
+ if ((cell === null || cell === void 0 ? void 0 : cell.f) != null && String(cell.f).trim() !== "") {
1367
+ (0, _formula.suppressFormulaRangeSelectionForInitialEdit)(ctx);
1368
+ }
1260
1369
  ctx.luckysheetCellUpdate = [row_index, col_index];
1261
1370
  }
1262
1371
  function getDataBySelectionNoCopy(ctx, range) {
@@ -4,10 +4,119 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ function getNodePlainText(node) {
8
+ var _a;
9
+ if (node.nodeType === 3) {
10
+ return (_a = node.textContent) !== null && _a !== void 0 ? _a : "";
11
+ }
12
+ if (node.nodeType !== 1) {
13
+ return "";
14
+ }
15
+ var element = node;
16
+ if (element.tagName === "BR") {
17
+ return "\n";
18
+ }
19
+ return Array.from(element.childNodes).map(function (child) {
20
+ return getNodePlainText(child);
21
+ }).join("");
22
+ }
23
+ function normalizeClipboardCellText(value) {
24
+ return value.replace(/\r\n/g, "\n").replace(/<br\s*\/?>/gi, "\n");
25
+ }
26
+ function formatTableCellForPlainText(value) {
27
+ var normalizedValue = normalizeClipboardCellText(value);
28
+ if (/["\n\t]/.test(normalizedValue)) {
29
+ return "\"".concat(normalizedValue.replace(/"/g, '""'), "\"");
30
+ }
31
+ return normalizedValue;
32
+ }
33
+ function tableToPlainText(table) {
34
+ var grid = [];
35
+ Array.from(table.rows).forEach(function (row, rowIndex) {
36
+ var _a;
37
+ (_a = grid[rowIndex]) !== null && _a !== void 0 ? _a : grid[rowIndex] = [];
38
+ var colIndex = 0;
39
+ Array.from(row.cells).forEach(function (cell) {
40
+ var _a;
41
+ while (grid[rowIndex][colIndex] !== undefined) {
42
+ colIndex += 1;
43
+ }
44
+ var cellText = Array.from(cell.childNodes).map(function (child) {
45
+ return getNodePlainText(child);
46
+ }).join("");
47
+ var rowSpan = Math.max(Number(cell.getAttribute("rowspan")) || 1, 1);
48
+ var colSpan = Math.max(Number(cell.getAttribute("colspan")) || 1, 1);
49
+ for (var r = 0; r < rowSpan; r += 1) {
50
+ var targetRow = rowIndex + r;
51
+ (_a = grid[targetRow]) !== null && _a !== void 0 ? _a : grid[targetRow] = [];
52
+ for (var c = 0; c < colSpan; c += 1) {
53
+ grid[targetRow][colIndex + c] = r === 0 && c === 0 ? cellText : "";
54
+ }
55
+ }
56
+ colIndex += colSpan;
57
+ });
58
+ });
59
+ var columnCount = grid.reduce(function (max, row) {
60
+ return Math.max(max, row.length);
61
+ }, 0);
62
+ return grid.map(function (row) {
63
+ return Array.from({
64
+ length: columnCount
65
+ }, function (_, index) {
66
+ var _a;
67
+ return (_a = row[index]) !== null && _a !== void 0 ? _a : "";
68
+ }).map(function (cell) {
69
+ return formatTableCellForPlainText(cell);
70
+ }).join("\t");
71
+ }).join("\n");
72
+ }
73
+ function legacyHtmlToPlainText(html) {
74
+ return html.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "");
75
+ }
76
+ function htmlToPlainText(html) {
77
+ var legacyPlainText = legacyHtmlToPlainText(html);
78
+ if (typeof document === "undefined" || !/<table[\s>]/i.test(html)) {
79
+ return legacyPlainText;
80
+ }
81
+ var container = document.createElement("div");
82
+ container.innerHTML = html;
83
+ var table = container.querySelector("table");
84
+ if (!table || table.rows.length === 0) {
85
+ return legacyPlainText;
86
+ }
87
+ return tableToPlainText(table);
88
+ }
89
+ function formatPlainTextForClipboard(plainText, isTableContent) {
90
+ if (isTableContent === void 0) {
91
+ isTableContent = false;
92
+ }
93
+ if (!isTableContent && plainText.includes("\n") && !plainText.includes("\t")) {
94
+ return "\"".concat(plainText.replace(/"/g, '""'), "\"");
95
+ }
96
+ return plainText;
97
+ }
7
98
  var clipboard = function () {
8
99
  function clipboard() {}
9
100
  clipboard.writeHtml = function (str) {
10
- var _a;
101
+ var _a, _b;
102
+ if (typeof ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) === null || _a === void 0 ? void 0 : _a.write) === "function") {
103
+ var htmlStr = str;
104
+ var htmlBlob = new Blob([htmlStr], {
105
+ type: "text/html"
106
+ });
107
+ var isTableContent = /<table[\s>]/i.test(str);
108
+ var plainText = formatPlainTextForClipboard(htmlToPlainText(str), isTableContent);
109
+ var textBlob = new Blob([plainText], {
110
+ type: "text/plain"
111
+ });
112
+ navigator.clipboard.write([new ClipboardItem({
113
+ "text/html": htmlBlob,
114
+ "text/plain": textBlob
115
+ })]).catch(function (e) {
116
+ return console.error(e);
117
+ });
118
+ return;
119
+ }
11
120
  try {
12
121
  var ele_1 = document.getElementById("fortune-copy-content");
13
122
  if (!ele_1) {
@@ -18,7 +127,7 @@ var clipboard = function () {
18
127
  ele_1.style.height = "0";
19
128
  ele_1.style.width = "0";
20
129
  ele_1.style.left = "-10000px";
21
- (_a = document.querySelector(".fortune-container")) === null || _a === void 0 ? void 0 : _a.append(ele_1);
130
+ (_b = document.querySelector(".fortune-container")) === null || _b === void 0 ? void 0 : _b.append(ele_1);
22
131
  }
23
132
  var previouslyFocusedElement_1 = document.activeElement;
24
133
  ele_1.style.display = "block";
@@ -251,20 +251,24 @@ function genarate(value) {
251
251
  v = datenum_local(dateObj);
252
252
  ct.t = "d";
253
253
  var map = {
254
- "yyyy-MM-dd": "dd/MM/yyyy",
255
- "yyyy-MM-dd HH:mm": "dd/MM/yyyy",
256
- "yyyy-MM-ddTHH:mm": "dd/MM/yyyy",
257
- "yyyy/MM/dd": "dd/MM/yyyy",
258
- "yyyy/MM/dd HH:mm": "dd/MM/yyyy",
254
+ "yyyy-MM-dd": "yyyy-MM-dd",
255
+ "yyyy-MM-dd HH:mm": "yyyy-MM-dd HH:mm",
256
+ "yyyy-MM-ddTHH:mm": "yyyy-MM-dd HH:mm",
257
+ "yyyy/MM/dd": "yyyy/MM/dd",
258
+ "yyyy/MM/dd HH:mm": "yyyy/MM/dd HH:mm",
259
259
  "yyyy.MM.dd": "yyyy.MM.dd",
260
260
  "MM/dd/yyyy h:mm AM/PM": "MM/dd/yyyy h:mm AM/PM",
261
261
  "MM/dd/yyyy": "MM/dd/yyyy",
262
262
  "M/d/yyyy": "M/d/yyyy",
263
263
  "MM/dd/yy": "MM/dd/yy",
264
264
  "dd/MM/yyyy": "dd/MM/yyyy",
265
- "dd-MM-yyyy": "dd/MM/yyyy",
265
+ "dd-MM-yyyy": "dd-MM-yyyy",
266
266
  "dd.MM.yyyy": "dd.MM.yyyy",
267
- named: "dd/MM/yyyy"
267
+ "named-mdy-full": "mmmm d, yyyy",
268
+ "named-mdy-abbr": "mmm d, yyyy",
269
+ "named-dmy-full": "d mmmm yyyy",
270
+ "named-dmy-abbr": "d mmm yyyy",
271
+ "named-abbr-dashes": "mmm-d-yyyy"
268
272
  };
269
273
  ct.fa = map[df.formatType] || "dd/MM/yyyy";
270
274
  m = _ssf.default.format(ct.fa, v);
@@ -284,6 +288,7 @@ function update(fmt, v) {
284
288
  return _ssf.default.format(fmt, v);
285
289
  }
286
290
  function is_date(fmt, v) {
291
+ console.log(_ssf.default.is_date(fmt, v), "is_date");
287
292
  return _ssf.default.is_date(fmt, v);
288
293
  }
289
294
  function fuzzynum(s) {
@@ -20,6 +20,9 @@ export declare class FormulaCache {
20
20
  rangetosheet?: string;
21
21
  rangedrag_column_start?: boolean;
22
22
  rangedrag_row_start?: boolean;
23
+ rangeSelectionActive?: boolean | null;
24
+ keyboardRangeSelectionLock?: boolean;
25
+ formulaEditorOwner?: "cell" | "fx" | null;
23
26
  functionRangeIndex?: number[];
24
27
  functionlistMap: any;
25
28
  execFunctionExist?: any[];
@@ -44,8 +47,20 @@ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, chi
44
47
  export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
45
48
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
46
49
  export declare function functionHTMLGenerate(txt: string): string;
50
+ export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): number | null;
51
+ export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null;
52
+ export declare function setFormulaEditorOwner(ctx: Context, owner: "cell" | "fx" | null): void;
53
+ export declare function getFormulaEditorOwner(ctx: Context): "cell" | "fx" | null;
54
+ export declare function hasIncompleteTruncatedCellRangeSyntax(formulaText: string): boolean;
55
+ export declare function isBareCellOrRangeOnlyFormula(formulaText: string): boolean;
56
+ export declare function suppressFormulaRangeSelectionForInitialEdit(ctx: Context): void;
57
+ export declare function isCaretAtValidFormulaRangeInsertionPoint(editor: HTMLElement | null): boolean;
58
+ export declare function markRangeSelectionDirty(ctx: Context): void;
59
+ export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null;
47
60
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
48
61
  export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
62
+ export declare function isFormulaReferenceInputMode(ctx: Context): boolean;
63
+ export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean;
49
64
  export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number): string;
50
65
  export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
51
66
  export declare function onFormulaRangeDragEnd(ctx: Context): void;
@@ -53,3 +68,11 @@ export declare function rangeDrag(ctx: Context, e: MouseEvent, cellInput: HTMLDi
53
68
  export declare function rangeDragColumn(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
54
69
  export declare function rangeDragRow(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
55
70
  export declare function functionCopy(ctx: Context, txt: string, mode: string, step: number): string;
71
+ type MoveReferenceRect = {
72
+ rowStart: number;
73
+ rowEnd: number;
74
+ colStart: number;
75
+ colEnd: number;
76
+ };
77
+ export declare function functionMoveReference(txt: string, formulaSheetName: string, movedSheetName: string, sourceRect: MoveReferenceRect, targetRowStart: number, targetColStart: number): string;
78
+ export {};