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