@univerjs/sheets-ui 0.5.5-nightly.202501220324 → 0.5.5

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.
Files changed (80) hide show
  1. package/LICENSE +176 -0
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +48 -44
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/fa-IR.js +1 -1
  6. package/lib/cjs/locale/fr-FR.js +1 -1
  7. package/lib/cjs/locale/ru-RU.js +1 -1
  8. package/lib/cjs/locale/vi-VN.js +1 -1
  9. package/lib/cjs/locale/zh-CN.js +1 -1
  10. package/lib/cjs/locale/zh-TW.js +1 -1
  11. package/lib/es/facade.js +576 -596
  12. package/lib/es/index.js +16692 -17083
  13. package/lib/es/locale/en-US.js +2 -2
  14. package/lib/es/locale/fa-IR.js +2 -2
  15. package/lib/es/locale/fr-FR.js +2 -2
  16. package/lib/es/locale/ru-RU.js +2 -2
  17. package/lib/es/locale/vi-VN.js +2 -2
  18. package/lib/es/locale/zh-CN.js +2 -2
  19. package/lib/es/locale/zh-TW.js +2 -2
  20. package/lib/index.css +1 -1
  21. package/lib/types/commands/commands/clipboard.command.d.ts +0 -1
  22. package/lib/types/components/border-panel/BorderPanel.d.ts +2 -1
  23. package/lib/types/components/border-panel/border-line/BorderLine.d.ts +2 -1
  24. package/lib/types/components/border-panel/border-line/icons/BorderDashDot.d.ts +2 -16
  25. package/lib/types/components/border-panel/border-line/icons/BorderDashDotDot.d.ts +2 -16
  26. package/lib/types/components/border-panel/border-line/icons/BorderDashed.d.ts +2 -16
  27. package/lib/types/components/border-panel/border-line/icons/BorderDotted.d.ts +2 -16
  28. package/lib/types/components/border-panel/border-line/icons/BorderHair.d.ts +2 -16
  29. package/lib/types/components/border-panel/border-line/icons/BorderMedium.d.ts +2 -16
  30. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashDot.d.ts +2 -16
  31. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashDotDot.d.ts +2 -16
  32. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashed.d.ts +2 -16
  33. package/lib/types/components/border-panel/border-line/icons/BorderThick.d.ts +2 -16
  34. package/lib/types/components/border-panel/border-line/icons/BorderThin.d.ts +2 -16
  35. package/lib/types/components/menu-item-input/MenuItemInput.d.ts +2 -1
  36. package/lib/types/controllers/clipboard/clipboard.controller.d.ts +0 -1
  37. package/lib/types/facade/f-event.d.ts +5 -20
  38. package/lib/types/facade/f-univer.d.ts +1 -4
  39. package/lib/types/services/clipboard/clipboard.service.d.ts +2 -5
  40. package/lib/types/services/clipboard/type.d.ts +1 -9
  41. package/lib/types/services/selection/base-selection-render.service.d.ts +0 -1
  42. package/lib/types/services/selection/selection-control.d.ts +2 -2
  43. package/lib/types/services/sheet-skeleton-manager.service.d.ts +1 -2
  44. package/lib/types/views/cell-alert/CellAlertPopup.d.ts +2 -1
  45. package/lib/types/views/clipboard/ClipboardPopupMenu.d.ts +2 -16
  46. package/lib/types/views/count-bar/CountBar.d.ts +2 -16
  47. package/lib/types/views/count-bar/ZoomSlider.d.ts +2 -16
  48. package/lib/types/views/defined-name/DefinedName.d.ts +2 -16
  49. package/lib/types/views/defined-name/DefinedNameContainer.d.ts +2 -16
  50. package/lib/types/views/defined-name/DefinedNameInput.d.ts +2 -1
  51. package/lib/types/views/defined-name/DefinedNameOverlay.d.ts +2 -16
  52. package/lib/types/views/formula-bar/FormulaBar.d.ts +2 -16
  53. package/lib/types/views/mobile/sheet-bar/MobileSheetBar.d.ts +2 -16
  54. package/lib/types/views/permission/error-msg-dialog/index.d.ts +2 -16
  55. package/lib/types/views/permission/panel/index.d.ts +2 -1
  56. package/lib/types/views/permission/panel-detail/PermissionDetailFooterPart.d.ts +2 -1
  57. package/lib/types/views/permission/panel-detail/PermissionDetailMainPart.d.ts +1 -1
  58. package/lib/types/views/permission/panel-detail/PermissionDetailPanel.d.ts +2 -1
  59. package/lib/types/views/permission/panel-detail/PermissionDetailUserPart.d.ts +2 -1
  60. package/lib/types/views/permission/panel-list/index.d.ts +2 -16
  61. package/lib/types/views/permission/permission-dialog/index.d.ts +2 -16
  62. package/lib/types/views/permission/spin/index.d.ts +1 -1
  63. package/lib/types/views/permission/user-dialog/index.d.ts +2 -16
  64. package/lib/types/views/sheet-bar/SheetBar.d.ts +2 -16
  65. package/lib/types/views/sheet-bar/sheet-bar-button/SheetBarButton.d.ts +1 -1
  66. package/lib/types/views/sheet-bar/sheet-bar-menu/SheetBarMenu.d.ts +1 -1
  67. package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarItem.d.ts +1 -1
  68. package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.d.ts +2 -16
  69. package/lib/types/views/sheet-container/SheetContainer.d.ts +4 -18
  70. package/lib/types/views/status-bar/StatusBar.d.ts +2 -16
  71. package/lib/umd/facade.js +1 -1
  72. package/lib/umd/index.js +48 -44
  73. package/lib/umd/locale/en-US.js +1 -1
  74. package/lib/umd/locale/fa-IR.js +1 -1
  75. package/lib/umd/locale/fr-FR.js +1 -1
  76. package/lib/umd/locale/ru-RU.js +1 -1
  77. package/lib/umd/locale/vi-VN.js +1 -1
  78. package/lib/umd/locale/zh-CN.js +1 -1
  79. package/lib/umd/locale/zh-TW.js +1 -1
  80. package/package.json +12 -12
