@univerjs/sheets-ui 0.5.2 → 0.5.3-nightly.202501041605
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 +25 -23
- package/lib/es/facade.js +261 -107
- package/lib/es/index.js +2918 -2875
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/set-scroll.command.d.ts +10 -0
- package/lib/types/facade/f-event.d.ts +121 -0
- package/lib/types/facade/f-univer.d.ts +11 -1
- package/lib/types/facade/f-workbook.d.ts +16 -10
- package/lib/types/facade/f-worksheet.d.ts +2 -2
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/scroll-manager.service.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +27 -25
- package/package.json +15 -39
- package/LICENSE +0 -176
package/lib/es/facade.js
CHANGED
|
@@ -1,11 +1,139 @@
|
|
|
1
|
-
import { FUniver as
|
|
2
|
-
import { IRenderManagerService as
|
|
3
|
-
import { SHEET_VIEW_KEY as
|
|
4
|
-
import { FSheetHooks as I, FWorkbook as
|
|
5
|
-
import { ISidebarService as
|
|
6
|
-
import { filter as
|
|
7
|
-
import { SheetInterceptorService as
|
|
8
|
-
class
|
|
1
|
+
import { FUniver as U, ICommandService as g, ILogService as b, toDisposable as s, awaitTime as H, InterceptorEffectEnum as N, FEventName as A, DisposableCollection as $, generateRandomId as V } from "@univerjs/core";
|
|
2
|
+
import { IRenderManagerService as a, DeviceInputEventType as w, SHEET_VIEWPORT_KEY as L, sheetContentViewportKeys as K } from "@univerjs/engine-render";
|
|
3
|
+
import { SheetPasteShortKeyCommand as k, ISheetClipboardService as T, SHEET_VIEW_KEY as u, HoverManagerService as h, SetCellEditVisibleOperation as v, SheetScrollManagerService as _, ISheetSelectionRenderService as m, SheetSkeletonManagerService as f, ChangeZoomRatioCommand as Y, SheetsScrollRenderController as z, DragManagerService as E, SheetCanvasPopManagerService as X, CellAlertManagerService as Z, IMarkSelectionService as J } from "@univerjs/sheets-ui";
|
|
4
|
+
import { FSheetHooks as I, FWorkbook as D, FWorksheet as W, FPermission as F, FRange as O } from "@univerjs/sheets/facade";
|
|
5
|
+
import { CutCommand as P, CopyCommand as y, PasteCommand as R, IClipboardInterfaceService as q, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as M, HTML_CLIPBOARD_MIME_TYPE as x, supportClipboardAPI as j, ISidebarService as G, IDialogService as Q, KeyCode as B, ComponentManager as ee } from "@univerjs/ui";
|
|
6
|
+
import { filter as S } from "rxjs";
|
|
7
|
+
import { SheetInterceptorService as te, INTERCEPTOR_POINT as re, InterceptCellContentPriority as ne } from "@univerjs/sheets";
|
|
8
|
+
class oe extends U {
|
|
9
|
+
_initialize(e) {
|
|
10
|
+
const t = e.get(g);
|
|
11
|
+
this.disposeWithMe(t.beforeCommandExecuted((r) => {
|
|
12
|
+
switch (r.id) {
|
|
13
|
+
case y.id:
|
|
14
|
+
case P.id:
|
|
15
|
+
this._beforeClipboardChange();
|
|
16
|
+
break;
|
|
17
|
+
case k.id:
|
|
18
|
+
this._beforeClipboardPaste(r.params);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
})), this.disposeWithMe(t.onCommandExecuted((r) => {
|
|
22
|
+
switch (r.id) {
|
|
23
|
+
case y.id:
|
|
24
|
+
case P.id:
|
|
25
|
+
this._clipboardChanged();
|
|
26
|
+
break;
|
|
27
|
+
case k.id:
|
|
28
|
+
this._clipboardPaste();
|
|
29
|
+
break;
|
|
30
|
+
case R.id:
|
|
31
|
+
this._clipboardPasteAsync();
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
})), this.disposeWithMe(t.beforeCommandExecuted(async (r) => {
|
|
35
|
+
switch (r.id) {
|
|
36
|
+
case R.id:
|
|
37
|
+
await this._beforeClipboardPasteAsync();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
_generateClipboardCopyParam() {
|
|
43
|
+
const e = this.getActiveUniverSheet(), t = e == null ? void 0 : e.getActiveSheet(), r = e == null ? void 0 : e.getActiveRange();
|
|
44
|
+
if (!e || !t || !r)
|
|
45
|
+
return;
|
|
46
|
+
const o = this._injector.get(T).generateCopyContent(e.getId(), t.getSheetId(), r.getRange());
|
|
47
|
+
if (!o)
|
|
48
|
+
return;
|
|
49
|
+
const { html: i, plain: c } = o;
|
|
50
|
+
return {
|
|
51
|
+
workbook: e,
|
|
52
|
+
worksheet: t,
|
|
53
|
+
text: c,
|
|
54
|
+
html: i,
|
|
55
|
+
fromSheet: t,
|
|
56
|
+
fromRange: r
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
_beforeClipboardChange() {
|
|
60
|
+
if (!this.hasEventCallback(this.Event.BeforeClipboardChange))
|
|
61
|
+
return;
|
|
62
|
+
const e = this._generateClipboardCopyParam();
|
|
63
|
+
if (e && (this.fireEvent(this.Event.BeforeClipboardChange, e), e.cancel))
|
|
64
|
+
throw new Error("Before clipboard change is canceled");
|
|
65
|
+
}
|
|
66
|
+
_clipboardChanged() {
|
|
67
|
+
if (!this.hasEventCallback(this.Event.ClipboardChanged))
|
|
68
|
+
return;
|
|
69
|
+
const e = this._generateClipboardCopyParam();
|
|
70
|
+
if (e && (this.fireEvent(this.Event.ClipboardChanged, e), e.cancel))
|
|
71
|
+
throw new Error("Clipboard changed is canceled");
|
|
72
|
+
}
|
|
73
|
+
_generateClipboardPasteParam(e) {
|
|
74
|
+
if (!e)
|
|
75
|
+
return;
|
|
76
|
+
const { htmlContent: t, textContent: r } = e, n = this.getActiveUniverSheet(), o = n == null ? void 0 : n.getActiveSheet();
|
|
77
|
+
return !n || !o ? void 0 : {
|
|
78
|
+
workbook: n,
|
|
79
|
+
worksheet: o,
|
|
80
|
+
text: r,
|
|
81
|
+
html: t
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async _generateClipboardPasteParamAsync() {
|
|
85
|
+
const e = this.getActiveUniverSheet(), t = e == null ? void 0 : e.getActiveSheet();
|
|
86
|
+
if (!e || !t)
|
|
87
|
+
return;
|
|
88
|
+
const o = (await this._injector.get(q).read())[0];
|
|
89
|
+
let i;
|
|
90
|
+
if (o) {
|
|
91
|
+
const c = o.types, C = c.indexOf(M) !== -1 ? await o.getType(M).then((p) => p && p.text()) : "", l = c.indexOf(x) !== -1 ? await o.getType(x).then((p) => p && p.text()) : "";
|
|
92
|
+
i = {
|
|
93
|
+
workbook: e,
|
|
94
|
+
worksheet: t,
|
|
95
|
+
text: C,
|
|
96
|
+
html: l
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return i;
|
|
100
|
+
}
|
|
101
|
+
_beforeClipboardPaste(e) {
|
|
102
|
+
if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
|
|
103
|
+
return;
|
|
104
|
+
const t = this._generateClipboardPasteParam(e);
|
|
105
|
+
if (t && (this.fireEvent(this.Event.BeforeClipboardPaste, t), t.cancel))
|
|
106
|
+
throw new Error("Before clipboard paste is canceled");
|
|
107
|
+
}
|
|
108
|
+
_clipboardPaste(e) {
|
|
109
|
+
if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
|
|
110
|
+
return;
|
|
111
|
+
const t = this._generateClipboardPasteParam(e);
|
|
112
|
+
if (t && (this.fireEvent(this.Event.BeforeClipboardPaste, t), t.cancel))
|
|
113
|
+
throw new Error("Clipboard pasted is canceled");
|
|
114
|
+
}
|
|
115
|
+
async _beforeClipboardPasteAsync() {
|
|
116
|
+
if (!this.hasEventCallback(this.Event.BeforeClipboardPaste))
|
|
117
|
+
return;
|
|
118
|
+
if (!j()) {
|
|
119
|
+
this._injector.get(b).warn("[Facade]: The navigator object only supports the browser environment");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const e = await this._generateClipboardPasteParamAsync();
|
|
123
|
+
if (e && (this.fireEvent(this.Event.BeforeClipboardPaste, e), e.cancel))
|
|
124
|
+
throw new Error("Before clipboard paste is canceled");
|
|
125
|
+
}
|
|
126
|
+
async _clipboardPasteAsync() {
|
|
127
|
+
if (!this.hasEventCallback(this.Event.ClipboardPasted))
|
|
128
|
+
return;
|
|
129
|
+
if (!j()) {
|
|
130
|
+
this._injector.get(b).warn("[Facade]: The navigator object only supports the browser environment");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const e = await this._generateClipboardPasteParamAsync();
|
|
134
|
+
if (e && (this.fireEvent(this.Event.ClipboardPasted, e), e.cancel))
|
|
135
|
+
throw new Error("Clipboard pasted is canceled");
|
|
136
|
+
}
|
|
9
137
|
customizeColumnHeader(e) {
|
|
10
138
|
const t = this.getActiveWorkbook();
|
|
11
139
|
if (!t) {
|
|
@@ -13,7 +141,7 @@ class Z extends b {
|
|
|
13
141
|
return;
|
|
14
142
|
}
|
|
15
143
|
const r = t == null ? void 0 : t.getId();
|
|
16
|
-
this._getSheetRenderComponent(r,
|
|
144
|
+
this._getSheetRenderComponent(r, u.COLUMN).setCustomHeader(e);
|
|
17
145
|
}
|
|
18
146
|
customizeRowHeader(e) {
|
|
19
147
|
const t = this.getActiveWorkbook();
|
|
@@ -22,23 +150,23 @@ class Z extends b {
|
|
|
22
150
|
return;
|
|
23
151
|
}
|
|
24
152
|
const r = t == null ? void 0 : t.getId();
|
|
25
|
-
this._getSheetRenderComponent(r,
|
|
153
|
+
this._getSheetRenderComponent(r, u.ROW).setCustomHeader(e);
|
|
26
154
|
}
|
|
27
155
|
registerSheetRowHeaderExtension(e, ...t) {
|
|
28
|
-
const r = this._getSheetRenderComponent(e,
|
|
29
|
-
return
|
|
156
|
+
const r = this._getSheetRenderComponent(e, u.ROW), n = r.register(...t);
|
|
157
|
+
return s(() => {
|
|
30
158
|
n.dispose(), r.makeDirty(!0);
|
|
31
159
|
});
|
|
32
160
|
}
|
|
33
161
|
registerSheetColumnHeaderExtension(e, ...t) {
|
|
34
|
-
const r = this._getSheetRenderComponent(e,
|
|
35
|
-
return
|
|
162
|
+
const r = this._getSheetRenderComponent(e, u.COLUMN), n = r.register(...t);
|
|
163
|
+
return s(() => {
|
|
36
164
|
n.dispose(), r.makeDirty(!0);
|
|
37
165
|
});
|
|
38
166
|
}
|
|
39
167
|
registerSheetMainExtension(e, ...t) {
|
|
40
|
-
const r = this._getSheetRenderComponent(e,
|
|
41
|
-
return
|
|
168
|
+
const r = this._getSheetRenderComponent(e, u.MAIN), n = r.register(...t);
|
|
169
|
+
return s(() => {
|
|
42
170
|
n.dispose(), r.makeDirty(!0);
|
|
43
171
|
});
|
|
44
172
|
}
|
|
@@ -52,13 +180,13 @@ class Z extends b {
|
|
|
52
180
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
53
181
|
*/
|
|
54
182
|
_getSheetRenderComponent(e, t) {
|
|
55
|
-
const n = this._injector.get(
|
|
183
|
+
const n = this._injector.get(a).getRenderById(e);
|
|
56
184
|
if (!n)
|
|
57
185
|
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
58
|
-
const { components: o } = n,
|
|
59
|
-
if (!
|
|
186
|
+
const { components: o } = n, i = o.get(t);
|
|
187
|
+
if (!i)
|
|
60
188
|
throw new Error("Render component not found");
|
|
61
|
-
return
|
|
189
|
+
return i;
|
|
62
190
|
}
|
|
63
191
|
/**
|
|
64
192
|
* Get sheet hooks.
|
|
@@ -69,14 +197,14 @@ class Z extends b {
|
|
|
69
197
|
return this._injector.createInstance(I);
|
|
70
198
|
}
|
|
71
199
|
}
|
|
72
|
-
|
|
73
|
-
class
|
|
200
|
+
U.extend(oe);
|
|
201
|
+
class ie extends D {
|
|
74
202
|
openSiderbar(e) {
|
|
75
|
-
return this._logDeprecation("openSiderbar"), this._injector.get(
|
|
203
|
+
return this._logDeprecation("openSiderbar"), this._injector.get(G).open(e);
|
|
76
204
|
}
|
|
77
205
|
openDialog(e) {
|
|
78
206
|
this._logDeprecation("openDialog");
|
|
79
|
-
const r = this._injector.get(
|
|
207
|
+
const r = this._injector.get(Q).open({
|
|
80
208
|
...e,
|
|
81
209
|
onClose: () => {
|
|
82
210
|
r.dispose();
|
|
@@ -85,100 +213,111 @@ class J extends R {
|
|
|
85
213
|
return r;
|
|
86
214
|
}
|
|
87
215
|
_logDeprecation(e) {
|
|
88
|
-
this._injector.get(
|
|
216
|
+
this._injector.get(b).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
|
|
89
217
|
}
|
|
90
218
|
onCellClick(e) {
|
|
91
|
-
const t = this._injector.get(
|
|
92
|
-
return
|
|
93
|
-
t.currentClickedCell$.pipe(
|
|
219
|
+
const t = this._injector.get(h);
|
|
220
|
+
return s(
|
|
221
|
+
t.currentClickedCell$.pipe(S((r) => !!r)).subscribe(e)
|
|
94
222
|
);
|
|
95
223
|
}
|
|
96
224
|
onCellHover(e) {
|
|
97
|
-
const t = this._injector.get(
|
|
98
|
-
return
|
|
99
|
-
t.currentRichText$.pipe(
|
|
225
|
+
const t = this._injector.get(h);
|
|
226
|
+
return s(
|
|
227
|
+
t.currentRichText$.pipe(S((r) => !!r)).subscribe(e)
|
|
100
228
|
);
|
|
101
229
|
}
|
|
102
230
|
onCellPointerDown(e) {
|
|
103
|
-
const t = this._injector.get(
|
|
104
|
-
return
|
|
231
|
+
const t = this._injector.get(h);
|
|
232
|
+
return s(
|
|
105
233
|
t.currentPointerDownCell$.subscribe(e)
|
|
106
234
|
);
|
|
107
235
|
}
|
|
108
236
|
onCellPointerUp(e) {
|
|
109
|
-
const t = this._injector.get(
|
|
110
|
-
return
|
|
237
|
+
const t = this._injector.get(h);
|
|
238
|
+
return s(
|
|
111
239
|
t.currentPointerUpCell$.subscribe(e)
|
|
112
240
|
);
|
|
113
241
|
}
|
|
114
242
|
onPointerMove(e) {
|
|
115
|
-
const t = this._injector.get(
|
|
116
|
-
return
|
|
117
|
-
t.currentCellPosWithEvent$.pipe(
|
|
243
|
+
const t = this._injector.get(h);
|
|
244
|
+
return s(
|
|
245
|
+
t.currentCellPosWithEvent$.pipe(S((r) => !!r)).subscribe((r) => {
|
|
118
246
|
e(r, r.event.buttons);
|
|
119
247
|
})
|
|
120
248
|
);
|
|
121
249
|
}
|
|
122
250
|
startEditing() {
|
|
123
|
-
return this._injector.get(
|
|
124
|
-
eventType:
|
|
251
|
+
return this._injector.get(g).syncExecuteCommand(v.id, {
|
|
252
|
+
eventType: w.Dblclick,
|
|
125
253
|
unitId: this._workbook.getUnitId(),
|
|
126
254
|
visible: !0
|
|
127
255
|
});
|
|
128
256
|
}
|
|
129
257
|
async endEditing(e) {
|
|
130
|
-
return this._injector.get(
|
|
131
|
-
eventType:
|
|
132
|
-
keycode: e ?
|
|
258
|
+
return this._injector.get(g).syncExecuteCommand(v.id, {
|
|
259
|
+
eventType: w.Keyboard,
|
|
260
|
+
keycode: e ? B.ENTER : B.ESC,
|
|
133
261
|
visible: !1,
|
|
134
262
|
unitId: this._workbook.getUnitId()
|
|
135
|
-
}), await
|
|
263
|
+
}), await H(0), !0;
|
|
136
264
|
}
|
|
265
|
+
endEditingAsync(e = !0) {
|
|
266
|
+
return this.endEditing(e);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get scroll state of specified sheet.
|
|
270
|
+
* @returns {IScrollState} scroll state
|
|
271
|
+
* @example
|
|
272
|
+
* ``` ts
|
|
273
|
+
* univerAPI.getActiveWorkbook().getScrollStateBySheetId($sheetId)
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
137
276
|
getScrollStateBySheetId(e) {
|
|
138
|
-
const t = this._workbook.getUnitId(), n = this._injector.get(
|
|
139
|
-
return n ? n.with(
|
|
277
|
+
const t = this._workbook.getUnitId(), n = this._injector.get(a).getRenderById(t);
|
|
278
|
+
return n ? n.with(_).getScrollStateByParam({ unitId: t, sheetId: e }) : null;
|
|
140
279
|
}
|
|
141
280
|
disableSelection() {
|
|
142
|
-
const e = this._workbook.getUnitId(), r = this._injector.get(
|
|
143
|
-
r && r.with(
|
|
281
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(a).getRenderById(e);
|
|
282
|
+
r && r.with(m).disableSelection();
|
|
144
283
|
}
|
|
145
284
|
enableSelection() {
|
|
146
|
-
const e = this._workbook.getUnitId(), r = this._injector.get(
|
|
147
|
-
r && r.with(
|
|
285
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(a).getRenderById(e);
|
|
286
|
+
r && r.with(m).enableSelection();
|
|
148
287
|
}
|
|
149
288
|
transparentSelection() {
|
|
150
|
-
const e = this._workbook.getUnitId(), r = this._injector.get(
|
|
151
|
-
r && r.with(
|
|
289
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(a).getRenderById(e);
|
|
290
|
+
r && r.with(m).transparentSelection();
|
|
152
291
|
}
|
|
153
292
|
showSelection() {
|
|
154
|
-
const e = this._workbook.getUnitId(), r = this._injector.get(
|
|
155
|
-
r && r.with(
|
|
293
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(a).getRenderById(e);
|
|
294
|
+
r && r.with(m).showSelection();
|
|
156
295
|
}
|
|
157
296
|
}
|
|
158
|
-
|
|
159
|
-
class
|
|
297
|
+
D.extend(ie);
|
|
298
|
+
class se extends W {
|
|
160
299
|
refreshCanvas() {
|
|
161
|
-
const e = this._injector.get(
|
|
300
|
+
const e = this._injector.get(a), t = this._fWorkbook.id, r = e.getRenderById(t);
|
|
162
301
|
if (!r)
|
|
163
302
|
throw new Error(`Render Unit with unitId ${t} not found`);
|
|
164
|
-
r.with(
|
|
303
|
+
r.with(f).reCalculate();
|
|
165
304
|
const n = r.mainComponent;
|
|
166
305
|
if (!n)
|
|
167
306
|
throw new Error("Main component not found");
|
|
168
307
|
n.makeDirty();
|
|
169
308
|
}
|
|
170
309
|
zoom(e) {
|
|
171
|
-
return this._injector.get(
|
|
310
|
+
return this._injector.get(g).syncExecuteCommand(Y.id, {
|
|
172
311
|
unitId: this._workbook.getUnitId(),
|
|
173
312
|
subUnitId: this._worksheet.getSheetId(),
|
|
174
313
|
zoomRatio: e
|
|
175
|
-
});
|
|
314
|
+
}), this;
|
|
176
315
|
}
|
|
177
316
|
getZoom() {
|
|
178
317
|
return this._worksheet.getZoomRatio();
|
|
179
318
|
}
|
|
180
319
|
getVisibleRange() {
|
|
181
|
-
const e = this._workbook.getUnitId(), r = this._injector.get(
|
|
320
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(a).getRenderById(e);
|
|
182
321
|
let n = {
|
|
183
322
|
startColumn: 0,
|
|
184
323
|
startRow: 0,
|
|
@@ -186,60 +325,60 @@ class X extends M {
|
|
|
186
325
|
endRow: 0
|
|
187
326
|
};
|
|
188
327
|
if (!r) return n;
|
|
189
|
-
const
|
|
190
|
-
if (!
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
n =
|
|
194
|
-
for (const [
|
|
195
|
-
|
|
328
|
+
const i = r.with(f).getCurrentSkeleton();
|
|
329
|
+
if (!i) return n;
|
|
330
|
+
const c = i == null ? void 0 : i.getVisibleRanges();
|
|
331
|
+
if (!c) return n;
|
|
332
|
+
n = i.getVisibleRangeByViewport(L.VIEW_MAIN);
|
|
333
|
+
for (const [C, l] of c)
|
|
334
|
+
K.indexOf(C) !== -1 && (n.startColumn = Math.min(n.startColumn, l.startColumn), n.startRow = Math.min(n.startRow, l.startRow), n.endColumn = Math.max(n.endColumn, l.endColumn), n.endRow = Math.max(n.endRow, l.endRow));
|
|
196
335
|
return n;
|
|
197
336
|
}
|
|
198
337
|
scrollToCell(e, t) {
|
|
199
|
-
const r = this._workbook.getUnitId(), o = this._injector.get(
|
|
200
|
-
o && (o == null ? void 0 : o.with(
|
|
338
|
+
const r = this._workbook.getUnitId(), o = this._injector.get(a).getRenderById(r);
|
|
339
|
+
o && (o == null ? void 0 : o.with(z)).scrollToCell(e, t);
|
|
201
340
|
}
|
|
202
341
|
getScrollState() {
|
|
203
|
-
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(
|
|
204
|
-
return n ? n.with(
|
|
342
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(a).getRenderById(e);
|
|
343
|
+
return n ? n.with(_).getScrollStateByParam({ unitId: e, sheetId: t }) : null;
|
|
205
344
|
}
|
|
206
345
|
onScroll(e) {
|
|
207
346
|
var o;
|
|
208
|
-
const t = this._workbook.getUnitId(), n = (o = this._injector.get(
|
|
347
|
+
const t = this._workbook.getUnitId(), n = (o = this._injector.get(a).getRenderById(t)) == null ? void 0 : o.with(_);
|
|
209
348
|
if (n) {
|
|
210
|
-
const
|
|
211
|
-
e(
|
|
349
|
+
const i = n.validViewportScrollInfo$.subscribe((c) => {
|
|
350
|
+
e(c);
|
|
212
351
|
});
|
|
213
|
-
return i
|
|
352
|
+
return s(i);
|
|
214
353
|
}
|
|
215
|
-
return
|
|
354
|
+
return s(() => {
|
|
216
355
|
});
|
|
217
356
|
}
|
|
218
357
|
}
|
|
219
|
-
|
|
220
|
-
class
|
|
358
|
+
W.extend(se);
|
|
359
|
+
class ae extends F {
|
|
221
360
|
setPermissionDialogVisible(e) {
|
|
222
361
|
this._permissionService.setShowComponents(e);
|
|
223
362
|
}
|
|
224
363
|
}
|
|
225
|
-
|
|
226
|
-
class
|
|
364
|
+
F.extend(ae);
|
|
365
|
+
class ce extends I {
|
|
227
366
|
onCellPointerMove(e) {
|
|
228
|
-
return
|
|
367
|
+
return s(this._injector.get(h).currentPosition$.subscribe(e));
|
|
229
368
|
}
|
|
230
369
|
onCellPointerOver(e) {
|
|
231
|
-
return
|
|
370
|
+
return s(this._injector.get(h).currentCell$.subscribe(e));
|
|
232
371
|
}
|
|
233
372
|
onCellDragOver(e) {
|
|
234
|
-
return
|
|
373
|
+
return s(this._injector.get(E).currentCell$.subscribe(e));
|
|
235
374
|
}
|
|
236
375
|
onCellDrop(e) {
|
|
237
|
-
return
|
|
376
|
+
return s(this._injector.get(E).endCell$.subscribe(e));
|
|
238
377
|
}
|
|
239
|
-
onCellRender(e, t =
|
|
240
|
-
return this._injector.get(
|
|
378
|
+
onCellRender(e, t = N.Style, r = ne.DATA_VALIDATION) {
|
|
379
|
+
return this._injector.get(te).intercept(re.CELL_CONTENT, {
|
|
241
380
|
effect: t,
|
|
242
|
-
handler: (n, o,
|
|
381
|
+
handler: (n, o, i) => i({
|
|
243
382
|
...n,
|
|
244
383
|
customRender: [
|
|
245
384
|
...(n == null ? void 0 : n.customRender) || [],
|
|
@@ -250,23 +389,38 @@ class G extends I {
|
|
|
250
389
|
});
|
|
251
390
|
}
|
|
252
391
|
onBeforeCellEdit(e) {
|
|
253
|
-
return this._injector.get(
|
|
392
|
+
return this._injector.get(g).beforeCommandExecuted((t) => {
|
|
254
393
|
const r = t.params;
|
|
255
|
-
t.id ===
|
|
394
|
+
t.id === v.id && r.visible && e(r);
|
|
256
395
|
});
|
|
257
396
|
}
|
|
258
397
|
onAfterCellEdit(e) {
|
|
259
|
-
return this._injector.get(
|
|
398
|
+
return this._injector.get(g).onCommandExecuted((t) => {
|
|
260
399
|
const r = t.params;
|
|
261
|
-
t.id ===
|
|
400
|
+
t.id === v.id && !r.visible && e(r);
|
|
262
401
|
});
|
|
263
402
|
}
|
|
264
403
|
}
|
|
265
|
-
I.extend(
|
|
266
|
-
class
|
|
404
|
+
I.extend(ce);
|
|
405
|
+
class de extends A {
|
|
406
|
+
get BeforeClipboardChange() {
|
|
407
|
+
return "BeforeClipboardChange";
|
|
408
|
+
}
|
|
409
|
+
get ClipboardChanged() {
|
|
410
|
+
return "ClipboardChanged";
|
|
411
|
+
}
|
|
412
|
+
get BeforeClipboardPaste() {
|
|
413
|
+
return "BeforeClipboardPaste";
|
|
414
|
+
}
|
|
415
|
+
get ClipboardPasted() {
|
|
416
|
+
return "ClipboardPasted";
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
A.extend(de);
|
|
420
|
+
class he extends O {
|
|
267
421
|
getCell() {
|
|
268
|
-
const e = this._injector.get(
|
|
269
|
-
return e.getRenderById(t).with(
|
|
422
|
+
const e = this._injector.get(a), t = this._workbook.getUnitId(), r = this._worksheet.getSheetId();
|
|
423
|
+
return e.getRenderById(t).with(f).getWorksheetSkeleton(r).skeleton.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
|
|
270
424
|
}
|
|
271
425
|
getCellRect() {
|
|
272
426
|
const { startX: e, startY: t, endX: r, endY: n } = this.getCell(), o = { x: e, y: t, width: r - e, height: n - t, top: t, left: e, bottom: n, right: r };
|
|
@@ -274,7 +428,7 @@ class Q extends y {
|
|
|
274
428
|
}
|
|
275
429
|
generateHTML() {
|
|
276
430
|
var t;
|
|
277
|
-
const e = this._injector.get(
|
|
431
|
+
const e = this._injector.get(T).generateCopyContent(
|
|
278
432
|
this._workbook.getUnitId(),
|
|
279
433
|
this._worksheet.getSheetId(),
|
|
280
434
|
this._range
|
|
@@ -282,7 +436,7 @@ class Q extends y {
|
|
|
282
436
|
return (t = e == null ? void 0 : e.html) != null ? t : "";
|
|
283
437
|
}
|
|
284
438
|
attachPopup(e) {
|
|
285
|
-
const { key: t, disposableCollection: r } =
|
|
439
|
+
const { key: t, disposableCollection: r } = le(e, this._injector.get(ee)), o = this._injector.get(X).attachPopupToCell(
|
|
286
440
|
this._range.startRow,
|
|
287
441
|
this._range.startColumn,
|
|
288
442
|
{ ...e, componentKey: t },
|
|
@@ -292,7 +446,7 @@ class Q extends y {
|
|
|
292
446
|
return o ? (r.add(o), r) : (r.dispose(), null);
|
|
293
447
|
}
|
|
294
448
|
attachAlertPopup(e) {
|
|
295
|
-
const t = this._injector.get(
|
|
449
|
+
const t = this._injector.get(Z), r = {
|
|
296
450
|
workbook: this._workbook,
|
|
297
451
|
worksheet: this._worksheet,
|
|
298
452
|
row: this._range.startRow,
|
|
@@ -310,24 +464,24 @@ class Q extends y {
|
|
|
310
464
|
};
|
|
311
465
|
}
|
|
312
466
|
highlight(e, t) {
|
|
313
|
-
const r = this._injector.get(
|
|
467
|
+
const r = this._injector.get(J), n = r.addShape({ range: this._range, style: e, primary: t });
|
|
314
468
|
if (!n)
|
|
315
469
|
throw new Error("Failed to highlight current range");
|
|
316
|
-
return
|
|
470
|
+
return s(() => {
|
|
317
471
|
r.removeShape(n);
|
|
318
472
|
});
|
|
319
473
|
}
|
|
320
474
|
}
|
|
321
|
-
|
|
322
|
-
function
|
|
323
|
-
const { componentKey: t, isVue3: r } =
|
|
475
|
+
O.extend(he);
|
|
476
|
+
function le(d, e) {
|
|
477
|
+
const { componentKey: t, isVue3: r } = d;
|
|
324
478
|
let n;
|
|
325
|
-
const o = new
|
|
326
|
-
return typeof t == "string" ? n = t : (n = `External_${
|
|
479
|
+
const o = new $();
|
|
480
|
+
return typeof t == "string" ? n = t : (n = `External_${V(6)}`, o.add(e.register(n, t, { framework: r ? "vue3" : "react" }))), {
|
|
327
481
|
key: n,
|
|
328
482
|
disposableCollection: o
|
|
329
483
|
};
|
|
330
484
|
}
|
|
331
485
|
export {
|
|
332
|
-
|
|
486
|
+
le as transformComponentKey
|
|
333
487
|
};
|