@univerjs/sheets-ui 0.5.5-nightly.202501241606 → 0.6.0-alpha.0

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