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