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