@univerjs/sheets-ui 0.6.0-nightly.202502131606 → 0.6.0-nightly.202502141606

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,11 +1,11 @@
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 ce, ILogService as T, toDisposable as b, awaitTime as de, InterceptorEffectEnum as he, generateRandomId as le } from "@univerjs/core";
2
- import { FUniver as te, FEventName as re } from "@univerjs/core/facade";
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 T, 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";
3
3
  import { RichTextEditingMutation as ge } from "@univerjs/docs";
4
4
  import { IRenderManagerService as m, DeviceInputEventType as N, SHEET_VIEWPORT_KEY as ue, sheetContentViewportKeys as ve } from "@univerjs/engine-render";
5
5
  import { SheetsSelectionsService as Ce, COMMAND_LISTENER_SKELETON_CHANGE as Se, getSkeletonChangedEffectedRange as me, InterceptCellContentPriority as be, SheetInterceptorService as Ee, INTERCEPTOR_POINT as pe } from "@univerjs/sheets";
6
- import { SetCellEditVisibleOperation as k, IEditorBridgeService as H, SetZoomRatioCommand as z, HoverManagerService as w, DragManagerService as U, SheetScrollManagerService as D, 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";
7
- import { FSheetHooks as $, FWorkbook as ie, FWorksheet as oe, FPermission as se, FRange as ae } from "@univerjs/sheets/facade";
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";
6
+ import { SetCellEditVisibleOperation as k, IEditorBridgeService as H, SetZoomRatioCommand as z, HoverManagerService as f, DragManagerService as U, SheetScrollManagerService as B, 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";
8
+ import { KeyCode as D, 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";
9
9
  import { filter as C, combineLatest as Ue } from "rxjs";
10
10
  class xe extends te {
11
11
  // eslint-disable-next-line max-lines-per-function
@@ -49,7 +49,7 @@ class xe extends te {
49
49
  worksheet: s,
50
50
  isZenEditor: !1,
51
51
  value: O.create(g.getUnit(W).getSnapshot()),
52
- isConfirm: S !== B.ESC
52
+ isConfirm: S !== D.ESC
53
53
  };
54
54
  if (this.fireEvent(this.Event.BeforeSheetEditEnd, I), I.cancel)
55
55
  throw new j();
@@ -91,7 +91,7 @@ class xe extends te {
91
91
  workbook: o,
92
92
  worksheet: s,
93
93
  isZenEditor: !1,
94
- isConfirm: l !== B.ESC
94
+ isConfirm: l !== D.ESC
95
95
  };
96
96
  this.fireEvent(this.Event.SheetEditEnded, h);
97
97
  }
@@ -100,7 +100,7 @@ class xe extends te {
100
100
  this.Event.SheetEditChanging,
101
101
  () => r.onCommandExecuted((t) => {
102
102
  if (t.id !== ge.id) return;
103
- const n = this.getCommandSheetTarget(t);
103
+ const n = this.getActiveSheet();
104
104
  if (!n) return;
105
105
  const { workbook: o, worksheet: s } = n, c = e.get(H), g = e.get(A), u = t.params;
106
106
  if (!c.isVisible().visible) return;
@@ -153,7 +153,7 @@ class xe extends te {
153
153
  this.disposeWithMe(l.lifecycle$.subscribe((v) => {
154
154
  if (v < F.Rendered) return;
155
155
  S.dispose();
156
- const h = e.get(w), I = e.get(U);
156
+ const h = e.get(f), I = e.get(U);
157
157
  h && (this.registerEventHandler(
158
158
  this.Event.CellClicked,
159
159
  () => {
@@ -359,13 +359,13 @@ class xe extends te {
359
359
  ]);
360
360
  this.disposeWithMe(u.subscribe(([l, S]) => {
361
361
  var i;
362
- if (l.type === ce.UNIVER_SHEET && (c = l), S <= F.Rendered) return;
362
+ if (l.type === ae.UNIVER_SHEET && (c = l), S <= F.Rendered) return;
363
363
  const v = new y();
364
364
  if (!c) return;
365
365
  const h = this.getWorkbook(c.unitId);
366
366
  if (!h) return;
367
367
  s.get(c.unitId) && ((i = s.get(c.unitId)) == null || i.dispose()), s.set(c.unitId, v);
368
- const I = c.with(D), d = c.with(Ce);
368
+ const I = c.with(B), d = c.with(Ce);
369
369
  v.add(this.registerEventHandler(
370
370
  this.Event.Scroll,
371
371
  () => I.validViewportScrollInfo$.subscribe((a) => {
@@ -512,7 +512,7 @@ class xe extends te {
512
512
  const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet(), t = e == null ? void 0 : e.getActiveRange();
513
513
  if (!e || !r || !t)
514
514
  return;
515
- 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());
516
516
  if (!o)
517
517
  return;
518
518
  const { html: s, plain: c } = o;
@@ -599,7 +599,7 @@ class xe extends te {
599
599
  return;
600
600
  }
601
601
  const t = r == null ? void 0 : r.getId(), n = this._injector.get(m), o = r.getActiveSheet(), s = o.getSheetId(), c = n.getRenderById(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, 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();
603
603
  }
604
604
  customizeRowHeader(e) {
605
605
  const r = this.getActiveWorkbook();
@@ -608,22 +608,22 @@ class xe extends te {
608
608
  return;
609
609
  }
610
610
  const t = r == null ? void 0 : r.getId();
611
- this._getSheetRenderComponent(t, f.ROW).setCustomHeader(e);
611
+ this._getSheetRenderComponent(t, w.ROW).setCustomHeader(e);
612
612
  }
613
613
  registerSheetRowHeaderExtension(e, ...r) {
614
- const t = this._getSheetRenderComponent(e, f.ROW), n = t.register(...r);
614
+ const t = this._getSheetRenderComponent(e, w.ROW), n = t.register(...r);
615
615
  return b(() => {
616
616
  n.dispose(), t.makeDirty(!0);
617
617
  });
618
618
  }
619
619
  registerSheetColumnHeaderExtension(e, ...r) {
620
- const t = this._getSheetRenderComponent(e, f.COLUMN), n = t.register(...r);
620
+ const t = this._getSheetRenderComponent(e, w.COLUMN), n = t.register(...r);
621
621
  return b(() => {
622
622
  n.dispose(), t.makeDirty(!0);
623
623
  });
624
624
  }
625
625
  registerSheetMainExtension(e, ...r) {
626
- const t = this._getSheetRenderComponent(e, f.MAIN), n = t.register(...r);
626
+ const t = this._getSheetRenderComponent(e, w.MAIN), n = t.register(...r);
627
627
  return b(() => {
628
628
  n.dispose(), t.makeDirty(!0);
629
629
  });
@@ -653,7 +653,7 @@ class xe extends te {
653
653
  }
654
654
  }
655
655
  te.extend(xe);
656
- class Te extends ie {
656
+ class Te extends ne {
657
657
  openSiderbar(e) {
658
658
  return this._logDeprecation("openSiderbar"), this._injector.get(Me).open(e);
659
659
  }
@@ -680,7 +680,7 @@ class Te extends ie {
680
680
  };
681
681
  }
682
682
  onCellClick(e) {
683
- const r = this._injector.get(w);
683
+ const r = this._injector.get(f);
684
684
  return b(
685
685
  r.currentClickedCell$.pipe(C((t) => !!t)).subscribe((t) => {
686
686
  e(t);
@@ -688,25 +688,25 @@ class Te extends ie {
688
688
  );
689
689
  }
690
690
  onCellHover(e) {
691
- const r = this._injector.get(w);
691
+ const r = this._injector.get(f);
692
692
  return b(
693
693
  r.currentRichText$.pipe(C((t) => !!t)).subscribe(e)
694
694
  );
695
695
  }
696
696
  onCellPointerDown(e) {
697
- const r = this._injector.get(w);
697
+ const r = this._injector.get(f);
698
698
  return b(
699
699
  r.currentPointerDownCell$.subscribe(e)
700
700
  );
701
701
  }
702
702
  onCellPointerUp(e) {
703
- const r = this._injector.get(w);
703
+ const r = this._injector.get(f);
704
704
  return b(
705
705
  r.currentPointerUpCell$.subscribe(e)
706
706
  );
707
707
  }
708
708
  onCellPointerMove(e) {
709
- const r = this._injector.get(w);
709
+ const r = this._injector.get(f);
710
710
  return b(
711
711
  r.currentCellPosWithEvent$.pipe(C((t) => !!t)).subscribe((t) => {
712
712
  e(t, t.event);
@@ -739,10 +739,10 @@ class Te extends ie {
739
739
  async endEditing(e) {
740
740
  return this._injector.get(P).syncExecuteCommand(k.id, {
741
741
  eventType: N.Keyboard,
742
- keycode: e ? B.ENTER : B.ESC,
742
+ keycode: e ? D.ENTER : D.ESC,
743
743
  visible: !1,
744
744
  unitId: this._workbook.getUnitId()
745
- }), await de(0), !0;
745
+ }), await ce(0), !0;
746
746
  }
747
747
  endEditingAsync(e = !0) {
748
748
  return this.endEditing(e);
@@ -758,7 +758,7 @@ class Te extends ie {
758
758
  */
759
759
  getScrollStateBySheetId(e) {
760
760
  const r = this._workbook.getUnitId(), n = this._injector.get(m).getRenderById(r);
761
- return n ? n.with(D).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
761
+ return n ? n.with(B).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
762
762
  }
763
763
  disableSelection() {
764
764
  const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
@@ -777,8 +777,8 @@ class Te extends ie {
777
777
  return t && t.with(x).showSelection(), this;
778
778
  }
779
779
  }
780
- ie.extend(Te);
781
- class De extends oe {
780
+ ne.extend(Te);
781
+ class Be extends ie {
782
782
  refreshCanvas() {
783
783
  const e = this._injector.get(m), r = this._fWorkbook.id, t = e.getRenderById(r);
784
784
  if (!t)
@@ -790,7 +790,7 @@ class De extends oe {
790
790
  return n.makeDirty(), this;
791
791
  }
792
792
  zoom(e) {
793
- return this._injector.get(P).syncExecuteCommand(we.id, {
793
+ return this._injector.get(P).syncExecuteCommand(fe.id, {
794
794
  unitId: this._workbook.getUnitId(),
795
795
  subUnitId: this._worksheet.getSheetId(),
796
796
  zoomRatio: e
@@ -819,7 +819,7 @@ class De extends oe {
819
819
  }
820
820
  scrollToCell(e, r) {
821
821
  const t = this._workbook.getUnitId(), o = this._injector.get(m).getRenderById(t);
822
- 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;
823
823
  }
824
824
  getScrollState() {
825
825
  const e = {
@@ -828,11 +828,11 @@ class De extends oe {
828
828
  sheetViewStartColumn: 0,
829
829
  sheetViewStartRow: 0
830
830
  }, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(m).getRenderById(r);
831
- return o && o.with(D).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
831
+ return o && o.with(B).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
832
832
  }
833
833
  onScroll(e) {
834
834
  var o;
835
- const r = this._workbook.getUnitId(), n = (o = this._injector.get(m).getRenderById(r)) == null ? void 0 : o.with(D);
835
+ const r = this._workbook.getUnitId(), n = (o = this._injector.get(m).getRenderById(r)) == null ? void 0 : o.with(B);
836
836
  if (n) {
837
837
  const s = n.validViewportScrollInfo$.subscribe((c) => {
838
838
  e(c);
@@ -866,12 +866,12 @@ class De extends oe {
866
866
  var g, u;
867
867
  const r = this, t = this._fWorkbook.getId(), n = this._injector.get(m), o = r.getSheetId(), s = n.getRenderById(t);
868
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());
869
- const c = this._getSheetRenderComponent(t, f.COLUMN);
869
+ const c = this._getSheetRenderComponent(t, w.COLUMN);
870
870
  c && (c.setCustomHeader(e), r == null || r.refreshCanvas());
871
871
  }
872
872
  customizeRowHeader(e) {
873
873
  const r = this._fWorkbook.getId();
874
- this._getSheetRenderComponent(r, f.ROW).setCustomHeader(e);
874
+ this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e);
875
875
  }
876
876
  setColumnHeaderHeight(e) {
877
877
  const r = this, t = this._fWorkbook.getId(), n = r.getSheetId();
@@ -888,7 +888,7 @@ class De extends oe {
888
888
  subUnitId: n,
889
889
  size: e
890
890
  });
891
- const o = this._getSheetRenderComponent(t, f.ROW);
891
+ const o = this._getSheetRenderComponent(t, w.ROW);
892
892
  return o && o.setCustomHeader({ headerStyle: { size: e } }), r == null || r.refreshCanvas(), this;
893
893
  }
894
894
  /**
@@ -908,19 +908,19 @@ class De extends oe {
908
908
  return s;
909
909
  }
910
910
  }
911
- oe.extend(De);
912
- class Be extends se {
911
+ ie.extend(Be);
912
+ class De extends oe {
913
913
  setPermissionDialogVisible(e) {
914
914
  this._permissionService.setShowComponents(e);
915
915
  }
916
916
  }
917
- se.extend(Be);
917
+ oe.extend(De);
918
918
  class Ae extends $ {
919
919
  onCellPointerMove(e) {
920
- return b(this._injector.get(w).currentPosition$.subscribe(e));
920
+ return b(this._injector.get(f).currentPosition$.subscribe(e));
921
921
  }
922
922
  onCellPointerOver(e) {
923
- return b(this._injector.get(w).currentCell$.subscribe(e));
923
+ return b(this._injector.get(f).currentCell$.subscribe(e));
924
924
  }
925
925
  onCellDragOver(e) {
926
926
  return b(this._injector.get(U).currentCell$.subscribe(e));
@@ -928,7 +928,7 @@ class Ae extends $ {
928
928
  onCellDrop(e) {
929
929
  return b(this._injector.get(U).endCell$.subscribe(e));
930
930
  }
931
- onCellRender(e, r = he.Style, t = be.DATA_VALIDATION) {
931
+ onCellRender(e, r = de.Style, t = be.DATA_VALIDATION) {
932
932
  return this._injector.get(Ee).intercept(pe.CELL_CONTENT, {
933
933
  effect: r,
934
934
  handler: (n, o, s) => s({
@@ -962,7 +962,7 @@ const M = {
962
962
  CellPointerMove: "CellPointerMove",
963
963
  CellHover: "CellHover"
964
964
  };
965
- class We extends re {
965
+ class We {
966
966
  get BeforeClipboardChange() {
967
967
  return "BeforeClipboardChange";
968
968
  }
@@ -1053,9 +1053,15 @@ class We extends re {
1053
1053
  get SheetSkeletonChanged() {
1054
1054
  return "SheetSkeletonChanged";
1055
1055
  }
1056
+ get BeforeSheetZoomChange() {
1057
+ return "BeforeSheetZoomChange";
1058
+ }
1059
+ get SheetZoomChanged() {
1060
+ return "SheetZoomChanged";
1061
+ }
1056
1062
  }
1057
- re.extend(We);
1058
- class $e extends ae {
1063
+ le.extend(We);
1064
+ class $e extends se {
1059
1065
  getCell() {
1060
1066
  var c;
1061
1067
  const e = this._injector.get(m), r = this._injector.get(T), 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;
@@ -1069,7 +1075,7 @@ class $e extends ae {
1069
1075
  }
1070
1076
  generateHTML() {
1071
1077
  var r;
1072
- const e = this._injector.get(ne).generateCopyContent(
1078
+ const e = this._injector.get(re).generateCopyContent(
1073
1079
  this._workbook.getUnitId(),
1074
1080
  this._worksheet.getSheetId(),
1075
1081
  this._range
@@ -1138,12 +1144,12 @@ class $e extends ae {
1138
1144
  });
1139
1145
  }
1140
1146
  }
1141
- ae.extend($e);
1147
+ se.extend($e);
1142
1148
  function ee(p, e) {
1143
1149
  const { componentKey: r, isVue3: t } = p;
1144
1150
  let n;
1145
1151
  const o = new y();
1146
- return typeof r == "string" ? n = r : (n = `External_${le(6)}`, o.add(e.register(n, r, { framework: t ? "vue3" : "react" }))), {
1152
+ return typeof r == "string" ? n = r : (n = `External_${he(6)}`, o.add(e.register(n, r, { framework: t ? "vue3" : "react" }))), {
1147
1153
  key: n,
1148
1154
  disposableCollection: o
1149
1155
  };