@univerjs/sheets-zen-editor 0.10.12 → 0.10.13-nightly.202510290902
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/index.js +3 -3
- package/lib/es/index.js +233 -199
- package/lib/index.js +233 -199
- package/lib/umd/index.js +3 -3
- package/package.json +13 -13
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as D, IUniverInstanceService as
|
|
5
|
-
import { IEditorService as
|
|
6
|
-
import { IRenderManagerService as
|
|
7
|
-
import { IEditorBridgeService as
|
|
8
|
-
import { IZenZoneService as
|
|
9
|
-
import { jsxs as
|
|
10
|
-
import { clsx as
|
|
11
|
-
import {
|
|
12
|
-
import { BehaviorSubject as
|
|
13
|
-
import { RangeProtectionPermissionEditPoint as
|
|
14
|
-
const
|
|
1
|
+
var oe = Object.defineProperty;
|
|
2
|
+
var se = (e, t, n) => t in e ? oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var p = (e, t, n) => se(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { CommandType as D, IUniverInstanceService as w, delayAnimationFrame as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as u, Tools as Y, UniverInstanceType as x, DocumentFlavor as G, DocumentDataModel as ce, createIdentifier as ae, ICommandService as K, DEFAULT_EMPTY_DOCUMENT_VALUE as le, FOCUSING_DOC as de, FOCUSING_UNIVER_EDITOR as ue, EDITOR_ACTIVATED as ge, FOCUSING_EDITOR_STANDALONE as he, Disposable as fe, RxDisposable as me, Plugin as ve, merge as pe, Inject as _e, Injector as Se, IConfigService as Ie } from "@univerjs/core";
|
|
5
|
+
import { IEditorService as P, VIEWPORT_KEY as Ce, DocBackScrollRenderController as Ee } from "@univerjs/docs-ui";
|
|
6
|
+
import { IRenderManagerService as X } from "@univerjs/engine-render";
|
|
7
|
+
import { IEditorBridgeService as T, EditingRenderController as Ne, getCurrentExclusiveRangeInterest$ as Oe, getCurrentRangeDisable$ as Te, getEditorObject as be } from "@univerjs/sheets-ui";
|
|
8
|
+
import { IZenZoneService as b, ISidebarService as z, useDependency as y, MenuItemType as Me, ContextMenuPosition as ye, ContextMenuGroup as De, KeyCode as q, MetaKeys as we, IMenuManagerService as Re, IShortcutService as xe } from "@univerjs/ui";
|
|
9
|
+
import { jsxs as j, jsx as _ } from "react/jsx-runtime";
|
|
10
|
+
import { clsx as A } from "@univerjs/design";
|
|
11
|
+
import { useRef as J, createElement as $, forwardRef as Q, useEffect as Pe } from "react";
|
|
12
|
+
import { BehaviorSubject as ze, switchMap as $e, map as ke, takeUntil as Ue } from "rxjs";
|
|
13
|
+
import { RangeProtectionPermissionEditPoint as Ze, WorksheetEditPermission as Be, WorksheetSetCellValuePermission as Le, WorksheetSetCellStylePermission as je, WorkbookEditablePermission as Ae } from "@univerjs/sheets";
|
|
14
|
+
const k = {
|
|
15
15
|
id: "zen-editor.command.open-zen-editor",
|
|
16
16
|
type: D.COMMAND,
|
|
17
17
|
handler: async (e) => {
|
|
18
|
-
var
|
|
19
|
-
const t = e.get(
|
|
18
|
+
var I;
|
|
19
|
+
const t = e.get(b), n = e.get(P), i = e.get(T), r = e.get(w), o = e.get(z);
|
|
20
20
|
o.visible && (o.close(), await R()), t.open();
|
|
21
|
-
const s =
|
|
21
|
+
const s = n.getEditor(u);
|
|
22
22
|
if (s == null)
|
|
23
23
|
return !1;
|
|
24
|
-
const c =
|
|
24
|
+
const c = i.getLatestEditCellState();
|
|
25
25
|
if (c == null)
|
|
26
26
|
return !1;
|
|
27
|
-
const a = (
|
|
27
|
+
const a = (I = c.documentLayoutObject.documentModel) == null ? void 0 : I.getSnapshot();
|
|
28
28
|
if (a == null)
|
|
29
29
|
return !1;
|
|
30
|
-
r.focusUnit(
|
|
31
|
-
const { body: l, drawings:
|
|
30
|
+
r.focusUnit(u);
|
|
31
|
+
const { body: l, drawings: f, drawingsOrder: d, tableSource: g, settings: m } = Y.deepClone(a), v = {
|
|
32
32
|
...s.getDocumentData(),
|
|
33
33
|
body: l,
|
|
34
|
-
drawings:
|
|
35
|
-
drawingsOrder:
|
|
36
|
-
tableSource:
|
|
34
|
+
drawings: f,
|
|
35
|
+
drawingsOrder: d,
|
|
36
|
+
tableSource: g,
|
|
37
37
|
settings: m
|
|
38
38
|
}, h = [
|
|
39
39
|
{
|
|
@@ -42,106 +42,140 @@ const Z = {
|
|
|
42
42
|
collapsed: !0
|
|
43
43
|
}
|
|
44
44
|
];
|
|
45
|
-
return s.focus(), s.setDocumentData(
|
|
45
|
+
return s.focus(), s.setDocumentData(v, h), s.clearUndoRedoHistory(), !0;
|
|
46
46
|
}
|
|
47
|
-
},
|
|
47
|
+
}, U = {
|
|
48
48
|
id: "zen-editor.command.cancel-zen-edit",
|
|
49
49
|
type: D.COMMAND,
|
|
50
50
|
handler: async (e) => {
|
|
51
|
-
const t = e.get(
|
|
51
|
+
const t = e.get(b), n = e.get(T), i = e.get(w), r = e.get(z);
|
|
52
52
|
r.visible && (r.close(), await R()), t.close();
|
|
53
|
-
const o =
|
|
54
|
-
return o ? (
|
|
53
|
+
const o = i.getCurrentUnitForType(x.UNIVER_SHEET);
|
|
54
|
+
return o ? (i.focusUnit(o.getUnitId()), n.refreshEditCellState(), !0) : !1;
|
|
55
55
|
}
|
|
56
|
-
},
|
|
56
|
+
}, Z = {
|
|
57
57
|
id: "zen-editor.command.confirm-zen-edit",
|
|
58
58
|
type: D.COMMAND,
|
|
59
59
|
handler: async (e) => {
|
|
60
60
|
var l;
|
|
61
|
-
const t = e.get(
|
|
61
|
+
const t = e.get(b), n = e.get(T), i = e.get(w), r = e.get(P), o = e.get(z);
|
|
62
62
|
o.visible && (o.close(), await R()), t.close();
|
|
63
|
-
const s = r.getEditor(
|
|
63
|
+
const s = r.getEditor(u);
|
|
64
64
|
if (s == null)
|
|
65
65
|
return !1;
|
|
66
|
-
const c = e.get(
|
|
66
|
+
const c = e.get(X), a = i.getCurrentUnitForType(x.UNIVER_SHEET);
|
|
67
67
|
if (a) {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
|
|
68
|
+
const f = a.getUnitId(), d = (l = c.getRenderById(f)) == null ? void 0 : l.with(Ne);
|
|
69
|
+
if (d) {
|
|
70
|
+
const g = Y.deepClone(s.getDocumentData());
|
|
71
|
+
g.documentStyle.documentFlavor = G.UNSPECIFIED, d.submitCellData(new ce(g));
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return i.focusUnit(a.getUnitId()), n.refreshEditCellState(), !0;
|
|
74
74
|
}
|
|
75
75
|
return !1;
|
|
76
76
|
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (i[n] = e[n]);
|
|
89
|
-
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
90
|
-
for (var r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
|
|
91
|
-
t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (i[n[r]] = e[n[r]]);
|
|
92
|
-
return i;
|
|
93
|
-
}, A = U(function(e, t) {
|
|
94
|
-
var i = e.icon, n = e.id, r = e.className, o = e.extend, s = We(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = ee("_".concat(Ge()));
|
|
95
|
-
return te(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, d({ ref: t, className: c }, s), o);
|
|
96
|
-
});
|
|
97
|
-
function te(e, t, i, n, r) {
|
|
98
|
-
return j(e.tag, d(d({ key: t }, He(e, i, r)), n), (Ye(e, i).children || []).map(function(o, s) {
|
|
99
|
-
return te(o, "".concat(t, "-").concat(e.tag, "-").concat(s), i, void 0, r);
|
|
100
|
-
}));
|
|
77
|
+
}, Ve = "sheets-zen-editor.config", V = {};
|
|
78
|
+
function B({ ref: e, ...t }) {
|
|
79
|
+
const { icon: n, id: i, className: r, extend: o, ...s } = t, c = `univerjs-icon univerjs-icon-${i} ${r || ""}`.trim(), a = J(`_${He()}`);
|
|
80
|
+
return ee(n, `${i}`, {
|
|
81
|
+
defIds: n.defIds,
|
|
82
|
+
idSuffix: a.current
|
|
83
|
+
}, {
|
|
84
|
+
ref: e,
|
|
85
|
+
className: c,
|
|
86
|
+
...s
|
|
87
|
+
}, o);
|
|
101
88
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
89
|
+
function ee(e, t, n, i, r) {
|
|
90
|
+
return $(e.tag, {
|
|
91
|
+
key: t,
|
|
92
|
+
...Fe(e, n, r),
|
|
93
|
+
...i
|
|
94
|
+
}, (We(e, n).children || []).map((o, s) => ee(o, `${t}-${e.tag}-${s}`, n, void 0, r)));
|
|
95
|
+
}
|
|
96
|
+
function Fe(e, t, n) {
|
|
97
|
+
const i = { ...e.attrs };
|
|
98
|
+
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), e.tag === "mask" && i.id && (i.id = i.id + t.idSuffix), Object.entries(i).forEach(([o, s]) => {
|
|
99
|
+
o === "mask" && typeof s == "string" && (i[o] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
107
100
|
});
|
|
108
|
-
|
|
109
|
-
return !r || r.length === 0 || (e.tag === "use" &&
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})), n;
|
|
101
|
+
const { defIds: r } = t;
|
|
102
|
+
return !r || r.length === 0 || (e.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + t.idSuffix), Object.entries(i).forEach(([o, s]) => {
|
|
103
|
+
typeof s == "string" && (i[o] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
104
|
+
})), i;
|
|
113
105
|
}
|
|
114
|
-
function
|
|
115
|
-
var i
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
function We(e, t) {
|
|
107
|
+
var i;
|
|
108
|
+
const { defIds: n } = t;
|
|
109
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && ((i = e.children) != null && i.length) ? {
|
|
110
|
+
...e,
|
|
111
|
+
children: e.children.map((r) => typeof r.attrs.id == "string" && n && n.includes(r.attrs.id) ? {
|
|
112
|
+
...r,
|
|
113
|
+
attrs: {
|
|
114
|
+
...r.attrs,
|
|
115
|
+
id: r.attrs.id + t.idSuffix
|
|
116
|
+
}
|
|
117
|
+
} : r)
|
|
118
|
+
} : e;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function He() {
|
|
121
121
|
return Math.random().toString(36).substring(2, 8);
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
B.displayName = "UniverIcon";
|
|
124
|
+
const Ye = {
|
|
125
|
+
tag: "svg",
|
|
126
|
+
attrs: {
|
|
127
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
+
fill: "none",
|
|
129
|
+
viewBox: "0 0 16 16",
|
|
130
|
+
width: "1em",
|
|
131
|
+
height: "1em"
|
|
132
|
+
},
|
|
133
|
+
children: [{
|
|
134
|
+
tag: "path",
|
|
135
|
+
attrs: {
|
|
136
|
+
fill: "currentColor",
|
|
137
|
+
d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",
|
|
138
|
+
fillRule: "evenodd",
|
|
139
|
+
clipRule: "evenodd"
|
|
140
|
+
}
|
|
141
|
+
}]
|
|
142
|
+
}, te = Q(function(t, n) {
|
|
143
|
+
return $(B, Object.assign({}, t, {
|
|
126
144
|
id: "check-mark-icon",
|
|
127
|
-
ref:
|
|
128
|
-
icon:
|
|
145
|
+
ref: n,
|
|
146
|
+
icon: Ye
|
|
129
147
|
}));
|
|
130
148
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
te.displayName = "CheckMarkIcon";
|
|
150
|
+
const Ge = {
|
|
151
|
+
tag: "svg",
|
|
152
|
+
attrs: {
|
|
153
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
154
|
+
fill: "none",
|
|
155
|
+
viewBox: "0 0 16 16",
|
|
156
|
+
width: "1em",
|
|
157
|
+
height: "1em"
|
|
158
|
+
},
|
|
159
|
+
children: [{
|
|
160
|
+
tag: "path",
|
|
161
|
+
attrs: {
|
|
162
|
+
fill: "currentColor",
|
|
163
|
+
d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"
|
|
164
|
+
}
|
|
165
|
+
}]
|
|
166
|
+
}, ne = Q(function(t, n) {
|
|
167
|
+
return $(B, Object.assign({}, t, {
|
|
134
168
|
id: "close-icon",
|
|
135
|
-
ref:
|
|
136
|
-
icon:
|
|
169
|
+
ref: n,
|
|
170
|
+
icon: Ge
|
|
137
171
|
}));
|
|
138
172
|
});
|
|
139
|
-
|
|
140
|
-
class
|
|
173
|
+
ne.displayName = "CloseIcon";
|
|
174
|
+
class Ke {
|
|
141
175
|
constructor() {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
176
|
+
p(this, "_position", null);
|
|
177
|
+
p(this, "_position$", new ze(null));
|
|
178
|
+
p(this, "position$", this._position$.asObservable());
|
|
145
179
|
}
|
|
146
180
|
dispose() {
|
|
147
181
|
this._position$.complete(), this._position = null;
|
|
@@ -156,12 +190,12 @@ class qe {
|
|
|
156
190
|
this._position$.next(t);
|
|
157
191
|
}
|
|
158
192
|
}
|
|
159
|
-
const
|
|
193
|
+
const L = ae(
|
|
160
194
|
"univer.sheet-zen-editor-manager.service"
|
|
161
|
-
),
|
|
162
|
-
id:
|
|
195
|
+
), Xe = "ZEN_EDITOR_PLUGIN_", qe = `${Xe}ZEN_EDITOR_COMPONENT`, Je = {
|
|
196
|
+
id: u,
|
|
163
197
|
body: {
|
|
164
|
-
dataStream: `${
|
|
198
|
+
dataStream: `${le}`,
|
|
165
199
|
textRuns: [],
|
|
166
200
|
tables: [],
|
|
167
201
|
customBlocks: [],
|
|
@@ -180,7 +214,7 @@ const $ = le(
|
|
|
180
214
|
width: 595,
|
|
181
215
|
height: Number.POSITIVE_INFINITY
|
|
182
216
|
},
|
|
183
|
-
documentFlavor:
|
|
217
|
+
documentFlavor: G.MODERN,
|
|
184
218
|
marginTop: 0,
|
|
185
219
|
marginBottom: 0,
|
|
186
220
|
marginRight: 0,
|
|
@@ -193,15 +227,15 @@ const $ = le(
|
|
|
193
227
|
drawings: {},
|
|
194
228
|
drawingsOrder: []
|
|
195
229
|
};
|
|
196
|
-
function
|
|
197
|
-
const e =
|
|
198
|
-
|
|
230
|
+
function Qe() {
|
|
231
|
+
const e = J(null), t = y(L), n = y(P), i = y(K);
|
|
232
|
+
Pe(() => {
|
|
199
233
|
const c = e.current;
|
|
200
234
|
if (!c)
|
|
201
235
|
return;
|
|
202
|
-
const a =
|
|
203
|
-
editorUnitId:
|
|
204
|
-
initialSnapshot:
|
|
236
|
+
const a = n.register({
|
|
237
|
+
editorUnitId: u,
|
|
238
|
+
initialSnapshot: Je,
|
|
205
239
|
scrollBar: !0,
|
|
206
240
|
backScrollOffset: 100
|
|
207
241
|
}, c), l = new ResizeObserver(() => {
|
|
@@ -212,136 +246,136 @@ function tt() {
|
|
|
212
246
|
};
|
|
213
247
|
}, []);
|
|
214
248
|
function r() {
|
|
215
|
-
const c =
|
|
216
|
-
c == null || c.blur(),
|
|
249
|
+
const c = n.getEditor(u);
|
|
250
|
+
c == null || c.blur(), i.executeCommand(U.id);
|
|
217
251
|
}
|
|
218
252
|
function o() {
|
|
219
|
-
const c =
|
|
220
|
-
c == null || c.blur(),
|
|
253
|
+
const c = n.getEditor(u);
|
|
254
|
+
c == null || c.blur(), i.executeCommand(Z.id);
|
|
221
255
|
}
|
|
222
256
|
const s = "univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";
|
|
223
|
-
return /* @__PURE__ */
|
|
257
|
+
return /* @__PURE__ */ j(
|
|
224
258
|
"div",
|
|
225
259
|
{
|
|
226
260
|
className: "univer-absolute univer-inset-0 univer-size-full univer-bg-white dark:!univer-bg-gray-800",
|
|
227
261
|
children: [
|
|
228
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ j(
|
|
229
263
|
"div",
|
|
230
264
|
{
|
|
231
265
|
className: "univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",
|
|
232
266
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ _(
|
|
234
268
|
"span",
|
|
235
269
|
{
|
|
236
|
-
className:
|
|
270
|
+
className: A(s, `
|
|
237
271
|
univer-text-red-500
|
|
238
272
|
hover:univer-text-red-600
|
|
239
273
|
`),
|
|
240
274
|
onClick: r,
|
|
241
|
-
children: /* @__PURE__ */
|
|
275
|
+
children: /* @__PURE__ */ _(ne, { className: "univer-size-5" })
|
|
242
276
|
}
|
|
243
277
|
),
|
|
244
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ _(
|
|
245
279
|
"span",
|
|
246
280
|
{
|
|
247
|
-
className:
|
|
281
|
+
className: A(s, `
|
|
248
282
|
univer-text-green-500
|
|
249
283
|
hover:univer-text-green-600
|
|
250
284
|
`),
|
|
251
285
|
onClick: o,
|
|
252
|
-
children: /* @__PURE__ */
|
|
286
|
+
children: /* @__PURE__ */ _(te, { className: "univer-size-5" })
|
|
253
287
|
}
|
|
254
288
|
)
|
|
255
289
|
]
|
|
256
290
|
}
|
|
257
291
|
),
|
|
258
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ _("div", { ref: e, className: "univer-absolute univer-inset-0 univer-size-full" })
|
|
259
293
|
]
|
|
260
294
|
}
|
|
261
295
|
);
|
|
262
296
|
}
|
|
263
|
-
function
|
|
264
|
-
const t = e.get(
|
|
297
|
+
function et(e) {
|
|
298
|
+
const t = e.get(T);
|
|
265
299
|
return {
|
|
266
|
-
id:
|
|
300
|
+
id: k.id,
|
|
267
301
|
type: Me.BUTTON,
|
|
268
302
|
title: "rightClick.zenEditor",
|
|
269
303
|
icon: "AmplifyIcon",
|
|
270
|
-
hidden$:
|
|
304
|
+
hidden$: Oe(e),
|
|
271
305
|
disabled$: t.currentEditCell$.pipe(
|
|
272
|
-
|
|
306
|
+
$e((n) => Te(e, { workbookTypes: [Ae], worksheetTypes: [Be, Le, je], rangeTypes: [Ze] }).pipe(ke((i) => {
|
|
273
307
|
var r, o, s, c;
|
|
274
|
-
return
|
|
308
|
+
return i || ((c = (s = (o = (r = n == null ? void 0 : n.documentLayoutObject.documentModel) == null ? void 0 : r.getBody()) == null ? void 0 : o.customBlocks) == null ? void 0 : s.length) != null ? c : 0) > 0;
|
|
275
309
|
})))
|
|
276
310
|
)
|
|
277
311
|
};
|
|
278
312
|
}
|
|
279
|
-
const
|
|
280
|
-
[
|
|
313
|
+
const tt = {
|
|
314
|
+
[ye.MAIN_AREA]: {
|
|
281
315
|
[De.OTHERS]: {
|
|
282
|
-
[
|
|
316
|
+
[k.id]: {
|
|
283
317
|
order: 2,
|
|
284
|
-
menuItemFactory:
|
|
318
|
+
menuItemFactory: et
|
|
285
319
|
}
|
|
286
320
|
}
|
|
287
321
|
}
|
|
288
|
-
},
|
|
289
|
-
id:
|
|
322
|
+
}, nt = {
|
|
323
|
+
id: Z.id,
|
|
290
324
|
description: "shortcut.sheet.zen-edit-confirm",
|
|
291
325
|
group: "4_sheet-edit",
|
|
292
|
-
preconditions: (e) =>
|
|
293
|
-
binding:
|
|
294
|
-
},
|
|
295
|
-
id:
|
|
326
|
+
preconditions: (e) => ie(e),
|
|
327
|
+
binding: q.ENTER | we.ALT
|
|
328
|
+
}, it = {
|
|
329
|
+
id: U.id,
|
|
296
330
|
description: "shortcut.sheet.zen-edit-cancel",
|
|
297
331
|
group: "4_sheet-edit",
|
|
298
|
-
preconditions: (e) =>
|
|
299
|
-
binding:
|
|
332
|
+
preconditions: (e) => ie(e),
|
|
333
|
+
binding: q.ESC
|
|
300
334
|
};
|
|
301
|
-
function
|
|
302
|
-
return e.getContextValue(
|
|
335
|
+
function ie(e) {
|
|
336
|
+
return e.getContextValue(de) && e.getContextValue(ue) && e.getContextValue(ge) && !e.getContextValue(he);
|
|
303
337
|
}
|
|
304
|
-
var
|
|
305
|
-
for (var r =
|
|
338
|
+
var rt = Object.getOwnPropertyDescriptor, ot = (e, t, n, i) => {
|
|
339
|
+
for (var r = i > 1 ? void 0 : i ? rt(t, n) : t, o = e.length - 1, s; o >= 0; o--)
|
|
306
340
|
(s = e[o]) && (r = s(r) || r);
|
|
307
341
|
return r;
|
|
308
|
-
},
|
|
309
|
-
let N = class extends
|
|
310
|
-
constructor(e, t,
|
|
311
|
-
super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService =
|
|
342
|
+
}, C = (e, t) => (n, i) => t(n, i, e);
|
|
343
|
+
let N = class extends fe {
|
|
344
|
+
constructor(e, t, n, i) {
|
|
345
|
+
super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = n, this._shortcutService = i, this._initialize();
|
|
312
346
|
}
|
|
313
347
|
_initialize() {
|
|
314
348
|
this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
|
|
315
349
|
}
|
|
316
350
|
_initCustomComponents() {
|
|
317
|
-
this.disposeWithMe(this._zenZoneService.set(
|
|
351
|
+
this.disposeWithMe(this._zenZoneService.set(qe, Qe));
|
|
318
352
|
}
|
|
319
353
|
_initCommands() {
|
|
320
|
-
[
|
|
354
|
+
[k, U, Z].forEach((e) => {
|
|
321
355
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
322
356
|
});
|
|
323
357
|
}
|
|
324
358
|
_initMenus() {
|
|
325
|
-
this._menuManagerService.mergeMenu(
|
|
359
|
+
this._menuManagerService.mergeMenu(tt);
|
|
326
360
|
}
|
|
327
361
|
_initShortcuts() {
|
|
328
|
-
[
|
|
362
|
+
[nt, it].forEach((e) => {
|
|
329
363
|
this.disposeWithMe(this._shortcutService.registerShortcut(e));
|
|
330
364
|
});
|
|
331
365
|
}
|
|
332
366
|
};
|
|
333
|
-
N =
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
367
|
+
N = ot([
|
|
368
|
+
C(0, b),
|
|
369
|
+
C(1, K),
|
|
370
|
+
C(2, Re),
|
|
371
|
+
C(3, xe)
|
|
338
372
|
], N);
|
|
339
|
-
var
|
|
340
|
-
for (var r =
|
|
373
|
+
var st = Object.getOwnPropertyDescriptor, ct = (e, t, n, i) => {
|
|
374
|
+
for (var r = i > 1 ? void 0 : i ? st(t, n) : t, o = e.length - 1, s; o >= 0; o--)
|
|
341
375
|
(s = e[o]) && (r = s(r) || r);
|
|
342
376
|
return r;
|
|
343
|
-
},
|
|
344
|
-
let
|
|
377
|
+
}, F = (e, t) => (n, i) => t(n, i, e);
|
|
378
|
+
let O = class extends me {
|
|
345
379
|
constructor(e, t) {
|
|
346
380
|
super(), this._zenEditorManagerService = e, this._renderManagerService = t, this._initialize();
|
|
347
381
|
}
|
|
@@ -350,83 +384,83 @@ let y = class extends me {
|
|
|
350
384
|
}
|
|
351
385
|
// Listen to changes in the size of the zen editor container to set the size of the editor.
|
|
352
386
|
_syncZenEditorSize() {
|
|
353
|
-
this._zenEditorManagerService.position$.pipe(
|
|
387
|
+
this._zenEditorManagerService.position$.pipe(Ue(this.dispose$)).subscribe((e) => {
|
|
354
388
|
if (e == null)
|
|
355
389
|
return;
|
|
356
|
-
const { width: t, height:
|
|
357
|
-
|
|
358
|
-
|
|
390
|
+
const { width: t, height: n } = e, i = be(u, this._renderManagerService);
|
|
391
|
+
i != null && requestIdleCallback(() => {
|
|
392
|
+
i.engine.resizeBySize(t, n), this._calculatePagePosition(i), this._scrollToTop();
|
|
359
393
|
});
|
|
360
394
|
});
|
|
361
395
|
}
|
|
362
396
|
_calculatePagePosition(e) {
|
|
363
|
-
const { document: t, scene:
|
|
397
|
+
const { document: t, scene: n, docBackground: i } = e, r = n == null ? void 0 : n.getParent(), { width: o, height: s, pageMarginLeft: c, pageMarginTop: a } = t;
|
|
364
398
|
if (r == null || o === Number.POSITIVE_INFINITY || s === Number.POSITIVE_INFINITY)
|
|
365
399
|
return;
|
|
366
|
-
const { width: l, height:
|
|
367
|
-
let
|
|
368
|
-
const
|
|
369
|
-
let m = 0,
|
|
370
|
-
const { scaleX: h, scaleY:
|
|
371
|
-
l > (o + c * 2) * h ? (
|
|
372
|
-
const M =
|
|
373
|
-
if (
|
|
374
|
-
const
|
|
400
|
+
const { width: l, height: f } = r;
|
|
401
|
+
let d = 0;
|
|
402
|
+
const g = a;
|
|
403
|
+
let m = 0, S = 0, v = Number.POSITIVE_INFINITY;
|
|
404
|
+
const { scaleX: h, scaleY: I } = n.getAncestorScale();
|
|
405
|
+
l > (o + c * 2) * h ? (d = l / 2 - o * h / 2, d /= h, m = (l - c * 2) / h, v = 0) : (d = c, m = o + c * 2, v = (m - l / h) / 2), f > s ? S = (f - a * 2) / I : S = s + a * 2, n.resize(m, S), t.translate(d, g), i.translate(d, g);
|
|
406
|
+
const M = n.getViewport(Ce.VIEW_MAIN);
|
|
407
|
+
if (v !== Number.POSITIVE_INFINITY && M != null) {
|
|
408
|
+
const re = M.transScroll2ViewportScrollValue(v, 0).x;
|
|
375
409
|
M.scrollToBarPos({
|
|
376
|
-
x:
|
|
410
|
+
x: re
|
|
377
411
|
});
|
|
378
412
|
}
|
|
379
413
|
return this;
|
|
380
414
|
}
|
|
381
415
|
_scrollToTop() {
|
|
382
|
-
var
|
|
383
|
-
const e = (
|
|
416
|
+
var n;
|
|
417
|
+
const e = (n = this._renderManagerService.getRenderById(u)) == null ? void 0 : n.with(Ee), t = {
|
|
384
418
|
startOffset: 0,
|
|
385
419
|
endOffset: 0
|
|
386
420
|
};
|
|
387
421
|
e && e.scrollToRange(t);
|
|
388
422
|
}
|
|
389
423
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
],
|
|
394
|
-
var
|
|
395
|
-
for (var r =
|
|
424
|
+
O = ct([
|
|
425
|
+
F(0, L),
|
|
426
|
+
F(1, X)
|
|
427
|
+
], O);
|
|
428
|
+
var at = Object.getOwnPropertyDescriptor, lt = (e, t, n, i) => {
|
|
429
|
+
for (var r = i > 1 ? void 0 : i ? at(t, n) : t, o = e.length - 1, s; o >= 0; o--)
|
|
396
430
|
(s = e[o]) && (r = s(r) || r);
|
|
397
431
|
return r;
|
|
398
|
-
},
|
|
399
|
-
let
|
|
400
|
-
constructor(e =
|
|
401
|
-
super(), this._config = e, this._injector = t, this._configService =
|
|
402
|
-
const { menu:
|
|
432
|
+
}, W = (e, t) => (n, i) => t(n, i, e), E;
|
|
433
|
+
let H = (E = class extends ve {
|
|
434
|
+
constructor(e = V, t, n) {
|
|
435
|
+
super(), this._config = e, this._injector = t, this._configService = n;
|
|
436
|
+
const { menu: i, ...r } = pe(
|
|
403
437
|
{},
|
|
404
|
-
|
|
438
|
+
V,
|
|
405
439
|
this._config
|
|
406
440
|
);
|
|
407
|
-
|
|
441
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Ve, r), this._initializeDependencies(this._injector);
|
|
408
442
|
}
|
|
409
443
|
_initializeDependencies(e) {
|
|
410
444
|
[
|
|
411
445
|
[N],
|
|
412
|
-
[
|
|
413
|
-
[
|
|
414
|
-
].forEach((
|
|
446
|
+
[O],
|
|
447
|
+
[L, { useClass: Ke }]
|
|
448
|
+
].forEach((n) => e.add(n));
|
|
415
449
|
}
|
|
416
450
|
onReady() {
|
|
417
451
|
this._injector.get(N);
|
|
418
452
|
}
|
|
419
453
|
onSteady() {
|
|
420
|
-
this._injector.get(
|
|
454
|
+
this._injector.get(O);
|
|
421
455
|
}
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
],
|
|
456
|
+
}, p(E, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), p(E, "type", x.UNIVER_SHEET), E);
|
|
457
|
+
H = lt([
|
|
458
|
+
W(1, _e(Se)),
|
|
459
|
+
W(2, Ie)
|
|
460
|
+
], H);
|
|
427
461
|
export {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
462
|
+
U as CancelZenEditCommand,
|
|
463
|
+
Z as ConfirmZenEditCommand,
|
|
464
|
+
k as OpenZenEditorCommand,
|
|
465
|
+
H as UniverSheetsZenEditorPlugin
|
|
432
466
|
};
|