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