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