package/lib/es/facade.js CHANGED
@@ -1,543 +1,537 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3
- import { FUniver, ICommandService, IUniverInstanceService, CanceledError, RichTextValue, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, LifecycleService, DisposableCollection, LifecycleStages, UniverInstanceType, ILogService, toDisposable, awaitTime, InterceptorEffectEnum, FEventName, generateRandomId } from "@univerjs/core";
4
- import { RichTextEditingMutation } from "@univerjs/docs";
5
- import { IRenderManagerService, DeviceInputEventType, SHEET_VIEWPORT_KEY, sheetContentViewportKeys } from "@univerjs/engine-render";
6
- import { SheetsSelectionsService, COMMAND_LISTENER_SKELETON_CHANGE, getSkeletonChangedEffectedRange, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
7
- import { SetCellEditVisibleOperation, IEditorBridgeService, SetZoomRatioCommand, HoverManagerService, DragManagerService, SheetScrollManagerService, SheetPasteShortKeyCommand, ISheetClipboardService, SheetSkeletonManagerService, SHEET_VIEW_KEY, ISheetSelectionRenderService, ChangeZoomRatioCommand, SheetsScrollRenderController, SetWorksheetColAutoWidthCommand, SheetCanvasPopManagerService, CellAlertManagerService, IMarkSelectionService } from "@univerjs/sheets-ui";
8
- import { FSheetHooks, FWorkbook, FWorksheet, FPermission, FRange } from "@univerjs/sheets/facade";
9
- import { KeyCode, CutCommand, CopyCommand, PasteCommand, IClipboardInterfaceService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, supportClipboardAPI, ISidebarService, IDialogService, ComponentManager } from "@univerjs/ui";
10
- import { filter, combineLatest } from "rxjs";
11
- const _FUniverSheetsUIMixin = class _FUniverSheetsUIMixin extends FUniver {
1
+ import { FUniver as ue, ICommandService as I, IUniverInstanceService as L, CanceledError as G, RichTextValue as q, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as A, LifecycleService as Q, DisposableCollection as W, LifecycleStages as ee, UniverInstanceType as fe, ILogService as D, toDisposable as C, awaitTime as Ee, InterceptorEffectEnum as we, FEventName as ve, generateRandomId as _e } from "@univerjs/core";
2
+ import { RichTextEditingMutation as ke } from "@univerjs/docs";
3
+ import { IRenderManagerService as m, DeviceInputEventType as te, SHEET_VIEWPORT_KEY as Ie, sheetContentViewportKeys as Pe } from "@univerjs/engine-render";
4
+ import { SheetsSelectionsService as Me, COMMAND_LISTENER_SKELETON_CHANGE as Re, getSkeletonChangedEffectedRange as ye, SheetInterceptorService as Ue, INTERCEPTOR_POINT as He, InterceptCellContentPriority as xe } from "@univerjs/sheets";
5
+ import { SetCellEditVisibleOperation as P, IEditorBridgeService as $, SetZoomRatioCommand as re, HoverManagerService as _, DragManagerService as U, SheetScrollManagerService as T, SheetPasteShortKeyCommand as ne, ISheetClipboardService as Se, SHEET_VIEW_KEY as R, ISheetSelectionRenderService as H, SheetSkeletonManagerService as x, ChangeZoomRatioCommand as De, SheetsScrollRenderController as Te, SetWorksheetColAutoWidthCommand as Be, SheetCanvasPopManagerService as ie, CellAlertManagerService as Le, IMarkSelectionService as Ae } from "@univerjs/sheets-ui";
6
+ import { FSheetHooks as j, FWorkbook as Ce, FWorksheet as be, FPermission as pe, FRange as me } from "@univerjs/sheets/facade";
7
+ import { KeyCode as B, CutCommand as oe, CopyCommand as se, PasteCommand as ae, IClipboardInterfaceService as $e, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as ce, HTML_CLIPBOARD_MIME_TYPE as de, supportClipboardAPI as he, ISidebarService as We, IDialogService as je, ComponentManager as le } from "@univerjs/ui";
8
+ import { filter as v, combineLatest as Oe } from "rxjs";
9
+ class Fe extends ue {
12
10
  // eslint-disable-next-line max-lines-per-function
13
- _initSheetUIEvent(injector) {
14
- const commandService = injector.get(ICommandService);
15
- this.disposeWithMe(commandService.beforeCommandExecuted((commandInfo) => {
16
- if (commandInfo.id === SetCellEditVisibleOperation.id) {
11
+ _initSheetUIEvent(e) {
12
+ const r = e.get(I);
13
+ this.disposeWithMe(r.beforeCommandExecuted((t) => {
14
+ if (t.id === P.id) {
17
15
  if (!this._eventListend(this.Event.BeforeSheetEditStart) && !this._eventListend(this.Event.BeforeSheetEditEnd))
18
16
  return;
19
- const target = this.getCommandSheetTarget(commandInfo);
20
- if (!target)
17
+ const i = this.getCommandSheetTarget(t);
18
+ if (!i)
21
19
  return;
22
- const { workbook, worksheet } = target, editorBridgeService = injector.get(IEditorBridgeService), univerInstanceService = injector.get(IUniverInstanceService), params = commandInfo.params, { visible, keycode, eventType } = params, loc = editorBridgeService.getEditLocation();
23
- if (visible) {
24
- const eventParams = {
25
- row: loc.row,
26
- column: loc.column,
27
- eventType,
28
- keycode,
29
- workbook,
30
- worksheet,
20
+ const { workbook: o, worksheet: s } = i, c = e.get($), g = e.get(L), b = t.params, { visible: l, keycode: h, eventType: S } = b, d = c.getEditLocation();
21
+ if (l) {
22
+ const f = {
23
+ row: d.row,
24
+ column: d.column,
25
+ eventType: S,
26
+ keycode: h,
27
+ workbook: o,
28
+ worksheet: s,
31
29
  isZenEditor: !1
32
30
  };
33
- if (this.fireEvent(this.Event.BeforeSheetEditStart, eventParams), eventParams.cancel)
34
- throw new CanceledError();
31
+ if (this.fireEvent(this.Event.BeforeSheetEditStart, f), f.cancel)
32
+ throw new G();
35
33
  } else {
36
- const eventParams = {
37
- row: loc.row,
38
- column: loc.column,
39
- eventType,
40
- keycode,
41
- workbook,
42
- worksheet,
34
+ const f = {
35
+ row: d.row,
36
+ column: d.column,
37
+ eventType: S,
38
+ keycode: h,
39
+ workbook: o,
40
+ worksheet: s,
43
41
  isZenEditor: !1,
44
- value: RichTextValue.create(univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),
45
- isConfirm: keycode !== KeyCode.ESC
42
+ value: q.create(g.getUnit(A).getSnapshot()),
43
+ isConfirm: h !== B.ESC
46
44
  };
47
- if (this.fireEvent(this.Event.BeforeSheetEditEnd, eventParams), eventParams.cancel)
48
- throw new CanceledError();
45
+ if (this.fireEvent(this.Event.BeforeSheetEditEnd, f), f.cancel)
46
+ throw new G();
49
47
  }
50
48
  }
51
- if (commandInfo.id === SetZoomRatioCommand.id) {
49
+ if (t.id === re.id) {
52
50
  if (!this._eventListend(this.Event.BeforeSheetZoomChange))
53
51
  return;
54
- const target = this.getCommandSheetTarget(commandInfo);
55
- if (!target)
52
+ const i = this.getCommandSheetTarget(t);
53
+ if (!i)
56
54
  return;
57
- const { workbook, worksheet } = target;
55
+ const { workbook: o, worksheet: s } = i;
58
56
  this.fireEvent(this.Event.BeforeSheetZoomChange, {
59
- zoom: commandInfo.params.zoomRatio,
60
- workbook,
61
- worksheet
57
+ zoom: t.params.zoomRatio,
58
+ workbook: o,
59
+ worksheet: s
62
60
  });
63
61
  }
64
- })), this.disposeWithMe(commandService.onCommandExecuted((commandInfo) => {
65
- if (commandInfo.id === SetCellEditVisibleOperation.id) {
62
+ })), this.disposeWithMe(r.onCommandExecuted((t) => {
63
+ if (t.id === P.id) {
66
64
  if (!this._eventListend(this.Event.SheetEditStarted) && !this._eventListend(this.Event.SheetEditEnded))
67
65
  return;
68
- const target = this.getCommandSheetTarget(commandInfo);
69
- if (!target)
66
+ const i = this.getCommandSheetTarget(t);
67
+ if (!i)
70
68
  return;
71
- const { workbook, worksheet } = target, editorBridgeService = injector.get(IEditorBridgeService), params = commandInfo.params, { visible, keycode, eventType } = params, loc = editorBridgeService.getEditLocation();
72
- if (visible) {
73
- const eventParams = {
74
- row: loc.row,
75
- column: loc.column,
76
- eventType,
77
- keycode,
78
- workbook,
79
- worksheet,
69
+ const { workbook: o, worksheet: s } = i, c = e.get($), g = t.params, { visible: b, keycode: l, eventType: h } = g, S = c.getEditLocation();
70
+ if (b) {
71
+ const d = {
72
+ row: S.row,
73
+ column: S.column,
74
+ eventType: h,
75
+ keycode: l,
76
+ workbook: o,
77
+ worksheet: s,
80
78
  isZenEditor: !1
81
79
  };
82
- this.fireEvent(this.Event.SheetEditStarted, eventParams);
80
+ this.fireEvent(this.Event.SheetEditStarted, d);
83
81
  } else {
84
- const eventParams = {
85
- row: loc.row,
86
- column: loc.column,
87
- eventType,
88
- keycode,
89
- workbook,
90
- worksheet,
82
+ const d = {
83
+ row: S.row,
84
+ column: S.column,
85
+ eventType: h,
86
+ keycode: l,
87
+ workbook: o,
88
+ worksheet: s,
91
89
  isZenEditor: !1,
92
- isConfirm: keycode !== KeyCode.ESC
90
+ isConfirm: l !== B.ESC
93
91
  };
94
- this.fireEvent(this.Event.SheetEditEnded, eventParams);
92
+ this.fireEvent(this.Event.SheetEditEnded, d);
95
93
  }
96
94
  }
97
- if (commandInfo.id === RichTextEditingMutation.id) {
95
+ if (t.id === ke.id) {
98
96
  if (!this._eventListend(this.Event.SheetEditChanging))
99
97
  return;
100
- const target = this.getCommandSheetTarget(commandInfo);
101
- if (!target)
98
+ const i = this.getCommandSheetTarget(t);
99
+ if (!i)
102
100
  return;
103
- const { workbook, worksheet } = target, editorBridgeService = injector.get(IEditorBridgeService), univerInstanceService = injector.get(IUniverInstanceService), params = commandInfo.params;
104
- if (!editorBridgeService.isVisible().visible) return;
105
- const { unitId } = params;
106
- if (unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
107
- const { row, column } = editorBridgeService.getEditLocation(), eventParams = {
108
- workbook,
109
- worksheet,
110
- row,
111
- column,
112
- value: RichTextValue.create(univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),
101
+ const { workbook: o, worksheet: s } = i, c = e.get($), g = e.get(L), b = t.params;
102
+ if (!c.isVisible().visible) return;
103
+ const { unitId: l } = b;
104
+ if (l === A) {
105
+ const { row: h, column: S } = c.getEditLocation(), d = {
106
+ workbook: o,
107
+ worksheet: s,
108
+ row: h,
109
+ column: S,
110
+ value: q.create(g.getUnit(A).getSnapshot()),
113
111
  isZenEditor: !1
114
112
  };
115
- this.fireEvent(this.Event.SheetEditChanging, eventParams);
113
+ this.fireEvent(this.Event.SheetEditChanging, d);
116
114
  }
117
115
  }
118
- if (commandInfo.id === SetZoomRatioCommand.id) {
116
+ if (t.id === re.id) {
119
117
  if (!this._eventListend(this.Event.SheetZoomChanged))
120
118
  return;
121
- const target = this.getCommandSheetTarget(commandInfo);
122
- if (!target)
119
+ const i = this.getCommandSheetTarget(t);
120
+ if (!i)
123
121
  return;
124
- const { workbook, worksheet } = target;
122
+ const { workbook: o, worksheet: s } = i;
125
123
  this.fireEvent(this.Event.SheetZoomChanged, {
126
- zoom: worksheet.getZoom(),
127
- workbook,
128
- worksheet
124
+ zoom: s.getZoom(),
125
+ workbook: o,
126
+ worksheet: s
129
127
  });
130
128
  }
131
- })), this._initObserverListener(injector);
129
+ })), this._initObserverListener(e);
132
130
  }
133
131
  // eslint-disable-next-line max-lines-per-function
134
- _initObserverListener(injector) {
135
- const unitM = injector.get(IUniverInstanceService).getFocusedUnit(), unitId = unitM == null ? void 0 : unitM.getUnitId(), renderManagerService = injector.get(IRenderManagerService);
136
- if (unitId) {
137
- const lifeCycleService2 = injector.get(LifecycleService), disposable = new DisposableCollection();
138
- this.disposeWithMe(lifeCycleService2.lifecycle$.subscribe((lifecycle) => {
139
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
140
- if (lifecycle < LifecycleStages.Rendered) return;
141
- disposable.dispose();
142
- const hoverManagerService = injector.get(HoverManagerService), dragManagerService = injector.get(DragManagerService);
143
- hoverManagerService && (disposable.add(
144
- (_a = hoverManagerService.currentClickedCell$) == null ? void 0 : _a.pipe(filter((cell) => !!cell)).subscribe((cell) => {
132
+ _initObserverListener(e) {
133
+ const t = e.get(L).getFocusedUnit(), i = t == null ? void 0 : t.getUnitId(), o = e.get(m);
134
+ if (i) {
135
+ const l = e.get(Q), h = new W();
136
+ this.disposeWithMe(l.lifecycle$.subscribe((S) => {
137
+ var k, M, u, p, E, O, F, N, V, Z, K, z, Y, X, J;
138
+ if (S < ee.Rendered) return;
139
+ h.dispose();
140
+ const d = e.get(_), f = e.get(U);
141
+ d && (h.add(
142
+ (k = d.currentClickedCell$) == null ? void 0 : k.pipe(v((n) => !!n)).subscribe((n) => {
145
143
  if (!this._eventListend(this.Event.CellClicked)) return;
146
- const baseParams = this.getSheetTarget(cell.location.unitId, cell.location.subUnitId);
147
- baseParams && this.fireEvent(this.Event.CellClicked, {
148
- ...baseParams,
149
- ...cell,
150
- row: cell.location.row,
151
- column: cell.location.col
144
+ const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
145
+ a && this.fireEvent(this.Event.CellClicked, {
146
+ ...a,
147
+ ...n,
148
+ row: n.location.row,
149
+ column: n.location.col
152
150
  });
153
151
  })
154
- ), disposable.add(
155
- (_b = hoverManagerService.currentRichText$) == null ? void 0 : _b.pipe(filter((cell) => !!cell)).subscribe((cell) => {
152
+ ), h.add(
153
+ (M = d.currentRichText$) == null ? void 0 : M.pipe(v((n) => !!n)).subscribe((n) => {
156
154
  if (!this._eventListend(this.Event.CellHover)) return;
157
- const baseParams = this.getSheetTarget(cell.unitId, cell.subUnitId);
158
- baseParams && this.fireEvent(this.Event.CellHover, {
159
- ...baseParams,
160
- ...cell,
161
- row: cell.row,
162
- column: cell.col
155
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
156
+ a && this.fireEvent(this.Event.CellHover, {
157
+ ...a,
158
+ ...n,
159
+ row: n.row,
160
+ column: n.col
163
161
  });
164
162
  })
165
- ), disposable.add(
166
- (_c = hoverManagerService.currentPointerDownCell$) == null ? void 0 : _c.pipe(filter((cell) => !!cell)).subscribe((cell) => {
163
+ ), h.add(
164
+ (u = d.currentPointerDownCell$) == null ? void 0 : u.pipe(v((n) => !!n)).subscribe((n) => {
167
165
  if (!this._eventListend(this.Event.CellPointerDown)) return;
168
- const baseParams = this.getSheetTarget(cell.unitId, cell.subUnitId);
169
- baseParams && this.fireEvent(this.Event.CellPointerDown, {
170
- ...baseParams,
171
- ...cell,
172
- row: cell.row,
173
- column: cell.col
166
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
167
+ a && this.fireEvent(this.Event.CellPointerDown, {
168
+ ...a,
169
+ ...n,
170
+ row: n.row,
171
+ column: n.col
174
172
  });
175
173
  })
176
- ), disposable.add(
177
- (_d = hoverManagerService.currentPointerUpCell$) == null ? void 0 : _d.pipe(filter((cell) => !!cell)).subscribe((cell) => {
174
+ ), h.add(
175
+ (p = d.currentPointerUpCell$) == null ? void 0 : p.pipe(v((n) => !!n)).subscribe((n) => {
178
176
  if (!this._eventListend(this.Event.CellPointerUp)) return;
179
- const baseParams = this.getSheetTarget(cell.unitId, cell.subUnitId);
180
- baseParams && this.fireEvent(this.Event.CellPointerUp, {
181
- ...baseParams,
182
- ...cell,
183
- row: cell.row,
184
- column: cell.col
177
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
178
+ a && this.fireEvent(this.Event.CellPointerUp, {
179
+ ...a,
180
+ ...n,
181
+ row: n.row,
182
+ column: n.col
185
183
  });
186
184
  })
187
- ), disposable.add(
188
- (_e = hoverManagerService.currentCellPosWithEvent$) == null ? void 0 : _e.pipe(filter((cell) => !!cell)).subscribe((cell) => {
185
+ ), h.add(
186
+ (E = d.currentCellPosWithEvent$) == null ? void 0 : E.pipe(v((n) => !!n)).subscribe((n) => {
189
187
  if (!this._eventListend(this.Event.CellPointerMove)) return;
190
- const baseParams = this.getSheetTarget(cell.unitId, cell.subUnitId);
191
- baseParams && this.fireEvent(this.Event.CellPointerMove, {
192
- ...baseParams,
193
- ...cell,
194
- row: cell.row,
195
- column: cell.col
188
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
189
+ a && this.fireEvent(this.Event.CellPointerMove, {
190
+ ...a,
191
+ ...n,
192
+ row: n.row,
193
+ column: n.col
196
194
  });
197
195
  })
198
- ), disposable.add(
199
- (_f = dragManagerService.currentCell$) == null ? void 0 : _f.pipe(filter((cell) => !!cell)).subscribe((cell) => {
196
+ ), h.add(
197
+ (O = f.currentCell$) == null ? void 0 : O.pipe(v((n) => !!n)).subscribe((n) => {
200
198
  if (!this._eventListend(this.Event.DragOver)) return;
201
- const baseParams = this.getSheetTarget(cell.location.unitId, cell.location.subUnitId);
202
- baseParams && this.fireEvent(this.Event.DragOver, {
203
- ...baseParams,
204
- ...cell,
205
- row: cell.location.row,
206
- column: cell.location.col
199
+ const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
200
+ a && this.fireEvent(this.Event.DragOver, {
201
+ ...a,
202
+ ...n,
203
+ row: n.location.row,
204
+ column: n.location.col
207
205
  });
208
206
  })
209
- ), disposable.add(
210
- (_g = dragManagerService.endCell$) == null ? void 0 : _g.pipe(filter((cell) => !!cell)).subscribe((cell) => {
207
+ ), h.add(
208
+ (F = f.endCell$) == null ? void 0 : F.pipe(v((n) => !!n)).subscribe((n) => {
211
209
  if (!this._eventListend(this.Event.Drop)) return;
212
- const baseParams = this.getSheetTarget(cell.location.unitId, cell.location.subUnitId);
213
- baseParams && this.fireEvent(this.Event.Drop, {
214
- ...baseParams,
215
- ...cell,
216
- row: cell.location.row,
217
- column: cell.location.col
210
+ const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
211
+ a && this.fireEvent(this.Event.Drop, {
212
+ ...a,
213
+ ...n,
214
+ row: n.location.row,
215
+ column: n.location.col
218
216
  });
219
217
  })
220
- ), disposable.add(
221
- (_h = hoverManagerService.currentRowHeaderClick$) == null ? void 0 : _h.pipe(filter((header) => !!header)).subscribe((header) => {
218
+ ), h.add(
219
+ (N = d.currentRowHeaderClick$) == null ? void 0 : N.pipe(v((n) => !!n)).subscribe((n) => {
222
220
  if (!this._eventListend(this.Event.RowHeaderClick)) return;
223
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
224
- baseParams && this.fireEvent(this.Event.RowHeaderClick, {
225
- ...baseParams,
226
- row: header.index
221
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
222
+ a && this.fireEvent(this.Event.RowHeaderClick, {
223
+ ...a,
224
+ row: n.index
227
225
  });
228
226
  })
229
- ), disposable.add(
230
- (_i = hoverManagerService.currentRowHeaderPointerDown$) == null ? void 0 : _i.pipe(filter((header) => !!header)).subscribe((header) => {
227
+ ), h.add(
228
+ (V = d.currentRowHeaderPointerDown$) == null ? void 0 : V.pipe(v((n) => !!n)).subscribe((n) => {
231
229
  if (!this._eventListend(this.Event.RowHeaderPointerDown)) return;
232
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
233
- baseParams && this.fireEvent(this.Event.RowHeaderPointerDown, {
234
- ...baseParams,
235
- row: header.index
230
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
231
+ a && this.fireEvent(this.Event.RowHeaderPointerDown, {
232
+ ...a,
233
+ row: n.index
236
234
  });
237
235
  })
238
- ), disposable.add(
239
- (_j = hoverManagerService.currentRowHeaderPointerUp$) == null ? void 0 : _j.pipe(filter((header) => !!header)).subscribe((header) => {
236
+ ), h.add(
237
+ (Z = d.currentRowHeaderPointerUp$) == null ? void 0 : Z.pipe(v((n) => !!n)).subscribe((n) => {
240
238
  if (!this._eventListend(this.Event.RowHeaderPointerUp)) return;
241
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
242
- baseParams && this.fireEvent(this.Event.RowHeaderPointerUp, {
243
- ...baseParams,
244
- row: header.index
239
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
240
+ a && this.fireEvent(this.Event.RowHeaderPointerUp, {
241
+ ...a,
242
+ row: n.index
245
243
  });
246
244
  })
247
- ), disposable.add(
248
- (_k = hoverManagerService.currentHoveredRowHeader$) == null ? void 0 : _k.pipe(filter((header) => !!header)).subscribe((header) => {
245
+ ), h.add(
246
+ (K = d.currentHoveredRowHeader$) == null ? void 0 : K.pipe(v((n) => !!n)).subscribe((n) => {
249
247
  if (!this._eventListend(this.Event.RowHeaderHover)) return;
250
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
251
- baseParams && this.fireEvent(this.Event.RowHeaderHover, {
252
- ...baseParams,
253
- row: header.index
248
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
249
+ a && this.fireEvent(this.Event.RowHeaderHover, {
250
+ ...a,
251
+ row: n.index
254
252
  });
255
253
  })
256
- ), disposable.add(
257
- (_l = hoverManagerService.currentColHeaderClick$) == null ? void 0 : _l.pipe(filter((header) => !!header)).subscribe((header) => {
254
+ ), h.add(
255
+ (z = d.currentColHeaderClick$) == null ? void 0 : z.pipe(v((n) => !!n)).subscribe((n) => {
258
256
  if (!this._eventListend(this.Event.ColumnHeaderClick)) return;
259
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
260
- baseParams && this.fireEvent(this.Event.ColumnHeaderClick, {
261
- ...baseParams,
262
- column: header.index
257
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
258
+ a && this.fireEvent(this.Event.ColumnHeaderClick, {
259
+ ...a,
260
+ column: n.index
263
261
  });
264
262
  })
265
- ), disposable.add(
266
- (_m = hoverManagerService.currentColHeaderPointerDown$) == null ? void 0 : _m.pipe(filter((header) => !!header)).subscribe((header) => {
263
+ ), h.add(
264
+ (Y = d.currentColHeaderPointerDown$) == null ? void 0 : Y.pipe(v((n) => !!n)).subscribe((n) => {
267
265
  if (!this._eventListend(this.Event.ColumnHeaderPointerDown)) return;
268
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
269
- baseParams && this.fireEvent(this.Event.ColumnHeaderPointerDown, {
270
- ...baseParams,
271
- column: header.index
266
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
267
+ a && this.fireEvent(this.Event.ColumnHeaderPointerDown, {
268
+ ...a,
269
+ column: n.index
272
270
  });
273
271
  })
274
- ), disposable.add(
275
- (_n = hoverManagerService.currentColHeaderPointerUp$) == null ? void 0 : _n.pipe(filter((header) => !!header)).subscribe((header) => {
272
+ ), h.add(
273
+ (X = d.currentColHeaderPointerUp$) == null ? void 0 : X.pipe(v((n) => !!n)).subscribe((n) => {
276
274
  if (!this._eventListend(this.Event.ColumnHeaderPointerUp)) return;
277
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
278
- baseParams && this.fireEvent(this.Event.ColumnHeaderPointerUp, {
279
- ...baseParams,
280
- column: header.index
275
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
276
+ a && this.fireEvent(this.Event.ColumnHeaderPointerUp, {
277
+ ...a,
278
+ column: n.index
281
279
  });
282
280
  })
283
- ), disposable.add(
284
- (_o = hoverManagerService.currentHoveredColHeader$) == null ? void 0 : _o.pipe(filter((header) => !!header)).subscribe((header) => {
281
+ ), h.add(
282
+ (J = d.currentHoveredColHeader$) == null ? void 0 : J.pipe(v((n) => !!n)).subscribe((n) => {
285
283
  if (!this._eventListend(this.Event.ColumnHeaderHover)) return;
286
- const baseParams = this.getSheetTarget(header.unitId, header.subUnitId);
287
- baseParams && this.fireEvent(this.Event.ColumnHeaderHover, {
288
- ...baseParams,
289
- column: header.index
284
+ const a = this.getSheetTarget(n.unitId, n.subUnitId);
285
+ a && this.fireEvent(this.Event.ColumnHeaderHover, {
286
+ ...a,
287
+ column: n.index
290
288
  });
291
289
  })
292
290
  ));
293
- })), this.disposeWithMe(disposable);
291
+ })), this.disposeWithMe(h);
294
292
  }
295
- const unitMap = /* @__PURE__ */ new Map();
296
- let sheetRenderUnit;
297
- const lifeCycleService = injector.get(LifecycleService), combined$ = combineLatest([
298
- renderManagerService.created$,
299
- lifeCycleService.lifecycle$
293
+ const s = /* @__PURE__ */ new Map();
294
+ let c;
295
+ const g = e.get(Q), b = Oe([
296
+ o.created$,
297
+ g.lifecycle$
300
298
  ]);
301
- this.disposeWithMe(combined$.subscribe(([created, lifecycle]) => {
302
- var _a;
303
- if (created.type === UniverInstanceType.UNIVER_SHEET && (sheetRenderUnit = created), lifecycle <= LifecycleStages.Rendered) return;
304
- const disposable = new DisposableCollection();
305
- if (!sheetRenderUnit) return;
306
- const workbook = this.getWorkbook(sheetRenderUnit.unitId);
307
- if (!workbook) return;
308
- unitMap.get(sheetRenderUnit.unitId) && ((_a = unitMap.get(sheetRenderUnit.unitId)) == null || _a.dispose()), unitMap.set(sheetRenderUnit.unitId, disposable);
309
- const scrollManagerService = sheetRenderUnit.with(SheetScrollManagerService);
310
- disposable.add(scrollManagerService.validViewportScrollInfo$.subscribe((params) => {
311
- params && this._eventListend(this.Event.Scroll) && this.fireEvent(this.Event.Scroll, {
312
- workbook,
313
- worksheet: workbook.getActiveSheet(),
314
- ...params
299
+ this.disposeWithMe(b.subscribe(([l, h]) => {
300
+ var M;
301
+ if (l.type === fe.UNIVER_SHEET && (c = l), h <= ee.Rendered) return;
302
+ const S = new W();
303
+ if (!c) return;
304
+ const d = this.getWorkbook(c.unitId);
305
+ if (!d) return;
306
+ s.get(c.unitId) && ((M = s.get(c.unitId)) == null || M.dispose()), s.set(c.unitId, S);
307
+ const f = c.with(T);
308
+ S.add(f.validViewportScrollInfo$.subscribe((u) => {
309
+ u && this._eventListend(this.Event.Scroll) && this.fireEvent(this.Event.Scroll, {
310
+ workbook: d,
311
+ worksheet: d.getActiveSheet(),
312
+ ...u
315
313
  });
316
314
  }));
317
- const selectionService = sheetRenderUnit.with(SheetsSelectionsService);
318
- disposable.add(selectionService.selectionMoveStart$.subscribe((selections) => {
319
- var _a2;
315
+ const k = c.with(Me);
316
+ S.add(k.selectionMoveStart$.subscribe((u) => {
317
+ var p;
320
318
  this._eventListend(this.Event.SelectionMoveStart) && this.fireEvent(this.Event.SelectionMoveStart, {
321
- workbook,
322
- worksheet: workbook.getActiveSheet(),
323
- selections: (_a2 = selections == null ? void 0 : selections.map((s) => s.range)) != null ? _a2 : []
319
+ workbook: d,
320
+ worksheet: d.getActiveSheet(),
321
+ selections: (p = u == null ? void 0 : u.map((E) => E.range)) != null ? p : []
324
322
  });
325
- })), disposable.add(selectionService.selectionMoving$.subscribe((selections) => {
326
- var _a2;
323
+ })), S.add(k.selectionMoving$.subscribe((u) => {
324
+ var p;
327
325
  this._eventListend(this.Event.SelectionMoving) && this.fireEvent(this.Event.SelectionMoving, {
328
- workbook,
329
- worksheet: workbook.getActiveSheet(),
330
- selections: (_a2 = selections == null ? void 0 : selections.map((s) => s.range)) != null ? _a2 : []
326
+ workbook: d,
327
+ worksheet: d.getActiveSheet(),
328
+ selections: (p = u == null ? void 0 : u.map((E) => E.range)) != null ? p : []
331
329
  });
332
- })), disposable.add(selectionService.selectionMoveEnd$.subscribe((selections) => {
333
- var _a2;
330
+ })), S.add(k.selectionMoveEnd$.subscribe((u) => {
331
+ var p;
334
332
  this._eventListend(this.Event.SelectionMoveEnd) && this.fireEvent(this.Event.SelectionMoveEnd, {
335
- workbook,
336
- worksheet: workbook.getActiveSheet(),
337
- selections: (_a2 = selections == null ? void 0 : selections.map((s) => s.range)) != null ? _a2 : []
333
+ workbook: d,
334
+ worksheet: d.getActiveSheet(),
335
+ selections: (p = u == null ? void 0 : u.map((E) => E.range)) != null ? p : []
338
336
  });
339
- })), disposable.add(selectionService.selectionChanged$.subscribe((selections) => {
340
- var _a2;
337
+ })), S.add(k.selectionChanged$.subscribe((u) => {
338
+ var p;
341
339
  this._eventListend(this.Event.SelectionChanged) && this.fireEvent(this.Event.SelectionChanged, {
342
- workbook,
343
- worksheet: workbook.getActiveSheet(),
344
- selections: (_a2 = selections == null ? void 0 : selections.map((s) => s.range)) != null ? _a2 : []
340
+ workbook: d,
341
+ worksheet: d.getActiveSheet(),
342
+ selections: (p = u == null ? void 0 : u.map((E) => E.range)) != null ? p : []
345
343
  });
346
- })), sheetRenderUnit = null, this.disposeWithMe(disposable);
347
- })), this.disposeWithMe(renderManagerService.disposed$.subscribe((unitId2) => {
348
- var _a;
349
- (_a = unitMap.get(unitId2)) == null || _a.dispose(), unitMap.delete(unitId2);
344
+ })), c = null, this.disposeWithMe(S);
345
+ })), this.disposeWithMe(o.disposed$.subscribe((l) => {
346
+ var h;
347
+ (h = s.get(l)) == null || h.dispose(), s.delete(l);
350
348
  })), this.disposeWithMe(() => {
351
- unitMap.forEach((disposable) => {
352
- disposable.dispose();
349
+ s.forEach((l) => {
350
+ l.dispose();
353
351
  });
354
352
  });
355
353
  }
356
- /**
357
- * @ignore
358
- */
359
- _initialize(injector) {
360
- this._initSheetUIEvent(injector);
361
- const commandService = injector.get(ICommandService);
362
- this.disposeWithMe(commandService.beforeCommandExecuted((commandInfo) => {
363
- switch (commandInfo.id) {
364
- case CopyCommand.id:
365
- case CutCommand.id:
354
+ _initialize(e) {
355
+ this._initSheetUIEvent(e);
356
+ const r = e.get(I);
357
+ this.disposeWithMe(r.beforeCommandExecuted((t) => {
358
+ switch (t.id) {
359
+ case se.id:
360
+ case oe.id:
366
361
  this._beforeClipboardChange();
367
362
  break;
368
- case SheetPasteShortKeyCommand.id:
369
- this._beforeClipboardPaste(commandInfo.params);
363
+ case ne.id:
364
+ this._beforeClipboardPaste(t.params);
370
365
  break;
371
366
  }
372
- })), this.disposeWithMe(commandService.onCommandExecuted((commandInfo) => {
373
- if (COMMAND_LISTENER_SKELETON_CHANGE.indexOf(commandInfo.id) > -1) {
367
+ })), this.disposeWithMe(r.onCommandExecuted((t) => {
368
+ if (Re.indexOf(t.id) > -1) {
374
369
  if (!this._eventListend(this.Event.SheetSkeletonChanged)) return;
375
- const sheet = this.getActiveSheet();
376
- if (!sheet) return;
377
- const ranges = getSkeletonChangedEffectedRange(commandInfo).map((range) => {
378
- var _a, _b;
379
- return (_b = (_a = this.getWorkbook(range.unitId)) == null ? void 0 : _a.getSheetBySheetId(range.subUnitId)) == null ? void 0 : _b.getRange(range.range);
370
+ const i = this.getActiveSheet();
371
+ if (!i) return;
372
+ const o = ye(t).map((s) => {
373
+ var c, g;
374
+ return (g = (c = this.getWorkbook(s.unitId)) == null ? void 0 : c.getSheetBySheetId(s.subUnitId)) == null ? void 0 : g.getRange(s.range);
380
375
  }).filter(Boolean);
381
- if (!ranges.length) return;
376
+ if (!o.length) return;
382
377
  this.fireEvent(this.Event.SheetSkeletonChanged, {
383
- workbook: sheet.workbook,
384
- worksheet: sheet.worksheet,
385
- payload: commandInfo,
386
- skeleton: sheet.worksheet.getSkeleton(),
387
- effectedRanges: ranges
378
+ workbook: i.workbook,
379
+ worksheet: i.worksheet,
380
+ payload: t,
381
+ skeleton: i.worksheet.getSkeleton(),
382
+ effectedRanges: o
388
383
  });
389
384
  return;
390
385
  }
391
- switch (commandInfo.id) {
392
- case CopyCommand.id:
393
- case CutCommand.id:
386
+ switch (t.id) {
387
+ case se.id:
388
+ case oe.id:
394
389
  this._clipboardChanged();
395
390
  break;
396
- case SheetPasteShortKeyCommand.id:
391
+ case ne.id:
397
392
  this._clipboardPaste();
398
393
  break;
399
- case PasteCommand.id:
394
+ case ae.id:
400
395
  this._clipboardPasteAsync();
401
396
  break;
402
397
  }
403
- })), this.disposeWithMe(commandService.beforeCommandExecuted(async (commandInfo) => {
404
- switch (commandInfo.id) {
405
- case PasteCommand.id:
398
+ })), this.disposeWithMe(r.beforeCommandExecuted(async (t) => {
399
+ switch (t.id) {
400
+ case ae.id:
406
401
  await this._beforeClipboardPasteAsync();
407
402
  break;
408
403
  }
409
404
  }));
410
405
  }
411
406
  _generateClipboardCopyParam() {
412
- const workbook = this.getActiveWorkbook(), worksheet = workbook == null ? void 0 : workbook.getActiveSheet(), range = workbook == null ? void 0 : workbook.getActiveRange();
413
- if (!workbook || !worksheet || !range)
407
+ const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet(), t = e == null ? void 0 : e.getActiveRange();
408
+ if (!e || !r || !t)
414
409
  return;
415
- const content = this._injector.get(ISheetClipboardService).generateCopyContent(workbook.getId(), worksheet.getSheetId(), range.getRange());
416
- if (!content)
410
+ const o = this._injector.get(Se).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
411
+ if (!o)
417
412
  return;
418
- const { html, plain } = content;
413
+ const { html: s, plain: c } = o;
419
414
  return {
420
- workbook,
421
- worksheet,
422
- text: plain,
423
- html,
424
- fromSheet: worksheet,
425
- fromRange: range
415
+ workbook: e,
416
+ worksheet: r,
417
+ text: c,
418
+ html: s,
419
+ fromSheet: r,
420
+ fromRange: t
426
421
  };
427
422
  }
428
423
  _beforeClipboardChange() {
429
424
  if (!this.hasEventCallback(this.Event.BeforeClipboardChange))
430
425
  return;
431
- const eventParams = this._generateClipboardCopyParam();
432
- if (eventParams && (this.fireEvent(this.Event.BeforeClipboardChange, eventParams), eventParams.cancel))
426
+ const e = this._generateClipboardCopyParam();
427
+ if (e && (this.fireEvent(this.Event.BeforeClipboardChange, e), e.cancel))
433
428
  throw new Error("Before clipboard change is canceled");
434
429
  }
435
430
  _clipboardChanged() {
436
431
  if (!this.hasEventCallback(this.Event.ClipboardChanged))
437
432
  return;
438
- const eventParams = this._generateClipboardCopyParam();
439
- if (eventParams && (this.fireEvent(this.Event.ClipboardChanged, eventParams), eventParams.cancel))
433
+ const e = this._generateClipboardCopyParam();
434
+ if (e && (this.fireEvent(this.Event.ClipboardChanged, e), e.cancel))
440
435
  throw new Error("Clipboard changed is canceled");
441
436
  }
442
- _generateClipboardPasteParam(params) {
443
- if (!params)
437
+ _generateClipboardPasteParam(e) {
438
+ if (!e)
444
439
  return;
445
- const { htmlContent, textContent } = params, workbook = this.getActiveWorkbook(), worksheet = workbook == null ? void 0 : workbook.getActiveSheet();
446
- return !workbook || !worksheet ? void 0 : {
447
- workbook,
448
- worksheet,
449
- text: textContent,
450
- html: htmlContent
440
+ const { htmlContent: r, textContent: t } = e, i = this.getActiveWorkbook(), o = i == null ? void 0 : i.getActiveSheet();
441
+ return !i || !o ? void 0 : {
442
+ workbook: i,
443
+ worksheet: o,
444
+ text: t,
445
+ html: r
451
446
  };
452
447
  }
453
448
  async _generateClipboardPasteParamAsync() {
454
- const workbook = this.getActiveWorkbook(), worksheet = workbook == null ? void 0 : workbook.getActiveSheet();
455
- if (!workbook || !worksheet)
449
+ const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet();
450
+ if (!e || !r)
456
451
  return;
457
- const item = (await this._injector.get(IClipboardInterfaceService).read())[0];
458
- let eventParams;
459
- if (item) {
460
- const types = item.types, text = types.indexOf(PLAIN_TEXT_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "", html = types.indexOf(HTML_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(HTML_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "";
461
- eventParams = {
462
- workbook,
463
- worksheet,
464
- text,
465
- html
452
+ const o = (await this._injector.get($e).read())[0];
453
+ let s;
454
+ if (o) {
455
+ const c = o.types, g = c.indexOf(ce) !== -1 ? await o.getType(ce).then((l) => l && l.text()) : "", b = c.indexOf(de) !== -1 ? await o.getType(de).then((l) => l && l.text()) : "";
456
+ s = {
457
+ workbook: e,
458
+ worksheet: r,
459
+ text: g,
460
+ html: b
466
461
  };
467
462
  }
468
- return eventParams;
463
+ return s;
469
464
  }
470
- _beforeClipboardPaste(params) {
465
+ _beforeClipboardPaste(e) {
471
466
  if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
472
467
  return;
473
- const eventParams = this._generateClipboardPasteParam(params);
474
- if (eventParams && (this.fireEvent(this.Event.BeforeClipboardPaste, eventParams), eventParams.cancel))
468
+ const r = this._generateClipboardPasteParam(e);
469
+ if (r && (this.fireEvent(this.Event.BeforeClipboardPaste, r), r.cancel))
475
470
  throw new Error("Before clipboard paste is canceled");
476
471
  }
477
- _clipboardPaste(params) {
472
+ _clipboardPaste(e) {
478
473
  if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
479
474
  return;
480
- const eventParams = this._generateClipboardPasteParam(params);
481
- if (eventParams && (this.fireEvent(this.Event.BeforeClipboardPaste, eventParams), eventParams.cancel))
475
+ const r = this._generateClipboardPasteParam(e);
476
+ if (r && (this.fireEvent(this.Event.BeforeClipboardPaste, r), r.cancel))
482
477
  throw new Error("Clipboard pasted is canceled");
483
478
  }
484
479
  async _beforeClipboardPasteAsync() {
485
480
  if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
486
481
  return;
487
- if (!supportClipboardAPI()) {
488
- this._injector.get(ILogService).warn("[Facade]: The navigator object only supports the browser environment");
482
+ if (!he()) {
483
+ this._injector.get(D).warn("[Facade]: The navigator object only supports the browser environment");
489
484
  return;
490
485
  }
491
- const eventParams = await this._generateClipboardPasteParamAsync();
492
- if (eventParams && (this.fireEvent(this.Event.BeforeClipboardPaste, eventParams), eventParams.cancel))
486
+ const e = await this._generateClipboardPasteParamAsync();
487
+ if (e && (this.fireEvent(this.Event.BeforeClipboardPaste, e), e.cancel))
493
488
  throw new Error("Before clipboard paste is canceled");
494
489
  }
495
490
  async _clipboardPasteAsync() {
496
491
  if (!this.hasEventCallback(this.Event.ClipboardPasted))
497
492
  return;
498
- if (!supportClipboardAPI()) {
499
- this._injector.get(ILogService).warn("[Facade]: The navigator object only supports the browser environment");
493
+ if (!he()) {
494
+ this._injector.get(D).warn("[Facade]: The navigator object only supports the browser environment");
500
495
  return;
501
496
  }
502
- const eventParams = await this._generateClipboardPasteParamAsync();
503
- if (eventParams && (this.fireEvent(this.Event.ClipboardPasted, eventParams), eventParams.cancel))
497
+ const e = await this._generateClipboardPasteParamAsync();
498
+ if (e && (this.fireEvent(this.Event.ClipboardPasted, e), e.cancel))
504
499
  throw new Error("Clipboard pasted is canceled");
505
500
  }
506
- customizeColumnHeader(cfg) {
507
- var _a, _b;
508
- const wb = this.getActiveWorkbook();
509
- if (!wb) {
501
+ customizeColumnHeader(e) {
502
+ const r = this.getActiveWorkbook();
503
+ if (!r) {
510
504
  console.error("WorkBook not exist");
511
505
  return;
512
506
  }
513
- const unitId = wb == null ? void 0 : wb.getId(), renderManagerService = this._injector.get(IRenderManagerService), activeSheet = wb.getActiveSheet(), subUnitId = activeSheet.getSheetId(), render = renderManagerService.getRenderById(unitId);
514
- render && ((_a = cfg.headerStyle) != null && _a.size) && (render.with(SheetSkeletonManagerService).setColumnHeaderSize(subUnitId, render, (_b = cfg.headerStyle) == null ? void 0 : _b.size), activeSheet == null || activeSheet.refreshCanvas()), this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.COLUMN).setCustomHeader(cfg), activeSheet == null || activeSheet.refreshCanvas();
507
+ const t = r == null ? void 0 : r.getId();
508
+ this._getSheetRenderComponent(t, R.COLUMN).setCustomHeader(e);
515
509
  }
516
- customizeRowHeader(cfg) {
517
- const wb = this.getActiveWorkbook();
518
- if (!wb) {
510
+ customizeRowHeader(e) {
511
+ const r = this.getActiveWorkbook();
512
+ if (!r) {
519
513
  console.error("WorkBook not exist");
520
514
  return;
521
515
  }
522
- const unitId = wb == null ? void 0 : wb.getId();
523
- this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.ROW).setCustomHeader(cfg);
516
+ const t = r == null ? void 0 : r.getId();
517
+ this._getSheetRenderComponent(t, R.ROW).setCustomHeader(e);
524
518
  }
525
- registerSheetRowHeaderExtension(unitId, ...extensions) {
526
- const sheetComponent = this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.ROW), registerDisposable = sheetComponent.register(...extensions);
527
- return toDisposable(() => {
528
- registerDisposable.dispose(), sheetComponent.makeDirty(!0);
519
+ registerSheetRowHeaderExtension(e, ...r) {
520
+ const t = this._getSheetRenderComponent(e, R.ROW), i = t.register(...r);
521
+ return C(() => {
522
+ i.dispose(), t.makeDirty(!0);
529
523
  });
530
524
  }
531
- registerSheetColumnHeaderExtension(unitId, ...extensions) {
532
- const sheetComponent = this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.COLUMN), registerDisposable = sheetComponent.register(...extensions);
533
- return toDisposable(() => {
534
- registerDisposable.dispose(), sheetComponent.makeDirty(!0);
525
+ registerSheetColumnHeaderExtension(e, ...r) {
526
+ const t = this._getSheetRenderComponent(e, R.COLUMN), i = t.register(...r);
527
+ return C(() => {
528
+ i.dispose(), t.makeDirty(!0);
535
529
  });
536
530
  }
537
- registerSheetMainExtension(unitId, ...extensions) {
538
- const sheetComponent = this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.MAIN), registerDisposable = sheetComponent.register(...extensions);
539
- return toDisposable(() => {
540
- registerDisposable.dispose(), sheetComponent.makeDirty(!0);
531
+ registerSheetMainExtension(e, ...r) {
532
+ const t = this._getSheetRenderComponent(e, R.MAIN), i = t.register(...r);
533
+ return C(() => {
534
+ i.dispose(), t.makeDirty(!0);
541
535
  });
542
536
  }
543
537
  /**
@@ -547,119 +541,117 @@ const _FUniverSheetsUIMixin = class _FUniverSheetsUIMixin extends FUniver {
547
541
  * @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
548
542
  * @returns {Nullable<RenderComponentType>} The render component.
549
543
  */
550
- _getSheetRenderComponent(unitId, viewKey) {
551
- const render = this._injector.get(IRenderManagerService).getRenderById(unitId);
552
- if (!render)
553
- throw new Error(`Render Unit with unitId ${unitId} not found`);
554
- const { components } = render, renderComponent = components.get(viewKey);
555
- if (!renderComponent)
544
+ _getSheetRenderComponent(e, r) {
545
+ const i = this._injector.get(m).getRenderById(e);
546
+ if (!i)
547
+ throw new Error(`Render Unit with unitId ${e} not found`);
548
+ const { components: o } = i, s = o.get(r);
549
+ if (!s)
556
550
  throw new Error("Render component not found");
557
- return renderComponent;
551
+ return s;
558
552
  }
559
553
  /**
560
554
  * Get sheet hooks.
561
555
  * @returns {FSheetHooks} FSheetHooks instance
562
556
  */
563
557
  getSheetHooks() {
564
- return this._injector.createInstance(FSheetHooks);
558
+ return this._injector.createInstance(j);
565
559
  }
566
- };
567
- __name(_FUniverSheetsUIMixin, "FUniverSheetsUIMixin");
568
- let FUniverSheetsUIMixin = _FUniverSheetsUIMixin;
569
- FUniver.extend(FUniverSheetsUIMixin);
570
- const _FWorkbookSheetsUIMixin = class _FWorkbookSheetsUIMixin extends FWorkbook {
571
- openSiderbar(params) {
572
- return this._logDeprecation("openSiderbar"), this._injector.get(ISidebarService).open(params);
573
- }
574
- openDialog(dialog) {
560
+ }
561
+ ue.extend(Fe);
562
+ class Ne extends Ce {
563
+ openSiderbar(e) {
564
+ return this._logDeprecation("openSiderbar"), this._injector.get(We).open(e);
565
+ }
566
+ openDialog(e) {
575
567
  this._logDeprecation("openDialog");
576
- const disposable = this._injector.get(IDialogService).open({
577
- ...dialog,
578
- onClose: /* @__PURE__ */ __name(() => {
579
- disposable.dispose();
580
- }, "onClose")
568
+ const t = this._injector.get(je).open({
569
+ ...e,
570
+ onClose: () => {
571
+ t.dispose();
572
+ }
581
573
  });
582
- return disposable;
574
+ return t;
583
575
  }
584
- _logDeprecation(name) {
585
- this._injector.get(ILogService).warn("[FWorkbook]", `${name} is deprecated. Please use the function of the same name on "FUniver".`);
576
+ _logDeprecation(e) {
577
+ this._injector.get(D).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
586
578
  }
587
- generateCellParams(cell) {
588
- const worksheet = this.getActiveSheet();
579
+ generateCellParams(e) {
580
+ const r = this.getActiveSheet();
589
581
  return {
590
- row: cell.row,
591
- column: cell.col,
582
+ row: e.row,
583
+ column: e.col,
592
584
  workbook: this,
593
- worksheet
585
+ worksheet: r
594
586
  };
595
587
  }
596
- onCellClick(callback) {
597
- const hoverManagerService = this._injector.get(HoverManagerService);
598
- return toDisposable(
599
- hoverManagerService.currentClickedCell$.pipe(filter((cell) => !!cell)).subscribe((cell) => {
600
- callback(cell);
588
+ onCellClick(e) {
589
+ const r = this._injector.get(_);
590
+ return C(
591
+ r.currentClickedCell$.pipe(v((t) => !!t)).subscribe((t) => {
592
+ e(t);
601
593
  })
602
594
  );
603
595
  }
604
- onCellHover(callback) {
605
- const hoverManagerService = this._injector.get(HoverManagerService);
606
- return toDisposable(
607
- hoverManagerService.currentRichText$.pipe(filter((cell) => !!cell)).subscribe(callback)
596
+ onCellHover(e) {
597
+ const r = this._injector.get(_);
598
+ return C(
599
+ r.currentRichText$.pipe(v((t) => !!t)).subscribe(e)
608
600
  );
609
601
  }
610
- onCellPointerDown(callback) {
611
- const hoverManagerService = this._injector.get(HoverManagerService);
612
- return toDisposable(
613
- hoverManagerService.currentPointerDownCell$.subscribe(callback)
602
+ onCellPointerDown(e) {
603
+ const r = this._injector.get(_);
604
+ return C(
605
+ r.currentPointerDownCell$.subscribe(e)
614
606
  );
615
607
  }
616
- onCellPointerUp(callback) {
617
- const hoverManagerService = this._injector.get(HoverManagerService);
618
- return toDisposable(
619
- hoverManagerService.currentPointerUpCell$.subscribe(callback)
608
+ onCellPointerUp(e) {
609
+ const r = this._injector.get(_);
610
+ return C(
611
+ r.currentPointerUpCell$.subscribe(e)
620
612
  );
621
613
  }
622
- onCellPointerMove(callback) {
623
- const hoverManagerService = this._injector.get(HoverManagerService);
624
- return toDisposable(
625
- hoverManagerService.currentCellPosWithEvent$.pipe(filter((cell) => !!cell)).subscribe((cell) => {
626
- callback(cell, cell.event);
614
+ onCellPointerMove(e) {
615
+ const r = this._injector.get(_);
616
+ return C(
617
+ r.currentCellPosWithEvent$.pipe(v((t) => !!t)).subscribe((t) => {
618
+ e(t, t.event);
627
619
  })
628
620
  );
629
621
  }
630
- onDragOver(callback) {
631
- const dragManagerService = this._injector.get(DragManagerService);
632
- return toDisposable(
633
- dragManagerService.currentCell$.pipe(filter((cell) => !!cell)).subscribe((cell) => {
634
- callback(cell);
622
+ onDragOver(e) {
623
+ const r = this._injector.get(U);
624
+ return C(
625
+ r.currentCell$.pipe(v((t) => !!t)).subscribe((t) => {
626
+ e(t);
635
627
  })
636
628
  );
637
629
  }
638
- onDrop(callback) {
639
- const dragManagerService = this._injector.get(DragManagerService);
640
- return toDisposable(
641
- dragManagerService.endCell$.pipe(filter((cell) => !!cell)).subscribe((cell) => {
642
- callback(cell);
630
+ onDrop(e) {
631
+ const r = this._injector.get(U);
632
+ return C(
633
+ r.endCell$.pipe(v((t) => !!t)).subscribe((t) => {
634
+ e(t);
643
635
  })
644
636
  );
645
637
  }
646
638
  startEditing() {
647
- return this._injector.get(ICommandService).syncExecuteCommand(SetCellEditVisibleOperation.id, {
648
- eventType: DeviceInputEventType.Dblclick,
639
+ return this._injector.get(I).syncExecuteCommand(P.id, {
640
+ eventType: te.Dblclick,
649
641
  unitId: this._workbook.getUnitId(),
650
642
  visible: !0
651
643
  });
652
644
  }
653
- async endEditing(save) {
654
- return this._injector.get(ICommandService).syncExecuteCommand(SetCellEditVisibleOperation.id, {
655
- eventType: DeviceInputEventType.Keyboard,
656
- keycode: save ? KeyCode.ENTER : KeyCode.ESC,
645
+ async endEditing(e) {
646
+ return this._injector.get(I).syncExecuteCommand(P.id, {
647
+ eventType: te.Keyboard,
648
+ keycode: e ? B.ENTER : B.ESC,
657
649
  visible: !1,
658
650
  unitId: this._workbook.getUnitId()
659
- }), await awaitTime(0), !0;
651
+ }), await Ee(0), !0;
660
652
  }
661
- endEditingAsync(save = !0) {
662
- return this.endEditing(save);
653
+ endEditingAsync(e = !0) {
654
+ return this.endEditing(e);
663
655
  }
664
656
  /**
665
657
  * Get scroll state of specified sheet.
@@ -670,169 +662,161 @@ const _FWorkbookSheetsUIMixin = class _FWorkbookSheetsUIMixin extends FWorkbook
670
662
  * univerAPI.getActiveWorkbook().getScrollStateBySheetId($sheetId)
671
663
  * ```
672
664
  */
673
- getScrollStateBySheetId(sheetId) {
674
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
675
- return render ? render.with(SheetScrollManagerService).getScrollStateByParam({ unitId, sheetId }) : null;
665
+ getScrollStateBySheetId(e) {
666
+ const r = this._workbook.getUnitId(), i = this._injector.get(m).getRenderById(r);
667
+ return i ? i.with(T).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
676
668
  }
677
669
  disableSelection() {
678
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
679
- return render && render.with(ISheetSelectionRenderService).disableSelection(), this;
670
+ const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
671
+ return t && t.with(H).disableSelection(), this;
680
672
  }
681
673
  enableSelection() {
682
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
683
- return render && render.with(ISheetSelectionRenderService).enableSelection(), this;
674
+ const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
675
+ return t && t.with(H).enableSelection(), this;
684
676
  }
685
677
  transparentSelection() {
686
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
687
- return render && render.with(ISheetSelectionRenderService).transparentSelection(), this;
678
+ const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
679
+ return t && t.with(H).transparentSelection(), this;
688
680
  }
689
681
  showSelection() {
690
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
691
- return render && render.with(ISheetSelectionRenderService).showSelection(), this;
682
+ const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
683
+ return t && t.with(H).showSelection(), this;
692
684
  }
693
- };
694
- __name(_FWorkbookSheetsUIMixin, "FWorkbookSheetsUIMixin");
695
- let FWorkbookSheetsUIMixin = _FWorkbookSheetsUIMixin;
696
- FWorkbook.extend(FWorkbookSheetsUIMixin);
697
- const _FWorksheetSkeletonMixin = class _FWorksheetSkeletonMixin extends FWorksheet {
685
+ }
686
+ Ce.extend(Ne);
687
+ class Ve extends be {
698
688
  refreshCanvas() {
699
- const renderManagerService = this._injector.get(IRenderManagerService), unitId = this._fWorkbook.id, render = renderManagerService.getRenderById(unitId);
700
- if (!render)
701
- throw new Error(`Render Unit with unitId ${unitId} not found`);
702
- render.with(SheetSkeletonManagerService).reCalculate();
703
- const mainComponent = render.mainComponent;
704
- if (!mainComponent)
689
+ const e = this._injector.get(m), r = this._fWorkbook.id, t = e.getRenderById(r);
690
+ if (!t)
691
+ throw new Error(`Render Unit with unitId ${r} not found`);
692
+ t.with(x).reCalculate();
693
+ const i = t.mainComponent;
694
+ if (!i)
705
695
  throw new Error("Main component not found");
706
- return mainComponent.makeDirty(), this;
696
+ return i.makeDirty(), this;
707
697
  }
708
- zoom(zoomRatio) {
709
- return this._injector.get(ICommandService).syncExecuteCommand(ChangeZoomRatioCommand.id, {
698
+ zoom(e) {
699
+ return this._injector.get(I).syncExecuteCommand(De.id, {
710
700
  unitId: this._workbook.getUnitId(),
711
701
  subUnitId: this._worksheet.getSheetId(),
712
- zoomRatio
702
+ zoomRatio: e
713
703
  }), this;
714
704
  }
715
705
  getZoom() {
716
706
  return this._worksheet.getZoomRatio();
717
707
  }
718
708
  getVisibleRange() {
719
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
720
- let range = {
709
+ const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
710
+ let i = {
721
711
  startColumn: 0,
722
712
  startRow: 0,
723
713
  endColumn: 0,
724
714
  endRow: 0
725
715
  };
726
- if (!render) return range;
727
- const sk = render.with(SheetSkeletonManagerService).getCurrentSkeleton();
728
- if (!sk) return range;
729
- const visibleRangeMap = sk == null ? void 0 : sk.getVisibleRanges();
730
- if (!visibleRangeMap) return range;
731
- range = sk.getVisibleRangeByViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
732
- for (const [k, r] of visibleRangeMap)
733
- sheetContentViewportKeys.indexOf(k) !== -1 && (range.startColumn = Math.min(range.startColumn, r.startColumn), range.startRow = Math.min(range.startRow, r.startRow), range.endColumn = Math.max(range.endColumn, r.endColumn), range.endRow = Math.max(range.endRow, r.endRow));
734
- return range;
735
- }
736
- scrollToCell(row, column) {
737
- const unitId = this._workbook.getUnitId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
738
- return render && (render == null ? void 0 : render.with(SheetsScrollRenderController)).scrollToCell(row, column), this;
716
+ if (!t) return i;
717
+ const s = t.with(x).getCurrentSkeleton();
718
+ if (!s) return i;
719
+ const c = s == null ? void 0 : s.getVisibleRanges();
720
+ if (!c) return i;
721
+ i = s.getVisibleRangeByViewport(Ie.VIEW_MAIN);
722
+ for (const [g, b] of c)
723
+ Pe.indexOf(g) !== -1 && (i.startColumn = Math.min(i.startColumn, b.startColumn), i.startRow = Math.min(i.startRow, b.startRow), i.endColumn = Math.max(i.endColumn, b.endColumn), i.endRow = Math.max(i.endRow, b.endRow));
724
+ return i;
725
+ }
726
+ scrollToCell(e, r) {
727
+ const t = this._workbook.getUnitId(), o = this._injector.get(m).getRenderById(t);
728
+ return o && (o == null ? void 0 : o.with(Te)).scrollToCell(e, r), this;
739
729
  }
740
730
  getScrollState() {
741
- const emptyScrollState = {
731
+ const e = {
742
732
  offsetX: 0,
743
733
  offsetY: 0,
744
734
  sheetViewStartColumn: 0,
745
735
  sheetViewStartRow: 0
746
- }, unitId = this._workbook.getUnitId(), sheetId = this._worksheet.getSheetId(), render = this._injector.get(IRenderManagerService).getRenderById(unitId);
747
- return render && render.with(SheetScrollManagerService).getScrollStateByParam({ unitId, sheetId }) || emptyScrollState;
748
- }
749
- onScroll(callback) {
750
- var _a;
751
- const unitId = this._workbook.getUnitId(), scrollManagerService = (_a = this._injector.get(IRenderManagerService).getRenderById(unitId)) == null ? void 0 : _a.with(SheetScrollManagerService);
752
- if (scrollManagerService) {
753
- const sub = scrollManagerService.validViewportScrollInfo$.subscribe((params) => {
754
- callback(params);
736
+ }, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(m).getRenderById(r);
737
+ return o && o.with(T).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
738
+ }
739
+ onScroll(e) {
740
+ var o;
741
+ const r = this._workbook.getUnitId(), i = (o = this._injector.get(m).getRenderById(r)) == null ? void 0 : o.with(T);
742
+ if (i) {
743
+ const s = i.validViewportScrollInfo$.subscribe((c) => {
744
+ e(c);
755
745
  });
756
- return toDisposable(sub);
746
+ return C(s);
757
747
  }
758
- return toDisposable(() => {
748
+ return C(() => {
759
749
  });
760
750
  }
761
751
  getSkeleton() {
762
- var _a, _b;
763
- const service = (_a = this._injector.get(IRenderManagerService).getRenderById(this._workbook.getUnitId())) == null ? void 0 : _a.with(SheetSkeletonManagerService);
764
- return (_b = service == null ? void 0 : service.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : _b.skeleton;
752
+ var r, t;
753
+ const e = (r = this._injector.get(m).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(x);
754
+ return (t = e == null ? void 0 : e.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : t.skeleton;
765
755
  }
766
- setColumnAutoWidth(columnPosition, numColumn) {
767
- const unitId = this._workbook.getUnitId(), subUnitId = this._worksheet.getSheetId(), ranges = [
756
+ setColumnAutoWidth(e, r) {
757
+ const t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
768
758
  {
769
- startColumn: columnPosition,
770
- endColumn: columnPosition + numColumn - 1,
759
+ startColumn: e,
760
+ endColumn: e + r - 1,
771
761
  startRow: 0,
772
762
  endRow: this._worksheet.getRowCount() - 1
773
763
  }
774
764
  ];
775
- return this._commandService.syncExecuteCommand(SetWorksheetColAutoWidthCommand.id, {
776
- unitId,
777
- subUnitId,
778
- ranges
765
+ return this._commandService.syncExecuteCommand(Be.id, {
766
+ unitId: t,
767
+ subUnitId: i,
768
+ ranges: o
779
769
  }), this;
780
770
  }
781
- };
782
- __name(_FWorksheetSkeletonMixin, "FWorksheetSkeletonMixin");
783
- let FWorksheetSkeletonMixin = _FWorksheetSkeletonMixin;
784
- FWorksheet.extend(FWorksheetSkeletonMixin);
785
- const _FPermissionSheetsUIMixin = class _FPermissionSheetsUIMixin extends FPermission {
786
- setPermissionDialogVisible(visible) {
787
- this._permissionService.setShowComponents(visible);
771
+ }
772
+ be.extend(Ve);
773
+ class Ze extends pe {
774
+ setPermissionDialogVisible(e) {
775
+ this._permissionService.setShowComponents(e);
788
776
  }
789
- };
790
- __name(_FPermissionSheetsUIMixin, "FPermissionSheetsUIMixin");
791
- let FPermissionSheetsUIMixin = _FPermissionSheetsUIMixin;
792
- FPermission.extend(FPermissionSheetsUIMixin);
793
- const _FSheetHooksUIMixin = class _FSheetHooksUIMixin extends FSheetHooks {
794
- onCellPointerMove(callback) {
795
- return toDisposable(this._injector.get(HoverManagerService).currentPosition$.subscribe(callback));
796
- }
797
- onCellPointerOver(callback) {
798
- return toDisposable(this._injector.get(HoverManagerService).currentCell$.subscribe(callback));
799
- }
800
- onCellDragOver(callback) {
801
- return toDisposable(this._injector.get(DragManagerService).currentCell$.subscribe(callback));
802
- }
803
- onCellDrop(callback) {
804
- return toDisposable(this._injector.get(DragManagerService).endCell$.subscribe(callback));
805
- }
806
- onCellRender(customRender, effect = InterceptorEffectEnum.Style, priority = InterceptCellContentPriority.DATA_VALIDATION) {
807
- return this._injector.get(SheetInterceptorService).intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
808
- effect,
809
- handler: /* @__PURE__ */ __name((cell, pos, next) => next({
810
- ...cell,
777
+ }
778
+ pe.extend(Ze);
779
+ class Ke extends j {
780
+ onCellPointerMove(e) {
781
+ return C(this._injector.get(_).currentPosition$.subscribe(e));
782
+ }
783
+ onCellPointerOver(e) {
784
+ return C(this._injector.get(_).currentCell$.subscribe(e));
785
+ }
786
+ onCellDragOver(e) {
787
+ return C(this._injector.get(U).currentCell$.subscribe(e));
788
+ }
789
+ onCellDrop(e) {
790
+ return C(this._injector.get(U).endCell$.subscribe(e));
791
+ }
792
+ onCellRender(e, r = we.Style, t = xe.DATA_VALIDATION) {
793
+ return this._injector.get(Ue).intercept(He.CELL_CONTENT, {
794
+ effect: r,
795
+ handler: (i, o, s) => s({
796
+ ...i,
811
797
  customRender: [
812
- ...(cell == null ? void 0 : cell.customRender) || [],
813
- ...customRender || []
798
+ ...(i == null ? void 0 : i.customRender) || [],
799
+ ...e || []
814
800
  ]
815
- }), "handler"),
816
- priority
801
+ }),
802
+ priority: t
817
803
  });
818
804
  }
819
- onBeforeCellEdit(callback) {
820
- return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
821
- const params = command.params;
822
- command.id === SetCellEditVisibleOperation.id && params.visible && callback(params);
805
+ onBeforeCellEdit(e) {
806
+ return this._injector.get(I).beforeCommandExecuted((r) => {
807
+ const t = r.params;
808
+ r.id === P.id && t.visible && e(t);
823
809
  });
824
810
  }
825
- onAfterCellEdit(callback) {
826
- return this._injector.get(ICommandService).onCommandExecuted((command) => {
827
- const params = command.params;
828
- command.id === SetCellEditVisibleOperation.id && !params.visible && callback(params);
811
+ onAfterCellEdit(e) {
812
+ return this._injector.get(I).onCommandExecuted((r) => {
813
+ const t = r.params;
814
+ r.id === P.id && !t.visible && e(t);
829
815
  });
830
816
  }
831
- };
832
- __name(_FSheetHooksUIMixin, "FSheetHooksUIMixin");
833
- let FSheetHooksUIMixin = _FSheetHooksUIMixin;
834
- FSheetHooks.extend(FSheetHooksUIMixin);
835
- const CellFEventName = {
817
+ }
818
+ j.extend(Ke);
819
+ const y = {
836
820
  CellClicked: "CellClicked",
837
821
  CellPointerDown: "CellPointerDown",
838
822
  CellPointerUp: "CellPointerUp",
@@ -845,7 +829,8 @@ const CellFEventName = {
845
829
  SelectionMoving: "SelectionMoving",
846
830
  SelectionMoveEnd: "SelectionMoveEnd",
847
831
  SelectionChanged: "SelectionChanged"
848
- }, _FSheetsUIEventName = class _FSheetsUIEventName extends FEventName {
832
+ };
833
+ class ze extends ve {
849
834
  get BeforeClipboardChange() {
850
835
  return "BeforeClipboardChange";
851
836
  }
@@ -874,19 +859,19 @@ const CellFEventName = {
874
859
  return "SheetEditEnded";
875
860
  }
876
861
  get CellClicked() {
877
- return CellFEventName.CellClicked;
862
+ return y.CellClicked;
878
863
  }
879
864
  get CellHover() {
880
- return CellFEventName.CellHover;
865
+ return y.CellHover;
881
866
  }
882
867
  get CellPointerDown() {
883
- return CellFEventName.CellPointerDown;
868
+ return y.CellPointerDown;
884
869
  }
885
870
  get CellPointerUp() {
886
- return CellFEventName.CellPointerUp;
871
+ return y.CellPointerUp;
887
872
  }
888
873
  get CellPointerMove() {
889
- return CellFEventName.CellPointerMove;
874
+ return y.CellPointerMove;
890
875
  }
891
876
  get DragOver() {
892
877
  return "DragOver";
@@ -936,45 +921,43 @@ const CellFEventName = {
936
921
  get SheetSkeletonChanged() {
937
922
  return "SheetSkeletonChanged";
938
923
  }
939
- };
940
- __name(_FSheetsUIEventName, "FSheetsUIEventName");
941
- let FSheetsUIEventName = _FSheetsUIEventName;
942
- FEventName.extend(FSheetsUIEventName);
943
- const _FRangeSheetsUIMixin = class _FRangeSheetsUIMixin extends FRange {
924
+ }
925
+ ve.extend(ze);
926
+ class Ye extends me {
944
927
  getCell() {
945
- var _a;
946
- const renderManagerService = this._injector.get(IRenderManagerService), logService = this._injector.get(ILogService), unitId = this._workbook.getUnitId(), subUnitId = this._worksheet.getSheetId(), render = renderManagerService.getRenderById(unitId), skeleton = (_a = render == null ? void 0 : render.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _a.skeleton;
947
- if (!skeleton)
948
- throw logService.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
949
- return skeleton.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
928
+ var c;
929
+ const e = this._injector.get(m), r = this._injector.get(D), t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = e.getRenderById(t), s = (c = o == null ? void 0 : o.with(x).getWorksheetSkeleton(i)) == null ? void 0 : c.skeleton;
930
+ if (!s)
931
+ throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
932
+ return s.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
950
933
  }
951
934
  getCellRect() {
952
- const { startX: x, startY: y, endX: x2, endY: y2 } = this.getCell(), data = { x, y, width: x2 - x, height: y2 - y, top: y, left: x, bottom: y2, right: x2 };
953
- return { ...data, toJSON: /* @__PURE__ */ __name(() => JSON.stringify(data), "toJSON") };
935
+ const { startX: e, startY: r, endX: t, endY: i } = this.getCell(), o = { x: e, y: r, width: t - e, height: i - r, top: r, left: e, bottom: i, right: t };
936
+ return { ...o, toJSON: () => JSON.stringify(o) };
954
937
  }
955
938
  generateHTML() {
956
- var _a;
957
- const copyContent = this._injector.get(ISheetClipboardService).generateCopyContent(
939
+ var r;
940
+ const e = this._injector.get(Se).generateCopyContent(
958
941
  this._workbook.getUnitId(),
959
942
  this._worksheet.getSheetId(),
960
943
  this._range
961
944
  );
962
- return (_a = copyContent == null ? void 0 : copyContent.html) != null ? _a : "";
945
+ return (r = e == null ? void 0 : e.html) != null ? r : "";
963
946
  }
964
- attachPopup(popup) {
965
- var _a, _b, _c;
966
- popup.direction = (_a = popup.direction) != null ? _a : "horizontal", popup.extraProps = (_b = popup.extraProps) != null ? _b : {}, popup.offset = (_c = popup.offset) != null ? _c : [0, 0];
967
- const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(ComponentManager)), disposePopup = this._injector.get(SheetCanvasPopManagerService).attachPopupToCell(
947
+ attachPopup(e) {
948
+ var s, c, g;
949
+ e.direction = (s = e.direction) != null ? s : "horizontal", e.extraProps = (c = e.extraProps) != null ? c : {}, e.offset = (g = e.offset) != null ? g : [0, 0];
950
+ const { key: r, disposableCollection: t } = ge(e, this._injector.get(le)), o = this._injector.get(ie).attachPopupToCell(
968
951
  this._range.startRow,
969
952
  this._range.startColumn,
970
- { ...popup, componentKey: key },
953
+ { ...e, componentKey: r },
971
954
  this.getUnitId(),
972
955
  this._worksheet.getSheetId()
973
956
  );
974
- return disposePopup ? (disposableCollection.add(disposePopup), disposableCollection) : (disposableCollection.dispose(), null);
957
+ return o ? (t.add(o), t) : (t.dispose(), null);
975
958
  }
976
- attachAlertPopup(alert) {
977
- const cellAlertService = this._injector.get(CellAlertManagerService), location = {
959
+ attachAlertPopup(e) {
960
+ const r = this._injector.get(Le), t = {
978
961
  workbook: this._workbook,
979
962
  worksheet: this._worksheet,
980
963
  row: this._range.startRow,
@@ -982,13 +965,13 @@ const _FRangeSheetsUIMixin = class _FRangeSheetsUIMixin extends FRange {
982
965
  unitId: this.getUnitId(),
983
966
  subUnitId: this._worksheet.getSheetId()
984
967
  };
985
- return cellAlertService.showAlert({
986
- ...alert,
987
- location
968
+ return r.showAlert({
969
+ ...e,
970
+ location: t
988
971
  }), {
989
- dispose: /* @__PURE__ */ __name(() => {
990
- cellAlertService.removeAlert(alert.key);
991
- }, "dispose")
972
+ dispose: () => {
973
+ r.removeAlert(e.key);
974
+ }
992
975
  };
993
976
  }
994
977
  /**
@@ -1003,39 +986,36 @@ const _FRangeSheetsUIMixin = class _FRangeSheetsUIMixin extends FRange {
1003
986
  extraProps: { alert: { type: 0, title: 'This is an Info', message: 'This is an info message' } },
1004
987
  });
1005
988
  */
1006
- attachRangePopup(popup) {
1007
- var _a, _b, _c;
1008
- popup.direction = (_a = popup.direction) != null ? _a : "horizontal", popup.extraProps = (_b = popup.extraProps) != null ? _b : {}, popup.offset = (_c = popup.offset) != null ? _c : [0, 0];
1009
- const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(ComponentManager)), disposePopup = this._injector.get(SheetCanvasPopManagerService).attachRangePopup(
989
+ attachRangePopup(e) {
990
+ var s, c, g;
991
+ e.direction = (s = e.direction) != null ? s : "horizontal", e.extraProps = (c = e.extraProps) != null ? c : {}, e.offset = (g = e.offset) != null ? g : [0, 0];
992
+ const { key: r, disposableCollection: t } = ge(e, this._injector.get(le)), o = this._injector.get(ie).attachRangePopup(
1010
993
  this._range,
1011
- { ...popup, componentKey: key },
994
+ { ...e, componentKey: r },
1012
995
  this.getUnitId(),
1013
996
  this._worksheet.getSheetId()
1014
997
  );
1015
- return disposePopup ? (disposableCollection.add(disposePopup), disposableCollection) : (disposableCollection.dispose(), null);
998
+ return o ? (t.add(o), t) : (t.dispose(), null);
1016
999
  }
1017
- highlight(style, primary) {
1018
- const markSelectionService = this._injector.get(IMarkSelectionService), id = markSelectionService.addShape({ range: this._range, style, primary });
1019
- if (!id)
1000
+ highlight(e, r) {
1001
+ const t = this._injector.get(Ae), i = t.addShape({ range: this._range, style: e, primary: r });
1002
+ if (!i)
1020
1003
  throw new Error("Failed to highlight current range");
1021
- return toDisposable(() => {
1022
- markSelectionService.removeShape(id);
1004
+ return C(() => {
1005
+ t.removeShape(i);
1023
1006
  });
1024
1007
  }
1025
- };
1026
- __name(_FRangeSheetsUIMixin, "FRangeSheetsUIMixin");
1027
- let FRangeSheetsUIMixin = _FRangeSheetsUIMixin;
1028
- FRange.extend(FRangeSheetsUIMixin);
1029
- function transformComponentKey(component, componentManager) {
1030
- const { componentKey, isVue3 } = component;
1031
- let key;
1032
- const disposableCollection = new DisposableCollection();
1033
- return typeof componentKey == "string" ? key = componentKey : (key = `External_${generateRandomId(6)}`, disposableCollection.add(componentManager.register(key, componentKey, { framework: isVue3 ? "vue3" : "react" }))), {
1034
- key,
1035
- disposableCollection
1008
+ }
1009
+ me.extend(Ye);
1010
+ function ge(w, e) {
1011
+ const { componentKey: r, isVue3: t } = w;
1012
+ let i;
1013
+ const o = new W();
1014
+ return typeof r == "string" ? i = r : (i = `External_${_e(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
1015
+ key: i,
1016
+ disposableCollection: o
1036
1017
  };
1037
1018
  }
1038
- __name(transformComponentKey, "transformComponentKey");
1039
1019
  export {
1040
- transformComponentKey
1020
+ ge as transformComponentKey
1041
1021
  };