@univerjs/sheets-ui 0.5.1 → 0.5.2-nightly.202412281605
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 +52 -30
- package/lib/es/facade.js +180 -237
- package/lib/es/index.js +20005 -19632
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/__tests__/create-sheet-skeleton-test-bed.d.ts +22 -0
- package/lib/types/commands/commands/__tests__/sheet-skeleton.spec.d.ts +16 -0
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +2 -1
- package/lib/types/commands/commands/auto-fill.command.d.ts +2 -2
- package/lib/types/commands/commands/set-selection.command.d.ts +2 -2
- package/lib/types/controllers/auto-fill.controller.d.ts +0 -3
- package/lib/types/controllers/clipboard/clipboard.controller.d.ts +0 -4
- package/lib/types/controllers/clipboard/utils.d.ts +4 -0
- package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -1
- package/lib/types/controllers/hover-render.controller.d.ts +1 -1
- package/lib/types/controllers/move-range.controller.d.ts +1 -1
- package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +10 -3
- package/lib/types/facade/f-workbook.d.ts +67 -3
- package/lib/types/facade/f-worksheet.d.ts +63 -0
- package/lib/types/index.d.ts +61 -66
- package/lib/types/services/auto-fill/auto-fill.service.d.ts +7 -6
- package/lib/types/services/cell-alert-manager.service.d.ts +3 -3
- package/lib/types/services/clipboard/__tests__/clipboard-test-bed.d.ts +1 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +5 -3
- package/lib/types/services/clipboard/copy-content-cache.d.ts +1 -0
- package/lib/types/services/clipboard/html-to-usm/utils.d.ts +1 -0
- package/lib/types/services/clipboard/type.d.ts +1 -0
- package/lib/types/services/hover-manager.service.d.ts +27 -3
- package/lib/types/services/mark-selection/mark-selection.service.d.ts +3 -1
- package/lib/types/services/scroll-manager.service.d.ts +5 -6
- package/lib/types/services/selection/base-selection-render.service.d.ts +21 -9
- package/lib/types/services/selection/mobile-selection-render.service.d.ts +1 -1
- package/lib/types/services/selection/selection-control.d.ts +20 -6
- package/lib/types/services/selection/selection-render-model.d.ts +0 -1
- package/lib/types/services/selection/selection-render.service.d.ts +12 -3
- package/lib/types/services/selection/selection-shape-extension.d.ts +1 -1
- package/lib/types/services/shortcut-experience.service.d.ts +0 -1
- package/lib/types/services/utils/doc-skeleton-util.d.ts +1 -1
- package/lib/types/services/utils/drawing-position-util.d.ts +35 -0
- package/lib/types/views/defined-name/component-name.d.ts +0 -1
- package/lib/types/views/permission/panel-detail/PermissionDetailMainPart.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +50 -28
- package/package.json +16 -15
- package/LICENSE +0 -176
package/lib/es/facade.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { filter as w, BehaviorSubject as x } from "rxjs";
|
|
10
|
-
import { SheetInterceptorService as G, INTERCEPTOR_POINT as Q, InterceptCellContentPriority as Z } from "@univerjs/sheets";
|
|
11
|
-
class ee extends y {
|
|
1
|
+
import { FUniver as b, toDisposable as i, ILogService as x, ICommandService as h, awaitTime as j, InterceptorEffectEnum as U, DisposableCollection as P, generateRandomId as D } from "@univerjs/core";
|
|
2
|
+
import { IRenderManagerService as c, DeviceInputEventType as _, SHEET_VIEWPORT_KEY as B, sheetContentViewportKeys as T } from "@univerjs/engine-render";
|
|
3
|
+
import { SHEET_VIEW_KEY as l, HoverManagerService as d, SetCellEditVisibleOperation as m, SheetScrollManagerService as v, ISheetSelectionRenderService as S, SheetSkeletonManagerService as C, ChangeZoomRatioCommand as W, SheetsScrollRenderController as F, DragManagerService as k, ISheetClipboardService as O, SheetCanvasPopManagerService as A, CellAlertManagerService as H, IMarkSelectionService as $ } from "@univerjs/sheets-ui";
|
|
4
|
+
import { FSheetHooks as I, FWorkbook as R, FWorksheet as M, FPermission as f, FRange as y } from "@univerjs/sheets/facade";
|
|
5
|
+
import { ISidebarService as V, IDialogService as N, KeyCode as w, ComponentManager as K } from "@univerjs/ui";
|
|
6
|
+
import { filter as p } from "rxjs";
|
|
7
|
+
import { SheetInterceptorService as L, INTERCEPTOR_POINT as Y, InterceptCellContentPriority as z } from "@univerjs/sheets";
|
|
8
|
+
class Z extends b {
|
|
12
9
|
customizeColumnHeader(e) {
|
|
13
10
|
const t = this.getActiveWorkbook();
|
|
14
11
|
if (!t) {
|
|
15
12
|
console.error("WorkBook not exist");
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
18
|
-
const
|
|
19
|
-
this._getSheetRenderComponent(
|
|
15
|
+
const r = t == null ? void 0 : t.getId();
|
|
16
|
+
this._getSheetRenderComponent(r, l.COLUMN).setCustomHeader(e);
|
|
20
17
|
}
|
|
21
18
|
customizeRowHeader(e) {
|
|
22
19
|
const t = this.getActiveWorkbook();
|
|
@@ -24,25 +21,25 @@ class ee extends y {
|
|
|
24
21
|
console.error("WorkBook not exist");
|
|
25
22
|
return;
|
|
26
23
|
}
|
|
27
|
-
const
|
|
28
|
-
this._getSheetRenderComponent(
|
|
24
|
+
const r = t == null ? void 0 : t.getId();
|
|
25
|
+
this._getSheetRenderComponent(r, l.ROW).setCustomHeader(e);
|
|
29
26
|
}
|
|
30
27
|
registerSheetRowHeaderExtension(e, ...t) {
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
|
|
28
|
+
const r = this._getSheetRenderComponent(e, l.ROW), n = r.register(...t);
|
|
29
|
+
return i(() => {
|
|
30
|
+
n.dispose(), r.makeDirty(!0);
|
|
34
31
|
});
|
|
35
32
|
}
|
|
36
33
|
registerSheetColumnHeaderExtension(e, ...t) {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
|
|
34
|
+
const r = this._getSheetRenderComponent(e, l.COLUMN), n = r.register(...t);
|
|
35
|
+
return i(() => {
|
|
36
|
+
n.dispose(), r.makeDirty(!0);
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
39
|
registerSheetMainExtension(e, ...t) {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
|
|
40
|
+
const r = this._getSheetRenderComponent(e, l.MAIN), n = r.register(...t);
|
|
41
|
+
return i(() => {
|
|
42
|
+
n.dispose(), r.makeDirty(!0);
|
|
46
43
|
});
|
|
47
44
|
}
|
|
48
45
|
/**
|
|
@@ -55,13 +52,13 @@ class ee extends y {
|
|
|
55
52
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
56
53
|
*/
|
|
57
54
|
_getSheetRenderComponent(e, t) {
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
55
|
+
const n = this._injector.get(c).getRenderById(e);
|
|
56
|
+
if (!n)
|
|
60
57
|
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
61
|
-
const { components: o } =
|
|
62
|
-
if (!
|
|
58
|
+
const { components: o } = n, s = o.get(t);
|
|
59
|
+
if (!s)
|
|
63
60
|
throw new Error("Render component not found");
|
|
64
|
-
return
|
|
61
|
+
return s;
|
|
65
62
|
}
|
|
66
63
|
/**
|
|
67
64
|
* Get sheet hooks.
|
|
@@ -69,269 +66,215 @@ class ee extends y {
|
|
|
69
66
|
* @returns {FSheetHooks} FSheetHooks instance
|
|
70
67
|
*/
|
|
71
68
|
getSheetHooks() {
|
|
72
|
-
return this._injector.createInstance(
|
|
69
|
+
return this._injector.createInstance(I);
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
|
|
76
|
-
class
|
|
72
|
+
b.extend(Z);
|
|
73
|
+
class J extends R {
|
|
77
74
|
openSiderbar(e) {
|
|
78
|
-
return this._logDeprecation("openSiderbar"), this._injector.get(
|
|
75
|
+
return this._logDeprecation("openSiderbar"), this._injector.get(V).open(e);
|
|
79
76
|
}
|
|
80
77
|
openDialog(e) {
|
|
81
78
|
this._logDeprecation("openDialog");
|
|
82
|
-
const
|
|
79
|
+
const r = this._injector.get(N).open({
|
|
83
80
|
...e,
|
|
84
81
|
onClose: () => {
|
|
85
|
-
|
|
82
|
+
r.dispose();
|
|
86
83
|
}
|
|
87
84
|
});
|
|
88
|
-
return
|
|
85
|
+
return r;
|
|
89
86
|
}
|
|
90
87
|
_logDeprecation(e) {
|
|
91
|
-
this._injector.get(
|
|
88
|
+
this._injector.get(x).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
|
|
92
89
|
}
|
|
93
90
|
onCellClick(e) {
|
|
94
|
-
const t = this._injector.get(
|
|
95
|
-
return
|
|
96
|
-
t.currentClickedCell$.pipe(
|
|
91
|
+
const t = this._injector.get(d);
|
|
92
|
+
return i(
|
|
93
|
+
t.currentClickedCell$.pipe(p((r) => !!r)).subscribe(e)
|
|
97
94
|
);
|
|
98
95
|
}
|
|
99
96
|
onCellHover(e) {
|
|
100
|
-
const t = this._injector.get(
|
|
101
|
-
return
|
|
102
|
-
t.currentRichText$.pipe(
|
|
97
|
+
const t = this._injector.get(d);
|
|
98
|
+
return i(
|
|
99
|
+
t.currentRichText$.pipe(p((r) => !!r)).subscribe(e)
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
onCellPointerDown(e) {
|
|
103
|
+
const t = this._injector.get(d);
|
|
104
|
+
return i(
|
|
105
|
+
t.currentPointerDownCell$.subscribe(e)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
onCellPointerUp(e) {
|
|
109
|
+
const t = this._injector.get(d);
|
|
110
|
+
return i(
|
|
111
|
+
t.currentPointerUpCell$.subscribe(e)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
onPointerMove(e) {
|
|
115
|
+
const t = this._injector.get(d);
|
|
116
|
+
return i(
|
|
117
|
+
t.currentCellPosWithEvent$.pipe(p((r) => !!r)).subscribe((r) => {
|
|
118
|
+
e(r, r.event.buttons);
|
|
119
|
+
})
|
|
103
120
|
);
|
|
104
121
|
}
|
|
105
122
|
startEditing() {
|
|
106
|
-
return this._injector.get(
|
|
107
|
-
eventType:
|
|
123
|
+
return this._injector.get(h).syncExecuteCommand(m.id, {
|
|
124
|
+
eventType: _.Dblclick,
|
|
108
125
|
unitId: this._workbook.getUnitId(),
|
|
109
126
|
visible: !0
|
|
110
127
|
});
|
|
111
128
|
}
|
|
112
129
|
async endEditing(e) {
|
|
113
|
-
return this._injector.get(
|
|
114
|
-
eventType:
|
|
115
|
-
keycode: e ?
|
|
130
|
+
return this._injector.get(h).syncExecuteCommand(m.id, {
|
|
131
|
+
eventType: _.Keyboard,
|
|
132
|
+
keycode: e ? w.ENTER : w.ESC,
|
|
116
133
|
visible: !1,
|
|
117
134
|
unitId: this._workbook.getUnitId()
|
|
118
|
-
}), await
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
R.extend(te);
|
|
122
|
-
function ne(s, e) {
|
|
123
|
-
const { startRow: t, startColumn: n, endRow: r, endColumn: o, rangeType: i } = e, I = r < t ? r : t, u = r < t ? t : r, _ = o < n ? o : n, j = o < n ? n : o, h = s.getNoMergeCellPositionByIndex(I, _), l = s.getNoMergeCellPositionByIndex(u, j);
|
|
124
|
-
return {
|
|
125
|
-
startRow: t,
|
|
126
|
-
startColumn: n,
|
|
127
|
-
endRow: r,
|
|
128
|
-
endColumn: o,
|
|
129
|
-
rangeType: i,
|
|
130
|
-
startY: (h == null ? void 0 : h.startY) || 0,
|
|
131
|
-
endY: (l == null ? void 0 : l.endY) || 0,
|
|
132
|
-
startX: (h == null ? void 0 : h.startX) || 0,
|
|
133
|
-
endX: (l == null ? void 0 : l.endX) || 0
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
var re = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, se = (s, e, t, n) => {
|
|
137
|
-
for (var r = n > 1 ? void 0 : n ? oe(e, t) : e, o = s.length - 1, i; o >= 0; o--)
|
|
138
|
-
(i = s[o]) && (r = (n ? i(e, t, r) : i(r)) || r);
|
|
139
|
-
return n && r && re(e, t, r), r;
|
|
140
|
-
}, ie = (s, e) => (t, n) => e(t, n, s);
|
|
141
|
-
let m = class extends T {
|
|
142
|
-
constructor(e, t) {
|
|
143
|
-
super();
|
|
144
|
-
a(this, "_currentSkeletonSearchParam", {
|
|
145
|
-
sheetId: ""
|
|
146
|
-
});
|
|
147
|
-
a(this, "_sheetSkeletonParam", []);
|
|
148
|
-
a(this, "_currentSkeleton$", new x(null));
|
|
149
|
-
a(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
|
|
150
|
-
/**
|
|
151
|
-
* CurrentSkeletonBefore for pre-triggered logic during registration
|
|
152
|
-
*/
|
|
153
|
-
a(this, "_currentSkeletonBefore$", new x(null));
|
|
154
|
-
a(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
155
|
-
this._context = e, this._injector = t, this.disposeWithMe(() => {
|
|
156
|
-
this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._sheetSkeletonParam = [];
|
|
157
|
-
}), this._initRemoveSheet();
|
|
158
|
-
}
|
|
159
|
-
_initRemoveSheet() {
|
|
160
|
-
this.disposeWithMe(this._context.unit.sheetDisposed$.subscribe((e) => {
|
|
161
|
-
this.disposeSkeleton({
|
|
162
|
-
sheetId: e.getSheetId()
|
|
163
|
-
});
|
|
164
|
-
}));
|
|
135
|
+
}), await j(0), !0;
|
|
165
136
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return
|
|
137
|
+
getScrollStateBySheetId(e) {
|
|
138
|
+
const t = this._workbook.getUnitId(), n = this._injector.get(c).getRenderById(t);
|
|
139
|
+
return n ? n.with(v).getScrollStateByParam({ unitId: t, sheetId: e }) : null;
|
|
169
140
|
}
|
|
170
|
-
|
|
171
|
-
|
|
141
|
+
disableSelection() {
|
|
142
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(c).getRenderById(e);
|
|
143
|
+
r && r.with(S).disableSelection();
|
|
172
144
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* unitId is never read?
|
|
178
|
-
*/
|
|
179
|
-
getUnitSkeleton(e, t) {
|
|
180
|
-
const n = this._getSkeleton({ sheetId: t });
|
|
181
|
-
return n != null && (n.unitId = e), n;
|
|
182
|
-
}
|
|
183
|
-
setCurrent(e) {
|
|
184
|
-
this._setCurrent(e);
|
|
185
|
-
}
|
|
186
|
-
_setCurrent(e) {
|
|
187
|
-
const t = this._getSkeleton(e), n = this._context.unitId;
|
|
188
|
-
if (t != null)
|
|
189
|
-
this._reCalculate(t);
|
|
190
|
-
else {
|
|
191
|
-
const { sheetId: i } = e, u = this._context.unit.getSheetBySheetId(e.sheetId);
|
|
192
|
-
if (u == null)
|
|
193
|
-
return;
|
|
194
|
-
const _ = this._buildSkeleton(u);
|
|
195
|
-
this._sheetSkeletonParam.push({
|
|
196
|
-
unitId: n,
|
|
197
|
-
sheetId: i,
|
|
198
|
-
skeleton: _,
|
|
199
|
-
dirty: !1
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
this._currentSkeletonSearchParam = e;
|
|
203
|
-
const r = this._currentSkeletonSearchParam.sheetId, o = this.getUnitSkeleton(n, r);
|
|
204
|
-
this._currentSkeletonBefore$.next(o), this._currentSkeleton$.next(o);
|
|
145
|
+
enableSelection() {
|
|
146
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(c).getRenderById(e);
|
|
147
|
+
r && r.with(S).enableSelection();
|
|
205
148
|
}
|
|
206
|
-
|
|
207
|
-
const e = this.
|
|
208
|
-
|
|
149
|
+
transparentSelection() {
|
|
150
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(c).getRenderById(e);
|
|
151
|
+
r && r.with(S).transparentSelection();
|
|
209
152
|
}
|
|
210
|
-
|
|
211
|
-
e
|
|
153
|
+
showSelection() {
|
|
154
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(c).getRenderById(e);
|
|
155
|
+
r && r.with(S).showSelection();
|
|
212
156
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
* @param state
|
|
217
|
-
*/
|
|
218
|
-
makeDirty(e, t = !0) {
|
|
219
|
-
const n = this._getSkeleton(e);
|
|
220
|
-
n != null && (n.dirty = t);
|
|
221
|
-
}
|
|
222
|
-
getOrCreateSkeleton(e) {
|
|
223
|
-
const t = this._getSkeleton(e);
|
|
224
|
-
if (t)
|
|
225
|
-
return t.skeleton;
|
|
226
|
-
const r = this._context.unit.getSheetBySheetId(e.sheetId);
|
|
227
|
-
if (!r)
|
|
228
|
-
return;
|
|
229
|
-
const o = this._buildSkeleton(r);
|
|
230
|
-
return this._sheetSkeletonParam.push({
|
|
231
|
-
unitId: this._context.unitId,
|
|
232
|
-
sheetId: e.sheetId,
|
|
233
|
-
skeleton: o,
|
|
234
|
-
dirty: !1
|
|
235
|
-
}), o;
|
|
236
|
-
}
|
|
237
|
-
disposeSkeleton(e) {
|
|
238
|
-
const t = this._sheetSkeletonParam.findIndex((n) => n.sheetId === e.sheetId);
|
|
239
|
-
t > -1 && (this._sheetSkeletonParam[t].skeleton.dispose(), this._sheetSkeletonParam.splice(t, 1));
|
|
240
|
-
}
|
|
241
|
-
/** @deprecated Use function `attachRangeWithCoord` instead. */
|
|
242
|
-
attachRangeWithCoord(e) {
|
|
243
|
-
const t = this.getCurrentSkeleton();
|
|
244
|
-
return t ? ne(t, e) : null;
|
|
245
|
-
}
|
|
246
|
-
_getSkeleton(e) {
|
|
247
|
-
const t = this._sheetSkeletonParam.find((n) => n.sheetId === e.sheetId);
|
|
248
|
-
return t != null && (t.commandId = e.commandId), t;
|
|
249
|
-
}
|
|
250
|
-
_buildSkeleton(e) {
|
|
251
|
-
const t = e.getConfig();
|
|
252
|
-
return this._injector.createInstance(
|
|
253
|
-
N,
|
|
254
|
-
e,
|
|
255
|
-
t,
|
|
256
|
-
e.getCellMatrix(),
|
|
257
|
-
this._context.unit.getStyles()
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
m = se([
|
|
262
|
-
ie(1, W(B))
|
|
263
|
-
], m);
|
|
264
|
-
class ce extends M {
|
|
157
|
+
}
|
|
158
|
+
R.extend(J);
|
|
159
|
+
class X extends M {
|
|
265
160
|
refreshCanvas() {
|
|
266
|
-
const e = this._injector.get(
|
|
267
|
-
if (!n)
|
|
268
|
-
throw new Error(`Render Unit with unitId ${t} not found`);
|
|
269
|
-
n.with(m).reCalculate();
|
|
270
|
-
const r = n.mainComponent;
|
|
161
|
+
const e = this._injector.get(c), t = this._fWorkbook.id, r = e.getRenderById(t);
|
|
271
162
|
if (!r)
|
|
163
|
+
throw new Error(`Render Unit with unitId ${t} not found`);
|
|
164
|
+
r.with(C).reCalculate();
|
|
165
|
+
const n = r.mainComponent;
|
|
166
|
+
if (!n)
|
|
272
167
|
throw new Error("Main component not found");
|
|
273
|
-
|
|
168
|
+
n.makeDirty();
|
|
169
|
+
}
|
|
170
|
+
zoom(e) {
|
|
171
|
+
return this._injector.get(h).executeCommand(W.id, {
|
|
172
|
+
unitId: this._workbook.getUnitId(),
|
|
173
|
+
subUnitId: this._worksheet.getSheetId(),
|
|
174
|
+
zoomRatio: e
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
getZoom() {
|
|
178
|
+
return this._worksheet.getZoomRatio();
|
|
179
|
+
}
|
|
180
|
+
getVisibleRange() {
|
|
181
|
+
const e = this._workbook.getUnitId(), r = this._injector.get(c).getRenderById(e);
|
|
182
|
+
let n = {
|
|
183
|
+
startColumn: 0,
|
|
184
|
+
startRow: 0,
|
|
185
|
+
endColumn: 0,
|
|
186
|
+
endRow: 0
|
|
187
|
+
};
|
|
188
|
+
if (!r) return n;
|
|
189
|
+
const s = r.with(C).getCurrentSkeleton();
|
|
190
|
+
if (!s) return n;
|
|
191
|
+
const g = s == null ? void 0 : s.getVisibleRanges();
|
|
192
|
+
if (!g) return n;
|
|
193
|
+
n = s.getVisibleRangeByViewport(B.VIEW_MAIN);
|
|
194
|
+
for (const [E, u] of g)
|
|
195
|
+
T.indexOf(E) !== -1 && (n.startColumn = Math.min(n.startColumn, u.startColumn), n.startRow = Math.min(n.startRow, u.startRow), n.endColumn = Math.max(n.endColumn, u.endColumn), n.endRow = Math.max(n.endRow, u.endRow));
|
|
196
|
+
return n;
|
|
197
|
+
}
|
|
198
|
+
scrollToCell(e, t) {
|
|
199
|
+
const r = this._workbook.getUnitId(), o = this._injector.get(c).getRenderById(r);
|
|
200
|
+
o && (o == null ? void 0 : o.with(F)).scrollToCell(e, t);
|
|
201
|
+
}
|
|
202
|
+
getScrollState() {
|
|
203
|
+
const e = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), n = this._injector.get(c).getRenderById(e);
|
|
204
|
+
return n ? n.with(v).getScrollStateByParam({ unitId: e, sheetId: t }) : null;
|
|
205
|
+
}
|
|
206
|
+
onScroll(e) {
|
|
207
|
+
var o;
|
|
208
|
+
const t = this._workbook.getUnitId(), n = (o = this._injector.get(c).getRenderById(t)) == null ? void 0 : o.with(v);
|
|
209
|
+
if (n) {
|
|
210
|
+
const s = n.validViewportScrollInfo$.subscribe((g) => {
|
|
211
|
+
e(g);
|
|
212
|
+
});
|
|
213
|
+
return i(s);
|
|
214
|
+
}
|
|
215
|
+
return i(() => {
|
|
216
|
+
});
|
|
274
217
|
}
|
|
275
218
|
}
|
|
276
|
-
M.extend(
|
|
277
|
-
class
|
|
219
|
+
M.extend(X);
|
|
220
|
+
class q extends f {
|
|
278
221
|
setPermissionDialogVisible(e) {
|
|
279
222
|
this._permissionService.setShowComponents(e);
|
|
280
223
|
}
|
|
281
224
|
}
|
|
282
|
-
|
|
283
|
-
class
|
|
225
|
+
f.extend(q);
|
|
226
|
+
class G extends I {
|
|
284
227
|
onCellPointerMove(e) {
|
|
285
|
-
return
|
|
228
|
+
return i(this._injector.get(d).currentPosition$.subscribe(e));
|
|
286
229
|
}
|
|
287
230
|
onCellPointerOver(e) {
|
|
288
|
-
return
|
|
231
|
+
return i(this._injector.get(d).currentCell$.subscribe(e));
|
|
289
232
|
}
|
|
290
233
|
onCellDragOver(e) {
|
|
291
|
-
return
|
|
234
|
+
return i(this._injector.get(k).currentCell$.subscribe(e));
|
|
292
235
|
}
|
|
293
236
|
onCellDrop(e) {
|
|
294
|
-
return
|
|
237
|
+
return i(this._injector.get(k).endCell$.subscribe(e));
|
|
295
238
|
}
|
|
296
|
-
onCellRender(e, t =
|
|
297
|
-
return this._injector.get(
|
|
239
|
+
onCellRender(e, t = U.Style, r = z.DATA_VALIDATION) {
|
|
240
|
+
return this._injector.get(L).intercept(Y.CELL_CONTENT, {
|
|
298
241
|
effect: t,
|
|
299
|
-
handler: (
|
|
300
|
-
...
|
|
242
|
+
handler: (n, o, s) => s({
|
|
243
|
+
...n,
|
|
301
244
|
customRender: [
|
|
302
|
-
...(
|
|
245
|
+
...(n == null ? void 0 : n.customRender) || [],
|
|
303
246
|
...e || []
|
|
304
247
|
]
|
|
305
248
|
}),
|
|
306
|
-
priority:
|
|
249
|
+
priority: r
|
|
307
250
|
});
|
|
308
251
|
}
|
|
309
252
|
onBeforeCellEdit(e) {
|
|
310
|
-
return this._injector.get(
|
|
311
|
-
const
|
|
312
|
-
t.id ===
|
|
253
|
+
return this._injector.get(h).beforeCommandExecuted((t) => {
|
|
254
|
+
const r = t.params;
|
|
255
|
+
t.id === m.id && r.visible && e(r);
|
|
313
256
|
});
|
|
314
257
|
}
|
|
315
258
|
onAfterCellEdit(e) {
|
|
316
|
-
return this._injector.get(
|
|
317
|
-
const
|
|
318
|
-
t.id ===
|
|
259
|
+
return this._injector.get(h).onCommandExecuted((t) => {
|
|
260
|
+
const r = t.params;
|
|
261
|
+
t.id === m.id && !r.visible && e(r);
|
|
319
262
|
});
|
|
320
263
|
}
|
|
321
264
|
}
|
|
322
|
-
|
|
323
|
-
class
|
|
265
|
+
I.extend(G);
|
|
266
|
+
class Q extends y {
|
|
324
267
|
getCell() {
|
|
325
|
-
const e = this._injector.get(
|
|
326
|
-
return e.getRenderById(t).with(
|
|
268
|
+
const e = this._injector.get(c), t = this._workbook.getUnitId(), r = this._worksheet.getSheetId();
|
|
269
|
+
return e.getRenderById(t).with(C).getWorksheetSkeleton(r).skeleton.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
|
|
327
270
|
}
|
|
328
271
|
getCellRect() {
|
|
329
|
-
const { startX: e, startY: t, endX:
|
|
272
|
+
const { startX: e, startY: t, endX: r, endY: n } = this.getCell(), o = { x: e, y: t, width: r - e, height: n - t, top: t, left: e, bottom: n, right: r };
|
|
330
273
|
return { ...o, toJSON: () => JSON.stringify(o) };
|
|
331
274
|
}
|
|
332
275
|
generateHTML() {
|
|
333
276
|
var t;
|
|
334
|
-
const e = this._injector.get(
|
|
277
|
+
const e = this._injector.get(O).generateCopyContent(
|
|
335
278
|
this._workbook.getUnitId(),
|
|
336
279
|
this._worksheet.getSheetId(),
|
|
337
280
|
this._range
|
|
@@ -339,17 +282,17 @@ class le extends P {
|
|
|
339
282
|
return (t = e == null ? void 0 : e.html) != null ? t : "";
|
|
340
283
|
}
|
|
341
284
|
attachPopup(e) {
|
|
342
|
-
const { key: t, disposableCollection:
|
|
285
|
+
const { key: t, disposableCollection: r } = ee(e, this._injector.get(K)), o = this._injector.get(A).attachPopupToCell(
|
|
343
286
|
this._range.startRow,
|
|
344
287
|
this._range.startColumn,
|
|
345
288
|
{ ...e, componentKey: t },
|
|
346
289
|
this.getUnitId(),
|
|
347
290
|
this._worksheet.getSheetId()
|
|
348
291
|
);
|
|
349
|
-
return o ? (
|
|
292
|
+
return o ? (r.add(o), r) : (r.dispose(), null);
|
|
350
293
|
}
|
|
351
294
|
attachAlertPopup(e) {
|
|
352
|
-
const t = this._injector.get(
|
|
295
|
+
const t = this._injector.get(H), r = {
|
|
353
296
|
workbook: this._workbook,
|
|
354
297
|
worksheet: this._worksheet,
|
|
355
298
|
row: this._range.startRow,
|
|
@@ -359,7 +302,7 @@ class le extends P {
|
|
|
359
302
|
};
|
|
360
303
|
return t.showAlert({
|
|
361
304
|
...e,
|
|
362
|
-
location:
|
|
305
|
+
location: r
|
|
363
306
|
}), {
|
|
364
307
|
dispose: () => {
|
|
365
308
|
t.removeAlert(e.key);
|
|
@@ -367,24 +310,24 @@ class le extends P {
|
|
|
367
310
|
};
|
|
368
311
|
}
|
|
369
312
|
highlight(e, t) {
|
|
370
|
-
const
|
|
371
|
-
if (!
|
|
313
|
+
const r = this._injector.get($), n = r.addShape({ range: this._range, style: e, primary: t });
|
|
314
|
+
if (!n)
|
|
372
315
|
throw new Error("Failed to highlight current range");
|
|
373
|
-
return
|
|
374
|
-
|
|
316
|
+
return i(() => {
|
|
317
|
+
r.removeShape(n);
|
|
375
318
|
});
|
|
376
319
|
}
|
|
377
320
|
}
|
|
378
|
-
|
|
379
|
-
function
|
|
380
|
-
const { componentKey: t, isVue3:
|
|
381
|
-
let
|
|
382
|
-
const o = new
|
|
383
|
-
return typeof t == "string" ?
|
|
384
|
-
key:
|
|
321
|
+
y.extend(Q);
|
|
322
|
+
function ee(a, e) {
|
|
323
|
+
const { componentKey: t, isVue3: r } = a;
|
|
324
|
+
let n;
|
|
325
|
+
const o = new P();
|
|
326
|
+
return typeof t == "string" ? n = t : (n = `External_${D(6)}`, o.add(e.register(n, t, { framework: r ? "vue3" : "react" }))), {
|
|
327
|
+
key: n,
|
|
385
328
|
disposableCollection: o
|
|
386
329
|
};
|
|
387
330
|
}
|
|
388
331
|
export {
|
|
389
|
-
|
|
332
|
+
ee as transformComponentKey
|
|
390
333
|
};
|