@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
@@ -16,10 +16,11 @@ import { checkCF, getComputeMap } from "./ConditionFormat";
16
16
  import { getFailureText, validateCellData } from "./dataVerification";
17
17
  import { genarate, update } from "./format";
18
18
  import { clearCellError, getRowHeight } from "../api";
19
- import { delFunctionGroup, execfunction, execFunctionGroup, functionHTMLGenerate, getcellrange, iscelldata } from "./formula";
19
+ import { delFunctionGroup, execfunction, execFunctionGroup, functionHTMLGenerate, getcellrange, iscelldata, suppressFormulaRangeSelectionForInitialEdit } from "./formula";
20
20
  import { attrToCssName, convertSpanToShareString, isInlineStringCell, isInlineStringCT } from "./inline-string";
21
21
  import { isRealNull, isRealNum, valueIsError } from "./validation";
22
22
  import { getCellTextInfo } from "./text";
23
+ import { locale } from "../locale";
23
24
  import { spillSortResult } from "./sort";
24
25
  export function normalizedCellAttr(cell, attr, defaultFontSize) {
25
26
  if (defaultFontSize === void 0) {
@@ -69,6 +70,32 @@ function newlinesToBr(text) {
69
70
  if (!text) return "";
70
71
  return text.replace(/\r\n|\r|\n/g, "<br />");
71
72
  }
73
+ function closeUnclosedParenthesesInFormula(formula) {
74
+ if (!formula.startsWith("=") || formula.length <= 1) return formula;
75
+ var body = formula.slice(1);
76
+ var depth = 0;
77
+ var inString = false;
78
+ for (var i = 0; i < body.length; i += 1) {
79
+ var ch = body[i];
80
+ if (inString) {
81
+ if (ch === '"') {
82
+ if (body[i + 1] === '"') {
83
+ i += 1;
84
+ } else {
85
+ inString = false;
86
+ }
87
+ }
88
+ continue;
89
+ }
90
+ if (ch === '"') {
91
+ inString = true;
92
+ continue;
93
+ }
94
+ if (ch === "(") depth += 1;else if (ch === ")") depth = Math.max(0, depth - 1);
95
+ }
96
+ if (depth <= 0) return formula;
97
+ return "".concat(formula).concat(")".repeat(depth));
98
+ }
72
99
  export function getCellValue(r, c, data, attr) {
73
100
  var _a;
74
101
  if (!attr) {
@@ -541,6 +568,8 @@ export function cancelNormalSelected(ctx) {
541
568
  ctx.formulaCache.rangestart = false;
542
569
  ctx.formulaCache.rangedrag_column_start = false;
543
570
  ctx.formulaCache.rangedrag_row_start = false;
571
+ ctx.formulaCache.rangeSelectionActive = null;
572
+ ctx.formulaCache.formulaEditorOwner = null;
544
573
  }
545
574
  export function updateCell(ctx, r, c, $input, value, canvas) {
546
575
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
@@ -616,6 +645,11 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
616
645
  }
617
646
  }
618
647
  value = value || inputText;
648
+ if (_.isString(value) && value.startsWith("=") && value.length > 1) {
649
+ value = closeUnclosedParenthesesInFormula(value);
650
+ } else if (_.isPlainObject(value) && _.isString(value.f) && value.f.startsWith("=") && value.f.length > 1) {
651
+ value.f = closeUnclosedParenthesesInFormula(value.f);
652
+ }
619
653
  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;
620
654
  if (shouldClearError) {
621
655
  clearCellError(ctx, r, c);
@@ -1041,7 +1075,7 @@ export function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1041
1075
  if (key === "it" && valueNum !== 0) {
1042
1076
  style.fontStyle = "italic";
1043
1077
  }
1044
- if (key === "fs" && valueNum !== 10) {
1078
+ if (key === "fs" && !_.isNil(value)) {
1045
1079
  style.fontSize = "".concat(valueNum, "pt");
1046
1080
  }
1047
1081
  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)) {
@@ -1065,14 +1099,13 @@ export function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
1065
1099
  return style;
1066
1100
  }
1067
1101
  export function getStyleByCell(ctx, d, r, c) {
1068
- var _a;
1102
+ var _a, _b;
1069
1103
  var style = {};
1070
1104
  var checksAF = [];
1071
1105
  var cf_compute = getComputeMap(ctx);
1072
1106
  var checksCF = checkCF(r, c, cf_compute);
1073
1107
  var cell = (_a = d === null || d === void 0 ? void 0 : d[r]) === null || _a === void 0 ? void 0 : _a[c];
1074
1108
  if (!cell) return {};
1075
- var isInline = isInlineStringCell(cell);
1076
1109
  if ("bg" in cell) {
1077
1110
  var value = normalizedCellAttr(cell, "bg");
1078
1111
  if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
@@ -1103,7 +1136,9 @@ export function getStyleByCell(ctx, d, r, c) {
1103
1136
  }
1104
1137
  if ("ff" in cell) {
1105
1138
  var value = normalizedCellAttr(cell, "ff");
1106
- style.fontFamily = value;
1139
+ var fontarray = locale(ctx).fontarray;
1140
+ var ffIndex = parseInt(value, 10);
1141
+ style.fontFamily = Number.isNaN(ffIndex) ? value : (_b = fontarray[ffIndex]) !== null && _b !== void 0 ? _b : value;
1107
1142
  }
1108
1143
  if ("vt" in cell) {
1109
1144
  var value = normalizedCellAttr(cell, "vt");
@@ -1113,12 +1148,52 @@ export function getStyleByCell(ctx, d, r, c) {
1113
1148
  style.alignItems = "flex-end";
1114
1149
  }
1115
1150
  }
1116
- if (!isInline) {
1117
- style = _.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
1118
- }
1151
+ style = _.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
1119
1152
  return style;
1120
1153
  }
1121
- export function getInlineStringHTML(r, c, data) {
1154
+ function normalizeInlineStringClipboardStyle(style) {
1155
+ var decorations = new Set();
1156
+ var normalizedStyle = {
1157
+ color: style.color || "#000000",
1158
+ fontFamily: style.fontFamily || "Arial",
1159
+ fontSize: style.fontSize || "11pt",
1160
+ fontStyle: style.fontStyle || "normal",
1161
+ fontWeight: style.fontWeight || "400"
1162
+ };
1163
+ var backgroundColor = style.backgroundColor || style.background;
1164
+ if (backgroundColor && backgroundColor !== "transparent" && backgroundColor !== "rgba(0, 0, 0, 0)") {
1165
+ normalizedStyle.backgroundColor = backgroundColor;
1166
+ }
1167
+ if (typeof style.textDecoration === "string") {
1168
+ style.textDecoration.split(/\s+/).filter(Boolean).forEach(function (decoration) {
1169
+ return decorations.add(decoration);
1170
+ });
1171
+ }
1172
+ if (style.borderBottom) {
1173
+ decorations.add("underline");
1174
+ normalizedStyle.textDecorationSkipInk = "none";
1175
+ }
1176
+ if (decorations.size > 0) {
1177
+ normalizedStyle.textDecoration = Array.from(decorations).join(" ");
1178
+ }
1179
+ return normalizedStyle;
1180
+ }
1181
+ function buildClipboardCompatibleInlineRuns(text, styleAttr) {
1182
+ var normalizedText = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
1183
+ var segments = normalizedText.split("\n");
1184
+ return segments.map(function (segment, index) {
1185
+ var html = "";
1186
+ if (segment.length > 0) {
1187
+ html += "<span style='".concat(styleAttr, "'>").concat(segment, "</span>");
1188
+ }
1189
+ if (index < segments.length - 1) {
1190
+ html += "<span style='".concat(styleAttr, "'><br></span>");
1191
+ }
1192
+ return html;
1193
+ }).join("");
1194
+ }
1195
+ export function getInlineStringHTML(r, c, data, options) {
1196
+ var _a;
1122
1197
  var ct = getCellValue(r, c, data, "ct");
1123
1198
  if (isInlineStringCT(ct)) {
1124
1199
  var strings = ct.s;
@@ -1126,17 +1201,45 @@ export function getInlineStringHTML(r, c, data) {
1126
1201
  for (var i = 0; i < strings.length; i += 1) {
1127
1202
  var strObj = strings[i];
1128
1203
  if (strObj.v) {
1129
- var style = getFontStyleByCell(strObj);
1204
+ var baseStyle = __assign(__assign({}, (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) ? (_a = options.inheritedStyle) !== null && _a !== void 0 ? _a : {} : {}), getFontStyleByCell(strObj));
1205
+ var style = (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) ? normalizeInlineStringClipboardStyle(baseStyle) : baseStyle;
1206
+ if (!style.fontWeight) {
1207
+ style.fontWeight = "400";
1208
+ }
1209
+ if (!style.fontStyle) {
1210
+ style.fontStyle = "normal";
1211
+ }
1212
+ if (!style.fontSize) {
1213
+ style.fontSize = "11pt";
1214
+ }
1215
+ if (!style.fontFamily) {
1216
+ style.fontFamily = "Arial";
1217
+ }
1130
1218
  var link = strObj.link;
1131
1219
  if ((link === null || link === void 0 ? void 0 : link.linkType) && (link === null || link === void 0 ? void 0 : link.linkAddress)) {
1132
1220
  style.color = style.color || "rgb(0, 0, 255)";
1133
- style.borderBottom = style.borderBottom || "1px solid rgb(0, 0, 255)";
1221
+ if (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) {
1222
+ style.textDecoration = style.textDecoration ? "".concat(style.textDecoration, " underline") : "underline";
1223
+ style.textDecorationSkipInk = "none";
1224
+ } else {
1225
+ style.borderBottom = style.borderBottom || "1px solid rgb(0, 0, 255)";
1226
+ }
1134
1227
  }
1135
- var styleStr = _.map(style, function (v, key) {
1228
+ var styleStr = _.toPairs(style).filter(function (_a) {
1229
+ var v = _a[1];
1230
+ return !_.isNil(v) && v !== "" && v !== "undefined";
1231
+ }).map(function (_a) {
1232
+ var key = _a[0],
1233
+ v = _a[1];
1136
1234
  return "".concat(_.kebabCase(key), ":").concat(_.isNumber(v) ? "".concat(v, "px") : v, ";");
1137
- }).join("");
1138
- 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;"), "'") : "";
1139
- value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'").concat(dataAttrs, ">").concat(strObj.v, "</span>");
1235
+ }).join(" ");
1236
+ 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;"), "'") : "";
1237
+ if (options === null || options === void 0 ? void 0 : options.useSemanticMarkup) {
1238
+ value += buildClipboardCompatibleInlineRuns(strObj.v, styleStr);
1239
+ } else {
1240
+ var segmentText = strObj.v.replace(/\r\n/g, "<br>").replace(/\n/g, "<br>");
1241
+ value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'").concat(dataAttrs, ">").concat(segmentText, "</span>");
1242
+ }
1140
1243
  }
1141
1244
  }
1142
1245
  return value;
@@ -1224,6 +1327,12 @@ export function getdatabyselection(ctx, range, sheetId) {
1224
1327
  return data;
1225
1328
  }
1226
1329
  export function luckysheetUpdateCell(ctx, row_index, col_index) {
1330
+ var _a;
1331
+ var flowdata = getFlowdata(ctx);
1332
+ var cell = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[row_index]) === null || _a === void 0 ? void 0 : _a[col_index];
1333
+ if ((cell === null || cell === void 0 ? void 0 : cell.f) != null && String(cell.f).trim() !== "") {
1334
+ suppressFormulaRangeSelectionForInitialEdit(ctx);
1335
+ }
1227
1336
  ctx.luckysheetCellUpdate = [row_index, col_index];
1228
1337
  }
1229
1338
  export function getDataBySelectionNoCopy(ctx, range) {
@@ -1,7 +1,116 @@
1
+ function getNodePlainText(node) {
2
+ var _a;
3
+ if (node.nodeType === 3) {
4
+ return (_a = node.textContent) !== null && _a !== void 0 ? _a : "";
5
+ }
6
+ if (node.nodeType !== 1) {
7
+ return "";
8
+ }
9
+ var element = node;
10
+ if (element.tagName === "BR") {
11
+ return "\n";
12
+ }
13
+ return Array.from(element.childNodes).map(function (child) {
14
+ return getNodePlainText(child);
15
+ }).join("");
16
+ }
17
+ function normalizeClipboardCellText(value) {
18
+ return value.replace(/\r\n/g, "\n").replace(/<br\s*\/?>/gi, "\n");
19
+ }
20
+ function formatTableCellForPlainText(value) {
21
+ var normalizedValue = normalizeClipboardCellText(value);
22
+ if (/["\n\t]/.test(normalizedValue)) {
23
+ return "\"".concat(normalizedValue.replace(/"/g, '""'), "\"");
24
+ }
25
+ return normalizedValue;
26
+ }
27
+ function tableToPlainText(table) {
28
+ var grid = [];
29
+ Array.from(table.rows).forEach(function (row, rowIndex) {
30
+ var _a;
31
+ (_a = grid[rowIndex]) !== null && _a !== void 0 ? _a : grid[rowIndex] = [];
32
+ var colIndex = 0;
33
+ Array.from(row.cells).forEach(function (cell) {
34
+ var _a;
35
+ while (grid[rowIndex][colIndex] !== undefined) {
36
+ colIndex += 1;
37
+ }
38
+ var cellText = Array.from(cell.childNodes).map(function (child) {
39
+ return getNodePlainText(child);
40
+ }).join("");
41
+ var rowSpan = Math.max(Number(cell.getAttribute("rowspan")) || 1, 1);
42
+ var colSpan = Math.max(Number(cell.getAttribute("colspan")) || 1, 1);
43
+ for (var r = 0; r < rowSpan; r += 1) {
44
+ var targetRow = rowIndex + r;
45
+ (_a = grid[targetRow]) !== null && _a !== void 0 ? _a : grid[targetRow] = [];
46
+ for (var c = 0; c < colSpan; c += 1) {
47
+ grid[targetRow][colIndex + c] = r === 0 && c === 0 ? cellText : "";
48
+ }
49
+ }
50
+ colIndex += colSpan;
51
+ });
52
+ });
53
+ var columnCount = grid.reduce(function (max, row) {
54
+ return Math.max(max, row.length);
55
+ }, 0);
56
+ return grid.map(function (row) {
57
+ return Array.from({
58
+ length: columnCount
59
+ }, function (_, index) {
60
+ var _a;
61
+ return (_a = row[index]) !== null && _a !== void 0 ? _a : "";
62
+ }).map(function (cell) {
63
+ return formatTableCellForPlainText(cell);
64
+ }).join("\t");
65
+ }).join("\n");
66
+ }
67
+ function legacyHtmlToPlainText(html) {
68
+ return html.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "");
69
+ }
70
+ function htmlToPlainText(html) {
71
+ var legacyPlainText = legacyHtmlToPlainText(html);
72
+ if (typeof document === "undefined" || !/<table[\s>]/i.test(html)) {
73
+ return legacyPlainText;
74
+ }
75
+ var container = document.createElement("div");
76
+ container.innerHTML = html;
77
+ var table = container.querySelector("table");
78
+ if (!table || table.rows.length === 0) {
79
+ return legacyPlainText;
80
+ }
81
+ return tableToPlainText(table);
82
+ }
83
+ function formatPlainTextForClipboard(plainText, isTableContent) {
84
+ if (isTableContent === void 0) {
85
+ isTableContent = false;
86
+ }
87
+ if (!isTableContent && plainText.includes("\n") && !plainText.includes("\t")) {
88
+ return "\"".concat(plainText.replace(/"/g, '""'), "\"");
89
+ }
90
+ return plainText;
91
+ }
1
92
  var clipboard = function () {
2
93
  function clipboard() {}
3
94
  clipboard.writeHtml = function (str) {
4
- var _a;
95
+ var _a, _b;
96
+ if (typeof ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) === null || _a === void 0 ? void 0 : _a.write) === "function") {
97
+ var htmlStr = str;
98
+ var htmlBlob = new Blob([htmlStr], {
99
+ type: "text/html"
100
+ });
101
+ var isTableContent = /<table[\s>]/i.test(str);
102
+ var plainText = formatPlainTextForClipboard(htmlToPlainText(str), isTableContent);
103
+ var textBlob = new Blob([plainText], {
104
+ type: "text/plain"
105
+ });
106
+ navigator.clipboard.write([new ClipboardItem({
107
+ "text/html": htmlBlob,
108
+ "text/plain": textBlob
109
+ })]).catch(function (e) {
110
+ return console.error(e);
111
+ });
112
+ return;
113
+ }
5
114
  try {
6
115
  var ele_1 = document.getElementById("fortune-copy-content");
7
116
  if (!ele_1) {
@@ -12,7 +121,7 @@ var clipboard = function () {
12
121
  ele_1.style.height = "0";
13
122
  ele_1.style.width = "0";
14
123
  ele_1.style.left = "-10000px";
15
- (_a = document.querySelector(".fortune-container")) === null || _a === void 0 ? void 0 : _a.append(ele_1);
124
+ (_b = document.querySelector(".fortune-container")) === null || _b === void 0 ? void 0 : _b.append(ele_1);
16
125
  }
17
126
  var previouslyFocusedElement_1 = document.activeElement;
18
127
  ele_1.style.display = "block";
@@ -240,20 +240,24 @@ export function genarate(value) {
240
240
  v = datenum_local(dateObj);
241
241
  ct.t = "d";
242
242
  var map = {
243
- "yyyy-MM-dd": "dd/MM/yyyy",
244
- "yyyy-MM-dd HH:mm": "dd/MM/yyyy",
245
- "yyyy-MM-ddTHH:mm": "dd/MM/yyyy",
246
- "yyyy/MM/dd": "dd/MM/yyyy",
247
- "yyyy/MM/dd HH:mm": "dd/MM/yyyy",
243
+ "yyyy-MM-dd": "yyyy-MM-dd",
244
+ "yyyy-MM-dd HH:mm": "yyyy-MM-dd HH:mm",
245
+ "yyyy-MM-ddTHH:mm": "yyyy-MM-dd HH:mm",
246
+ "yyyy/MM/dd": "yyyy/MM/dd",
247
+ "yyyy/MM/dd HH:mm": "yyyy/MM/dd HH:mm",
248
248
  "yyyy.MM.dd": "yyyy.MM.dd",
249
249
  "MM/dd/yyyy h:mm AM/PM": "MM/dd/yyyy h:mm AM/PM",
250
250
  "MM/dd/yyyy": "MM/dd/yyyy",
251
251
  "M/d/yyyy": "M/d/yyyy",
252
252
  "MM/dd/yy": "MM/dd/yy",
253
253
  "dd/MM/yyyy": "dd/MM/yyyy",
254
- "dd-MM-yyyy": "dd/MM/yyyy",
254
+ "dd-MM-yyyy": "dd-MM-yyyy",
255
255
  "dd.MM.yyyy": "dd.MM.yyyy",
256
- named: "dd/MM/yyyy"
256
+ "named-mdy-full": "mmmm d, yyyy",
257
+ "named-mdy-abbr": "mmm d, yyyy",
258
+ "named-dmy-full": "d mmmm yyyy",
259
+ "named-dmy-abbr": "d mmm yyyy",
260
+ "named-abbr-dashes": "mmm-d-yyyy"
257
261
  };
258
262
  ct.fa = map[df.formatType] || "dd/MM/yyyy";
259
263
  m = SSF.format(ct.fa, v);
@@ -273,6 +277,7 @@ export function update(fmt, v) {
273
277
  return SSF.format(fmt, v);
274
278
  }
275
279
  export function is_date(fmt, v) {
280
+ console.log(SSF.is_date(fmt, v), "is_date");
276
281
  return SSF.is_date(fmt, v);
277
282
  }
278
283
  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 {};