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