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