@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/es/facade.js CHANGED
@@ -1,9 +1,10 @@
1
- import { FUniver as te, 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 ce, ILogService as D, toDisposable as b, awaitTime as de, InterceptorEffectEnum as he, FEventName as re, generateRandomId as le } from "@univerjs/core";
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 w, DragManagerService as U, SheetScrollManagerService as T, SheetPasteShortKeyCommand as V, ISheetClipboardService as ne, SheetSkeletonManagerService as R, SHEET_VIEW_KEY as f, ISheetSelectionRenderService as x, ChangeZoomRatioCommand as we, SheetsScrollRenderController as fe, SetWorksheetColAutoWidthCommand as ke, SetColumnHeaderHeightCommand as Ie, SetRowHeaderWidthCommand as _e, SheetCanvasPopManagerService as Z, CellAlertManagerService as Pe, IMarkSelectionService as Re } from "@univerjs/sheets-ui";
6
- import { FSheetHooks as $, FWorkbook as ie, FWorksheet as oe, FPermission as se, FRange as ae } from "@univerjs/sheets/facade";
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.getCommandSheetTarget(t);
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(w), I = e.get(U);
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 === ce.UNIVER_SHEET && (c = l), C <= F.Rendered) return;
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(ne).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
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, f.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
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, f.ROW).setCustomHeader(e);
611
+ this._getSheetRenderComponent(t, w.ROW).setCustomHeader(e);
611
612
  }
612
613
  registerSheetRowHeaderExtension(e, ...r) {
613
- const t = this._getSheetRenderComponent(e, f.ROW), n = t.register(...r);
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, f.COLUMN), n = t.register(...r);
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, f.MAIN), n = t.register(...r);
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 ie {
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(w);
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(w);
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(w);
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(w);
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(w);
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 de(0), !0;
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
- ie.extend(De);
780
- class Te extends oe {
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(we.id, {
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(fe)).scrollToCell(e, r), this;
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, f.COLUMN);
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, f.ROW).setCustomHeader(e);
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, f.ROW);
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
- oe.extend(Te);
911
- class Be extends se {
911
+ ie.extend(Te);
912
+ class Be extends oe {
912
913
  setPermissionDialogVisible(e) {
913
914
  this._permissionService.setShowComponents(e);
914
915
  }
915
916
  }
916
- se.extend(Be);
917
+ oe.extend(Be);
917
918
  class Ae extends $ {
918
919
  onCellPointerMove(e) {
919
- return b(this._injector.get(w).currentPosition$.subscribe(e));
920
+ return b(this._injector.get(f).currentPosition$.subscribe(e));
920
921
  }
921
922
  onCellPointerOver(e) {
922
- return b(this._injector.get(w).currentCell$.subscribe(e));
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 = he.Style, t = pe.DATA_VALIDATION) {
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 extends re {
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
- re.extend(We);
1064
- class $e extends ae {
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(ne).generateCopyContent(
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
- ae.extend($e);
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_${le(6)}`, o.add(e.register(n, r, { framework: t ? "vue3" : "react" }))), {
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
  };