@univerjs/sheets-ui 0.6.0-experimental.20250212-dbe9830 → 0.6.0-experimental.20250220-d9a8e74
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/cjs/facade.js +1 -1
- package/lib/cjs/index.js +28 -28
- package/lib/es/facade.js +46 -39
- package/lib/es/index.js +6236 -6159
- package/lib/index.css +1 -1
- package/lib/types/controllers/permission/sheet-permission-init-ui.controller.d.ts +7 -0
- package/lib/types/facade/f-event.d.ts +6 -3
- package/lib/types/facade/f-univer.d.ts +3 -2
- package/lib/types/index.d.ts +4 -3
- package/lib/types/services/clipboard/utils.d.ts +1 -0
- package/lib/types/views/formula-bar/FormulaBar.d.ts +5 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +26 -26
- package/package.json +16 -16
package/lib/es/facade.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICommandService as P, CanceledError as j, IUniverInstanceService as A, RichTextValue as O, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as W, LifecycleService as L, DisposableCollection as y, LifecycleStages as F, UniverInstanceType as ae, ILogService as D, toDisposable as b, awaitTime as ce, InterceptorEffectEnum as de, generateRandomId as he } from "@univerjs/core";
|
|
2
|
+
import { FUniver as te, FEventName as le } from "@univerjs/core/facade";
|
|
2
3
|
import { RichTextEditingMutation as ge } from "@univerjs/docs";
|
|
3
4
|
import { IRenderManagerService as m, DeviceInputEventType as N, SHEET_VIEWPORT_KEY as ue, sheetContentViewportKeys as ve } from "@univerjs/engine-render";
|
|
4
5
|
import { SheetsSelectionsService as Se, COMMAND_LISTENER_SKELETON_CHANGE as Ce, getSkeletonChangedEffectedRange as me, SheetInterceptorService as be, INTERCEPTOR_POINT as Ee, InterceptCellContentPriority as pe } from "@univerjs/sheets";
|
|
5
|
-
import { SetCellEditVisibleOperation as k, IEditorBridgeService as H, SetZoomRatioCommand as z, HoverManagerService as
|
|
6
|
-
import { FSheetHooks as $, FWorkbook as
|
|
6
|
+
import { SetCellEditVisibleOperation as k, IEditorBridgeService as H, SetZoomRatioCommand as z, HoverManagerService as f, DragManagerService as U, SheetScrollManagerService as T, SheetPasteShortKeyCommand as V, ISheetClipboardService as re, SheetSkeletonManagerService as R, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as x, ChangeZoomRatioCommand as fe, SheetsScrollRenderController as we, SetWorksheetColAutoWidthCommand as ke, SetColumnHeaderHeightCommand as Ie, SetRowHeaderWidthCommand as _e, SheetCanvasPopManagerService as Z, CellAlertManagerService as Pe, IMarkSelectionService as Re } from "@univerjs/sheets-ui";
|
|
7
|
+
import { FSheetHooks as $, FWorkbook as ne, FWorksheet as ie, FPermission as oe, FRange as se } from "@univerjs/sheets/facade";
|
|
7
8
|
import { KeyCode as B, CutCommand as K, CopyCommand as Y, PasteCommand as X, IClipboardInterfaceService as He, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as J, HTML_CLIPBOARD_MIME_TYPE as G, supportClipboardAPI as q, ISidebarService as Me, IDialogService as ye, ComponentManager as Q } from "@univerjs/ui";
|
|
8
9
|
import { filter as S, combineLatest as Ue } from "rxjs";
|
|
9
10
|
class xe extends te {
|
|
@@ -99,7 +100,7 @@ class xe extends te {
|
|
|
99
100
|
this.Event.SheetEditChanging,
|
|
100
101
|
() => r.onCommandExecuted((t) => {
|
|
101
102
|
if (t.id !== ge.id) return;
|
|
102
|
-
const n = this.
|
|
103
|
+
const n = this.getActiveSheet();
|
|
103
104
|
if (!n) return;
|
|
104
105
|
const { workbook: o, worksheet: s } = n, c = e.get(H), g = e.get(A), u = t.params;
|
|
105
106
|
if (!c.isVisible().visible) return;
|
|
@@ -152,7 +153,7 @@ class xe extends te {
|
|
|
152
153
|
this.disposeWithMe(l.lifecycle$.subscribe((v) => {
|
|
153
154
|
if (v < F.Rendered) return;
|
|
154
155
|
C.dispose();
|
|
155
|
-
const h = e.get(
|
|
156
|
+
const h = e.get(f), I = e.get(U);
|
|
156
157
|
h && (this.registerEventHandler(
|
|
157
158
|
this.Event.CellClicked,
|
|
158
159
|
() => {
|
|
@@ -358,7 +359,7 @@ class xe extends te {
|
|
|
358
359
|
]);
|
|
359
360
|
this.disposeWithMe(u.subscribe(([l, C]) => {
|
|
360
361
|
var i;
|
|
361
|
-
if (l.type ===
|
|
362
|
+
if (l.type === ae.UNIVER_SHEET && (c = l), C <= F.Rendered) return;
|
|
362
363
|
const v = new y();
|
|
363
364
|
if (!c) return;
|
|
364
365
|
const h = this.getWorkbook(c.unitId);
|
|
@@ -470,7 +471,7 @@ class xe extends te {
|
|
|
470
471
|
if (Ce.indexOf(t.id) > -1) {
|
|
471
472
|
const n = this.getActiveSheet();
|
|
472
473
|
if (!n) return;
|
|
473
|
-
const o = me(t).map((s) => {
|
|
474
|
+
const o = me(t, n.worksheet.getMaxColumns()).map((s) => {
|
|
474
475
|
var c, g;
|
|
475
476
|
return (g = (c = this.getWorkbook(s.unitId)) == null ? void 0 : c.getSheetBySheetId(s.subUnitId)) == null ? void 0 : g.getRange(s.range);
|
|
476
477
|
}).filter(Boolean);
|
|
@@ -511,7 +512,7 @@ class xe extends te {
|
|
|
511
512
|
const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet(), t = e == null ? void 0 : e.getActiveRange();
|
|
512
513
|
if (!e || !r || !t)
|
|
513
514
|
return;
|
|
514
|
-
const o = this._injector.get(
|
|
515
|
+
const o = this._injector.get(re).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
|
|
515
516
|
if (!o)
|
|
516
517
|
return;
|
|
517
518
|
const { html: s, plain: c } = o;
|
|
@@ -598,7 +599,7 @@ class xe extends te {
|
|
|
598
599
|
return;
|
|
599
600
|
}
|
|
600
601
|
const t = r == null ? void 0 : r.getId(), n = this._injector.get(m), o = r.getActiveSheet(), s = o.getSheetId(), c = n.getRenderById(t);
|
|
601
|
-
c && ((u = e.headerStyle) != null && u.size) && (c.with(R).setColumnHeaderSize(c, s, (l = e.headerStyle) == null ? void 0 : l.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t,
|
|
602
|
+
c && ((u = e.headerStyle) != null && u.size) && (c.with(R).setColumnHeaderSize(c, s, (l = e.headerStyle) == null ? void 0 : l.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t, w.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
|
|
602
603
|
}
|
|
603
604
|
customizeRowHeader(e) {
|
|
604
605
|
const r = this.getActiveWorkbook();
|
|
@@ -607,22 +608,22 @@ class xe extends te {
|
|
|
607
608
|
return;
|
|
608
609
|
}
|
|
609
610
|
const t = r == null ? void 0 : r.getId();
|
|
610
|
-
this._getSheetRenderComponent(t,
|
|
611
|
+
this._getSheetRenderComponent(t, w.ROW).setCustomHeader(e);
|
|
611
612
|
}
|
|
612
613
|
registerSheetRowHeaderExtension(e, ...r) {
|
|
613
|
-
const t = this._getSheetRenderComponent(e,
|
|
614
|
+
const t = this._getSheetRenderComponent(e, w.ROW), n = t.register(...r);
|
|
614
615
|
return b(() => {
|
|
615
616
|
n.dispose(), t.makeDirty(!0);
|
|
616
617
|
});
|
|
617
618
|
}
|
|
618
619
|
registerSheetColumnHeaderExtension(e, ...r) {
|
|
619
|
-
const t = this._getSheetRenderComponent(e,
|
|
620
|
+
const t = this._getSheetRenderComponent(e, w.COLUMN), n = t.register(...r);
|
|
620
621
|
return b(() => {
|
|
621
622
|
n.dispose(), t.makeDirty(!0);
|
|
622
623
|
});
|
|
623
624
|
}
|
|
624
625
|
registerSheetMainExtension(e, ...r) {
|
|
625
|
-
const t = this._getSheetRenderComponent(e,
|
|
626
|
+
const t = this._getSheetRenderComponent(e, w.MAIN), n = t.register(...r);
|
|
626
627
|
return b(() => {
|
|
627
628
|
n.dispose(), t.makeDirty(!0);
|
|
628
629
|
});
|
|
@@ -652,7 +653,7 @@ class xe extends te {
|
|
|
652
653
|
}
|
|
653
654
|
}
|
|
654
655
|
te.extend(xe);
|
|
655
|
-
class De extends
|
|
656
|
+
class De extends ne {
|
|
656
657
|
openSiderbar(e) {
|
|
657
658
|
return this._logDeprecation("openSiderbar"), this._injector.get(Me).open(e);
|
|
658
659
|
}
|
|
@@ -679,7 +680,7 @@ class De extends ie {
|
|
|
679
680
|
};
|
|
680
681
|
}
|
|
681
682
|
onCellClick(e) {
|
|
682
|
-
const r = this._injector.get(
|
|
683
|
+
const r = this._injector.get(f);
|
|
683
684
|
return b(
|
|
684
685
|
r.currentClickedCell$.pipe(S((t) => !!t)).subscribe((t) => {
|
|
685
686
|
e(t);
|
|
@@ -687,25 +688,25 @@ class De extends ie {
|
|
|
687
688
|
);
|
|
688
689
|
}
|
|
689
690
|
onCellHover(e) {
|
|
690
|
-
const r = this._injector.get(
|
|
691
|
+
const r = this._injector.get(f);
|
|
691
692
|
return b(
|
|
692
693
|
r.currentRichText$.pipe(S((t) => !!t)).subscribe(e)
|
|
693
694
|
);
|
|
694
695
|
}
|
|
695
696
|
onCellPointerDown(e) {
|
|
696
|
-
const r = this._injector.get(
|
|
697
|
+
const r = this._injector.get(f);
|
|
697
698
|
return b(
|
|
698
699
|
r.currentPointerDownCell$.subscribe(e)
|
|
699
700
|
);
|
|
700
701
|
}
|
|
701
702
|
onCellPointerUp(e) {
|
|
702
|
-
const r = this._injector.get(
|
|
703
|
+
const r = this._injector.get(f);
|
|
703
704
|
return b(
|
|
704
705
|
r.currentPointerUpCell$.subscribe(e)
|
|
705
706
|
);
|
|
706
707
|
}
|
|
707
708
|
onCellPointerMove(e) {
|
|
708
|
-
const r = this._injector.get(
|
|
709
|
+
const r = this._injector.get(f);
|
|
709
710
|
return b(
|
|
710
711
|
r.currentCellPosWithEvent$.pipe(S((t) => !!t)).subscribe((t) => {
|
|
711
712
|
e(t, t.event);
|
|
@@ -741,7 +742,7 @@ class De extends ie {
|
|
|
741
742
|
keycode: e ? B.ENTER : B.ESC,
|
|
742
743
|
visible: !1,
|
|
743
744
|
unitId: this._workbook.getUnitId()
|
|
744
|
-
}), await
|
|
745
|
+
}), await ce(0), !0;
|
|
745
746
|
}
|
|
746
747
|
endEditingAsync(e = !0) {
|
|
747
748
|
return this.endEditing(e);
|
|
@@ -776,8 +777,8 @@ class De extends ie {
|
|
|
776
777
|
return t && t.with(x).showSelection(), this;
|
|
777
778
|
}
|
|
778
779
|
}
|
|
779
|
-
|
|
780
|
-
class Te extends
|
|
780
|
+
ne.extend(De);
|
|
781
|
+
class Te extends ie {
|
|
781
782
|
refreshCanvas() {
|
|
782
783
|
const e = this._injector.get(m), r = this._fWorkbook.id, t = e.getRenderById(r);
|
|
783
784
|
if (!t)
|
|
@@ -789,7 +790,7 @@ class Te extends oe {
|
|
|
789
790
|
return n.makeDirty(), this;
|
|
790
791
|
}
|
|
791
792
|
zoom(e) {
|
|
792
|
-
return this._injector.get(P).syncExecuteCommand(
|
|
793
|
+
return this._injector.get(P).syncExecuteCommand(fe.id, {
|
|
793
794
|
unitId: this._workbook.getUnitId(),
|
|
794
795
|
subUnitId: this._worksheet.getSheetId(),
|
|
795
796
|
zoomRatio: e
|
|
@@ -818,7 +819,7 @@ class Te extends oe {
|
|
|
818
819
|
}
|
|
819
820
|
scrollToCell(e, r) {
|
|
820
821
|
const t = this._workbook.getUnitId(), o = this._injector.get(m).getRenderById(t);
|
|
821
|
-
return o && (o == null ? void 0 : o.with(
|
|
822
|
+
return o && (o == null ? void 0 : o.with(we)).scrollToCell(e, r), this;
|
|
822
823
|
}
|
|
823
824
|
getScrollState() {
|
|
824
825
|
const e = {
|
|
@@ -865,12 +866,12 @@ class Te extends oe {
|
|
|
865
866
|
var g, u;
|
|
866
867
|
const r = this, t = this._fWorkbook.getId(), n = this._injector.get(m), o = r.getSheetId(), s = n.getRenderById(t);
|
|
867
868
|
s && ((g = e.headerStyle) != null && g.size) && (s.with(R).setColumnHeaderSize(s, o, (u = e.headerStyle) == null ? void 0 : u.size), r == null || r.refreshCanvas());
|
|
868
|
-
const c = this._getSheetRenderComponent(t,
|
|
869
|
+
const c = this._getSheetRenderComponent(t, w.COLUMN);
|
|
869
870
|
c && (c.setCustomHeader(e), r == null || r.refreshCanvas());
|
|
870
871
|
}
|
|
871
872
|
customizeRowHeader(e) {
|
|
872
873
|
const r = this._fWorkbook.getId();
|
|
873
|
-
this._getSheetRenderComponent(r,
|
|
874
|
+
this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e);
|
|
874
875
|
}
|
|
875
876
|
setColumnHeaderHeight(e) {
|
|
876
877
|
const r = this, t = this._fWorkbook.getId(), n = r.getSheetId();
|
|
@@ -887,7 +888,7 @@ class Te extends oe {
|
|
|
887
888
|
subUnitId: n,
|
|
888
889
|
size: e
|
|
889
890
|
});
|
|
890
|
-
const o = this._getSheetRenderComponent(t,
|
|
891
|
+
const o = this._getSheetRenderComponent(t, w.ROW);
|
|
891
892
|
return o && o.setCustomHeader({ headerStyle: { size: e } }), r == null || r.refreshCanvas(), this;
|
|
892
893
|
}
|
|
893
894
|
/**
|
|
@@ -907,19 +908,19 @@ class Te extends oe {
|
|
|
907
908
|
return s;
|
|
908
909
|
}
|
|
909
910
|
}
|
|
910
|
-
|
|
911
|
-
class Be extends
|
|
911
|
+
ie.extend(Te);
|
|
912
|
+
class Be extends oe {
|
|
912
913
|
setPermissionDialogVisible(e) {
|
|
913
914
|
this._permissionService.setShowComponents(e);
|
|
914
915
|
}
|
|
915
916
|
}
|
|
916
|
-
|
|
917
|
+
oe.extend(Be);
|
|
917
918
|
class Ae extends $ {
|
|
918
919
|
onCellPointerMove(e) {
|
|
919
|
-
return b(this._injector.get(
|
|
920
|
+
return b(this._injector.get(f).currentPosition$.subscribe(e));
|
|
920
921
|
}
|
|
921
922
|
onCellPointerOver(e) {
|
|
922
|
-
return b(this._injector.get(
|
|
923
|
+
return b(this._injector.get(f).currentCell$.subscribe(e));
|
|
923
924
|
}
|
|
924
925
|
onCellDragOver(e) {
|
|
925
926
|
return b(this._injector.get(U).currentCell$.subscribe(e));
|
|
@@ -927,7 +928,7 @@ class Ae extends $ {
|
|
|
927
928
|
onCellDrop(e) {
|
|
928
929
|
return b(this._injector.get(U).endCell$.subscribe(e));
|
|
929
930
|
}
|
|
930
|
-
onCellRender(e, r =
|
|
931
|
+
onCellRender(e, r = de.Style, t = pe.DATA_VALIDATION) {
|
|
931
932
|
return this._injector.get(be).intercept(Ee.CELL_CONTENT, {
|
|
932
933
|
effect: r,
|
|
933
934
|
handler: (n, o, s) => s({
|
|
@@ -968,7 +969,7 @@ const M = {
|
|
|
968
969
|
SelectionMoveEnd: "SelectionMoveEnd",
|
|
969
970
|
SelectionChanged: "SelectionChanged"
|
|
970
971
|
};
|
|
971
|
-
class We
|
|
972
|
+
class We {
|
|
972
973
|
get BeforeClipboardChange() {
|
|
973
974
|
return "BeforeClipboardChange";
|
|
974
975
|
}
|
|
@@ -1059,9 +1060,15 @@ class We extends re {
|
|
|
1059
1060
|
get SheetSkeletonChanged() {
|
|
1060
1061
|
return "SheetSkeletonChanged";
|
|
1061
1062
|
}
|
|
1063
|
+
get BeforeSheetZoomChange() {
|
|
1064
|
+
return "BeforeSheetZoomChange";
|
|
1065
|
+
}
|
|
1066
|
+
get SheetZoomChanged() {
|
|
1067
|
+
return "SheetZoomChanged";
|
|
1068
|
+
}
|
|
1062
1069
|
}
|
|
1063
|
-
|
|
1064
|
-
class $e extends
|
|
1070
|
+
le.extend(We);
|
|
1071
|
+
class $e extends se {
|
|
1065
1072
|
getCell() {
|
|
1066
1073
|
var c;
|
|
1067
1074
|
const e = this._injector.get(m), r = this._injector.get(D), t = this._workbook.getUnitId(), n = this._worksheet.getSheetId(), o = e.getRenderById(t), s = (c = o == null ? void 0 : o.with(R).getSkeletonParam(n)) == null ? void 0 : c.skeleton;
|
|
@@ -1075,7 +1082,7 @@ class $e extends ae {
|
|
|
1075
1082
|
}
|
|
1076
1083
|
generateHTML() {
|
|
1077
1084
|
var r;
|
|
1078
|
-
const e = this._injector.get(
|
|
1085
|
+
const e = this._injector.get(re).generateCopyContent(
|
|
1079
1086
|
this._workbook.getUnitId(),
|
|
1080
1087
|
this._worksheet.getSheetId(),
|
|
1081
1088
|
this._range
|
|
@@ -1144,12 +1151,12 @@ class $e extends ae {
|
|
|
1144
1151
|
});
|
|
1145
1152
|
}
|
|
1146
1153
|
}
|
|
1147
|
-
|
|
1154
|
+
se.extend($e);
|
|
1148
1155
|
function ee(p, e) {
|
|
1149
1156
|
const { componentKey: r, isVue3: t } = p;
|
|
1150
1157
|
let n;
|
|
1151
1158
|
const o = new y();
|
|
1152
|
-
return typeof r == "string" ? n = r : (n = `External_${
|
|
1159
|
+
return typeof r == "string" ? n = r : (n = `External_${he(6)}`, o.add(e.register(n, r, { framework: t ? "vue3" : "react" }))), {
|
|
1153
1160
|
key: n,
|
|
1154
1161
|
disposableCollection: o
|
|
1155
1162
|
};
|