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