@fileverse-dev/fortune-core 1.2.96-scroll-4 → 1.2.97
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 +0 -11
- package/es/modules/cell.js +269 -274
- package/es/modules/inline-string.js +0 -2
- package/es/modules/toolbar.js +0 -4
- package/es/modules/validation.js +1 -1
- package/lib/events/keyboard.js +0 -11
- package/lib/modules/cell.js +269 -274
- package/lib/modules/inline-string.js +0 -2
- package/lib/modules/toolbar.js +0 -4
- package/lib/modules/validation.js +1 -1
- package/package.json +2 -2
package/es/events/keyboard.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
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
|
-
};
|
|
11
1
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
12
2
|
function adopt(value) {
|
|
13
3
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -141,7 +131,6 @@ export function handleGlobalEnter(ctx, cellInput, e, canvas) {
|
|
|
141
131
|
if (last && !_.isNil(last.row_focus) && !_.isNil(last.column_focus)) {}
|
|
142
132
|
e.preventDefault();
|
|
143
133
|
} else if (ctx.luckysheetCellUpdate.length > 0) {
|
|
144
|
-
console.log("handleGlobalEnter", __assign({}, ctx.luckysheetCellUpdate));
|
|
145
134
|
var lastCellUpdate = _.clone(ctx.luckysheetCellUpdate);
|
|
146
135
|
updateCell(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
|
|
147
136
|
ctx.luckysheet_select_save = [{
|
package/es/modules/cell.js
CHANGED
|
@@ -309,7 +309,7 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
309
309
|
var flag = vupdate.split("").every(function (ele) {
|
|
310
310
|
return ele === "0" || ele === ".";
|
|
311
311
|
});
|
|
312
|
-
if (flag) {
|
|
312
|
+
if (flag || /^0+\d/.test(vupdate)) {
|
|
313
313
|
vupdate = parseFloat(vupdate);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
@@ -539,211 +539,127 @@ 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
|
-
|
|
542
|
+
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
543
|
+
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
544
|
+
if (inputText === null || inputText === void 0 ? void 0 : inputText.startsWith("=")) {
|
|
545
|
+
inputText = inputText === null || inputText === void 0 ? void 0 : inputText.replace(/[\r\n]/g, "");
|
|
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;
|
|
547
566
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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);
|
|
564
|
-
cancelNormalSelected(ctx);
|
|
565
|
-
ctx.warnDialog = failureText;
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
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");
|
|
568
579
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
+
}];
|
|
581
610
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
611
|
+
}
|
|
612
|
+
value = value || inputText;
|
|
613
|
+
var shouldClearError = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.f) ? oldValue.f !== value : (oldValue === null || oldValue === void 0 ? void 0 : oldValue.v) !== value;
|
|
614
|
+
if (shouldClearError) {
|
|
615
|
+
clearCellError(ctx, r, c);
|
|
616
|
+
}
|
|
617
|
+
if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
|
|
618
|
+
cancelNormalSelected(ctx);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (!isCurInline) {
|
|
622
|
+
if (isRealNull(value) && !isPrevInline) {
|
|
623
|
+
if (!curv || isRealNull(curv.v) && !curv.spl && !curv.f) {
|
|
624
|
+
cancelNormalSelected(ctx);
|
|
625
|
+
return;
|
|
591
626
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
curv_1.ct.fa = "General";
|
|
597
|
-
curv_1.tb = "1";
|
|
627
|
+
} else if (curv && curv.qp !== 1) {
|
|
628
|
+
if (_.isPlainObject(curv) && (value === curv.f || value === curv.v || value === curv.m)) {
|
|
629
|
+
cancelNormalSelected(ctx);
|
|
630
|
+
return;
|
|
598
631
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
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
|
-
}];
|
|
632
|
+
if (value === curv) {
|
|
633
|
+
cancelNormalSelected(ctx);
|
|
634
|
+
return;
|
|
611
635
|
}
|
|
612
636
|
}
|
|
613
|
-
value = value
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
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
|
-
}
|
|
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
|
-
}
|
|
637
|
+
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {} else if (_.isPlainObject(curv) && curv && curv.ct && curv.ct.fa && curv.ct.fa !== "@" && !isRealNull(value)) {
|
|
638
|
+
delete curv.m;
|
|
639
|
+
if (curv.f) {
|
|
640
|
+
delete curv.f;
|
|
641
|
+
delete curv.spl;
|
|
644
642
|
}
|
|
645
643
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
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) && (oldValue_1 === null || oldValue_1 === void 0 ? void 0 : oldValue_1.baseCurrencyPrice)) {
|
|
703
|
-
curv_1.m = "".concat((parseFloat(value) / 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 {
|
|
644
|
+
}
|
|
645
|
+
var isRunExecFunction = true;
|
|
646
|
+
var d = flowdata;
|
|
647
|
+
var dynamicArrayItem = null;
|
|
648
|
+
if (_.isPlainObject(curv)) {
|
|
649
|
+
if (!isCurInline) {
|
|
719
650
|
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
720
651
|
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
721
652
|
isRunExecFunction = false;
|
|
722
|
-
|
|
723
|
-
|
|
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
|
-
}
|
|
653
|
+
curv = _.cloneDeep(((_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) || {});
|
|
654
|
+
curv.v = v[1], curv.f = v[2];
|
|
741
655
|
if (v.length === 4 && v[3].type === "sparklines") {
|
|
656
|
+
delete curv.m;
|
|
657
|
+
delete curv.v;
|
|
742
658
|
var curCalv = v[3].data;
|
|
743
659
|
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
744
|
-
|
|
660
|
+
curv.v = curCalv[0];
|
|
745
661
|
} else {
|
|
746
|
-
|
|
662
|
+
curv.spl = v[3].data;
|
|
747
663
|
}
|
|
748
664
|
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
749
665
|
dynamicArrayItem = v[3].data;
|
|
@@ -753,119 +669,198 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
753
669
|
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
754
670
|
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
755
671
|
isRunExecFunction = false;
|
|
756
|
-
|
|
672
|
+
curv = _.cloneDeep(((_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) || {});
|
|
673
|
+
curv.v = v[1], curv.f = v[2];
|
|
757
674
|
if (v.length === 4 && v[3].type === "sparklines") {
|
|
675
|
+
delete curv.m;
|
|
676
|
+
delete curv.v;
|
|
758
677
|
var curCalv = v[3].data;
|
|
759
678
|
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
760
|
-
|
|
679
|
+
curv.v = curCalv[0];
|
|
761
680
|
} else {
|
|
762
|
-
|
|
681
|
+
curv.spl = v[3].data;
|
|
763
682
|
}
|
|
764
683
|
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
765
684
|
dynamicArrayItem = v[3].data;
|
|
766
685
|
}
|
|
767
686
|
} else {
|
|
687
|
+
Object.keys(value).forEach(function (attr) {
|
|
688
|
+
curv[attr] = value[attr];
|
|
689
|
+
});
|
|
768
690
|
clearCellError(ctx, r, c);
|
|
769
|
-
var v = curv_1;
|
|
770
|
-
if (_.isNil(value.v)) {
|
|
771
|
-
value.v = v;
|
|
772
|
-
}
|
|
773
691
|
}
|
|
774
692
|
} else {
|
|
775
693
|
clearCellError(ctx, r, c);
|
|
776
694
|
delFunctionGroup(ctx, r, c);
|
|
777
|
-
|
|
695
|
+
curv = _.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
|
|
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);
|
|
778
706
|
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
|
+
}
|
|
779
714
|
}
|
|
780
715
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
if (
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
if (typeof value === "string") {
|
|
716
|
+
value = curv;
|
|
717
|
+
} else {
|
|
718
|
+
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
719
|
+
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
720
|
+
isRunExecFunction = false;
|
|
787
721
|
value = {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
t: "g"
|
|
791
|
-
},
|
|
792
|
-
v: value,
|
|
793
|
-
tb: "1"
|
|
722
|
+
v: v[1],
|
|
723
|
+
f: v[2]
|
|
794
724
|
};
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
if (
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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;
|
|
725
|
+
if (/^[\d.,]+$/.test(value.v)) {
|
|
726
|
+
var args = (_k = getContentInParentheses(value === null || value === void 0 ? void 0 : value.f)) === null || _k === void 0 ? void 0 : _k.split(",");
|
|
727
|
+
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
728
|
+
return arg.trim().toUpperCase();
|
|
729
|
+
});
|
|
730
|
+
var formatted = processArray(cellRefs, d, flowdata);
|
|
731
|
+
if (formatted) {
|
|
732
|
+
value.m = update(formatted, value.v);
|
|
733
|
+
value.ct = {
|
|
734
|
+
fa: formatted,
|
|
735
|
+
t: "n"
|
|
736
|
+
};
|
|
812
737
|
}
|
|
738
|
+
value.ht = 2;
|
|
813
739
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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;
|
|
827
|
-
}
|
|
828
|
-
if (value.m == null) {
|
|
829
|
-
value.m = value.v;
|
|
740
|
+
if (v.length === 4 && v[3].type === "sparklines") {
|
|
741
|
+
var curCalv = v[3].data;
|
|
742
|
+
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
743
|
+
value.v = curCalv[0];
|
|
744
|
+
} else {
|
|
745
|
+
value.spl = v[3].data;
|
|
746
|
+
}
|
|
747
|
+
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
748
|
+
dynamicArrayItem = v[3].data;
|
|
830
749
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
var currentRowLen = defaultrowlen;
|
|
847
|
-
if (textInfo) {
|
|
848
|
-
currentRowLen = textInfo.textHeightAll + 2;
|
|
750
|
+
} else if (_.isPlainObject(value)) {
|
|
751
|
+
var valueFunction = value.f;
|
|
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;
|
|
849
765
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
766
|
+
} else {
|
|
767
|
+
clearCellError(ctx, r, c);
|
|
768
|
+
var v = curv;
|
|
769
|
+
if (_.isNil(value.v)) {
|
|
770
|
+
value.v = v;
|
|
854
771
|
}
|
|
855
772
|
}
|
|
773
|
+
} else {
|
|
774
|
+
clearCellError(ctx, r, c);
|
|
775
|
+
delFunctionGroup(ctx, r, c);
|
|
776
|
+
execFunctionGroup(ctx, r, c, value);
|
|
777
|
+
isRunExecFunction = false;
|
|
856
778
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
779
|
+
}
|
|
780
|
+
var decemialCount = ((_l = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _l === void 0 ? void 0 : _l.toString().includes(".")) ? (_o = (_m = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _m === void 0 ? void 0 : _m.toString().split(" ")[0].split(".")[1]) === null || _o === void 0 ? void 0 : _o.length : 0;
|
|
781
|
+
var coin = (_p = oldValue === null || oldValue === void 0 ? void 0 : oldValue.m) === null || _p === void 0 ? void 0 : _p.toString().split(" ")[1];
|
|
782
|
+
if (_typeof(value) === "object" && value.baseValue && !(value === null || value === void 0 ? void 0 : value.m)) {
|
|
783
|
+
value.m = "".concat((parseFloat(value === null || value === void 0 ? void 0 : value.v) / (oldValue === null || oldValue === void 0 ? void 0 : oldValue.baseCurrencyPrice)).toFixed(decemialCount || 2), " ").concat(coin);
|
|
784
|
+
}
|
|
785
|
+
if (typeof value === "string") {
|
|
786
|
+
value = {
|
|
787
|
+
ct: {
|
|
788
|
+
fa: "General",
|
|
789
|
+
t: "g"
|
|
790
|
+
},
|
|
791
|
+
v: value,
|
|
792
|
+
tb: "1"
|
|
793
|
+
};
|
|
794
|
+
} else if (_typeof(value) === "object" && !value.tb) {
|
|
795
|
+
value.tb = "1";
|
|
796
|
+
}
|
|
797
|
+
var isValueArray = Array.isArray((_q = value === null || value === void 0 ? void 0 : value.v) === null || _q === void 0 ? void 0 : _q[0]);
|
|
798
|
+
try {
|
|
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
|
+
});
|
|
808
|
+
}
|
|
809
|
+
ctx.formulaCache.execFunctionGlobalData = null;
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
863
812
|
}
|
|
864
|
-
ctx.formulaCache.execFunctionGlobalData = null;
|
|
865
813
|
} catch (e) {
|
|
866
|
-
console.
|
|
867
|
-
|
|
814
|
+
console.log("[updateCell] spill failed; falling back", e);
|
|
815
|
+
}
|
|
816
|
+
var url = getUrlFromText($input === null || $input === void 0 ? void 0 : $input.innerText);
|
|
817
|
+
if (url && _typeof(value) === "object" && value) {
|
|
818
|
+
value.hl = 1;
|
|
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
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
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
|
+
});
|
|
868
862
|
}
|
|
863
|
+
ctx.formulaCache.execFunctionGlobalData = null;
|
|
869
864
|
}
|
|
870
865
|
export function getOrigincell(ctx, r, c, i) {
|
|
871
866
|
var data = getFlowdata(ctx, i);
|
|
@@ -286,7 +286,6 @@ function extendCssText(origin, cover, isLimit) {
|
|
|
286
286
|
}
|
|
287
287
|
export function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
288
288
|
var _a, _b, _c;
|
|
289
|
-
console.log("updateInlineStringFormat", attr, value);
|
|
290
289
|
var w = window.getSelection();
|
|
291
290
|
if (!w) return;
|
|
292
291
|
if (w.rangeCount === 0) return;
|
|
@@ -435,5 +434,4 @@ export function updateInlineStringFormat(ctx, attr, value, cellInput) {
|
|
|
435
434
|
}
|
|
436
435
|
}
|
|
437
436
|
}
|
|
438
|
-
ctx.luckysheetCellUpdate = [];
|
|
439
437
|
}
|