@univerjs/sheets-ui 0.10.7 → 0.10.8

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,10 +1,10 @@
1
- import { ICommandService as _, CanceledError as E, IUniverInstanceService as j, RichTextValue as W, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as T, LifecycleService as ie, DisposableCollection as B, LifecycleStages as O, UniverInstanceType as oe, ILogService as U, toDisposable as m, awaitTime as se, InterceptorEffectEnum as ae, generateRandomId as ce } from "@univerjs/core";
1
+ import { ICommandService as _, CanceledError as E, IUniverInstanceService as W, RichTextValue as O, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as T, LifecycleService as ie, DisposableCollection as A, LifecycleStages as z, UniverInstanceType as oe, ILogService as U, toDisposable as m, awaitTime as se, InterceptorEffectEnum as ae, generateRandomId as ce } from "@univerjs/core";
2
2
  import { FUniver as q, FEventName as de } from "@univerjs/core/facade";
3
3
  import { RichTextEditingMutation as he } from "@univerjs/docs";
4
- import { IRenderManagerService as v, DeviceInputEventType as z, SHEET_VIEWPORT_KEY as le, sheetContentViewportKeys as ge } from "@univerjs/engine-render";
4
+ import { IRenderManagerService as v, DeviceInputEventType as L, SHEET_VIEWPORT_KEY as le, sheetContentViewportKeys as ge } from "@univerjs/engine-render";
5
5
  import { SheetsSelectionsService as ue, COMMAND_LISTENER_SKELETON_CHANGE as ve, getSkeletonChangedEffectedRange as Se, SetWorksheetRowIsAutoHeightCommand as me, InterceptCellContentPriority as Ce, SheetInterceptorService as we, INTERCEPTOR_POINT as be } from "@univerjs/sheets";
6
- import { SetCellEditVisibleOperation as f, IEditorBridgeService as R, SetZoomRatioCommand as A, HoverManagerService as p, DragManagerService as M, SheetScrollManagerService as x, SheetPasteShortKeyCommand as L, ISheetClipboardService as Q, SheetSkeletonManagerService as I, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as y, SheetsScrollRenderController as Ee, SetWorksheetColAutoWidthCommand as pe, SetColumnHeaderHeightCommand as fe, SetRowHeaderWidthCommand as ke, SheetCanvasPopManagerService as N, CellAlertManagerService as Ie, IMarkSelectionService as _e, ISheetCellDropdownManagerService as Pe } from "@univerjs/sheets-ui";
7
- import { FSheetHooks as $, FWorkbook as ee, FWorksheet as te, FPermission as re, FRange as ne } from "@univerjs/sheets/facade";
6
+ import { SetCellEditVisibleOperation as f, IEditorBridgeService as R, SetZoomRatioCommand as $, HoverManagerService as p, DragManagerService as M, SheetScrollManagerService as x, SheetPasteShortKeyCommand as B, ISheetClipboardService as Q, SheetSkeletonManagerService as I, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as y, SheetsScrollRenderController as Ee, SetWorksheetColAutoWidthCommand as pe, SetColumnHeaderHeightCommand as fe, SetRowHeaderWidthCommand as ke, SheetCanvasPopManagerService as N, CellAlertManagerService as Ie, IMarkSelectionService as _e, ISheetCellDropdownManagerService as Pe } from "@univerjs/sheets-ui";
7
+ import { FSheetHooks as j, FWorkbook as ee, FWorksheet as te, FPermission as re, FRange as ne } from "@univerjs/sheets/facade";
8
8
  import { KeyCode as D, CutCommand as F, CopyCommand as V, PasteCommand as Z, IClipboardInterfaceService as Re, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as K, HTML_CLIPBOARD_MIME_TYPE as Y, supportClipboardAPI as X, ISidebarService as He, IDialogService as Me, ComponentManager as J } from "@univerjs/ui";
