@univerjs/sheets-numfmt-ui 0.6.2 → 0.6.3
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/lib/es/index.js +65 -71
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -637,36 +637,33 @@ let re = class extends oe {
|
|
|
637
637
|
_initInterceptorEditorStart() {
|
|
638
638
|
this._editorBridgeService && this.disposeWithMe(
|
|
639
639
|
ge(
|
|
640
|
-
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
)
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const c = r.worksheet.getCellRaw(i, s);
|
|
657
|
-
return n && n(c);
|
|
658
|
-
}
|
|
659
|
-
case "percent":
|
|
660
|
-
case "date":
|
|
661
|
-
case "time":
|
|
662
|
-
case "datetime":
|
|
663
|
-
default:
|
|
664
|
-
return n && n(t);
|
|
640
|
+
this._sheetInterceptorService.writeCellInterceptor.intercept(zt, {
|
|
641
|
+
handler: (t, r, n) => {
|
|
642
|
+
const i = r.row, s = r.col, o = this._numfmtService.getValue(
|
|
643
|
+
r.unitId,
|
|
644
|
+
r.subUnitId,
|
|
645
|
+
i,
|
|
646
|
+
s
|
|
647
|
+
);
|
|
648
|
+
if (o)
|
|
649
|
+
switch (ne(o.pattern)) {
|
|
650
|
+
case "scientific":
|
|
651
|
+
case "currency":
|
|
652
|
+
case "grouped":
|
|
653
|
+
case "number": {
|
|
654
|
+
const c = r.worksheet.getCellRaw(i, s);
|
|
655
|
+
return n && n(c);
|
|
665
656
|
}
|
|
666
|
-
|
|
667
|
-
|
|
657
|
+
case "percent":
|
|
658
|
+
case "date":
|
|
659
|
+
case "time":
|
|
660
|
+
case "datetime":
|
|
661
|
+
default:
|
|
662
|
+
return n && n(t);
|
|
663
|
+
}
|
|
664
|
+
return n(t);
|
|
668
665
|
}
|
|
669
|
-
)
|
|
666
|
+
})
|
|
670
667
|
)
|
|
671
668
|
);
|
|
672
669
|
}
|
|
@@ -678,54 +675,51 @@ let re = class extends oe {
|
|
|
678
675
|
_initInterceptorEditorEnd() {
|
|
679
676
|
this.disposeWithMe(
|
|
680
677
|
ge(
|
|
681
|
-
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
682
|
-
|
|
683
|
-
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
678
|
+
this._sheetInterceptorService.writeCellInterceptor.intercept(Yt, {
|
|
679
|
+
// eslint-disable-next-line complexity
|
|
680
|
+
handler: (t, r, n) => {
|
|
681
|
+
var f, m, d, p;
|
|
682
|
+
this._collectEffectMutation.clean();
|
|
683
|
+
const i = this._numfmtService.getValue(
|
|
684
|
+
r.unitId,
|
|
685
|
+
r.subUnitId,
|
|
686
|
+
r.row,
|
|
687
|
+
r.col
|
|
688
|
+
), s = (f = i && ne(i.pattern)) != null ? f : "", o = () => {
|
|
689
|
+
i && this._collectEffectMutation.add(
|
|
689
690
|
r.unitId,
|
|
690
691
|
r.subUnitId,
|
|
691
692
|
r.row,
|
|
692
|
-
r.col
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
r.row,
|
|
698
|
-
r.col,
|
|
699
|
-
null
|
|
700
|
-
);
|
|
701
|
-
};
|
|
702
|
-
if (!(t != null && t.v) && !(t != null && t.p) || Je(i == null ? void 0 : i.pattern) || t.t === $.FORCE_STRING)
|
|
703
|
-
return n(t);
|
|
704
|
-
const a = (m = t.p) == null ? void 0 : m.body, c = (p = (d = t == null ? void 0 : t.p) == null ? void 0 : d.body) != null && p.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), l = Q.parseDate(c) || Q.parseTime(c) || Q.parseNumber(c);
|
|
705
|
-
if (a)
|
|
706
|
-
if (Kn(a)) {
|
|
707
|
-
const { dataStream: v } = a, h = v.replace(/\r\n$/, ""), y = Number(h);
|
|
708
|
-
if (Number.isNaN(y) && !l)
|
|
709
|
-
return n(t);
|
|
710
|
-
} else
|
|
711
|
-
return n(t);
|
|
712
|
-
if (l) {
|
|
713
|
-
l.z && this._collectEffectMutation.add(
|
|
714
|
-
r.unitId,
|
|
715
|
-
r.subUnitId,
|
|
716
|
-
r.row,
|
|
717
|
-
r.col,
|
|
718
|
-
{
|
|
719
|
-
pattern: l.z
|
|
720
|
-
}
|
|
721
|
-
);
|
|
722
|
-
const v = Number(l.v);
|
|
723
|
-
return n({ ...t, p: void 0, v, t: $.NUMBER });
|
|
724
|
-
} else (["date", "time", "datetime", "percent"].includes(s) || !Gn(c)) && o();
|
|
693
|
+
r.col,
|
|
694
|
+
null
|
|
695
|
+
);
|
|
696
|
+
};
|
|
697
|
+
if (!(t != null && t.v) && !(t != null && t.p) || Je(i == null ? void 0 : i.pattern) || t.t === $.FORCE_STRING)
|
|
725
698
|
return n(t);
|
|
726
|
-
|
|
699
|
+
const a = (m = t.p) == null ? void 0 : m.body, c = (p = (d = t == null ? void 0 : t.p) == null ? void 0 : d.body) != null && p.dataStream ? t.p.body.dataStream.replace(/\r\n$/, "") : String(t.v), l = Q.parseDate(c) || Q.parseTime(c) || Q.parseNumber(c);
|
|
700
|
+
if (a)
|
|
701
|
+
if (Kn(a)) {
|
|
702
|
+
const { dataStream: v } = a, h = v.replace(/\r\n$/, ""), y = Number(h);
|
|
703
|
+
if (Number.isNaN(y) && !l)
|
|
704
|
+
return n(t);
|
|
705
|
+
} else
|
|
706
|
+
return n(t);
|
|
707
|
+
if (l) {
|
|
708
|
+
l.z && this._collectEffectMutation.add(
|
|
709
|
+
r.unitId,
|
|
710
|
+
r.subUnitId,
|
|
711
|
+
r.row,
|
|
712
|
+
r.col,
|
|
713
|
+
{
|
|
714
|
+
pattern: l.z
|
|
715
|
+
}
|
|
716
|
+
);
|
|
717
|
+
const v = Number(l.v);
|
|
718
|
+
return n({ ...t, p: void 0, v, t: $.NUMBER });
|
|
719
|
+
} else (["date", "time", "datetime", "percent"].includes(s) || !Gn(c)) && o();
|
|
720
|
+
return n(t);
|
|
727
721
|
}
|
|
728
|
-
)
|
|
722
|
+
})
|
|
729
723
|
)
|
|
730
724
|
);
|
|
731
725
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-numfmt-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet numfmt plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@univerjs/icons": "^0.2.20",
|
|
58
|
-
"@univerjs/core": "0.6.
|
|
59
|
-
"@univerjs/design": "0.6.
|
|
60
|
-
"@univerjs/engine-formula": "0.6.
|
|
61
|
-
"@univerjs/engine-numfmt": "0.6.
|
|
62
|
-
"@univerjs/engine-render": "0.6.
|
|
63
|
-
"@univerjs/sheets": "0.6.
|
|
64
|
-
"@univerjs/sheets-numfmt": "0.6.
|
|
65
|
-
"@univerjs/sheets-ui": "0.6.
|
|
66
|
-
"@univerjs/ui": "0.6.
|
|
58
|
+
"@univerjs/core": "0.6.3",
|
|
59
|
+
"@univerjs/design": "0.6.3",
|
|
60
|
+
"@univerjs/engine-formula": "0.6.3",
|
|
61
|
+
"@univerjs/engine-numfmt": "0.6.3",
|
|
62
|
+
"@univerjs/engine-render": "0.6.3",
|
|
63
|
+
"@univerjs/sheets": "0.6.3",
|
|
64
|
+
"@univerjs/sheets-numfmt": "0.6.3",
|
|
65
|
+
"@univerjs/sheets-ui": "0.6.3",
|
|
66
|
+
"@univerjs/ui": "0.6.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"less": "^4.2.2",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"react": "18.3.1",
|
|
72
72
|
"rxjs": "^7.8.1",
|
|
73
73
|
"tailwindcss": "^3.4.17",
|
|
74
|
-
"typescript": "^5.
|
|
74
|
+
"typescript": "^5.8.2",
|
|
75
75
|
"vite": "^6.2.0",
|
|
76
76
|
"vitest": "^3.0.7",
|
|
77
|
-
"@univerjs-infra/shared": "0.6.
|
|
77
|
+
"@univerjs-infra/shared": "0.6.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"test": "vitest run",
|