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