@fileverse-dev/fortune-core 1.2.96-scroll → 1.2.96-scroll-2
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 +11 -0
- package/es/events/mouse.js +0 -4
- package/es/modules/cell.js +272 -268
- package/es/modules/inline-string.js +2 -0
- package/es/modules/toolbar.js +4 -0
- package/lib/events/keyboard.js +11 -0
- package/lib/events/mouse.js +0 -4
- package/lib/modules/cell.js +272 -268
- package/lib/modules/inline-string.js +2 -0
- package/lib/modules/toolbar.js +4 -0
- package/package.json +1 -1
package/es/events/keyboard.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
1
11
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
12
|
function adopt(value) {
|
|
3
13
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -131,6 +141,7 @@ export function handleGlobalEnter(ctx, cellInput, e, canvas) {
|
|
|
131
141
|
if (last && !_.isNil(last.row_focus) && !_.isNil(last.column_focus)) {}
|
|
132
142
|
e.preventDefault();
|
|
133
143
|
} else if (ctx.luckysheetCellUpdate.length > 0) {
|
|
144
|
+
console.log("handleGlobalEnter", __assign({}, ctx.luckysheetCellUpdate));
|
|
134
145
|
var lastCellUpdate = _.clone(ctx.luckysheetCellUpdate);
|
|
135
146
|
updateCell(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
|
|
136
147
|
ctx.luckysheet_select_save = [{
|
package/es/events/mouse.js
CHANGED
|
@@ -1644,7 +1644,6 @@ export function handleColSizeHandleMouseDown(ctx, globalCache, e, headerContaine
|
|
|
1644
1644
|
var _a;
|
|
1645
1645
|
removeEditingComment(ctx, globalCache);
|
|
1646
1646
|
cancelActiveImgItem(ctx, globalCache);
|
|
1647
|
-
ctx.luckysheetCellUpdate = [];
|
|
1648
1647
|
var scrollLeft = ctx.scrollLeft;
|
|
1649
1648
|
var scrollTop = ctx.scrollTop;
|
|
1650
1649
|
var mouseX = e.pageX - headerContainer.getBoundingClientRect().left - window.scrollX;
|
|
@@ -1673,7 +1672,6 @@ export function handleRowSizeHandleMouseDown(ctx, globalCache, e, headerContaine
|
|
|
1673
1672
|
removeEditingComment(ctx, globalCache);
|
|
1674
1673
|
cancelActiveImgItem(ctx, globalCache);
|
|
1675
1674
|
if (ctx.formulaCache.rangestart || ctx.formulaCache.rangedrag_column_start || ctx.formulaCache.rangedrag_row_start || israngeseleciton(ctx)) return;
|
|
1676
|
-
ctx.luckysheetCellUpdate = [];
|
|
1677
1675
|
var scrollLeft = ctx.scrollLeft;
|
|
1678
1676
|
var scrollTop = ctx.scrollTop;
|
|
1679
1677
|
var mouseY = e.pageY - headerContainer.getBoundingClientRect().top - window.scrollY;
|
|
@@ -1700,7 +1698,6 @@ export function handleRowSizeHandleMouseDown(ctx, globalCache, e, headerContaine
|
|
|
1700
1698
|
export function handleColFreezeHandleMouseDown(ctx, globalCache, e, headerContainer, workbookContainer, cellArea) {
|
|
1701
1699
|
removeEditingComment(ctx, globalCache);
|
|
1702
1700
|
cancelActiveImgItem(ctx, globalCache);
|
|
1703
|
-
ctx.luckysheetCellUpdate = [];
|
|
1704
1701
|
var scrollLeft = ctx.scrollLeft;
|
|
1705
1702
|
var scrollTop = ctx.scrollTop;
|
|
1706
1703
|
var x = e.pageX - headerContainer.getBoundingClientRect().left + scrollLeft;
|
|
@@ -1731,7 +1728,6 @@ export function handleColFreezeHandleMouseDown(ctx, globalCache, e, headerContai
|
|
|
1731
1728
|
export function handleRowFreezeHandleMouseDown(ctx, globalCache, e, headerContainer, workbookContainer, cellArea) {
|
|
1732
1729
|
removeEditingComment(ctx, globalCache);
|
|
1733
1730
|
cancelActiveImgItem(ctx, globalCache);
|
|
1734
|
-
ctx.luckysheetCellUpdate = [];
|
|
1735
1731
|
var scrollLeft = ctx.scrollLeft;
|
|
1736
1732
|
var scrollTop = ctx.scrollTop;
|
|
1737
1733
|
var y = e.pageY - headerContainer.getBoundingClientRect().top + scrollTop;
|
package/es/modules/cell.js
CHANGED
|
@@ -539,127 +539,211 @@ export function cancelNormalSelected(ctx) {
|
|
|
539
539
|
}
|
|
540
540
|
export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
541
541
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
548
|
-
var flowdata = getFlowdata(ctx);
|
|
549
|
-
if (!flowdata) return;
|
|
550
|
-
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
551
|
-
var dataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
552
|
-
var sheetFile = ctx.luckysheetfile[index];
|
|
553
|
-
var getUrlFromText = function getUrlFromText(text) {
|
|
554
|
-
var t = (text !== null && text !== void 0 ? text : "").trim();
|
|
555
|
-
if (!t || /[\s\r\n]/.test(t)) return null;
|
|
556
|
-
if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
|
|
557
|
-
return t.startsWith("http") ? t : "https://".concat(t);
|
|
558
|
-
};
|
|
559
|
-
if (!_.isNil(dataVerification)) {
|
|
560
|
-
var dvItem = dataVerification["".concat(r, "_").concat(c)];
|
|
561
|
-
if (!_.isNil(dvItem) && dvItem.prohibitInput && !validateCellData(ctx, dvItem, inputText)) {
|
|
562
|
-
var failureText = getFailureText(ctx, dvItem);
|
|
563
|
-
cancelNormalSelected(ctx);
|
|
564
|
-
ctx.warnDialog = failureText;
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
var curv = flowdata[r][c];
|
|
569
|
-
var oldValue = _.cloneDeep(curv);
|
|
570
|
-
var isPrevInline = isInlineStringCell(curv);
|
|
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";
|
|
572
|
-
var isCopyVal = false;
|
|
573
|
-
if (!isCurInline && inputText && inputText.length > 0) {
|
|
574
|
-
var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
|
|
575
|
-
if (splitArr.length > 1 && inputHtml !== "<br>") {
|
|
576
|
-
isCopyVal = true;
|
|
577
|
-
isCurInline = true;
|
|
578
|
-
inputText = splitArr.join("\r\n");
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
if ((curv === null || curv === void 0 ? void 0 : curv.ct) && !value && !isCurInline && isPrevInline) {
|
|
582
|
-
delete curv.ct.s;
|
|
583
|
-
curv.ct.t = "g";
|
|
584
|
-
curv.ct.fa = "General";
|
|
585
|
-
curv.tb = "1";
|
|
586
|
-
value = "";
|
|
587
|
-
} else if (isCurInline) {
|
|
588
|
-
if (!_.isPlainObject(curv)) {
|
|
589
|
-
curv = {};
|
|
590
|
-
}
|
|
591
|
-
curv || (curv = {});
|
|
592
|
-
var fontSize = curv.fs || 10;
|
|
593
|
-
if (!curv.ct) {
|
|
594
|
-
curv.ct = {};
|
|
595
|
-
curv.ct.fa = "General";
|
|
596
|
-
curv.tb = "1";
|
|
597
|
-
}
|
|
598
|
-
curv.ct.t = "inlineStr";
|
|
599
|
-
curv.ct.s = convertSpanToShareString($input.querySelectorAll("span"), curv);
|
|
600
|
-
delete curv.fs;
|
|
601
|
-
delete curv.f;
|
|
602
|
-
delete curv.v;
|
|
603
|
-
delete curv.m;
|
|
604
|
-
curv.fs = fontSize;
|
|
605
|
-
if (isCopyVal) {
|
|
606
|
-
curv.ct.s = [{
|
|
607
|
-
v: inputText,
|
|
608
|
-
fs: fontSize
|
|
609
|
-
}];
|
|
542
|
+
try {
|
|
543
|
+
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
544
|
+
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
545
|
+
if (inputText === null || inputText === void 0 ? void 0 : inputText.startsWith("=")) {
|
|
546
|
+
inputText = inputText === null || inputText === void 0 ? void 0 : inputText.replace(/[\r\n]/g, "");
|
|
610
547
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
} else if (curv && curv.qp !== 1) {
|
|
628
|
-
if (_.isPlainObject(curv) && (value === curv.f || value === curv.v || value === curv.m)) {
|
|
548
|
+
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
549
|
+
var flowdata = getFlowdata(ctx);
|
|
550
|
+
if (!flowdata) return;
|
|
551
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
552
|
+
var dataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
553
|
+
var sheetFile = ctx.luckysheetfile[index];
|
|
554
|
+
var getUrlFromText = function getUrlFromText(text) {
|
|
555
|
+
var t = (text !== null && text !== void 0 ? text : "").trim();
|
|
556
|
+
if (!t || /[\s\r\n]/.test(t)) return null;
|
|
557
|
+
if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
|
|
558
|
+
return t.startsWith("http") ? t : "https://".concat(t);
|
|
559
|
+
};
|
|
560
|
+
if (!_.isNil(dataVerification)) {
|
|
561
|
+
var dvItem = dataVerification["".concat(r, "_").concat(c)];
|
|
562
|
+
if (!_.isNil(dvItem) && dvItem.prohibitInput && !validateCellData(ctx, dvItem, inputText)) {
|
|
563
|
+
var failureText = getFailureText(ctx, dvItem);
|
|
629
564
|
cancelNormalSelected(ctx);
|
|
565
|
+
ctx.warnDialog = failureText;
|
|
630
566
|
return;
|
|
631
567
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
568
|
+
}
|
|
569
|
+
var curv_1 = flowdata[r][c];
|
|
570
|
+
var oldValue_1 = _.cloneDeep(curv_1);
|
|
571
|
+
var isPrevInline = isInlineStringCell(curv_1);
|
|
572
|
+
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";
|
|
573
|
+
var isCopyVal = false;
|
|
574
|
+
if (!isCurInline && inputText && inputText.length > 0) {
|
|
575
|
+
var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
|
|
576
|
+
if (splitArr.length > 1 && inputHtml !== "<br>") {
|
|
577
|
+
isCopyVal = true;
|
|
578
|
+
isCurInline = true;
|
|
579
|
+
inputText = splitArr.join("\r\n");
|
|
635
580
|
}
|
|
636
581
|
}
|
|
637
|
-
if (
|
|
638
|
-
delete
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
582
|
+
if ((curv_1 === null || curv_1 === void 0 ? void 0 : curv_1.ct) && !value && !isCurInline && isPrevInline) {
|
|
583
|
+
delete curv_1.ct.s;
|
|
584
|
+
curv_1.ct.t = "g";
|
|
585
|
+
curv_1.ct.fa = "General";
|
|
586
|
+
curv_1.tb = "1";
|
|
587
|
+
value = "";
|
|
588
|
+
} else if (isCurInline) {
|
|
589
|
+
if (!_.isPlainObject(curv_1)) {
|
|
590
|
+
curv_1 = {};
|
|
591
|
+
}
|
|
592
|
+
curv_1 || (curv_1 = {});
|
|
593
|
+
var fontSize = curv_1.fs || 10;
|
|
594
|
+
if (!curv_1.ct) {
|
|
595
|
+
curv_1.ct = {};
|
|
596
|
+
curv_1.ct.fa = "General";
|
|
597
|
+
curv_1.tb = "1";
|
|
598
|
+
}
|
|
599
|
+
curv_1.ct.t = "inlineStr";
|
|
600
|
+
curv_1.ct.s = convertSpanToShareString($input.querySelectorAll("span"), curv_1);
|
|
601
|
+
delete curv_1.fs;
|
|
602
|
+
delete curv_1.f;
|
|
603
|
+
delete curv_1.v;
|
|
604
|
+
delete curv_1.m;
|
|
605
|
+
curv_1.fs = fontSize;
|
|
606
|
+
if (isCopyVal) {
|
|
607
|
+
curv_1.ct.s = [{
|
|
608
|
+
v: inputText,
|
|
609
|
+
fs: fontSize
|
|
610
|
+
}];
|
|
642
611
|
}
|
|
643
612
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
613
|
+
value = value || inputText;
|
|
614
|
+
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;
|
|
615
|
+
if (shouldClearError) {
|
|
616
|
+
clearCellError(ctx, r, c);
|
|
617
|
+
}
|
|
618
|
+
if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
|
|
619
|
+
cancelNormalSelected(ctx);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
649
622
|
if (!isCurInline) {
|
|
623
|
+
if (isRealNull(value) && !isPrevInline) {
|
|
624
|
+
if (!curv_1 || isRealNull(curv_1.v) && !curv_1.spl && !curv_1.f) {
|
|
625
|
+
cancelNormalSelected(ctx);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
} else if (curv_1 && curv_1.qp !== 1) {
|
|
629
|
+
if (_.isPlainObject(curv_1) && (value === curv_1.f || value === curv_1.v || value === curv_1.m)) {
|
|
630
|
+
cancelNormalSelected(ctx);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (value === curv_1) {
|
|
634
|
+
cancelNormalSelected(ctx);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {} else if (_.isPlainObject(curv_1) && curv_1 && curv_1.ct && curv_1.ct.fa && curv_1.ct.fa !== "@" && !isRealNull(value)) {
|
|
639
|
+
delete curv_1.m;
|
|
640
|
+
if (curv_1.f) {
|
|
641
|
+
delete curv_1.f;
|
|
642
|
+
delete curv_1.spl;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
var isRunExecFunction = true;
|
|
647
|
+
var d = flowdata;
|
|
648
|
+
var dynamicArrayItem = null;
|
|
649
|
+
if (_.isPlainObject(curv_1)) {
|
|
650
|
+
if (!isCurInline) {
|
|
651
|
+
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
652
|
+
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
653
|
+
isRunExecFunction = false;
|
|
654
|
+
curv_1 = _.cloneDeep(((_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) || {});
|
|
655
|
+
curv_1.v = v[1], curv_1.f = v[2];
|
|
656
|
+
if (v.length === 4 && v[3].type === "sparklines") {
|
|
657
|
+
delete curv_1.m;
|
|
658
|
+
delete curv_1.v;
|
|
659
|
+
var curCalv = v[3].data;
|
|
660
|
+
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
661
|
+
curv_1.v = curCalv[0];
|
|
662
|
+
} else {
|
|
663
|
+
curv_1.spl = v[3].data;
|
|
664
|
+
}
|
|
665
|
+
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
666
|
+
dynamicArrayItem = v[3].data;
|
|
667
|
+
}
|
|
668
|
+
} else if (_.isPlainObject(value)) {
|
|
669
|
+
var valueFunction = value.f;
|
|
670
|
+
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
671
|
+
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
672
|
+
isRunExecFunction = false;
|
|
673
|
+
curv_1 = _.cloneDeep(((_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) || {});
|
|
674
|
+
curv_1.v = v[1], curv_1.f = v[2];
|
|
675
|
+
if (v.length === 4 && v[3].type === "sparklines") {
|
|
676
|
+
delete curv_1.m;
|
|
677
|
+
delete curv_1.v;
|
|
678
|
+
var curCalv = v[3].data;
|
|
679
|
+
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
680
|
+
curv_1.v = curCalv[0];
|
|
681
|
+
} else {
|
|
682
|
+
curv_1.spl = v[3].data;
|
|
683
|
+
}
|
|
684
|
+
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
685
|
+
dynamicArrayItem = v[3].data;
|
|
686
|
+
}
|
|
687
|
+
} else {
|
|
688
|
+
Object.keys(value).forEach(function (attr) {
|
|
689
|
+
curv_1[attr] = value[attr];
|
|
690
|
+
});
|
|
691
|
+
clearCellError(ctx, r, c);
|
|
692
|
+
}
|
|
693
|
+
} else {
|
|
694
|
+
clearCellError(ctx, r, c);
|
|
695
|
+
delFunctionGroup(ctx, r, c);
|
|
696
|
+
curv_1 = _.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
|
|
697
|
+
curv_1.v = value;
|
|
698
|
+
delete curv_1.f;
|
|
699
|
+
delete curv_1.spl;
|
|
700
|
+
var decemialCount_1 = ((_f = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _f === void 0 ? void 0 : _f.toString().includes(".")) ? (_h = (_g = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _g === void 0 ? void 0 : _g.toString().split(" ")[0].split(".")[1]) === null || _h === void 0 ? void 0 : _h.length : 0;
|
|
701
|
+
var coin_1 = (_j = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _j === void 0 ? void 0 : _j.toString().split(" ")[1];
|
|
702
|
+
if (_typeof(curv_1) === "object" && (curv_1 === null || curv_1 === void 0 ? void 0 : curv_1.baseValue)) {
|
|
703
|
+
curv_1.m = "".concat((parseFloat(value) / (oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.baseCurrencyPrice)).toFixed(decemialCount_1 || 2), " ").concat(coin_1);
|
|
704
|
+
curv_1.baseValue = value;
|
|
705
|
+
}
|
|
706
|
+
execFunctionGroup(ctx, r, c, curv_1);
|
|
707
|
+
isRunExecFunction = false;
|
|
708
|
+
if (curv_1.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
|
|
709
|
+
curv_1.qp = 0;
|
|
710
|
+
if (curv_1.ct) {
|
|
711
|
+
curv_1.ct.fa = "General";
|
|
712
|
+
curv_1.ct.t = "n";
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
value = curv_1;
|
|
718
|
+
} else {
|
|
650
719
|
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
651
720
|
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
652
721
|
isRunExecFunction = false;
|
|
653
|
-
|
|
654
|
-
|
|
722
|
+
value = {
|
|
723
|
+
v: v[1],
|
|
724
|
+
f: v[2]
|
|
725
|
+
};
|
|
726
|
+
if (/^[\d.,]+$/.test(value.v)) {
|
|
727
|
+
var args = (_k = getContentInParentheses(value === null || value === void 0 ? void 0 : value.f)) === null || _k === void 0 ? void 0 : _k.split(",");
|
|
728
|
+
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
729
|
+
return arg.trim().toUpperCase();
|
|
730
|
+
});
|
|
731
|
+
var formatted = processArray(cellRefs, d, flowdata);
|
|
732
|
+
if (formatted) {
|
|
733
|
+
value.m = update(formatted, value.v);
|
|
734
|
+
value.ct = {
|
|
735
|
+
fa: formatted,
|
|
736
|
+
t: "n"
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
value.ht = 2;
|
|
740
|
+
}
|
|
655
741
|
if (v.length === 4 && v[3].type === "sparklines") {
|
|
656
|
-
delete curv.m;
|
|
657
|
-
delete curv.v;
|
|
658
742
|
var curCalv = v[3].data;
|
|
659
743
|
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
660
|
-
|
|
744
|
+
value.v = curCalv[0];
|
|
661
745
|
} else {
|
|
662
|
-
|
|
746
|
+
value.spl = v[3].data;
|
|
663
747
|
}
|
|
664
748
|
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
665
749
|
dynamicArrayItem = v[3].data;
|
|
@@ -669,198 +753,118 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
669
753
|
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
670
754
|
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
671
755
|
isRunExecFunction = false;
|
|
672
|
-
|
|
673
|
-
curv.v = v[1], curv.f = v[2];
|
|
756
|
+
value.v = v[1], value.f = v[2];
|
|
674
757
|
if (v.length === 4 && v[3].type === "sparklines") {
|
|
675
|
-
delete curv.m;
|
|
676
|
-
delete curv.v;
|
|
677
758
|
var curCalv = v[3].data;
|
|
678
759
|
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
679
|
-
|
|
760
|
+
value.v = curCalv[0];
|
|
680
761
|
} else {
|
|
681
|
-
|
|
762
|
+
value.spl = v[3].data;
|
|
682
763
|
}
|
|
683
764
|
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
684
765
|
dynamicArrayItem = v[3].data;
|
|
685
766
|
}
|
|
686
767
|
} else {
|
|
687
|
-
Object.keys(value).forEach(function (attr) {
|
|
688
|
-
curv[attr] = value[attr];
|
|
689
|
-
});
|
|
690
768
|
clearCellError(ctx, r, c);
|
|
769
|
+
var v = curv_1;
|
|
770
|
+
if (_.isNil(value.v)) {
|
|
771
|
+
value.v = v;
|
|
772
|
+
}
|
|
691
773
|
}
|
|
692
774
|
} else {
|
|
693
775
|
clearCellError(ctx, r, c);
|
|
694
776
|
delFunctionGroup(ctx, r, c);
|
|
695
|
-
|
|
696
|
-
curv.v = value;
|
|
697
|
-
delete curv.f;
|
|
698
|
-
delete curv.spl;
|
|
699
|
-
var decemialCount_1 = ((_f = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _f === void 0 ? void 0 : _f.toString().includes(".")) ? (_h = (_g = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _g === void 0 ? void 0 : _g.toString().split(" ")[0].split(".")[1]) === null || _h === void 0 ? void 0 : _h.length : 0;
|
|
700
|
-
var coin_1 = (_j = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _j === void 0 ? void 0 : _j.toString().split(" ")[1];
|
|
701
|
-
if (_typeof(curv) === "object" && (curv === null || curv === void 0 ? void 0 : curv.baseValue)) {
|
|
702
|
-
curv.m = "".concat((parseFloat(value) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount_1 || 2), " ").concat(coin_1);
|
|
703
|
-
curv.baseValue = value;
|
|
704
|
-
}
|
|
705
|
-
execFunctionGroup(ctx, r, c, curv);
|
|
777
|
+
execFunctionGroup(ctx, r, c, value);
|
|
706
778
|
isRunExecFunction = false;
|
|
707
|
-
if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
|
|
708
|
-
curv.qp = 0;
|
|
709
|
-
if (curv.ct) {
|
|
710
|
-
curv.ct.fa = "General";
|
|
711
|
-
curv.ct.t = "n";
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
779
|
}
|
|
715
780
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
|
|
781
|
+
var decemialCount = ((_l = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _l === void 0 ? void 0 : _l.toString().includes(".")) ? (_o = (_m = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _m === void 0 ? void 0 : _m.toString().split(" ")[0].split(".")[1]) === null || _o === void 0 ? void 0 : _o.length : 0;
|
|
782
|
+
var coin = (_p = oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.m) === null || _p === void 0 ? void 0 : _p.toString().split(" ")[1];
|
|
783
|
+
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
784
|
+
value.m = "".concat((parseFloat(value === null || value === void 0 ? void 0 : value.v) / (oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.baseCurrencyPrice)).toFixed(decemialCount || 2), " ").concat(coin);
|
|
785
|
+
}
|
|
786
|
+
if (typeof value === "string") {
|
|
721
787
|
value = {
|
|
722
|
-
|
|
723
|
-
|
|
788
|
+
ct: {
|
|
789
|
+
fa: "General",
|
|
790
|
+
t: "g"
|
|
791
|
+
},
|
|
792
|
+
v: value,
|
|
793
|
+
tb: "1"
|
|
724
794
|
};
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
795
|
+
} else if (_typeof(value) === "object" && !value.tb) {
|
|
796
|
+
value.tb = "1";
|
|
797
|
+
}
|
|
798
|
+
var isValueArray = Array.isArray((_q = value === null || value === void 0 ? void 0 : value.v) === null || _q === void 0 ? void 0 : _q[0]);
|
|
799
|
+
try {
|
|
800
|
+
if (isValueArray) {
|
|
801
|
+
if (spillSortResult(ctx, r, c, value, d)) {
|
|
802
|
+
cancelNormalSelected(ctx);
|
|
803
|
+
if (ctx.hooks.afterUpdateCell) {
|
|
804
|
+
var newValue_1 = _.cloneDeep(d[r][c]);
|
|
805
|
+
setTimeout(function () {
|
|
806
|
+
var _a, _b;
|
|
807
|
+
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
ctx.formulaCache.execFunctionGlobalData = null;
|
|
811
|
+
return;
|
|
737
812
|
}
|
|
738
|
-
value.ht = 2;
|
|
739
813
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
814
|
+
} catch (e) {
|
|
815
|
+
console.log("[updateCell] spill failed; falling back", e);
|
|
816
|
+
}
|
|
817
|
+
var url = getUrlFromText($input === null || $input === void 0 ? void 0 : $input.innerText);
|
|
818
|
+
if (url && _typeof(value) === "object" && value) {
|
|
819
|
+
value.hl = 1;
|
|
820
|
+
if (!sheetFile.hyperlink) sheetFile.hyperlink = {};
|
|
821
|
+
sheetFile.hyperlink["".concat(r, "_").concat(c)] = {
|
|
822
|
+
linkType: "webpage",
|
|
823
|
+
linkAddress: url
|
|
824
|
+
};
|
|
825
|
+
if (typeof value.v !== "string") {
|
|
826
|
+
value.v = (_r = $input === null || $input === void 0 ? void 0 : $input.innerText) !== null && _r !== void 0 ? _r : url;
|
|
749
827
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
753
|
-
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
754
|
-
isRunExecFunction = false;
|
|
755
|
-
value.v = v[1], value.f = v[2];
|
|
756
|
-
if (v.length === 4 && v[3].type === "sparklines") {
|
|
757
|
-
var curCalv = v[3].data;
|
|
758
|
-
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
759
|
-
value.v = curCalv[0];
|
|
760
|
-
} else {
|
|
761
|
-
value.spl = v[3].data;
|
|
762
|
-
}
|
|
763
|
-
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
764
|
-
dynamicArrayItem = v[3].data;
|
|
765
|
-
}
|
|
766
|
-
} else {
|
|
767
|
-
clearCellError(ctx, r, c);
|
|
768
|
-
var v = curv;
|
|
769
|
-
if (_.isNil(value.v)) {
|
|
770
|
-
value.v = v;
|
|
771
|
-
}
|
|
828
|
+
if (value.m == null) {
|
|
829
|
+
value.m = value.v;
|
|
772
830
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
delFunctionGroup(ctx, r, c);
|
|
776
|
-
execFunctionGroup(ctx, r, c, value);
|
|
777
|
-
isRunExecFunction = false;
|
|
831
|
+
if (value.fc == null) value.fc = "rgb(0, 0, 255)";
|
|
832
|
+
if (value.un == null) value.un = 1;
|
|
778
833
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
if (isValueArray) {
|
|
800
|
-
if (spillSortResult(ctx, r, c, value, d)) {
|
|
801
|
-
cancelNormalSelected(ctx);
|
|
802
|
-
if (ctx.hooks.afterUpdateCell) {
|
|
803
|
-
var newValue_1 = _.cloneDeep(d[r][c]);
|
|
804
|
-
setTimeout(function () {
|
|
805
|
-
var _a, _b;
|
|
806
|
-
return (_b = (_a = ctx.hooks).afterUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, null, newValue_1);
|
|
807
|
-
});
|
|
834
|
+
setCellValue(ctx, r, c, d, value);
|
|
835
|
+
cancelNormalSelected(ctx);
|
|
836
|
+
if ((curv_1 === null || curv_1 === void 0 ? void 0 : curv_1.tb) === "2" && curv_1.v || isInlineStringCell(d[r][c])) {
|
|
837
|
+
var defaultrowlen = ctx.defaultrowlen;
|
|
838
|
+
var cfg = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].config || {};
|
|
839
|
+
if (!(((_s = cfg.columnlen) === null || _s === void 0 ? void 0 : _s[c]) && ((_t = cfg.rowlen) === null || _t === void 0 ? void 0 : _t[r]))) {
|
|
840
|
+
var cellWidth = ((_u = cfg.columnlen) === null || _u === void 0 ? void 0 : _u[c]) || ctx.defaultcollen;
|
|
841
|
+
var textInfo = canvas ? getCellTextInfo(d[r][c], canvas, ctx, {
|
|
842
|
+
r: r,
|
|
843
|
+
c: c,
|
|
844
|
+
cellWidth: cellWidth
|
|
845
|
+
}) : null;
|
|
846
|
+
var currentRowLen = defaultrowlen;
|
|
847
|
+
if (textInfo) {
|
|
848
|
+
currentRowLen = textInfo.textHeightAll + 2;
|
|
849
|
+
}
|
|
850
|
+
var previousRowHeight = getRowHeight(ctx, [r])[r];
|
|
851
|
+
if (currentRowLen > defaultrowlen && !((_v = cfg.customHeight) === null || _v === void 0 ? void 0 : _v[r]) && previousRowHeight < currentRowLen) {
|
|
852
|
+
if (_.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
853
|
+
cfg.rowlen[r] = currentRowLen;
|
|
808
854
|
}
|
|
809
|
-
ctx.formulaCache.execFunctionGlobalData = null;
|
|
810
|
-
return;
|
|
811
855
|
}
|
|
812
856
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (!sheetFile.hyperlink) sheetFile.hyperlink = {};
|
|
820
|
-
sheetFile.hyperlink["".concat(r, "_").concat(c)] = {
|
|
821
|
-
linkType: "webpage",
|
|
822
|
-
linkAddress: url
|
|
823
|
-
};
|
|
824
|
-
if (typeof value.v !== "string") {
|
|
825
|
-
value.v = (_r = $input === null || $input === void 0 ? void 0 : $input.innerText) !== null && _r !== void 0 ? _r : url;
|
|
826
|
-
}
|
|
827
|
-
if (value.m == null) {
|
|
828
|
-
value.m = value.v;
|
|
829
|
-
}
|
|
830
|
-
if (value.fc == null) value.fc = "rgb(0, 0, 255)";
|
|
831
|
-
if (value.un == null) value.un = 1;
|
|
832
|
-
}
|
|
833
|
-
setCellValue(ctx, r, c, d, value);
|
|
834
|
-
cancelNormalSelected(ctx);
|
|
835
|
-
if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || isInlineStringCell(d[r][c])) {
|
|
836
|
-
var defaultrowlen = ctx.defaultrowlen;
|
|
837
|
-
var cfg = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].config || {};
|
|
838
|
-
if (!(((_s = cfg.columnlen) === null || _s === void 0 ? void 0 : _s[c]) && ((_t = cfg.rowlen) === null || _t === void 0 ? void 0 : _t[r]))) {
|
|
839
|
-
var cellWidth = ((_u = cfg.columnlen) === null || _u === void 0 ? void 0 : _u[c]) || ctx.defaultcollen;
|
|
840
|
-
var textInfo = canvas ? getCellTextInfo(d[r][c], canvas, ctx, {
|
|
841
|
-
r: r,
|
|
842
|
-
c: c,
|
|
843
|
-
cellWidth: cellWidth
|
|
844
|
-
}) : null;
|
|
845
|
-
var currentRowLen = defaultrowlen;
|
|
846
|
-
if (textInfo) {
|
|
847
|
-
currentRowLen = textInfo.textHeightAll + 2;
|
|
848
|
-
}
|
|
849
|
-
var previousRowHeight = getRowHeight(ctx, [r])[r];
|
|
850
|
-
if (currentRowLen > defaultrowlen && !((_v = cfg.customHeight) === null || _v === void 0 ? void 0 : _v[r]) && previousRowHeight < currentRowLen) {
|
|
851
|
-
if (_.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
852
|
-
cfg.rowlen[r] = currentRowLen;
|
|
853
|
-
}
|
|
857
|
+
if (ctx.hooks.afterUpdateCell) {
|
|
858
|
+
var newValue_2 = _.cloneDeep(flowdata[r][c]);
|
|
859
|
+
var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
|
|
860
|
+
setTimeout(function () {
|
|
861
|
+
afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue_1, newValue_2);
|
|
862
|
+
});
|
|
854
863
|
}
|
|
864
|
+
ctx.formulaCache.execFunctionGlobalData = null;
|
|
865
|
+
} catch (e) {
|
|
866
|
+
cancelNormalSelected(ctx);
|
|
855
867
|
}
|
|
856
|
-
if (ctx.hooks.afterUpdateCell) {
|
|
857
|
-
var newValue_2 = _.cloneDeep(flowdata[r][c]);
|
|
858
|
-
var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
|
|
859
|
-
setTimeout(function () {
|
|
860
|
-
afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_2);
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
ctx.formulaCache.execFunctionGlobalData = null;
|
|
864
868
|
}
|
|
865
869
|
export function getOrigincell(ctx, r, c, i) {
|
|
866
870
|
var data = getFlowdata(ctx, i);
|