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