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