@fileverse-dev/fortune-core 1.3.11 → 1.3.12-mixed
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.
- package/es/events/keyboard.js +60 -37
- package/es/events/mouse.js +1 -0
- package/es/events/paste.js +47 -28
- package/es/locale/en.d.ts +3 -0
- package/es/locale/en.js +3 -0
- package/es/locale/es.d.ts +3 -0
- package/es/locale/es.js +3 -0
- package/es/locale/hi.d.ts +3 -0
- package/es/locale/hi.js +3 -0
- package/es/locale/index.d.ts +3 -0
- package/es/locale/zh.d.ts +3 -0
- package/es/locale/zh.js +3 -0
- package/es/locale/zh_tw.d.ts +3 -0
- package/es/locale/zh_tw.js +3 -0
- package/es/modules/ConditionFormat.js +26 -0
- package/es/modules/format.js +12 -7
- package/es/modules/inline-string.js +52 -24
- package/es/modules/validation.js +6 -3
- package/es/types.d.ts +2 -0
- package/lib/events/keyboard.js +60 -37
- package/lib/events/mouse.js +1 -0
- package/lib/events/paste.js +45 -26
- package/lib/locale/en.d.ts +3 -0
- package/lib/locale/en.js +3 -0
- package/lib/locale/es.d.ts +3 -0
- package/lib/locale/es.js +3 -0
- package/lib/locale/hi.d.ts +3 -0
- package/lib/locale/hi.js +3 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/zh.d.ts +3 -0
- package/lib/locale/zh.js +3 -0
- package/lib/locale/zh_tw.d.ts +3 -0
- package/lib/locale/zh_tw.js +3 -0
- package/lib/modules/ConditionFormat.js +26 -0
- package/lib/modules/format.js +12 -7
- package/lib/modules/inline-string.js +52 -24
- package/lib/modules/validation.js +6 -3
- package/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/lib/locale/index.d.ts
CHANGED
|
@@ -583,6 +583,8 @@ declare function locale(ctx: Context): {
|
|
|
583
583
|
conditionformat_equal_title: string;
|
|
584
584
|
conditionformat_textContains: string;
|
|
585
585
|
conditionformat_textContains_title: string;
|
|
586
|
+
conditionformat_empty: string;
|
|
587
|
+
conditionformat_empty_title: string;
|
|
586
588
|
conditionformat_occurrenceDate: string;
|
|
587
589
|
conditionformat_occurrenceDate_title: string;
|
|
588
590
|
conditionformat_duplicateValue: string;
|
|
@@ -685,6 +687,7 @@ declare function locale(ctx: Context): {
|
|
|
685
687
|
between2: string;
|
|
686
688
|
contain: string;
|
|
687
689
|
textContains: string;
|
|
690
|
+
empty: string;
|
|
688
691
|
duplicateValue: string;
|
|
689
692
|
uniqueValue: string;
|
|
690
693
|
top: string;
|
package/lib/locale/zh.d.ts
CHANGED
|
@@ -582,6 +582,8 @@ declare const _default: {
|
|
|
582
582
|
conditionformat_equal_title: string;
|
|
583
583
|
conditionformat_textContains: string;
|
|
584
584
|
conditionformat_textContains_title: string;
|
|
585
|
+
conditionformat_empty: string;
|
|
586
|
+
conditionformat_empty_title: string;
|
|
585
587
|
conditionformat_occurrenceDate: string;
|
|
586
588
|
conditionformat_occurrenceDate_title: string;
|
|
587
589
|
conditionformat_duplicateValue: string;
|
|
@@ -684,6 +686,7 @@ declare const _default: {
|
|
|
684
686
|
between2: string;
|
|
685
687
|
contain: string;
|
|
686
688
|
textContains: string;
|
|
689
|
+
empty: string;
|
|
687
690
|
duplicateValue: string;
|
|
688
691
|
uniqueValue: string;
|
|
689
692
|
top: string;
|
package/lib/locale/zh.js
CHANGED
|
@@ -10103,6 +10103,8 @@ var _default = exports.default = {
|
|
|
10103
10103
|
conditionformat_equal_title: "为等于以下值的单元格设置格式",
|
|
10104
10104
|
conditionformat_textContains: "条件格式——文本包含",
|
|
10105
10105
|
conditionformat_textContains_title: "为包含以下文本的单元格设置格式",
|
|
10106
|
+
conditionformat_empty: "条件格式——空值",
|
|
10107
|
+
conditionformat_empty_title: "为空单元格设置格式",
|
|
10106
10108
|
conditionformat_occurrenceDate: "条件格式——发生日期",
|
|
10107
10109
|
conditionformat_occurrenceDate_title: "为包含以下日期的单元格设置格式",
|
|
10108
10110
|
conditionformat_duplicateValue: "条件格式——重复值",
|
|
@@ -10205,6 +10207,7 @@ var _default = exports.default = {
|
|
|
10205
10207
|
between2: "之间",
|
|
10206
10208
|
contain: "包含",
|
|
10207
10209
|
textContains: "文本包含",
|
|
10210
|
+
empty: "空值",
|
|
10208
10211
|
duplicateValue: "重复值",
|
|
10209
10212
|
uniqueValue: "唯一值",
|
|
10210
10213
|
top: "前",
|
package/lib/locale/zh_tw.d.ts
CHANGED
|
@@ -726,6 +726,8 @@ declare const _default: {
|
|
|
726
726
|
conditionformat_equal_title: string;
|
|
727
727
|
conditionformat_textContains: string;
|
|
728
728
|
conditionformat_textContains_title: string;
|
|
729
|
+
conditionformat_empty: string;
|
|
730
|
+
conditionformat_empty_title: string;
|
|
729
731
|
conditionformat_occurrenceDate: string;
|
|
730
732
|
conditionformat_occurrenceDate_title: string;
|
|
731
733
|
conditionformat_duplicateValue: string;
|
|
@@ -828,6 +830,7 @@ declare const _default: {
|
|
|
828
830
|
between2: string;
|
|
829
831
|
contain: string;
|
|
830
832
|
textContains: string;
|
|
833
|
+
empty: string;
|
|
831
834
|
duplicateValue: string;
|
|
832
835
|
uniqueValue: string;
|
|
833
836
|
top: string;
|
package/lib/locale/zh_tw.js
CHANGED
|
@@ -9618,6 +9618,8 @@ var _default = exports.default = {
|
|
|
9618
9618
|
conditionformat_equal_title: "為等於以下值的儲存格設定格式",
|
|
9619
9619
|
conditionformat_textContains: "條件格式——文字包含",
|
|
9620
9620
|
conditionformat_textContains_title: "為包含以下文字的儲存格設定格式",
|
|
9621
|
+
conditionformat_empty: "條件格式——空值",
|
|
9622
|
+
conditionformat_empty_title: "為空儲存格設定格式",
|
|
9621
9623
|
conditionformat_occurrenceDate: "條件格式——發生日期",
|
|
9622
9624
|
conditionformat_occurrenceDate_title: "為包含以下日期的儲存格設定格式",
|
|
9623
9625
|
conditionformat_duplicateValue: "條件格式——重複值",
|
|
@@ -9720,6 +9722,7 @@ var _default = exports.default = {
|
|
|
9720
9722
|
between2: "之間",
|
|
9721
9723
|
contain: "包含",
|
|
9722
9724
|
textContains: "文字包含",
|
|
9725
|
+
empty: "空值",
|
|
9723
9726
|
duplicateValue: "重複值",
|
|
9724
9727
|
uniqueValue: "唯一值",
|
|
9725
9728
|
top: "前",
|
|
@@ -706,6 +706,32 @@ function compute(ctx, ruleArr, d) {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
+
} else if (conditionName === "empty") {
|
|
710
|
+
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
711
|
+
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
|
712
|
+
var cell = _lodash.default.isNil(d[r]) || _lodash.default.isNil(d[r][c]) ? null : d[r][c];
|
|
713
|
+
var isEmpty = _lodash.default.isNil(cell) || _lodash.default.isNil(cell.v) || (0, _validation.isRealNull)(cell.v);
|
|
714
|
+
if (isEmpty) {
|
|
715
|
+
if ("".concat(r, "_").concat(c) in computeMap) {
|
|
716
|
+
computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
|
|
717
|
+
computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
|
|
718
|
+
computeMap["".concat(r, "_").concat(c)].bold = bold_1;
|
|
719
|
+
computeMap["".concat(r, "_").concat(c)].italic = italic_1;
|
|
720
|
+
computeMap["".concat(r, "_").concat(c)].underline = underline_1;
|
|
721
|
+
computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
|
|
722
|
+
} else {
|
|
723
|
+
computeMap["".concat(r, "_").concat(c)] = {
|
|
724
|
+
textColor: textColor_1,
|
|
725
|
+
cellColor: cellColor_1,
|
|
726
|
+
bold: bold_1,
|
|
727
|
+
italic: italic_1,
|
|
728
|
+
underline: underline_1,
|
|
729
|
+
strikethrough: strikethrough_1
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
709
735
|
} else if (conditionName === "between") {
|
|
710
736
|
for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
|
|
711
737
|
for (var c = cellrange[s].column[0]; c <= cellrange[s].column[1]; c += 1) {
|
package/lib/modules/format.js
CHANGED
|
@@ -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
|
|
255
|
-
"yyyy-MM-dd HH:mm": "dd
|
|
256
|
-
"yyyy-MM-ddTHH:mm": "dd
|
|
257
|
-
"yyyy/MM/dd": "
|
|
258
|
-
"yyyy/MM/dd HH:mm": "
|
|
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
|
|
265
|
+
"dd-MM-yyyy": "dd-MM-yyyy",
|
|
266
266
|
"dd.MM.yyyy": "dd.MM.yyyy",
|
|
267
|
-
named: "
|
|
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) {
|
|
@@ -307,6 +307,9 @@ function extendCssText(origin, cover, isLimit) {
|
|
|
307
307
|
}
|
|
308
308
|
return newCss;
|
|
309
309
|
}
|
|
310
|
+
function escapeHtmlAttr(s) {
|
|
311
|
+
return s.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
312
|
+
}
|
|
310
313
|
function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
311
314
|
var _a, _b, _c;
|
|
312
315
|
var w = window.getSelection();
|
|
@@ -314,6 +317,34 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
314
317
|
if (w.rangeCount === 0) return;
|
|
315
318
|
var range = w.getRangeAt(0);
|
|
316
319
|
var $textEditor = cellInput;
|
|
320
|
+
if (range.startContainer === $textEditor && range.endContainer === $textEditor && range.collapsed === false) {
|
|
321
|
+
var start = range.startOffset;
|
|
322
|
+
var end = range.endOffset;
|
|
323
|
+
var children = Array.from($textEditor.childNodes).slice(start, end);
|
|
324
|
+
children.forEach(function (node) {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
327
|
+
var el = node;
|
|
328
|
+
if (el.tagName === "SPAN") {
|
|
329
|
+
var cssText = getCssText(el.style.cssText, attr, value);
|
|
330
|
+
el.setAttribute("style", cssText);
|
|
331
|
+
}
|
|
332
|
+
} else if (node.nodeType === Node.TEXT_NODE) {
|
|
333
|
+
var text = (_a = node.textContent) !== null && _a !== void 0 ? _a : "";
|
|
334
|
+
if (text.length === 0) return;
|
|
335
|
+
var wrapper = document.createElement("span");
|
|
336
|
+
var cssText = getCssText("", attr, value);
|
|
337
|
+
wrapper.setAttribute("style", cssText);
|
|
338
|
+
wrapper.textContent = text;
|
|
339
|
+
(_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(wrapper, node);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
var newRange = document.createRange();
|
|
343
|
+
newRange.selectNodeContents($textEditor);
|
|
344
|
+
w.removeAllRanges();
|
|
345
|
+
w.addRange(newRange);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
317
348
|
if (range.collapsed === true) {
|
|
318
349
|
return;
|
|
319
350
|
}
|
|
@@ -351,7 +382,7 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
351
382
|
cssText = extendCssText(box.style.cssText, cssText);
|
|
352
383
|
}
|
|
353
384
|
}
|
|
354
|
-
cont += "<span style
|
|
385
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\">").concat(left, "</span>");
|
|
355
386
|
}
|
|
356
387
|
if (mid !== "") {
|
|
357
388
|
var cssText = getCssText(span.style.cssText, attr, value);
|
|
@@ -361,7 +392,7 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
361
392
|
cssText = extendCssText(box.style.cssText, cssText);
|
|
362
393
|
}
|
|
363
394
|
}
|
|
364
|
-
cont += "<span style
|
|
395
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\">").concat(mid, "</span>");
|
|
365
396
|
}
|
|
366
397
|
if (right !== "") {
|
|
367
398
|
var cssText = span.style.cssText;
|
|
@@ -371,7 +402,7 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
371
402
|
cssText = extendCssText(box.style.cssText, cssText);
|
|
372
403
|
}
|
|
373
404
|
}
|
|
374
|
-
cont += "<span style
|
|
405
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\">").concat(right, "</span>");
|
|
375
406
|
}
|
|
376
407
|
if (((_a = startContainer.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === "SPAN") {
|
|
377
408
|
spanIndex = _lodash.default.indexOf($textEditor.querySelectorAll("span"), span);
|
|
@@ -414,33 +445,33 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
414
445
|
for (var i = 0; i < startSpanIndex; i += 1) {
|
|
415
446
|
var span = spans[i];
|
|
416
447
|
var content = span.innerHTML;
|
|
417
|
-
cont += "<span style
|
|
448
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(span.style.cssText), "\">").concat(content, "</span>");
|
|
418
449
|
}
|
|
419
450
|
if (sleft !== "") {
|
|
420
|
-
cont += "<span style
|
|
451
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(startSpan.style.cssText), "\">").concat(sleft, "</span>");
|
|
421
452
|
}
|
|
422
453
|
if (sright !== "") {
|
|
423
454
|
var cssText = getCssText(startSpan.style.cssText, attr, value);
|
|
424
|
-
cont += "<span style
|
|
455
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\">").concat(sright, "</span>");
|
|
425
456
|
}
|
|
426
457
|
if (startSpanIndex < endSpanIndex) {
|
|
427
458
|
for (var i = startSpanIndex + 1; i < endSpanIndex; i += 1) {
|
|
428
459
|
var span = spans[i];
|
|
429
460
|
var content = span.innerHTML;
|
|
430
|
-
cont += "<span style
|
|
461
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(span.style.cssText), "\">").concat(content, "</span>");
|
|
431
462
|
}
|
|
432
463
|
}
|
|
433
464
|
if (eleft !== "") {
|
|
434
465
|
var cssText = getCssText(endSpan.style.cssText, attr, value);
|
|
435
|
-
cont += "<span style
|
|
466
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\">").concat(eleft, "</span>");
|
|
436
467
|
}
|
|
437
468
|
if (eright !== "") {
|
|
438
|
-
cont += "<span style
|
|
469
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(endSpan.style.cssText), "\">").concat(eright, "</span>");
|
|
439
470
|
}
|
|
440
471
|
for (var i = endSpanIndex + 1; i < spans.length; i += 1) {
|
|
441
472
|
var span = spans[i];
|
|
442
473
|
var content = span.innerHTML;
|
|
443
|
-
cont += "<span style
|
|
474
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(span.style.cssText), "\">").concat(content, "</span>");
|
|
444
475
|
}
|
|
445
476
|
$textEditor.innerHTML = cont;
|
|
446
477
|
var startSeletedNodeIndex = void 0;
|
|
@@ -458,13 +489,10 @@ function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
458
489
|
}
|
|
459
490
|
}
|
|
460
491
|
}
|
|
461
|
-
function escapeHtmlAttr(s) {
|
|
462
|
-
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
463
|
-
}
|
|
464
492
|
function getLinkDataAttrs(span) {
|
|
465
493
|
var _a, _b;
|
|
466
494
|
if (((_a = span.dataset) === null || _a === void 0 ? void 0 : _a.linkType) && ((_b = span.dataset) === null || _b === void 0 ? void 0 : _b.linkAddress)) {
|
|
467
|
-
return " data-link-type
|
|
495
|
+
return " data-link-type=\"".concat(escapeHtmlAttr(span.dataset.linkType), "\" data-link-address=\"").concat(escapeHtmlAttr(span.dataset.linkAddress), "\"");
|
|
468
496
|
}
|
|
469
497
|
return "";
|
|
470
498
|
}
|
|
@@ -502,7 +530,7 @@ function applyLinkToSelection(cellInput, linkType, linkAddress) {
|
|
|
502
530
|
var box = span.closest("#luckysheet-input-box");
|
|
503
531
|
if (box != null) cssText = extendCssText(box.style.cssText, cssText);
|
|
504
532
|
}
|
|
505
|
-
cont += "<span style
|
|
533
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\"").concat(dataAttrs, ">").concat(left, "</span>");
|
|
506
534
|
}
|
|
507
535
|
if (mid !== "") {
|
|
508
536
|
var cssText = getLinkStyleCssText(span.style.cssText);
|
|
@@ -510,7 +538,7 @@ function applyLinkToSelection(cellInput, linkType, linkAddress) {
|
|
|
510
538
|
var box = span.closest("#luckysheet-input-box");
|
|
511
539
|
if (box != null) cssText = extendCssText(box.style.cssText, cssText);
|
|
512
540
|
}
|
|
513
|
-
cont += "<span style
|
|
541
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\" data-link-type=\"").concat(escapeHtmlAttr(linkType), "\" data-link-address=\"").concat(escapeHtmlAttr(linkAddress), "\">").concat(mid, "</span>");
|
|
514
542
|
}
|
|
515
543
|
if (right !== "") {
|
|
516
544
|
var cssText = span.style.cssText;
|
|
@@ -518,7 +546,7 @@ function applyLinkToSelection(cellInput, linkType, linkAddress) {
|
|
|
518
546
|
var box = span.closest("#luckysheet-input-box");
|
|
519
547
|
if (box != null) cssText = extendCssText(box.style.cssText, cssText);
|
|
520
548
|
}
|
|
521
|
-
cont += "<span style
|
|
549
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\"").concat(dataAttrs, ">").concat(right, "</span>");
|
|
522
550
|
}
|
|
523
551
|
if (((_a = startContainer.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === "SPAN") {
|
|
524
552
|
span.outerHTML = cont;
|
|
@@ -548,32 +576,32 @@ function applyLinkToSelection(cellInput, linkType, linkAddress) {
|
|
|
548
576
|
var cont = "";
|
|
549
577
|
for (var i = 0; i < startSpanIndex; i += 1) {
|
|
550
578
|
var sp = spans[i];
|
|
551
|
-
cont += "<span style
|
|
579
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(sp.style.cssText), "\"").concat(getLinkDataAttrs(sp), ">").concat(sp.innerHTML, "</span>");
|
|
552
580
|
}
|
|
553
581
|
if (sleft !== "") {
|
|
554
|
-
cont += "<span style
|
|
582
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(startSpan.style.cssText), "\"").concat(getLinkDataAttrs(startSpan), ">").concat(sleft, "</span>");
|
|
555
583
|
}
|
|
556
584
|
if (sright !== "") {
|
|
557
585
|
var cssText = getLinkStyleCssText(startSpan.style.cssText);
|
|
558
|
-
cont += "<span style
|
|
586
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\" data-link-type=\"").concat(escapeHtmlAttr(linkType), "\" data-link-address=\"").concat(escapeHtmlAttr(linkAddress), "\">").concat(sright, "</span>");
|
|
559
587
|
}
|
|
560
588
|
if (startSpanIndex < endSpanIndex) {
|
|
561
589
|
for (var i = startSpanIndex + 1; i < endSpanIndex; i += 1) {
|
|
562
590
|
var sp = spans[i];
|
|
563
591
|
var cssText = getLinkStyleCssText(sp.style.cssText);
|
|
564
|
-
cont += "<span style
|
|
592
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\" data-link-type=\"").concat(escapeHtmlAttr(linkType), "\" data-link-address=\"").concat(escapeHtmlAttr(linkAddress), "\">").concat(sp.innerHTML, "</span>");
|
|
565
593
|
}
|
|
566
594
|
}
|
|
567
595
|
if (eleft !== "") {
|
|
568
596
|
var cssText = getLinkStyleCssText(endSpan.style.cssText);
|
|
569
|
-
cont += "<span style
|
|
597
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(cssText), "\" data-link-type=\"").concat(escapeHtmlAttr(linkType), "\" data-link-address=\"").concat(escapeHtmlAttr(linkAddress), "\">").concat(eleft, "</span>");
|
|
570
598
|
}
|
|
571
599
|
if (eright !== "") {
|
|
572
|
-
cont += "<span style
|
|
600
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(endSpan.style.cssText), "\"").concat(getLinkDataAttrs(endSpan), ">").concat(eright, "</span>");
|
|
573
601
|
}
|
|
574
602
|
for (var i = endSpanIndex + 1; i < spans.length; i += 1) {
|
|
575
603
|
var sp = spans[i];
|
|
576
|
-
cont += "<span style
|
|
604
|
+
cont += "<span style=\"".concat(escapeHtmlAttr(sp.style.cssText), "\"").concat(getLinkDataAttrs(sp), ">").concat(sp.innerHTML, "</span>");
|
|
577
605
|
}
|
|
578
606
|
$textEditor.innerHTML = cont;
|
|
579
607
|
spans = $textEditor.querySelectorAll("span");
|
|
@@ -84,6 +84,7 @@ var MONTH_NAME_MAP = {
|
|
|
84
84
|
};
|
|
85
85
|
var MONTH_NAMES_RE = "january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|oct|nov|dec";
|
|
86
86
|
var MONTH_ABBR_RE = "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec";
|
|
87
|
+
var MONTH_ABBR_SET = new Set(MONTH_ABBR_RE.split("|"));
|
|
87
88
|
function isValidDateParts(year, month, day) {
|
|
88
89
|
if (year < 1900) return false;
|
|
89
90
|
if (month < 1 || month > 12) return false;
|
|
@@ -298,6 +299,7 @@ function detectDateFormat(str) {
|
|
|
298
299
|
var d = +m[2];
|
|
299
300
|
var y = +m[3];
|
|
300
301
|
if (mo && isValidDateParts(y, mo, d)) {
|
|
302
|
+
var isAbbr = MONTH_ABBR_SET.has(m[1].toLowerCase());
|
|
301
303
|
return {
|
|
302
304
|
year: y,
|
|
303
305
|
month: mo,
|
|
@@ -305,7 +307,7 @@ function detectDateFormat(str) {
|
|
|
305
307
|
hours: 0,
|
|
306
308
|
minutes: 0,
|
|
307
309
|
seconds: 0,
|
|
308
|
-
formatType: "named"
|
|
310
|
+
formatType: isAbbr ? "named-mdy-abbr" : "named-mdy-full"
|
|
309
311
|
};
|
|
310
312
|
}
|
|
311
313
|
}
|
|
@@ -315,6 +317,7 @@ function detectDateFormat(str) {
|
|
|
315
317
|
var mo = MONTH_NAME_MAP[m[2].toLowerCase()];
|
|
316
318
|
var y = +m[3];
|
|
317
319
|
if (mo && isValidDateParts(y, mo, d)) {
|
|
320
|
+
var isAbbr = MONTH_ABBR_SET.has(m[2].toLowerCase());
|
|
318
321
|
return {
|
|
319
322
|
year: y,
|
|
320
323
|
month: mo,
|
|
@@ -322,7 +325,7 @@ function detectDateFormat(str) {
|
|
|
322
325
|
hours: 0,
|
|
323
326
|
minutes: 0,
|
|
324
327
|
seconds: 0,
|
|
325
|
-
formatType: "named"
|
|
328
|
+
formatType: isAbbr ? "named-dmy-abbr" : "named-dmy-full"
|
|
326
329
|
};
|
|
327
330
|
}
|
|
328
331
|
}
|
|
@@ -339,7 +342,7 @@ function detectDateFormat(str) {
|
|
|
339
342
|
hours: 0,
|
|
340
343
|
minutes: 0,
|
|
341
344
|
seconds: 0,
|
|
342
|
-
formatType: "named"
|
|
345
|
+
formatType: "named-abbr-dashes"
|
|
343
346
|
};
|
|
344
347
|
}
|
|
345
348
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -328,6 +328,8 @@ export type GlobalCache = {
|
|
|
328
328
|
verticalScrollLock?: boolean;
|
|
329
329
|
horizontalScrollLock?: boolean;
|
|
330
330
|
overwriteCell?: boolean;
|
|
331
|
+
overwriteCellFirstChar?: string;
|
|
332
|
+
enteredEditByTyping?: boolean;
|
|
331
333
|
ignoreWriteCell?: boolean;
|
|
332
334
|
doNotFocus?: boolean;
|
|
333
335
|
doNotUpdateCell?: boolean;
|