9
9
  import { filter as u, combineLatest as ye } from "rxjs";
10
10
  class Ue extends q {
@@ -38,7 +38,7 @@ class Ue extends q {
38
38
  if (t.id !== f.id) return;
39
39
  const i = this.getActiveSheet();
40
40
  if (!i) return;
41
- const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(j), h = t.params, { visible: g, keycode: a, eventType: n } = h, c = d.getEditLocation();
41
+ const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(W), h = t.params, { visible: g, keycode: a, eventType: n } = h, c = d.getEditLocation();
42
42
  if (!g) {
43
43
  const P = {
44
44
  row: c.row,
@@ -48,7 +48,7 @@ class Ue extends q {
48
48
  workbook: o,
49
49
  worksheet: s,
50
50
  isZenEditor: !1,
51
- value: W.create(l.getUnit(T).getSnapshot()),
51
+ value: O.create(l.getUnit(T).getSnapshot()),
52
52
  isConfirm: a !== D.ESC
53
53
  };
54
54
  if (this.fireEvent(this.Event.BeforeSheetEditEnd, P), P.cancel)
@@ -102,7 +102,7 @@ class Ue extends q {
102
102
  if (t.id !== he.id) return;
103
103
  const i = this.getActiveSheet();
104
104
  if (!i) return;
105
- const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(j), h = t.params;
105
+ const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(W), h = t.params;
106
106
  if (!d.isVisible().visible) return;
107
107
  const { unitId: g } = h;
108
108
  if (g === T) {
@@ -111,7 +111,7 @@ class Ue extends q {
111
111
  worksheet: s,
112
112
  row: a,
113
113
  column: n,
114
- value: W.create(l.getUnit(T).getSnapshot()),
114
+ value: O.create(l.getUnit(T).getSnapshot()),
115
115
  isZenEditor: !1
116
116
  };
117
117
  this.fireEvent(this.Event.SheetEditChanging, c);
@@ -120,7 +120,7 @@ class Ue extends q {
120
120
  ), this.registerEventHandler(
121
121
  this.Event.BeforeSheetZoomChange,
122
122
  () => r.beforeCommandExecuted((t) => {
123
- if (t.id !== A.id) return;
123
+ if (t.id !== $.id) return;
124
124
  const i = this.getCommandSheetTarget(t);
125
125
  if (!i) return;
126
126
  const { workbook: o, worksheet: s } = i, d = {
@@ -134,7 +134,7 @@ class Ue extends q {
134
134
  ), this.registerEventHandler(
135
135
  this.Event.SheetZoomChanged,
136
136
  () => r.onCommandExecuted((t) => {
137
- if (t.id !== A.id) return;
137
+ if (t.id !== $.id) return;
138
138
  const i = this.getCommandSheetTarget(t);
139
139
  if (!i) return;
140
140
  const { workbook: o, worksheet: s } = i;
@@ -148,9 +148,9 @@ class Ue extends q {
148
148
  }
149
149
  // eslint-disable-next-line max-lines-per-function
150
150
  _initObserverListener(e) {
151
- const r = e.get(v), t = e.get(ie), i = new B();
151
+ const r = e.get(v), t = e.get(ie), i = new A();
152
152
  this.disposeWithMe(t.lifecycle$.subscribe((l) => {
153
- if (l !== O.Rendered) return;
153
+ if (l !== z.Rendered) return;
154
154
  i.dispose();
155
155
  const h = e.get(p), g = e.get(M);
156
156
  h && (this.registerEventHandler(
@@ -357,8 +357,8 @@ class Ue extends q {
357
357
  ]);
358
358
  this.disposeWithMe(d.subscribe(([l, h]) => {
359
359
  var P;
360
- if (l.type === oe.UNIVER_SHEET && (s = l), h <= O.Rendered || !s) return;
361
- const g = new B(), a = this.getWorkbook(s.unitId);
360
+ if (l.type === oe.UNIVER_SHEET && (s = l), h <= z.Rendered || !s) return;
361
+ const g = new A(), a = this.getWorkbook(s.unitId);
362
362
  if (!a) return;
363
363
  o.get(s.unitId) && ((P = o.get(s.unitId)) == null || P.dispose()), o.set(s.unitId, g);
364
364
  const n = s.with(x), c = s.with(ue);
@@ -451,7 +451,7 @@ class Ue extends q {
451
451
  this.Event.BeforeClipboardPaste,
452
452
  () => r.beforeCommandExecuted((t) => {
453
453
  switch (t.id) {
454
- case L.id:
454
+ case B.id:
455
455
  this._beforeClipboardPaste(t.params);
456
456
  break;
457
457
  case Z.id:
@@ -463,7 +463,7 @@ class Ue extends q {
463
463
  this.Event.ClipboardPasted,
464
464
  () => r.onCommandExecuted((t) => {
465
465
  switch (t.id) {
466
- case L.id:
466
+ case B.id:
467
467
  this._clipboardPaste(t.params);
468
468
  break;
469
469
  case Z.id:
@@ -633,7 +633,10 @@ class Ue extends q {
633
633
  * @returns {FSheetHooks} FSheetHooks instance
634
634
  */
635
635
  getSheetHooks() {
636
- return this._injector.createInstance($);
636
+ return this._injector.createInstance(j);
637
+ }
638
+ pasteIntoSheet(e, r, t) {
639
+ return this._commandService.executeCommand(B.id, { htmlContent: e, textContent: r, files: t });
637
640
  }
638
641
  }
639
642
  q.extend(Ue);
@@ -739,14 +742,14 @@ class xe extends ee {
739
742
  }
740
743
  startEditing() {
741
744
  return this._injector.get(_).syncExecuteCommand(f.id, {
742
- eventType: z.Dblclick,
745
+ eventType: L.Dblclick,
743
746
  unitId: this._workbook.getUnitId(),
744
747
  visible: !0
745
748
  });
746
749
  }
747
750
  async endEditing(e) {
748
751
  return this._injector.get(_).syncExecuteCommand(f.id, {
749
- eventType: z.Keyboard,
752
+ eventType: L.Keyboard,
750
753
  keycode: e ? D.ENTER : D.ESC,
751
754
  visible: !1,
752
755
  unitId: this._workbook.getUnitId()
@@ -802,7 +805,7 @@ class De extends te {
802
805
  }
803
806
  zoom(e) {
804
807
  const r = this._injector.get(_), t = Math.min(Math.max(e, 0.1), 4);
805
- return r.executeCommand(A.id, {
808
+ return r.executeCommand($.id, {
806
809
  unitId: this._workbook.getUnitId(),
807
810
  subUnitId: this._worksheet.getSheetId(),
808
811
  zoomRatio: t
@@ -945,7 +948,7 @@ class Te extends re {
945
948
  }
946
949
  }
947
950
  re.extend(Te);
948
- class Be extends $ {
951
+ class Be extends j {
949
952
  onCellPointerMove(e) {
950
953
  return m(this._injector.get(p).currentPosition$.subscribe(e));
951
954
  }
@@ -978,7 +981,7 @@ class Be extends $ {
978
981
  });
979
982
  }
980
983
  }
981
- $.extend(Be);
984
+ j.extend(Be);
982
985
  const H = {
983
986
  CellClicked: "CellClicked",
984
987
  CellPointerDown: "CellPointerDown",
@@ -1175,7 +1178,7 @@ ne.extend($e);
1175
1178
  function G(b, e) {
1176
1179
  const { componentKey: r, isVue3: t } = b;
1177
1180
  let i;
1178
- const o = new B();
1181
+ const o = new A();
1179
1182
  return typeof r == "string" ? i = r : (i = `External_${ce(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
1180
1183
  key: i,
1181
1184
  disposableCollection: o