@univerjs/sheets-ui 0.6.1-nightly.202502261607 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/facade.js CHANGED
@@ -1,427 +1,422 @@
1
- import { ICommandService as R, CanceledError as f, IUniverInstanceService as A, RichTextValue as L, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as $, LifecycleService as F, DisposableCollection as W, LifecycleStages as N, UniverInstanceType as ae, ILogService as T, toDisposable as E, awaitTime as ce, InterceptorEffectEnum as de, generateRandomId as he } from "@univerjs/core";
2
- import { FUniver as te, FEventName as le } from "@univerjs/core/facade";
3
- import { RichTextEditingMutation as ge } from "@univerjs/docs";
4
- import { IRenderManagerService as m, DeviceInputEventType as z, SHEET_VIEWPORT_KEY as ue, sheetContentViewportKeys as ve } from "@univerjs/engine-render";
5
- import { SheetsSelectionsService as Se, COMMAND_LISTENER_SKELETON_CHANGE as Ce, getSkeletonChangedEffectedRange as me, InterceptCellContentPriority as Ee, SheetInterceptorService as be, INTERCEPTOR_POINT as pe } from "@univerjs/sheets";
6
- import { SetCellEditVisibleOperation as I, IEditorBridgeService as M, SetZoomRatioCommand as j, HoverManagerService as w, DragManagerService as U, SheetScrollManagerService as D, SheetPasteShortKeyCommand as V, ISheetClipboardService as re, SheetSkeletonManagerService as H, SHEET_VIEW_KEY as k, ISheetSelectionRenderService as x, SheetsScrollRenderController as fe, SetWorksheetColAutoWidthCommand as we, SetColumnHeaderHeightCommand as ke, SetRowHeaderWidthCommand as Ie, SheetCanvasPopManagerService as Z, CellAlertManagerService as _e, IMarkSelectionService as Pe } from "@univerjs/sheets-ui";
7
- import { FSheetHooks as O, FWorkbook as ne, FWorksheet as ie, FPermission as oe, FRange as se } from "@univerjs/sheets/facade";
8
- import { KeyCode as B, CutCommand as K, CopyCommand as Y, PasteCommand as X, IClipboardInterfaceService as Re, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as J, HTML_CLIPBOARD_MIME_TYPE as G, supportClipboardAPI as q, ISidebarService as He, IDialogService as Me, ComponentManager as Q } from "@univerjs/ui";
9
- import { filter as S, combineLatest as ye } from "rxjs";
10
- class Ue extends te {
1
+ import { ICommandService as I, CanceledError as E, IUniverInstanceService as $, RichTextValue as j, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as D, LifecycleService as ie, DisposableCollection as B, LifecycleStages as O, UniverInstanceType as oe, ILogService as U, toDisposable as C, awaitTime as se, InterceptorEffectEnum as ae, generateRandomId as ce } from "@univerjs/core";
2
+ import { FUniver as q, FEventName as de } from "@univerjs/core/facade";
3
+ import { RichTextEditingMutation as he } from "@univerjs/docs";
4
+ import { IRenderManagerService as S, DeviceInputEventType as z, SHEET_VIEWPORT_KEY as le, sheetContentViewportKeys as ge } from "@univerjs/engine-render";
5
+ import { SheetsSelectionsService as ue, COMMAND_LISTENER_SKELETON_CHANGE as ve, getSkeletonChangedEffectedRange as Se, SetWorksheetRowIsAutoHeightCommand as Ce, InterceptCellContentPriority as me, SheetInterceptorService as be, INTERCEPTOR_POINT as Ee } from "@univerjs/sheets";
6
+ import { SetCellEditVisibleOperation as f, IEditorBridgeService as R, SetZoomRatioCommand as A, HoverManagerService as p, DragManagerService as M, SheetScrollManagerService as x, SheetPasteShortKeyCommand as L, ISheetClipboardService as Q, SheetSkeletonManagerService as _, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as y, SheetsScrollRenderController as pe, SetWorksheetColAutoWidthCommand as we, SetColumnHeaderHeightCommand as fe, SetRowHeaderWidthCommand as ke, SheetCanvasPopManagerService as N, CellAlertManagerService as Ie, IMarkSelectionService as _e } from "@univerjs/sheets-ui";
7
+ import { FSheetHooks as W, FWorkbook as ee, FWorksheet as te, FPermission as re, FRange as ne } from "@univerjs/sheets/facade";
8
+ import { KeyCode as T, CutCommand as F, CopyCommand as V, PasteCommand as Z, IClipboardInterfaceService as Pe, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as K, HTML_CLIPBOARD_MIME_TYPE as Y, supportClipboardAPI as X, ISidebarService as Re, IDialogService as He, ComponentManager as J } from "@univerjs/ui";
9
+ import { filter as u, combineLatest as Me } from "rxjs";
10
+ class ye extends q {
11
11
  // eslint-disable-next-line max-lines-per-function
12
12
  _initSheetUIEvent(e) {
13
- const r = e.get(R);
13
+ const r = e.get(I);
14
14
  this.registerEventHandler(
15
15
  this.Event.BeforeSheetEditStart,
16
16
  () => r.beforeCommandExecuted((t) => {
17
- if (t.id !== I.id) return;
17
+ if (t.id !== f.id) return;
18
18
  const i = this.getActiveSheet();
19
19
  if (!i) return;
20
- const { workbook: o, worksheet: s } = i, c = e.get(M), g = t.params, { visible: u, keycode: l, eventType: C } = g, v = c.getEditLocation();
21
- if (u) {
22
- const h = {
23
- row: v.row,
24
- column: v.column,
25
- eventType: C,
26
- keycode: l,
20
+ const { workbook: o, worksheet: a } = i, d = e.get(R), l = t.params, { visible: h, keycode: g, eventType: s } = l, n = d.getEditLocation();
21
+ if (h) {
22
+ const c = {
23
+ row: n.row,
24
+ column: n.column,
25
+ eventType: s,
26
+ keycode: g,
27
27
  workbook: o,
28
- worksheet: s,
28
+ worksheet: a,
29
29
  isZenEditor: !1
30
30
  };
31
- if (this.fireEvent(this.Event.BeforeSheetEditStart, h), h.cancel)
32
- throw new f();
31
+ if (this.fireEvent(this.Event.BeforeSheetEditStart, c), c.cancel)
32
+ throw new E();
33
33
  }
34
34
  })
35
35
  ), this.registerEventHandler(
36
36
  this.Event.BeforeSheetEditEnd,
37
37
  () => r.beforeCommandExecuted((t) => {
38
- if (t.id !== I.id) return;
38
+ if (t.id !== f.id) return;
39
39
  const i = this.getActiveSheet();
40
40
  if (!i) return;
41
- const { workbook: o, worksheet: s } = i, c = e.get(M), g = e.get(A), u = t.params, { visible: l, keycode: C, eventType: v } = u, h = c.getEditLocation();
42
- if (!l) {
43
- const _ = {
44
- row: h.row,
45
- column: h.column,
46
- eventType: v,
47
- keycode: C,
41
+ const { workbook: o, worksheet: a } = i, d = e.get(R), l = e.get($), h = t.params, { visible: g, keycode: s, eventType: n } = h, c = d.getEditLocation();
42
+ if (!g) {
43
+ const P = {
44
+ row: c.row,
45
+ column: c.column,
46
+ eventType: n,
47
+ keycode: s,
48
48
  workbook: o,
49
- worksheet: s,
49
+ worksheet: a,
50
50
  isZenEditor: !1,
51
- value: L.create(g.getUnit($).getSnapshot()),
52
- isConfirm: C !== B.ESC
51
+ value: j.create(l.getUnit(D).getSnapshot()),
52
+ isConfirm: s !== T.ESC
53
53
  };
54
- if (this.fireEvent(this.Event.BeforeSheetEditEnd, _), _.cancel)
55
- throw new f();
54
+ if (this.fireEvent(this.Event.BeforeSheetEditEnd, P), P.cancel)
55
+ throw new E();
56
56
  }
57
57
  })
58
58
  ), this.registerEventHandler(
59
59
  this.Event.SheetEditStarted,
60
60
  () => r.onCommandExecuted((t) => {
61
- if (t.id !== I.id) return;
61
+ if (t.id !== f.id) return;
62
62
  const i = this.getCommandSheetTarget(t);
63
63
  if (!i) return;
64
- const { workbook: o, worksheet: s } = i, c = e.get(M), g = t.params, { visible: u, keycode: l, eventType: C } = g, v = c.getEditLocation();
65
- if (u) {
66
- const h = {
67
- row: v.row,
68
- column: v.column,
69
- eventType: C,
70
- keycode: l,
64
+ const { workbook: o, worksheet: a } = i, d = e.get(R), l = t.params, { visible: h, keycode: g, eventType: s } = l, n = d.getEditLocation();
65
+ if (h) {
66
+ const c = {
67
+ row: n.row,
68
+ column: n.column,
69
+ eventType: s,
70
+ keycode: g,
71
71
  workbook: o,
72
- worksheet: s,
72
+ worksheet: a,
73
73
  isZenEditor: !1
74
74
  };
75
- this.fireEvent(this.Event.SheetEditStarted, h);
75
+ this.fireEvent(this.Event.SheetEditStarted, c);
76
76
  }
77
77
  })
78
78
  ), this.registerEventHandler(
79
79
  this.Event.SheetEditEnded,
80
80
  () => r.onCommandExecuted((t) => {
81
- if (t.id !== I.id) return;
81
+ if (t.id !== f.id) return;
82
82
  const i = this.getCommandSheetTarget(t);
83
83
  if (!i) return;
84
- const { workbook: o, worksheet: s } = i, c = e.get(M), g = t.params, { visible: u, keycode: l, eventType: C } = g, v = c.getEditLocation();
85
- if (!u) {
86
- const h = {
87
- row: v.row,
88
- column: v.column,
89
- eventType: C,
90
- keycode: l,
84
+ const { workbook: o, worksheet: a } = i, d = e.get(R), l = t.params, { visible: h, keycode: g, eventType: s } = l, n = d.getEditLocation();
85
+ if (!h) {
86
+ const c = {
87
+ row: n.row,
88
+ column: n.column,
89
+ eventType: s,
90
+ keycode: g,
91
91
  workbook: o,
92
- worksheet: s,
92
+ worksheet: a,
93
93
  isZenEditor: !1,
94
- isConfirm: l !== B.ESC
94
+ isConfirm: g !== T.ESC
95
95
  };
96
- this.fireEvent(this.Event.SheetEditEnded, h);
96
+ this.fireEvent(this.Event.SheetEditEnded, c);
97
97
  }
98
98
  })
99
99
  ), this.registerEventHandler(
100
100
  this.Event.SheetEditChanging,
101
101
  () => r.onCommandExecuted((t) => {
102
- if (t.id !== ge.id) return;
102
+ if (t.id !== he.id) return;
103
103
  const i = this.getActiveSheet();
104
104
  if (!i) return;
105
- const { workbook: o, worksheet: s } = i, c = e.get(M), g = e.get(A), u = t.params;
106
- if (!c.isVisible().visible) return;
107
- const { unitId: l } = u;
108
- if (l === $) {
109
- const { row: C, column: v } = c.getEditLocation(), h = {
105
+ const { workbook: o, worksheet: a } = i, d = e.get(R), l = e.get($), h = t.params;
106
+ if (!d.isVisible().visible) return;
107
+ const { unitId: g } = h;
108
+ if (g === D) {
109
+ const { row: s, column: n } = d.getEditLocation(), c = {
110
110
  workbook: o,
111
- worksheet: s,
112
- row: C,
113
- column: v,
114
- value: L.create(g.getUnit($).getSnapshot()),
111
+ worksheet: a,
112
+ row: s,
113
+ column: n,
114
+ value: j.create(l.getUnit(D).getSnapshot()),
115
115
  isZenEditor: !1
116
116
  };
117
- this.fireEvent(this.Event.SheetEditChanging, h);
117
+ this.fireEvent(this.Event.SheetEditChanging, c);
118
118
  }
119
119
  })
120
120
  ), this.registerEventHandler(
121
121
  this.Event.BeforeSheetZoomChange,
122
122
  () => r.beforeCommandExecuted((t) => {
123
- if (t.id !== j.id) return;
123
+ if (t.id !== A.id) return;
124
124
  const i = this.getCommandSheetTarget(t);
125
125
  if (!i) return;
126
- const { workbook: o, worksheet: s } = i, c = {
126
+ const { workbook: o, worksheet: a } = i, d = {
127
127
  zoom: t.params.zoomRatio,
128
128
  workbook: o,
129
- worksheet: s
129
+ worksheet: a
130
130
  };
131
- if (this.fireEvent(this.Event.BeforeSheetZoomChange, c), c.cancel)
132
- throw new f();
131
+ if (this.fireEvent(this.Event.BeforeSheetZoomChange, d), d.cancel)
132
+ throw new E();
133
133
  })
134
134
  ), this.registerEventHandler(
135
135
  this.Event.SheetZoomChanged,
136
136
  () => r.onCommandExecuted((t) => {
137
- if (t.id !== j.id) return;
137
+ if (t.id !== A.id) return;
138
138
  const i = this.getCommandSheetTarget(t);
139
139
  if (!i) return;
140
- const { workbook: o, worksheet: s } = i;
140
+ const { workbook: o, worksheet: a } = i;
141
141
  this.fireEvent(this.Event.SheetZoomChanged, {
142
- zoom: s.getZoom(),
142
+ zoom: a.getZoom(),
143
143
  workbook: o,
144
- worksheet: s
144
+ worksheet: a
145
145
  });
146
146
  })
147
147
  );
148
148
  }
149
149
  // eslint-disable-next-line max-lines-per-function
150
150
  _initObserverListener(e) {
151
- const t = e.get(A).getFocusedUnit(), i = t == null ? void 0 : t.getUnitId(), o = e.get(m);
152
- if (i) {
153
- const l = e.get(F), C = new W();
154
- this.disposeWithMe(l.lifecycle$.subscribe((v) => {
155
- if (v < N.Rendered) return;
156
- C.dispose();
157
- const h = e.get(w), _ = e.get(U);
158
- h && (this.registerEventHandler(
159
- this.Event.CellClicked,
160
- () => {
161
- var d;
162
- return (d = h.currentClickedCell$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
163
- const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
164
- a && this.fireEvent(this.Event.CellClicked, {
165
- ...a,
166
- ...n,
167
- row: n.location.row,
168
- column: n.location.col
169
- });
151
+ const r = e.get(S), t = e.get(ie), i = new B();
152
+ this.disposeWithMe(t.lifecycle$.subscribe((l) => {
153
+ if (l !== O.Rendered) return;
154
+ i.dispose();
155
+ const h = e.get(p), g = e.get(M);
156
+ h && (this.registerEventHandler(
157
+ this.Event.CellClicked,
158
+ () => {
159
+ var s;
160
+ return (s = h.currentClickedCell$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
161
+ const c = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
162
+ c && this.fireEvent(this.Event.CellClicked, {
163
+ ...c,
164
+ ...n,
165
+ row: n.location.row,
166
+ column: n.location.col
170
167
  });
171
- }
172
- ), this.registerEventHandler(
173
- this.Event.CellHover,
174
- () => {
175
- var d;
176
- return (d = h.currentRichText$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
177
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
178
- a && this.fireEvent(this.Event.CellHover, {
179
- ...a,
180
- ...n,
181
- row: n.row,
182
- column: n.col
183
- });
168
+ });
169
+ }
170
+ ), this.registerEventHandler(
171
+ this.Event.CellHover,
172
+ () => {
173
+ var s;
174
+ return (s = h.currentRichText$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
175
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
176
+ c && this.fireEvent(this.Event.CellHover, {
177
+ ...c,
178
+ ...n,
179
+ row: n.row,
180
+ column: n.col
184
181
  });
185
- }
186
- ), this.registerEventHandler(
187
- this.Event.CellPointerDown,
188
- () => {
189
- var d;
190
- return (d = h.currentPointerDownCell$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
191
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
192
- a && this.fireEvent(this.Event.CellPointerDown, {
193
- ...a,
194
- ...n,
195
- row: n.row,
196
- column: n.col
197
- });
182
+ });
183
+ }
184
+ ), this.registerEventHandler(
185
+ this.Event.CellPointerDown,
186
+ () => {
187
+ var s;
188
+ return (s = h.currentPointerDownCell$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
189
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
190
+ c && this.fireEvent(this.Event.CellPointerDown, {
191
+ ...c,
192
+ ...n,
193
+ row: n.row,
194
+ column: n.col
198
195
  });
199
- }
200
- ), this.registerEventHandler(
201
- this.Event.CellPointerUp,
202
- () => {
203
- var d;
204
- return (d = h.currentPointerUpCell$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
205
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
206
- a && this.fireEvent(this.Event.CellPointerUp, {
207
- ...a,
208
- ...n,
209
- row: n.row,
210
- column: n.col
211
- });
196
+ });
197
+ }
198
+ ), this.registerEventHandler(
199
+ this.Event.CellPointerUp,
200
+ () => {
201
+ var s;
202
+ return (s = h.currentPointerUpCell$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
203
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
204
+ c && this.fireEvent(this.Event.CellPointerUp, {
205
+ ...c,
206
+ ...n,
207
+ row: n.row,
208
+ column: n.col
212
209
  });
213
- }
214
- ), this.registerEventHandler(
215
- this.Event.CellPointerMove,
216
- () => {
217
- var d;
218
- return (d = h.currentCellPosWithEvent$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
219
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
220
- a && this.fireEvent(this.Event.CellPointerMove, {
221
- ...a,
222
- ...n,
223
- row: n.row,
224
- column: n.col
225
- });
210
+ });
211
+ }
212
+ ), this.registerEventHandler(
213
+ this.Event.CellPointerMove,
214
+ () => {
215
+ var s;
216
+ return (s = h.currentCellPosWithEvent$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
217
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
218
+ c && this.fireEvent(this.Event.CellPointerMove, {
219
+ ...c,
220
+ ...n,
221
+ row: n.row,
222
+ column: n.col
226
223
  });
227
- }
228
- ), this.registerEventHandler(
229
- this.Event.DragOver,
230
- () => {
231
- var d;
232
- return (d = _.currentCell$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
233
- const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
234
- a && this.fireEvent(this.Event.DragOver, {
235
- ...a,
236
- ...n,
237
- row: n.location.row,
238
- column: n.location.col
239
- });
224
+ });
225
+ }
226
+ ), this.registerEventHandler(
227
+ this.Event.DragOver,
228
+ () => {
229
+ var s;
230
+ return (s = g.currentCell$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
231
+ const c = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
232
+ c && this.fireEvent(this.Event.DragOver, {
233
+ ...c,
234
+ ...n,
235
+ row: n.location.row,
236
+ column: n.location.col
240
237
  });
241
- }
242
- ), this.registerEventHandler(
243
- this.Event.Drop,
244
- () => {
245
- var d;
246
- return (d = _.endCell$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
247
- const a = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
248
- a && this.fireEvent(this.Event.Drop, {
249
- ...a,
250
- ...n,
251
- row: n.location.row,
252
- column: n.location.col
253
- });
238
+ });
239
+ }
240
+ ), this.registerEventHandler(
241
+ this.Event.Drop,
242
+ () => {
243
+ var s;
244
+ return (s = g.endCell$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
245
+ const c = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
246
+ c && this.fireEvent(this.Event.Drop, {
247
+ ...c,
248
+ ...n,
249
+ row: n.location.row,
250
+ column: n.location.col
254
251
  });
255
- }
256
- ), this.registerEventHandler(
257
- this.Event.RowHeaderClick,
258
- () => {
259
- var d;
260
- return (d = h.currentRowHeaderClick$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
261
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
262
- a && this.fireEvent(this.Event.RowHeaderClick, {
263
- ...a,
264
- row: n.index
265
- });
252
+ });
253
+ }
254
+ ), this.registerEventHandler(
255
+ this.Event.RowHeaderClick,
256
+ () => {
257
+ var s;
258
+ return (s = h.currentRowHeaderClick$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
259
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
260
+ c && this.fireEvent(this.Event.RowHeaderClick, {
261
+ ...c,
262
+ row: n.index
266
263
  });
267
- }
268
- ), this.registerEventHandler(
269
- this.Event.RowHeaderPointerDown,
270
- () => {
271
- var d;
272
- return (d = h.currentRowHeaderPointerDown$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
273
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
274
- a && this.fireEvent(this.Event.RowHeaderPointerDown, {
275
- ...a,
276
- row: n.index
277
- });
264
+ });
265
+ }
266
+ ), this.registerEventHandler(
267
+ this.Event.RowHeaderPointerDown,
268
+ () => {
269
+ var s;
270
+ return (s = h.currentRowHeaderPointerDown$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
271
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
272
+ c && this.fireEvent(this.Event.RowHeaderPointerDown, {
273
+ ...c,
274
+ row: n.index
278
275
  });
279
- }
280
- ), this.registerEventHandler(
281
- this.Event.RowHeaderPointerUp,
282
- () => {
283
- var d;
284
- return (d = h.currentRowHeaderPointerUp$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
285
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
286
- a && this.fireEvent(this.Event.RowHeaderPointerUp, {
287
- ...a,
288
- row: n.index
289
- });
276
+ });
277
+ }
278
+ ), this.registerEventHandler(
279
+ this.Event.RowHeaderPointerUp,
280
+ () => {
281
+ var s;
282
+ return (s = h.currentRowHeaderPointerUp$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
283
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
284
+ c && this.fireEvent(this.Event.RowHeaderPointerUp, {
285
+ ...c,
286
+ row: n.index
290
287
  });
291
- }
292
- ), this.registerEventHandler(
293
- this.Event.RowHeaderHover,
294
- () => {
295
- var d;
296
- return (d = h.currentHoveredRowHeader$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
297
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
298
- a && this.fireEvent(this.Event.RowHeaderHover, {
299
- ...a,
300
- row: n.index
301
- });
288
+ });
289
+ }
290
+ ), this.registerEventHandler(
291
+ this.Event.RowHeaderHover,
292
+ () => {
293
+ var s;
294
+ return (s = h.currentHoveredRowHeader$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
295
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
296
+ c && this.fireEvent(this.Event.RowHeaderHover, {
297
+ ...c,
298
+ row: n.index
302
299
  });
303
- }
304
- ), this.registerEventHandler(
305
- this.Event.ColumnHeaderClick,
306
- () => {
307
- var d;
308
- return (d = h.currentColHeaderClick$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
309
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
310
- a && this.fireEvent(this.Event.ColumnHeaderClick, {
311
- ...a,
312
- column: n.index
313
- });
300
+ });
301
+ }
302
+ ), this.registerEventHandler(
303
+ this.Event.ColumnHeaderClick,
304
+ () => {
305
+ var s;
306
+ return (s = h.currentColHeaderClick$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
307
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
308
+ c && this.fireEvent(this.Event.ColumnHeaderClick, {
309
+ ...c,
310
+ column: n.index
314
311
  });
315
- }
316
- ), this.registerEventHandler(
317
- this.Event.ColumnHeaderPointerDown,
318
- () => {
319
- var d;
320
- return (d = h.currentColHeaderPointerDown$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
321
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
322
- a && this.fireEvent(this.Event.ColumnHeaderPointerDown, {
323
- ...a,
324
- column: n.index
325
- });
312
+ });
313
+ }
314
+ ), this.registerEventHandler(
315
+ this.Event.ColumnHeaderPointerDown,
316
+ () => {
317
+ var s;
318
+ return (s = h.currentColHeaderPointerDown$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
319
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
320
+ c && this.fireEvent(this.Event.ColumnHeaderPointerDown, {
321
+ ...c,
322
+ column: n.index
326
323
  });
327
- }
328
- ), this.registerEventHandler(
329
- this.Event.ColumnHeaderPointerUp,
330
- () => {
331
- var d;
332
- return (d = h.currentColHeaderPointerUp$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
333
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
334
- a && this.fireEvent(this.Event.ColumnHeaderPointerUp, {
335
- ...a,
336
- column: n.index
337
- });
324
+ });
325
+ }
326
+ ), this.registerEventHandler(
327
+ this.Event.ColumnHeaderPointerUp,
328
+ () => {
329
+ var s;
330
+ return (s = h.currentColHeaderPointerUp$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
331
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
332
+ c && this.fireEvent(this.Event.ColumnHeaderPointerUp, {
333
+ ...c,
334
+ column: n.index
338
335
  });
339
- }
340
- ), this.registerEventHandler(
341
- this.Event.ColumnHeaderHover,
342
- () => {
343
- var d;
344
- return (d = h.currentHoveredColHeader$) == null ? void 0 : d.pipe(S((n) => !!n)).subscribe((n) => {
345
- const a = this.getSheetTarget(n.unitId, n.subUnitId);
346
- a && this.fireEvent(this.Event.ColumnHeaderHover, {
347
- ...a,
348
- column: n.index
349
- });
336
+ });
337
+ }
338
+ ), this.registerEventHandler(
339
+ this.Event.ColumnHeaderHover,
340
+ () => {
341
+ var s;
342
+ return (s = h.currentHoveredColHeader$) == null ? void 0 : s.pipe(u((n) => !!n)).subscribe((n) => {
343
+ const c = this.getSheetTarget(n.unitId, n.subUnitId);
344
+ c && this.fireEvent(this.Event.ColumnHeaderHover, {
345
+ ...c,
346
+ column: n.index
350
347
  });
351
- }
352
- ));
353
- })), this.disposeWithMe(C);
354
- }
355
- const s = /* @__PURE__ */ new Map();
356
- let c;
357
- const g = e.get(F), u = ye([
358
- o.created$,
359
- g.lifecycle$
348
+ });
349
+ }
350
+ ));
351
+ })), this.disposeWithMe(i);
352
+ const o = /* @__PURE__ */ new Map();
353
+ let a;
354
+ const d = Me([
355
+ r.created$,
356
+ t.lifecycle$
360
357
  ]);
361
- this.disposeWithMe(u.subscribe(([l, C]) => {
362
- var n;
363
- if (l.type === ae.UNIVER_SHEET && (c = l), C <= N.Rendered) return;
364
- const v = new W();
365
- if (!c) return;
366
- const h = this.getWorkbook(c.unitId);
367
- if (!h) return;
368
- s.get(c.unitId) && ((n = s.get(c.unitId)) == null || n.dispose()), s.set(c.unitId, v);
369
- const _ = c.with(D), d = c.with(Se);
370
- v.add(this.registerEventHandler(
358
+ this.disposeWithMe(d.subscribe(([l, h]) => {
359
+ var P;
360
+ if (l.type === oe.UNIVER_SHEET && (a = l), h <= O.Rendered || !a) return;
361
+ const g = new B(), s = this.getWorkbook(a.unitId);
362
+ if (!s) return;
363
+ o.get(a.unitId) && ((P = o.get(a.unitId)) == null || P.dispose()), o.set(a.unitId, g);
364
+ const n = a.with(x), c = a.with(ue);
365
+ g.add(this.registerEventHandler(
371
366
  this.Event.Scroll,
372
- () => _.validViewportScrollInfo$.subscribe((a) => {
373
- a && this.fireEvent(this.Event.Scroll, {
374
- workbook: h,
375
- worksheet: h.getActiveSheet(),
376
- ...a
367
+ () => n.validViewportScrollInfo$.subscribe((v) => {
368
+ v && this.fireEvent(this.Event.Scroll, {
369
+ workbook: s,
370
+ worksheet: s.getActiveSheet(),
371
+ ...v
377
372
  });
378
373
  })
379
- )), v.add(this.registerEventHandler(
374
+ )), g.add(this.registerEventHandler(
380
375
  this.Event.SelectionMoveStart,
381
- () => d.selectionMoveStart$.subscribe((a) => {
382
- var b;
376
+ () => c.selectionMoveStart$.subscribe((v) => {
377
+ var m;
383
378
  this.fireEvent(this.Event.SelectionMoveStart, {
384
- workbook: h,
385
- worksheet: h.getActiveSheet(),
386
- selections: (b = a == null ? void 0 : a.map((P) => P.range)) != null ? b : []
379
+ workbook: s,
380
+ worksheet: s.getActiveSheet(),
381
+ selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
387
382
  });
388
383
  })
389
- )), v.add(this.registerEventHandler(
384
+ )), g.add(this.registerEventHandler(
390
385
  this.Event.SelectionMoving,
391
- () => d.selectionMoving$.subscribe((a) => {
392
- var b;
386
+ () => c.selectionMoving$.subscribe((v) => {
387
+ var m;
393
388
  this.fireEvent(this.Event.SelectionMoving, {
394
- workbook: h,
395
- worksheet: h.getActiveSheet(),
396
- selections: (b = a == null ? void 0 : a.map((P) => P.range)) != null ? b : []
389
+ workbook: s,
390
+ worksheet: s.getActiveSheet(),
391
+ selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
397
392
  });
398
393
  })
399
- )), v.add(this.registerEventHandler(
394
+ )), g.add(this.registerEventHandler(
400
395
  this.Event.SelectionMoveEnd,
401
- () => d.selectionMoveEnd$.subscribe((a) => {
402
- var b;
396
+ () => c.selectionMoveEnd$.subscribe((v) => {
397
+ var m;
403
398
  this.fireEvent(this.Event.SelectionMoveEnd, {
404
- workbook: h,
405
- worksheet: h.getActiveSheet(),
406
- selections: (b = a == null ? void 0 : a.map((P) => P.range)) != null ? b : []
399
+ workbook: s,
400
+ worksheet: s.getActiveSheet(),
401
+ selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
407
402
  });
408
403
  })
409
- )), v.add(this.registerEventHandler(
404
+ )), g.add(this.registerEventHandler(
410
405
  this.Event.SelectionChanged,
411
- () => d.selectionChanged$.subscribe((a) => {
412
- var b;
406
+ () => c.selectionChanged$.subscribe((v) => {
407
+ var m;
413
408
  this.fireEvent(this.Event.SelectionChanged, {
414
- workbook: h,
415
- worksheet: h.getActiveSheet(),
416
- selections: (b = a == null ? void 0 : a.map((P) => P.range)) != null ? b : []
409
+ workbook: s,
410
+ worksheet: s.getActiveSheet(),
411
+ selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
417
412
  });
418
413
  })
419
- )), c = null, this.disposeWithMe(v);
420
- })), this.disposeWithMe(o.disposed$.subscribe((l) => {
421
- var C;
422
- (C = s.get(l)) == null || C.dispose(), s.delete(l);
414
+ )), a = null, this.disposeWithMe(g);
415
+ })), this.disposeWithMe(r.disposed$.subscribe((l) => {
416
+ var h;
417
+ (h = o.get(l)) == null || h.dispose(), o.delete(l);
423
418
  })), this.disposeWithMe(() => {
424
- s.forEach((l) => {
419
+ o.forEach((l) => {
425
420
  l.dispose();
426
421
  });
427
422
  });
@@ -431,13 +426,13 @@ class Ue extends te {
431
426
  */
432
427
  _initialize(e) {
433
428
  this._initSheetUIEvent(e), this._initObserverListener(e);
434
- const r = e.get(R);
429
+ const r = e.get(I);
435
430
  this.registerEventHandler(
436
431
  this.Event.BeforeClipboardChange,
437
432
  () => r.beforeCommandExecuted((t) => {
438
433
  switch (t.id) {
439
- case Y.id:
440
- case K.id:
434
+ case V.id:
435
+ case F.id:
441
436
  this._beforeClipboardChange();
442
437
  break;
443
438
  }
@@ -446,8 +441,8 @@ class Ue extends te {
446
441
  this.Event.ClipboardChanged,
447
442
  () => r.onCommandExecuted((t) => {
448
443
  switch (t.id) {
449
- case Y.id:
450
- case K.id:
444
+ case V.id:
445
+ case F.id:
451
446
  this._clipboardChanged();
452
447
  break;
453
448
  }
@@ -456,10 +451,10 @@ class Ue extends te {
456
451
  this.Event.BeforeClipboardPaste,
457
452
  () => r.beforeCommandExecuted((t) => {
458
453
  switch (t.id) {
459
- case V.id:
454
+ case L.id:
460
455
  this._beforeClipboardPaste(t.params);
461
456
  break;
462
- case X.id:
457
+ case Z.id:
463
458
  this._beforeClipboardPasteAsync();
464
459
  break;
465
460
  }
@@ -468,10 +463,10 @@ class Ue extends te {
468
463
  this.Event.ClipboardPasted,
469
464
  () => r.onCommandExecuted((t) => {
470
465
  switch (t.id) {
471
- case V.id:
466
+ case L.id:
472
467
  this._clipboardPaste(t.params);
473
468
  break;
474
- case X.id:
469
+ case Z.id:
475
470
  this._clipboardPasteAsync();
476
471
  break;
477
472
  }
@@ -479,12 +474,12 @@ class Ue extends te {
479
474
  ), this.registerEventHandler(
480
475
  this.Event.SheetSkeletonChanged,
481
476
  () => r.onCommandExecuted((t) => {
482
- if (Ce.indexOf(t.id) > -1) {
477
+ if (ve.indexOf(t.id) > -1) {
483
478
  const i = this.getActiveSheet();
484
479
  if (!i) return;
485
- const o = me(t, i.worksheet.getMaxColumns()).map((s) => {
486
- var c, g;
487
- return (g = (c = this.getWorkbook(s.unitId)) == null ? void 0 : c.getSheetBySheetId(s.subUnitId)) == null ? void 0 : g.getRange(s.range);
480
+ const o = Se(t, i.worksheet.getMaxColumns()).map((a) => {
481
+ var d, l;
482
+ return (l = (d = this.getWorkbook(a.unitId)) == null ? void 0 : d.getSheetBySheetId(a.subUnitId)) == null ? void 0 : l.getRange(a.range);
488
483
  }).filter(Boolean);
489
484
  if (!o.length) return;
490
485
  this.fireEvent(this.Event.SheetSkeletonChanged, {
@@ -502,15 +497,15 @@ class Ue extends te {
502
497
  const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet(), t = e == null ? void 0 : e.getActiveRange();
503
498
  if (!e || !r || !t)
504
499
  return;
505
- const o = this._injector.get(re).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
500
+ const o = this._injector.get(Q).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
506
501
  if (!o)
507
502
  return;
508
- const { html: s, plain: c } = o;
503
+ const { html: a, plain: d } = o;
509
504
  return {
510
505
  workbook: e,
511
506
  worksheet: r,
512
- text: c,
513
- html: s,
507
+ text: d,
508
+ html: a,
514
509
  fromSheet: r,
515
510
  fromRange: t
516
511
  };
@@ -518,7 +513,7 @@ class Ue extends te {
518
513
  _beforeClipboardChange() {
519
514
  const e = this._generateClipboardCopyParam();
520
515
  if (e && (this.fireEvent(this.Event.BeforeClipboardChange, e), e.cancel))
521
- throw new f();
516
+ throw new E();
522
517
  }
523
518
  _clipboardChanged() {
524
519
  const e = this._generateClipboardCopyParam();
@@ -539,56 +534,56 @@ class Ue extends te {
539
534
  const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet();
540
535
  if (!e || !r)
541
536
  return;
542
- const o = (await this._injector.get(Re).read())[0];
543
- let s;
537
+ const o = (await this._injector.get(Pe).read())[0];
538
+ let a;
544
539
  if (o) {
545
- const c = o.types, g = c.indexOf(J) !== -1 ? await o.getType(J).then((l) => l && l.text()) : "", u = c.indexOf(G) !== -1 ? await o.getType(G).then((l) => l && l.text()) : "";
546
- s = {
540
+ const d = o.types, l = d.indexOf(K) !== -1 ? await o.getType(K).then((g) => g && g.text()) : "", h = d.indexOf(Y) !== -1 ? await o.getType(Y).then((g) => g && g.text()) : "";
541
+ a = {
547
542
  workbook: e,
548
543
  worksheet: r,
549
- text: g,
550
- html: u
544
+ text: l,
545
+ html: h
551
546
  };
552
547
  }
553
- return s;
548
+ return a;
554
549
  }
555
550
  _beforeClipboardPaste(e) {
556
551
  const r = this._generateClipboardPasteParam(e);
557
552
  if (r && (this.fireEvent(this.Event.BeforeClipboardPaste, r), r.cancel))
558
- throw new f();
553
+ throw new E();
559
554
  }
560
555
  _clipboardPaste(e) {
561
556
  const r = this._generateClipboardPasteParam(e);
562
557
  if (r && (this.fireEvent(this.Event.ClipboardPasted, r), r.cancel))
563
- throw new f();
558
+ throw new E();
564
559
  }
565
560
  async _beforeClipboardPasteAsync() {
566
- if (!q()) {
567
- this._injector.get(T).warn("[Facade]: The navigator object only supports the browser environment");
561
+ if (!X()) {
562
+ this._injector.get(U).warn("[Facade]: The navigator object only supports the browser environment");
568
563
  return;
569
564
  }
570
565
  const e = await this._generateClipboardPasteParamAsync();
571
566
  if (e && (this.fireEvent(this.Event.BeforeClipboardPaste, e), e.cancel))
572
- throw new f();
567
+ throw new E();
573
568
  }
574
569
  async _clipboardPasteAsync() {
575
- if (!q()) {
576
- this._injector.get(T).warn("[Facade]: The navigator object only supports the browser environment");
570
+ if (!X()) {
571
+ this._injector.get(U).warn("[Facade]: The navigator object only supports the browser environment");
577
572
  return;
578
573
  }
579
574
  const e = await this._generateClipboardPasteParamAsync();
580
575
  if (e && (this.fireEvent(this.Event.ClipboardPasted, e), e.cancel))
581
- throw new f();
576
+ throw new E();
582
577
  }
583
578
  customizeColumnHeader(e) {
584
- var u, l;
579
+ var h, g;
585
580
  const r = this.getActiveWorkbook();
586
581
  if (!r) {
587
582
  console.error("WorkBook not exist");
588
583
  return;
589
584
  }
590
- const t = r == null ? void 0 : r.getId(), i = this._injector.get(m), o = r.getActiveSheet(), s = o.getSheetId(), c = i.getRenderById(t);
591
- c && ((u = e.headerStyle) != null && u.size) && (c.with(H).setColumnHeaderSize(c, s, (l = e.headerStyle) == null ? void 0 : l.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t, k.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
585
+ const t = r == null ? void 0 : r.getId(), i = this._injector.get(S), o = r.getActiveSheet(), a = o.getSheetId(), d = i.getRenderById(t);
586
+ d && ((h = e.headerStyle) != null && h.size) && (d.with(_).setColumnHeaderSize(d, a, (g = e.headerStyle) == null ? void 0 : g.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t, w.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
592
587
  }
593
588
  customizeRowHeader(e) {
594
589
  const r = this.getActiveWorkbook();
@@ -597,23 +592,23 @@ class Ue extends te {
597
592
  return;
598
593
  }
599
594
  const t = r == null ? void 0 : r.getId();
600
- this._getSheetRenderComponent(t, k.ROW).setCustomHeader(e);
595
+ this._getSheetRenderComponent(t, w.ROW).setCustomHeader(e);
601
596
  }
602
597
  registerSheetRowHeaderExtension(e, ...r) {
603
- const t = this._getSheetRenderComponent(e, k.ROW), i = t.register(...r);
604
- return E(() => {
598
+ const t = this._getSheetRenderComponent(e, w.ROW), i = t.register(...r);
599
+ return C(() => {
605
600
  i.dispose(), t.makeDirty(!0);
606
601
  });
607
602
  }
608
603
  registerSheetColumnHeaderExtension(e, ...r) {
609
- const t = this._getSheetRenderComponent(e, k.COLUMN), i = t.register(...r);
610
- return E(() => {
604
+ const t = this._getSheetRenderComponent(e, w.COLUMN), i = t.register(...r);
605
+ return C(() => {
611
606
  i.dispose(), t.makeDirty(!0);
612
607
  });
613
608
  }
614
609
  registerSheetMainExtension(e, ...r) {
615
- const t = this._getSheetRenderComponent(e, k.MAIN), i = t.register(...r);
616
- return E(() => {
610
+ const t = this._getSheetRenderComponent(e, w.MAIN), i = t.register(...r);
611
+ return C(() => {
617
612
  i.dispose(), t.makeDirty(!0);
618
613
  });
619
614
  }
@@ -625,30 +620,30 @@ class Ue extends te {
625
620
  * @returns {Nullable<RenderComponentType>} The render component.
626
621
  */
627
622
  _getSheetRenderComponent(e, r) {
628
- const i = this._injector.get(m).getRenderById(e);
623
+ const i = this._injector.get(S).getRenderById(e);
629
624
  if (!i)
630
625
  throw new Error(`Render Unit with unitId ${e} not found`);
631
- const { components: o } = i, s = o.get(r);
632
- if (!s)
626
+ const { components: o } = i, a = o.get(r);
627
+ if (!a)
633
628
  throw new Error("Render component not found");
634
- return s;
629
+ return a;
635
630
  }
636
631
  /**
637
632
  * Get sheet hooks.
638
633
  * @returns {FSheetHooks} FSheetHooks instance
639
634
  */
640
635
  getSheetHooks() {
641
- return this._injector.createInstance(O);
636
+ return this._injector.createInstance(W);
642
637
  }
643
638
  }
644
- te.extend(Ue);
645
- class xe extends ne {
639
+ q.extend(ye);
640
+ class Ue extends ee {
646
641
  openSiderbar(e) {
647
- return this._logDeprecation("openSiderbar"), this._injector.get(He).open(e);
642
+ return this._logDeprecation("openSiderbar"), this._injector.get(Re).open(e);
648
643
  }
649
644
  openDialog(e) {
650
645
  this._logDeprecation("openDialog");
651
- const t = this._injector.get(Me).open({
646
+ const t = this._injector.get(He).open({
652
647
  ...e,
653
648
  onClose: () => {
654
649
  t.dispose();
@@ -657,7 +652,7 @@ class xe extends ne {
657
652
  return t;
658
653
  }
659
654
  _logDeprecation(e) {
660
- this._injector.get(T).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
655
+ this._injector.get(U).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
661
656
  }
662
657
  generateCellParams(e) {
663
658
  const r = this.getActiveSheet();
@@ -669,69 +664,69 @@ class xe extends ne {
669
664
  };
670
665
  }
671
666
  onCellClick(e) {
672
- const r = this._injector.get(w);
673
- return E(
674
- r.currentClickedCell$.pipe(S((t) => !!t)).subscribe((t) => {
667
+ const r = this._injector.get(p);
668
+ return C(
669
+ r.currentClickedCell$.pipe(u((t) => !!t)).subscribe((t) => {
675
670
  e(t);
676
671
  })
677
672
  );
678
673
  }
679
674
  onCellHover(e) {
680
- const r = this._injector.get(w);
681
- return E(
682
- r.currentRichText$.pipe(S((t) => !!t)).subscribe(e)
675
+ const r = this._injector.get(p);
676
+ return C(
677
+ r.currentRichText$.pipe(u((t) => !!t)).subscribe(e)
683
678
  );
684
679
  }
685
680
  onCellPointerDown(e) {
686
- const r = this._injector.get(w);
687
- return E(
681
+ const r = this._injector.get(p);
682
+ return C(
688
683
  r.currentPointerDownCell$.subscribe(e)
689
684
  );
690
685
  }
691
686
  onCellPointerUp(e) {
692
- const r = this._injector.get(w);
693
- return E(
687
+ const r = this._injector.get(p);
688
+ return C(
694
689
  r.currentPointerUpCell$.subscribe(e)
695
690
  );
696
691
  }
697
692
  onCellPointerMove(e) {
698
- const r = this._injector.get(w);
699
- return E(
700
- r.currentCellPosWithEvent$.pipe(S((t) => !!t)).subscribe((t) => {
693
+ const r = this._injector.get(p);
694
+ return C(
695
+ r.currentCellPosWithEvent$.pipe(u((t) => !!t)).subscribe((t) => {
701
696
  e(t, t.event);
702
697
  })
703
698
  );
704
699
  }
705
700
  onDragOver(e) {
706
- const r = this._injector.get(U);
707
- return E(
708
- r.currentCell$.pipe(S((t) => !!t)).subscribe((t) => {
701
+ const r = this._injector.get(M);
702
+ return C(
703
+ r.currentCell$.pipe(u((t) => !!t)).subscribe((t) => {
709
704
  e(t);
710
705
  })
711
706
  );
712
707
  }
713
708
  onDrop(e) {
714
- const r = this._injector.get(U);
715
- return E(
716
- r.endCell$.pipe(S((t) => !!t)).subscribe((t) => {
709
+ const r = this._injector.get(M);
710
+ return C(
711
+ r.endCell$.pipe(u((t) => !!t)).subscribe((t) => {
717
712
  e(t);
718
713
  })
719
714
  );
720
715
  }
721
716
  startEditing() {
722
- return this._injector.get(R).syncExecuteCommand(I.id, {
717
+ return this._injector.get(I).syncExecuteCommand(f.id, {
723
718
  eventType: z.Dblclick,
724
719
  unitId: this._workbook.getUnitId(),
725
720
  visible: !0
726
721
  });
727
722
  }
728
723
  async endEditing(e) {
729
- return this._injector.get(R).syncExecuteCommand(I.id, {
724
+ return this._injector.get(I).syncExecuteCommand(f.id, {
730
725
  eventType: z.Keyboard,
731
- keycode: e ? B.ENTER : B.ESC,
726
+ keycode: e ? T.ENTER : T.ESC,
732
727
  visible: !1,
733
728
  unitId: this._workbook.getUnitId()
734
- }), await ce(0), !0;
729
+ }), await se(0), !0;
735
730
  }
736
731
  endEditingAsync(e = !0) {
737
732
  return this.endEditing(e);
@@ -746,41 +741,41 @@ class xe extends ne {
746
741
  * ```
747
742
  */
748
743
  getScrollStateBySheetId(e) {
749
- const r = this._workbook.getUnitId(), i = this._injector.get(m).getRenderById(r);
750
- return i ? i.with(D).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
744
+ const r = this._workbook.getUnitId(), i = this._injector.get(S).getRenderById(r);
745
+ return i ? i.with(x).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
751
746
  }
752
747
  disableSelection() {
753
- const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
754
- return t && t.with(x).disableSelection(), this;
748
+ const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
749
+ return t && t.with(y).disableSelection(), this;
755
750
  }
756
751
  enableSelection() {
757
- const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
758
- return t && t.with(x).enableSelection(), this;
752
+ const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
753
+ return t && t.with(y).enableSelection(), this;
759
754
  }
760
755
  transparentSelection() {
761
- const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
762
- return t && t.with(x).transparentSelection(), this;
756
+ const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
757
+ return t && t.with(y).transparentSelection(), this;
763
758
  }
764
759
  showSelection() {
765
- const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
766
- return t && t.with(x).showSelection(), this;
760
+ const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
761
+ return t && t.with(y).showSelection(), this;
767
762
  }
768
763
  }
769
- ne.extend(xe);
770
- class Te extends ie {
764
+ ee.extend(Ue);
765
+ class xe extends te {
771
766
  refreshCanvas() {
772
- const e = this._injector.get(m), r = this._fWorkbook.id, t = e.getRenderById(r);
767
+ const e = this._injector.get(S), r = this._fWorkbook.id, t = e.getRenderById(r);
773
768
  if (!t)
774
769
  throw new Error(`Render Unit with unitId ${r} not found`);
775
- t.with(H).reCalculate();
770
+ t.with(_).reCalculate();
776
771
  const i = t.mainComponent;
777
772
  if (!i)
778
773
  throw new Error("Main component not found");
779
774
  return i.makeDirty(), this;
780
775
  }
781
776
  zoom(e) {
782
- const r = this._injector.get(R), t = Math.min(Math.max(e, 0.1), 4);
783
- return r.executeCommand(j.id, {
777
+ const r = this._injector.get(I), t = Math.min(Math.max(e, 0.1), 4);
778
+ return r.executeCommand(A.id, {
784
779
  unitId: this._workbook.getUnitId(),
785
780
  subUnitId: this._worksheet.getSheetId(),
786
781
  zoomRatio: t
@@ -790,7 +785,7 @@ class Te extends ie {
790
785
  return this._worksheet.getZoomRatio();
791
786
  }
792
787
  getVisibleRange() {
793
- const e = this._workbook.getUnitId(), t = this._injector.get(m).getRenderById(e);
788
+ const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
794
789
  let i = {
795
790
  startColumn: 0,
796
791
  startRow: 0,
@@ -798,18 +793,18 @@ class Te extends ie {
798
793
  endRow: 0
799
794
  };
800
795
  if (!t) return i;
801
- const s = t.with(H).getCurrentSkeleton();
802
- if (!s) return i;
803
- const c = s == null ? void 0 : s.getVisibleRanges();
804
- if (!c) return i;
805
- i = s.getVisibleRangeByViewport(ue.VIEW_MAIN);
806
- for (const [g, u] of c)
807
- ve.indexOf(g) !== -1 && (i.startColumn = Math.min(i.startColumn, u.startColumn), i.startRow = Math.min(i.startRow, u.startRow), i.endColumn = Math.max(i.endColumn, u.endColumn), i.endRow = Math.max(i.endRow, u.endRow));
796
+ const a = t.with(_).getCurrentSkeleton();
797
+ if (!a) return i;
798
+ const d = a == null ? void 0 : a.getVisibleRanges();
799
+ if (!d) return i;
800
+ i = a.getVisibleRangeByViewport(le.VIEW_MAIN);
801
+ for (const [l, h] of d)
802
+ ge.indexOf(l) !== -1 && (i.startColumn = Math.min(i.startColumn, h.startColumn), i.startRow = Math.min(i.startRow, h.startRow), i.endColumn = Math.max(i.endColumn, h.endColumn), i.endRow = Math.max(i.endRow, h.endRow));
808
803
  return i;
809
804
  }
810
805
  scrollToCell(e, r) {
811
- const t = this._workbook.getUnitId(), o = this._injector.get(m).getRenderById(t);
812
- return o && (o == null ? void 0 : o.with(fe)).scrollToCell(e, r), this;
806
+ const t = this._workbook.getUnitId(), o = this._injector.get(S).getRenderById(t);
807
+ return o && (o == null ? void 0 : o.with(pe)).scrollToCell(e, r), this;
813
808
  }
814
809
  getScrollState() {
815
810
  const e = {
@@ -817,27 +812,30 @@ class Te extends ie {
817
812
  offsetY: 0,
818
813
  sheetViewStartColumn: 0,
819
814
  sheetViewStartRow: 0
820
- }, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(m).getRenderById(r);
821
- return o && o.with(D).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
815
+ }, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(S).getRenderById(r);
816
+ return o && o.with(x).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
822
817
  }
823
818
  onScroll(e) {
824
819
  var o;
825
- const r = this._workbook.getUnitId(), i = (o = this._injector.get(m).getRenderById(r)) == null ? void 0 : o.with(D);
820
+ const r = this._workbook.getUnitId(), i = (o = this._injector.get(S).getRenderById(r)) == null ? void 0 : o.with(x);
826
821
  if (i) {
827
- const s = i.validViewportScrollInfo$.subscribe((c) => {
828
- e(c);
822
+ const a = i.validViewportScrollInfo$.subscribe((d) => {
823
+ e(d);
829
824
  });
830
- return E(s);
825
+ return C(a);
831
826
  }
832
- return E(() => {
827
+ return C(() => {
833
828
  });
834
829
  }
835
830
  getSkeleton() {
836
831
  var r, t;
837
- const e = (r = this._injector.get(m).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(H);
832
+ const e = (r = this._injector.get(S).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(_);
838
833
  return (t = e == null ? void 0 : e.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : t.skeleton;
839
834
  }
840
- setColumnAutoWidth(e, r) {
835
+ autoResizeColumn(e) {
836
+ return this.autoResizeColumns(e, 1);
837
+ }
838
+ autoResizeColumns(e, r) {
841
839
  const t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
842
840
  {
843
841
  startColumn: e,
@@ -852,20 +850,38 @@ class Te extends ie {
852
850
  ranges: o
853
851
  }), this;
854
852
  }
853
+ setColumnAutoWidth(e, r) {
854
+ return this.autoResizeColumns(e, r);
855
+ }
856
+ autoResizeRows(e, r) {
857
+ const t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
858
+ {
859
+ startRow: e,
860
+ endRow: e + r - 1,
861
+ startColumn: 0,
862
+ endColumn: this._worksheet.getColumnCount() - 1
863
+ }
864
+ ];
865
+ return this._commandService.syncExecuteCommand(Ce.id, {
866
+ unitId: t,
867
+ subUnitId: i,
868
+ ranges: o
869
+ }), this;
870
+ }
855
871
  customizeColumnHeader(e) {
856
- var g, u;
857
- const r = this, t = this._fWorkbook.getId(), i = this._injector.get(m), o = r.getSheetId(), s = i.getRenderById(t);
858
- s && ((g = e.headerStyle) != null && g.size) && (s.with(H).setColumnHeaderSize(s, o, (u = e.headerStyle) == null ? void 0 : u.size), r == null || r.refreshCanvas());
859
- const c = this._getSheetRenderComponent(t, k.COLUMN);
860
- c && (c.setCustomHeader(e), r == null || r.refreshCanvas());
872
+ var l, h;
873
+ const r = this, t = this._fWorkbook.getId(), i = this._injector.get(S), o = r.getSheetId(), a = i.getRenderById(t);
874
+ a && ((l = e.headerStyle) != null && l.size) && (a.with(_).setColumnHeaderSize(a, o, (h = e.headerStyle) == null ? void 0 : h.size), r == null || r.refreshCanvas());
875
+ const d = this._getSheetRenderComponent(t, w.COLUMN);
876
+ d && (d.setCustomHeader(e), r == null || r.refreshCanvas());
861
877
  }
862
878
  customizeRowHeader(e) {
863
879
  const r = this._fWorkbook.getId();
864
- this._getSheetRenderComponent(r, k.ROW).setCustomHeader(e);
880
+ this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e);
865
881
  }
866
882
  setColumnHeaderHeight(e) {
867
883
  const r = this, t = this._fWorkbook.getId(), i = r.getSheetId();
868
- return this._commandService.executeCommand(ke.id, {
884
+ return this._commandService.executeCommand(fe.id, {
869
885
  unitId: t,
870
886
  subUnitId: i,
871
887
  size: e
@@ -873,12 +889,12 @@ class Te extends ie {
873
889
  }
874
890
  setRowHeaderWidth(e) {
875
891
  const r = this, t = this._fWorkbook.getId(), i = r.getSheetId();
876
- this._commandService.executeCommand(Ie.id, {
892
+ this._commandService.executeCommand(ke.id, {
877
893
  unitId: t,
878
894
  subUnitId: i,
879
895
  size: e
880
896
  });
881
- const o = this._getSheetRenderComponent(t, k.ROW);
897
+ const o = this._getSheetRenderComponent(t, w.ROW);
882
898
  return o && o.setCustomHeader({ headerStyle: { size: e } }), r == null || r.refreshCanvas(), this;
883
899
  }
884
900
  /**
@@ -889,39 +905,39 @@ class Te extends ie {
889
905
  * @returns {Nullable<RenderComponentType>} The render component.
890
906
  */
891
907
  _getSheetRenderComponent(e, r) {
892
- const i = this._injector.get(m).getRenderById(e);
908
+ const i = this._injector.get(S).getRenderById(e);
893
909
  if (!i)
894
910
  throw new Error(`Render Unit with unitId ${e} not found`);
895
- const { components: o } = i, s = o.get(r);
896
- if (!s)
911
+ const { components: o } = i, a = o.get(r);
912
+ if (!a)
897
913
  throw new Error("Render component not found");
898
- return s;
914
+ return a;
899
915
  }
900
916
  }
901
- ie.extend(Te);
902
- class De extends oe {
917
+ te.extend(xe);
918
+ class Te extends re {
903
919
  setPermissionDialogVisible(e) {
904
920
  this._permissionService.setShowComponents(e);
905
921
  }
906
922
  }
907
- oe.extend(De);
908
- class Be extends O {
923
+ re.extend(Te);
924
+ class De extends W {
909
925
  onCellPointerMove(e) {
910
- return E(this._injector.get(w).currentPosition$.subscribe(e));
926
+ return C(this._injector.get(p).currentPosition$.subscribe(e));
911
927
  }
912
928
  onCellPointerOver(e) {
913
- return E(this._injector.get(w).currentCell$.subscribe(e));
929
+ return C(this._injector.get(p).currentCell$.subscribe(e));
914
930
  }
915
931
  onCellDragOver(e) {
916
- return E(this._injector.get(U).currentCell$.subscribe(e));
932
+ return C(this._injector.get(M).currentCell$.subscribe(e));
917
933
  }
918
934
  onCellDrop(e) {
919
- return E(this._injector.get(U).endCell$.subscribe(e));
935
+ return C(this._injector.get(M).endCell$.subscribe(e));
920
936
  }
921
- onCellRender(e, r = de.Style, t = Ee.DATA_VALIDATION) {
922
- return this._injector.get(be).intercept(pe.CELL_CONTENT, {
937
+ onCellRender(e, r = ae.Style, t = me.DATA_VALIDATION) {
938
+ return this._injector.get(be).intercept(Ee.CELL_CONTENT, {
923
939
  effect: r,
924
- handler: (i, o, s) => s({
940
+ handler: (i, o, a) => a({
925
941
  ...i,
926
942
  customRender: [
927
943
  ...(i == null ? void 0 : i.customRender) || [],
@@ -932,27 +948,27 @@ class Be extends O {
932
948
  });
933
949
  }
934
950
  onBeforeCellEdit(e) {
935
- return this._injector.get(R).beforeCommandExecuted((r) => {
951
+ return this._injector.get(I).beforeCommandExecuted((r) => {
936
952
  const t = r.params;
937
- r.id === I.id && t.visible && e(t);
953
+ r.id === f.id && t.visible && e(t);
938
954
  });
939
955
  }
940
956
  onAfterCellEdit(e) {
941
- return this._injector.get(R).onCommandExecuted((r) => {
957
+ return this._injector.get(I).onCommandExecuted((r) => {
942
958
  const t = r.params;
943
- r.id === I.id && !t.visible && e(t);
959
+ r.id === f.id && !t.visible && e(t);
944
960
  });
945
961
  }
946
962
  }
947
- O.extend(Be);
948
- const y = {
963
+ W.extend(De);
964
+ const H = {
949
965
  CellClicked: "CellClicked",
950
966
  CellPointerDown: "CellPointerDown",
951
967
  CellPointerUp: "CellPointerUp",
952
968
  CellPointerMove: "CellPointerMove",
953
969
  CellHover: "CellHover"
954
970
  };
955
- class Ae {
971
+ class Be {
956
972
  get BeforeClipboardChange() {
957
973
  return "BeforeClipboardChange";
958
974
  }
@@ -981,19 +997,19 @@ class Ae {
981
997
  return "SheetEditEnded";
982
998
  }
983
999
  get CellClicked() {
984
- return y.CellClicked;
1000
+ return H.CellClicked;
985
1001
  }
986
1002
  get CellHover() {
987
- return y.CellHover;
1003
+ return H.CellHover;
988
1004
  }
989
1005
  get CellPointerDown() {
990
- return y.CellPointerDown;
1006
+ return H.CellPointerDown;
991
1007
  }
992
1008
  get CellPointerUp() {
993
- return y.CellPointerUp;
1009
+ return H.CellPointerUp;
994
1010
  }
995
1011
  get CellPointerMove() {
996
- return y.CellPointerMove;
1012
+ return H.CellPointerMove;
997
1013
  }
998
1014
  get DragOver() {
999
1015
  return "DragOver";
@@ -1050,32 +1066,32 @@ class Ae {
1050
1066
  return "SheetZoomChanged";
1051
1067
  }
1052
1068
  }
1053
- le.extend(Ae);
1054
- class $e extends se {
1069
+ de.extend(Be);
1070
+ class Ae extends ne {
1055
1071
  getCell() {
1056
- var c;
1057
- const e = this._injector.get(m), r = this._injector.get(T), t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = e.getRenderById(t), s = (c = o == null ? void 0 : o.with(H).getSkeletonParam(i)) == null ? void 0 : c.skeleton;
1058
- if (!s)
1072
+ var d;
1073
+ const e = this._injector.get(S), r = this._injector.get(U), t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = e.getRenderById(t), a = (d = o == null ? void 0 : o.with(_).getSkeletonParam(i)) == null ? void 0 : d.skeleton;
1074
+ if (!a)
1059
1075
  throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
1060
- return s.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
1076
+ return a.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
1061
1077
  }
1062
1078
  getCellRect() {
1063
1079
  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 };
1064
1080
  return { ...o, toJSON: () => JSON.stringify(o) };
1065
1081
  }
1066
1082
  generateHTML() {
1067
- var r;
1068
- const e = this._injector.get(re).generateCopyContent(
1083
+ var t;
1084
+ const r = this._injector.get(Q).generateCopyContent(
1069
1085
  this._workbook.getUnitId(),
1070
1086
  this._worksheet.getSheetId(),
1071
1087
  this._range
1072
1088
  );
1073
- return (r = e == null ? void 0 : e.html) != null ? r : "";
1089
+ return (t = r == null ? void 0 : r.html) != null ? t : "";
1074
1090
  }
1075
1091
  attachPopup(e) {
1076
- var s, c, g;
1077
- e.direction = (s = e.direction) != null ? s : "horizontal", e.extraProps = (c = e.extraProps) != null ? c : {}, e.offset = (g = e.offset) != null ? g : [0, 0];
1078
- const { key: r, disposableCollection: t } = ee(e, this._injector.get(Q)), o = this._injector.get(Z).attachPopupToCell(
1092
+ var a, d, l;
1093
+ e.direction = (a = e.direction) != null ? a : "horizontal", e.extraProps = (d = e.extraProps) != null ? d : {}, e.offset = (l = e.offset) != null ? l : [0, 0];
1094
+ const { key: r, disposableCollection: t } = G(e, this._injector.get(J)), o = this._injector.get(N).attachPopupToCell(
1079
1095
  this._range.startRow,
1080
1096
  this._range.startColumn,
1081
1097
  { ...e, componentKey: r },
@@ -1085,7 +1101,7 @@ class $e extends se {
1085
1101
  return o ? (t.add(o), t) : (t.dispose(), null);
1086
1102
  }
1087
1103
  attachAlertPopup(e) {
1088
- const r = this._injector.get(_e), t = {
1104
+ const r = this._injector.get(Ie), t = {
1089
1105
  workbook: this._workbook,
1090
1106
  worksheet: this._worksheet,
1091
1107
  row: this._range.startRow,
@@ -1115,9 +1131,9 @@ class $e extends se {
1115
1131
  });
1116
1132
  */
1117
1133
  attachRangePopup(e) {
1118
- var s, c, g;
1119
- e.direction = (s = e.direction) != null ? s : "top-center", e.extraProps = (c = e.extraProps) != null ? c : {}, e.offset = (g = e.offset) != null ? g : [0, 0];
1120
- const { key: r, disposableCollection: t } = ee(e, this._injector.get(Q)), o = this._injector.get(Z).attachRangePopup(
1134
+ var a, d, l;
1135
+ e.direction = (a = e.direction) != null ? a : "top-center", e.extraProps = (d = e.extraProps) != null ? d : {}, e.offset = (l = e.offset) != null ? l : [0, 0];
1136
+ const { key: r, disposableCollection: t } = G(e, this._injector.get(J)), o = this._injector.get(N).attachRangePopup(
1121
1137
  this._range,
1122
1138
  { ...e, componentKey: r },
1123
1139
  this.getUnitId(),
@@ -1126,24 +1142,24 @@ class $e extends se {
1126
1142
  return o ? (t.add(o), t) : (t.dispose(), null);
1127
1143
  }
1128
1144
  highlight(e, r) {
1129
- const t = this._injector.get(Pe), i = t.addShape({ range: this._range, style: e, primary: r });
1145
+ const t = this._injector.get(_e), i = t.addShape({ range: this._range, style: e, primary: r });
1130
1146
  if (!i)
1131
1147
  throw new Error("Failed to highlight current range");
1132
- return E(() => {
1148
+ return C(() => {
1133
1149
  t.removeShape(i);
1134
1150
  });
1135
1151
  }
1136
1152
  }
1137
- se.extend($e);
1138
- function ee(p, e) {
1139
- const { componentKey: r, isVue3: t } = p;
1153
+ ne.extend(Ae);
1154
+ function G(b, e) {
1155
+ const { componentKey: r, isVue3: t } = b;
1140
1156
  let i;
1141
- const o = new W();
1142
- return typeof r == "string" ? i = r : (i = `External_${he(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
1157
+ const o = new B();
1158
+ return typeof r == "string" ? i = r : (i = `External_${ce(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
1143
1159
  key: i,
1144
1160
  disposableCollection: o
1145
1161
  };
1146
1162
  }
1147
1163
  export {
1148
- ee as transformComponentKey
1164
+ G as transformComponentKey
1149
1165
  };