@univerjs/sheets-zen-editor 0.4.2 → 0.5.0-beta.0
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 +2 -2
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +277 -290
- package/lib/{locale/en-US.json → es/locale/en-US.js} +7 -4
- package/lib/{locale/fa-IR.json → es/locale/fa-IR.js} +7 -4
- package/lib/{locale/ru-RU.json → es/locale/ru-RU.js} +7 -4
- package/lib/{locale/vi-VN.json → es/locale/vi-VN.js} +7 -4
- package/lib/{locale/zh-CN.json → es/locale/zh-CN.js} +7 -4
- package/lib/{locale/zh-TW.json → es/locale/zh-TW.js} +7 -4
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +30 -22
package/lib/es/index.js
CHANGED
|
@@ -1,158 +1,156 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
const OpenZenEditorCommand = {
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var ae = (e, t, r) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var v = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { CommandType as x, IUniverInstanceService as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as p, Tools as Y, UniverInstanceType as M, DocumentFlavor as H, DocumentDataModel as le, createIdentifier as de, RxDisposable as ue, DEFAULT_EMPTY_DOCUMENT_VALUE as fe, useDependency as P, ICommandService as G, FOCUSING_DOC as ge, FOCUSING_UNIVER_EDITOR as he, EDITOR_ACTIVATED as me, FOCUSING_EDITOR_STANDALONE as pe, Disposable as _e, Plugin as ve, Inject as Ee, Injector as Ie, IConfigService as Se } from "@univerjs/core";
|
|
5
|
+
import { IEditorService as D, VIEWPORT_KEY as Ce, DocBackScrollRenderController as Oe } from "@univerjs/docs-ui";
|
|
6
|
+
import { IRenderManagerService as K } from "@univerjs/engine-render";
|
|
7
|
+
import { IEditorBridgeService as j, EditingRenderController as ye, getEditorObject as Ne, getCurrentExclusiveRangeInterest$ as Te, getCurrentRangeDisable$ as be } from "@univerjs/sheets-ui";
|
|
8
|
+
import { IZenZoneService as T, MenuItemType as ze, ContextMenuPosition as Pe, ContextMenuGroup as xe, KeyCode as X, MetaKeys as Re, IMenuManagerService as Me, IShortcutService as De } from "@univerjs/ui";
|
|
9
|
+
import { BehaviorSubject as je, takeUntil as we } from "rxjs";
|
|
10
|
+
import Ue, { forwardRef as w, useRef as q, createElement as U, useEffect as Ze } from "react";
|
|
11
|
+
import { WorkbookEditablePermission as Le, WorksheetEditPermission as Ae, WorksheetSetCellValuePermission as $e, WorksheetSetCellStylePermission as Be, RangeProtectionPermissionEditPoint as ke } from "@univerjs/sheets";
|
|
12
|
+
const Z = {
|
|
14
13
|
id: "zen-editor.command.open-zen-editor",
|
|
15
|
-
type:
|
|
16
|
-
handler:
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
14
|
+
type: x.COMMAND,
|
|
15
|
+
handler: async (e) => {
|
|
16
|
+
var f;
|
|
17
|
+
const t = e.get(T), r = e.get(D), n = e.get(j), i = e.get(R);
|
|
18
|
+
t.open();
|
|
19
|
+
const o = r.getEditor(p);
|
|
20
|
+
if (o == null)
|
|
22
21
|
return !1;
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
22
|
+
const s = n.getLatestEditCellState();
|
|
23
|
+
if (s == null)
|
|
25
24
|
return !1;
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
25
|
+
const c = (f = s.documentLayoutObject.documentModel) == null ? void 0 : f.getSnapshot();
|
|
26
|
+
if (c == null)
|
|
28
27
|
return !1;
|
|
29
|
-
|
|
30
|
-
const { body, drawings, drawingsOrder, tableSource, settings } =
|
|
31
|
-
...
|
|
32
|
-
body,
|
|
33
|
-
drawings,
|
|
34
|
-
drawingsOrder,
|
|
35
|
-
tableSource,
|
|
36
|
-
settings
|
|
37
|
-
},
|
|
28
|
+
i.focusUnit(p);
|
|
29
|
+
const { body: a, drawings: u, drawingsOrder: g, tableSource: d, settings: S } = Y.deepClone(c), I = {
|
|
30
|
+
...o.getDocumentData(),
|
|
31
|
+
body: a,
|
|
32
|
+
drawings: u,
|
|
33
|
+
drawingsOrder: g,
|
|
34
|
+
tableSource: d,
|
|
35
|
+
settings: S
|
|
36
|
+
}, _ = [
|
|
38
37
|
{
|
|
39
38
|
startOffset: 0,
|
|
40
39
|
endOffset: 0,
|
|
41
40
|
collapsed: !0
|
|
42
41
|
}
|
|
43
42
|
];
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
},
|
|
43
|
+
return o.focus(), o.setDocumentData(I, _), o.clearUndoRedoHistory(), !0;
|
|
44
|
+
}
|
|
45
|
+
}, L = {
|
|
47
46
|
id: "zen-editor.command.cancel-zen-edit",
|
|
48
|
-
type:
|
|
49
|
-
handler:
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
},
|
|
47
|
+
type: x.COMMAND,
|
|
48
|
+
handler: async (e) => {
|
|
49
|
+
const t = e.get(T), r = e.get(j), n = e.get(R);
|
|
50
|
+
t.close();
|
|
51
|
+
const i = n.getCurrentUnitForType(M.UNIVER_SHEET);
|
|
52
|
+
return i ? (n.focusUnit(i.getUnitId()), r.refreshEditCellState(), !0) : !1;
|
|
53
|
+
}
|
|
54
|
+
}, A = {
|
|
56
55
|
id: "zen-editor.command.confirm-zen-edit",
|
|
57
|
-
type:
|
|
58
|
-
handler:
|
|
59
|
-
var
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
56
|
+
type: x.COMMAND,
|
|
57
|
+
handler: async (e) => {
|
|
58
|
+
var a;
|
|
59
|
+
const t = e.get(T), r = e.get(j), n = e.get(R), i = e.get(D);
|
|
60
|
+
t.close();
|
|
61
|
+
const o = i.getEditor(p);
|
|
62
|
+
if (o == null)
|
|
64
63
|
return !1;
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
64
|
+
const s = e.get(K), c = n.getCurrentUnitForType(M.UNIVER_SHEET);
|
|
65
|
+
if (c) {
|
|
66
|
+
const u = c.getUnitId(), g = (a = s.getRenderById(u)) == null ? void 0 : a.with(ye);
|
|
67
|
+
if (g) {
|
|
68
|
+
const d = Y.deepClone(o.getDocumentData());
|
|
69
|
+
d.documentStyle.documentFlavor = H.UNSPECIFIED, g.submitCellData(new le(d));
|
|
71
70
|
}
|
|
72
|
-
return
|
|
71
|
+
return n.focusUnit(c.getUnitId()), r.refreshEditCellState(), !0;
|
|
73
72
|
}
|
|
74
73
|
return !1;
|
|
75
|
-
}
|
|
76
|
-
},
|
|
74
|
+
}
|
|
75
|
+
}, Ve = "sheets-zen-editor.config", Fe = {};
|
|
76
|
+
class We {
|
|
77
77
|
constructor() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
v(this, "_position", null);
|
|
79
|
+
v(this, "_position$", new je(null));
|
|
80
|
+
v(this, "position$", this._position$.asObservable());
|
|
81
81
|
}
|
|
82
82
|
dispose() {
|
|
83
83
|
this._position$.complete(), this._position = null;
|
|
84
84
|
}
|
|
85
|
-
setPosition(
|
|
86
|
-
this._position =
|
|
85
|
+
setPosition(t) {
|
|
86
|
+
this._position = t, this._refresh(t);
|
|
87
87
|
}
|
|
88
88
|
getPosition() {
|
|
89
89
|
return this._position;
|
|
90
90
|
}
|
|
91
|
-
_refresh(
|
|
92
|
-
this._position$.next(
|
|
91
|
+
_refresh(t) {
|
|
92
|
+
this._position$.next(t);
|
|
93
93
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
let ZenEditorManagerService = _ZenEditorManagerService;
|
|
97
|
-
const IZenEditorManagerService = createIdentifier(
|
|
94
|
+
}
|
|
95
|
+
const $ = de(
|
|
98
96
|
"univer.sheet-zen-editor-manager.service"
|
|
99
97
|
);
|
|
100
|
-
var
|
|
101
|
-
for (var
|
|
102
|
-
(
|
|
103
|
-
return
|
|
104
|
-
},
|
|
105
|
-
let
|
|
106
|
-
constructor(
|
|
107
|
-
super(), this._zenEditorManagerService =
|
|
98
|
+
var Ye = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Ge = (e, t, r, n) => {
|
|
99
|
+
for (var i = n > 1 ? void 0 : n ? He(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
100
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
101
|
+
return n && i && Ye(t, r, i), i;
|
|
102
|
+
}, k = (e, t) => (r, n) => t(r, n, e);
|
|
103
|
+
let y = class extends ue {
|
|
104
|
+
constructor(e, t) {
|
|
105
|
+
super(), this._zenEditorManagerService = e, this._renderManagerService = t, this._initialize();
|
|
108
106
|
}
|
|
109
107
|
_initialize() {
|
|
110
108
|
this._syncZenEditorSize();
|
|
111
109
|
}
|
|
112
110
|
// Listen to changes in the size of the zen editor container to set the size of the editor.
|
|
113
111
|
_syncZenEditorSize() {
|
|
114
|
-
this._zenEditorManagerService.position$.pipe(
|
|
115
|
-
if (
|
|
112
|
+
this._zenEditorManagerService.position$.pipe(we(this.dispose$)).subscribe((e) => {
|
|
113
|
+
if (e == null)
|
|
116
114
|
return;
|
|
117
|
-
const { width, height } =
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
const { width: t, height: r } = e, n = Ne(p, this._renderManagerService);
|
|
116
|
+
n != null && requestIdleCallback(() => {
|
|
117
|
+
n.engine.resizeBySize(t, r), this._calculatePagePosition(n), this._scrollToTop();
|
|
120
118
|
});
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
|
-
_calculatePagePosition(
|
|
124
|
-
const { document:
|
|
125
|
-
if (
|
|
121
|
+
_calculatePagePosition(e) {
|
|
122
|
+
const { document: t, scene: r, docBackground: n } = e, i = r == null ? void 0 : r.getParent(), { width: o, height: s, pageMarginLeft: c, pageMarginTop: a } = t;
|
|
123
|
+
if (i == null || o === Number.POSITIVE_INFINITY || s === Number.POSITIVE_INFINITY)
|
|
126
124
|
return;
|
|
127
|
-
const { width:
|
|
128
|
-
let
|
|
129
|
-
const
|
|
130
|
-
let
|
|
131
|
-
const { scaleX, scaleY } =
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
x:
|
|
125
|
+
const { width: u, height: g } = i;
|
|
126
|
+
let d = 0;
|
|
127
|
+
const S = a;
|
|
128
|
+
let E = 0, I = 0, _ = Number.POSITIVE_INFINITY;
|
|
129
|
+
const { scaleX: f, scaleY: oe } = r.getAncestorScale();
|
|
130
|
+
u > (o + c * 2) * f ? (d = u / 2 - o * f / 2, d /= f, E = (u - c * 2) / f, _ = 0) : (d = c, E = o + c * 2, _ = (E - u / f) / 2), g > s ? I = (g - a * 2) / oe : I = s + a * 2, r.resize(E, I), t.translate(d, S), n.translate(d, S);
|
|
131
|
+
const z = r.getViewport(Ce.VIEW_MAIN);
|
|
132
|
+
if (_ !== Number.POSITIVE_INFINITY && z != null) {
|
|
133
|
+
const se = z.transScroll2ViewportScrollValue(_, 0).x;
|
|
134
|
+
z.scrollToBarPos({
|
|
135
|
+
x: se
|
|
138
136
|
});
|
|
139
137
|
}
|
|
140
138
|
return this;
|
|
141
139
|
}
|
|
142
140
|
_scrollToTop() {
|
|
143
|
-
var
|
|
144
|
-
const
|
|
141
|
+
var r;
|
|
142
|
+
const e = (r = this._renderManagerService.getRenderById(p)) == null ? void 0 : r.with(Oe), t = {
|
|
145
143
|
startOffset: 0,
|
|
146
144
|
endOffset: 0
|
|
147
145
|
};
|
|
148
|
-
|
|
146
|
+
e && e.scrollToRange(t);
|
|
149
147
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
],
|
|
155
|
-
var
|
|
148
|
+
};
|
|
149
|
+
y = Ge([
|
|
150
|
+
k(0, $),
|
|
151
|
+
k(1, K)
|
|
152
|
+
], y);
|
|
153
|
+
var J = { exports: {} }, b = {};
|
|
156
154
|
/**
|
|
157
155
|
* @license React
|
|
158
156
|
* react-jsx-runtime.production.min.js
|
|
@@ -162,108 +160,101 @@ var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
|
|
|
162
160
|
* This source code is licensed under the MIT license found in the
|
|
163
161
|
* LICENSE file in the root directory of this source tree.
|
|
164
162
|
*/
|
|
165
|
-
var
|
|
166
|
-
function
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
for (
|
|
170
|
-
if (
|
|
171
|
-
return { $$typeof:
|
|
163
|
+
var Ke = Ue, Xe = Symbol.for("react.element"), qe = Symbol.for("react.fragment"), Je = Object.prototype.hasOwnProperty, Qe = Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, et = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
164
|
+
function Q(e, t, r) {
|
|
165
|
+
var n, i = {}, o = null, s = null;
|
|
166
|
+
r !== void 0 && (o = "" + r), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
|
|
167
|
+
for (n in t) Je.call(t, n) && !et.hasOwnProperty(n) && (i[n] = t[n]);
|
|
168
|
+
if (e && e.defaultProps) for (n in t = e.defaultProps, t) i[n] === void 0 && (i[n] = t[n]);
|
|
169
|
+
return { $$typeof: Xe, type: e, key: o, ref: s, props: i, _owner: Qe.current };
|
|
172
170
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
|
|
171
|
+
b.Fragment = qe;
|
|
172
|
+
b.jsx = Q;
|
|
173
|
+
b.jsxs = Q;
|
|
174
|
+
J.exports = b;
|
|
175
|
+
var h = J.exports, l = function() {
|
|
176
|
+
return l = Object.assign || function(e) {
|
|
177
|
+
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
178
|
+
t = arguments[r];
|
|
179
|
+
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
183
180
|
}
|
|
184
|
-
return
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
var
|
|
188
|
-
for (var
|
|
189
|
-
if (
|
|
190
|
-
for (var i = 0,
|
|
191
|
-
|
|
192
|
-
return
|
|
193
|
-
},
|
|
194
|
-
var
|
|
195
|
-
return
|
|
181
|
+
return e;
|
|
182
|
+
}, l.apply(this, arguments);
|
|
183
|
+
}, tt = function(e, t) {
|
|
184
|
+
var r = {};
|
|
185
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
186
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
187
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
188
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
|
|
189
|
+
return r;
|
|
190
|
+
}, B = w(function(e, t) {
|
|
191
|
+
var r = e.icon, n = e.id, i = e.className, o = e.extend, s = tt(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = q("_".concat(it()));
|
|
192
|
+
return ee(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, l({ ref: t, className: c }, s), o);
|
|
196
193
|
});
|
|
197
|
-
function
|
|
198
|
-
return
|
|
199
|
-
return
|
|
194
|
+
function ee(e, t, r, n, i) {
|
|
195
|
+
return U(e.tag, l(l({ key: t }, nt(e, r, i)), n), (rt(e, r).children || []).map(function(o, s) {
|
|
196
|
+
return ee(o, "".concat(t, "-").concat(e.tag, "-").concat(s), r, void 0, i);
|
|
200
197
|
}));
|
|
201
198
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
})), attrs;
|
|
199
|
+
function nt(e, t, r) {
|
|
200
|
+
var n = l({}, e.attrs);
|
|
201
|
+
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
|
|
202
|
+
var i = t.defIds;
|
|
203
|
+
return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(o) {
|
|
204
|
+
var s = o[0], c = o[1];
|
|
205
|
+
typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
206
|
+
})), n;
|
|
211
207
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}) }) : node;
|
|
208
|
+
function rt(e, t) {
|
|
209
|
+
var r, n = t.defIds;
|
|
210
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? l(l({}, e), { children: e.children.map(function(i) {
|
|
211
|
+
return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? l(l({}, i), { attrs: l(l({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
|
|
212
|
+
}) }) : e;
|
|
218
213
|
}
|
|
219
|
-
|
|
220
|
-
function generateShortUuid() {
|
|
214
|
+
function it() {
|
|
221
215
|
return Math.random().toString(36).substring(2, 8);
|
|
222
216
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
217
|
+
B.displayName = "UniverIcon";
|
|
218
|
+
var ot = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, te = w(function(e, t) {
|
|
219
|
+
return U(B, Object.assign({}, e, {
|
|
227
220
|
id: "check-mark-single",
|
|
228
|
-
ref,
|
|
229
|
-
icon:
|
|
221
|
+
ref: t,
|
|
222
|
+
icon: ot
|
|
230
223
|
}));
|
|
231
224
|
});
|
|
232
|
-
|
|
233
|
-
var
|
|
234
|
-
return
|
|
225
|
+
te.displayName = "CheckMarkSingle";
|
|
226
|
+
var st = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }] }, ne = w(function(e, t) {
|
|
227
|
+
return U(B, Object.assign({}, e, {
|
|
235
228
|
id: "close-single",
|
|
236
|
-
ref,
|
|
237
|
-
icon:
|
|
229
|
+
ref: t,
|
|
230
|
+
icon: st
|
|
238
231
|
}));
|
|
239
232
|
});
|
|
240
|
-
|
|
241
|
-
function
|
|
242
|
-
var t,
|
|
243
|
-
if (typeof e == "string" || typeof e == "number")
|
|
233
|
+
ne.displayName = "CloseSingle";
|
|
234
|
+
function re(e) {
|
|
235
|
+
var t, r, n = "";
|
|
236
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
244
237
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
245
|
-
var
|
|
246
|
-
for (t = 0; t <
|
|
247
|
-
} else for (
|
|
248
|
-
return
|
|
238
|
+
var i = e.length;
|
|
239
|
+
for (t = 0; t < i; t++) e[t] && (r = re(e[t])) && (n && (n += " "), n += r);
|
|
240
|
+
} else for (r in e) e[r] && (n && (n += " "), n += r);
|
|
241
|
+
return n;
|
|
249
242
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return n2;
|
|
243
|
+
function V() {
|
|
244
|
+
for (var e, t, r = 0, n = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t = re(e)) && (n && (n += " "), n += t);
|
|
245
|
+
return n;
|
|
254
246
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
id: DOCS_ZEN_EDITOR_UNIT_ID_KEY,
|
|
247
|
+
const ct = "univer-zen-editor", at = "univer-zen-editor-icon-wrapper", lt = "univer-zen-editor-icon-container", dt = "univer-zen-editor-icon-success", ut = "univer-zen-editor-icon-error", ft = "univer-zen-editor-canvas-container", m = {
|
|
248
|
+
zenEditor: ct,
|
|
249
|
+
zenEditorIconWrapper: at,
|
|
250
|
+
zenEditorIconContainer: lt,
|
|
251
|
+
zenEditorIconSuccess: dt,
|
|
252
|
+
zenEditorIconError: ut,
|
|
253
|
+
zenEditorCanvasContainer: ft
|
|
254
|
+
}, gt = "ZEN_EDITOR_PLUGIN_", ht = `${gt}ZEN_EDITOR_COMPONENT`, mt = {
|
|
255
|
+
id: p,
|
|
265
256
|
body: {
|
|
266
|
-
dataStream: `${
|
|
257
|
+
dataStream: `${fe}`,
|
|
267
258
|
textRuns: [],
|
|
268
259
|
tables: [],
|
|
269
260
|
customBlocks: [],
|
|
@@ -282,7 +273,7 @@ const zenEditor = "univer-zen-editor", zenEditorIconWrapper = "univer-zen-editor
|
|
|
282
273
|
width: 595,
|
|
283
274
|
height: Number.POSITIVE_INFINITY
|
|
284
275
|
},
|
|
285
|
-
documentFlavor:
|
|
276
|
+
documentFlavor: H.MODERN,
|
|
286
277
|
marginTop: 0,
|
|
287
278
|
marginBottom: 0,
|
|
288
279
|
marginRight: 0,
|
|
@@ -295,162 +286,158 @@ const zenEditor = "univer-zen-editor", zenEditorIconWrapper = "univer-zen-editor
|
|
|
295
286
|
drawings: {},
|
|
296
287
|
drawingsOrder: []
|
|
297
288
|
};
|
|
298
|
-
function
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
289
|
+
function pt() {
|
|
290
|
+
const e = q(null), t = P($), r = P(D), n = P(G);
|
|
291
|
+
Ze(() => {
|
|
292
|
+
const s = e.current;
|
|
293
|
+
if (!s)
|
|
303
294
|
return;
|
|
304
|
-
const
|
|
295
|
+
const c = r.register(
|
|
305
296
|
{
|
|
306
|
-
editorUnitId:
|
|
307
|
-
initialSnapshot:
|
|
297
|
+
editorUnitId: p,
|
|
298
|
+
initialSnapshot: mt,
|
|
308
299
|
scrollBar: !0,
|
|
309
300
|
noNeedVerticalAlign: !0,
|
|
310
301
|
backScrollOffset: 100
|
|
311
302
|
},
|
|
312
|
-
|
|
313
|
-
),
|
|
314
|
-
|
|
303
|
+
s
|
|
304
|
+
), a = new ResizeObserver(() => {
|
|
305
|
+
t.setPosition(s.getBoundingClientRect());
|
|
315
306
|
});
|
|
316
|
-
return
|
|
317
|
-
|
|
307
|
+
return a.observe(s), () => {
|
|
308
|
+
c.dispose(), a.unobserve(s);
|
|
318
309
|
};
|
|
319
310
|
}, []);
|
|
320
|
-
function
|
|
321
|
-
|
|
311
|
+
function i() {
|
|
312
|
+
n.executeCommand(L.id);
|
|
322
313
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
commandService.executeCommand(ConfirmZenEditCommand.id);
|
|
314
|
+
function o() {
|
|
315
|
+
n.executeCommand(A.id);
|
|
326
316
|
}
|
|
327
|
-
return
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
/* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ h.jsxs("div", { className: m.zenEditor, children: [
|
|
318
|
+
/* @__PURE__ */ h.jsxs("div", { className: m.zenEditorIconWrapper, children: [
|
|
319
|
+
/* @__PURE__ */ h.jsx(
|
|
330
320
|
"span",
|
|
331
321
|
{
|
|
332
|
-
className:
|
|
333
|
-
onClick:
|
|
334
|
-
children: /* @__PURE__ */
|
|
322
|
+
className: V(m.zenEditorIconContainer, m.zenEditorIconError),
|
|
323
|
+
onClick: i,
|
|
324
|
+
children: /* @__PURE__ */ h.jsx(ne, { style: { fontSize: "22px" } })
|
|
335
325
|
}
|
|
336
326
|
),
|
|
337
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ h.jsx(
|
|
338
328
|
"span",
|
|
339
329
|
{
|
|
340
|
-
className:
|
|
341
|
-
onClick:
|
|
342
|
-
children: /* @__PURE__ */
|
|
330
|
+
className: V(m.zenEditorIconContainer, m.zenEditorIconSuccess),
|
|
331
|
+
onClick: o,
|
|
332
|
+
children: /* @__PURE__ */ h.jsx(te, { style: { fontSize: "22px" } })
|
|
343
333
|
}
|
|
344
334
|
)
|
|
345
335
|
] }),
|
|
346
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ h.jsx("div", { className: m.zenEditorCanvasContainer, ref: e })
|
|
347
337
|
] });
|
|
348
338
|
}
|
|
349
|
-
|
|
350
|
-
function ZenEditorMenuItemFactory(accessor) {
|
|
339
|
+
function _t(e) {
|
|
351
340
|
return {
|
|
352
|
-
id:
|
|
353
|
-
type:
|
|
341
|
+
id: Z.id,
|
|
342
|
+
type: ze.BUTTON,
|
|
354
343
|
title: "rightClick.zenEditor",
|
|
355
344
|
icon: "AmplifySingle",
|
|
356
|
-
hidden$:
|
|
357
|
-
disabled$:
|
|
345
|
+
hidden$: Te(e),
|
|
346
|
+
disabled$: be(e, { workbookTypes: [Le], worksheetTypes: [Ae, $e, Be], rangeTypes: [ke] })
|
|
358
347
|
};
|
|
359
348
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
[OpenZenEditorCommand.id]: {
|
|
349
|
+
const vt = {
|
|
350
|
+
[Pe.MAIN_AREA]: {
|
|
351
|
+
[xe.OTHERS]: {
|
|
352
|
+
[Z.id]: {
|
|
365
353
|
order: 2,
|
|
366
|
-
menuItemFactory:
|
|
354
|
+
menuItemFactory: _t
|
|
367
355
|
}
|
|
368
356
|
}
|
|
369
357
|
}
|
|
370
|
-
},
|
|
371
|
-
id:
|
|
358
|
+
}, Et = {
|
|
359
|
+
id: A.id,
|
|
372
360
|
description: "shortcut.sheet.zen-edit-confirm",
|
|
373
361
|
group: "4_sheet-edit",
|
|
374
|
-
preconditions:
|
|
375
|
-
binding:
|
|
376
|
-
},
|
|
377
|
-
id:
|
|
362
|
+
preconditions: (e) => ie(e),
|
|
363
|
+
binding: X.ENTER | Re.ALT
|
|
364
|
+
}, It = {
|
|
365
|
+
id: L.id,
|
|
378
366
|
description: "shortcut.sheet.zen-edit-cancel",
|
|
379
367
|
group: "4_sheet-edit",
|
|
380
|
-
preconditions:
|
|
381
|
-
binding:
|
|
368
|
+
preconditions: (e) => ie(e),
|
|
369
|
+
binding: X.ESC
|
|
382
370
|
};
|
|
383
|
-
function
|
|
384
|
-
return
|
|
371
|
+
function ie(e) {
|
|
372
|
+
return e.getContextValue(ge) && e.getContextValue(he) && e.getContextValue(me) && !e.getContextValue(pe);
|
|
385
373
|
}
|
|
386
|
-
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
super(), this._zenZoneService = _zenZoneService, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._shortcutService = _shortcutService, this._initialize();
|
|
374
|
+
var St = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, Ot = (e, t, r, n) => {
|
|
375
|
+
for (var i = n > 1 ? void 0 : n ? Ct(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
376
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
377
|
+
return n && i && St(t, r, i), i;
|
|
378
|
+
}, C = (e, t) => (r, n) => t(r, n, e);
|
|
379
|
+
let N = class extends _e {
|
|
380
|
+
constructor(e, t, r, n) {
|
|
381
|
+
super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = r, this._shortcutService = n, this._initialize();
|
|
395
382
|
}
|
|
396
383
|
_initialize() {
|
|
397
384
|
this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
|
|
398
385
|
}
|
|
399
386
|
_initCustomComponents() {
|
|
400
|
-
this.disposeWithMe(this._zenZoneService.set(
|
|
387
|
+
this.disposeWithMe(this._zenZoneService.set(ht, pt));
|
|
401
388
|
}
|
|
402
389
|
_initCommands() {
|
|
403
|
-
[
|
|
404
|
-
this.disposeWithMe(this._commandService.registerCommand(
|
|
390
|
+
[Z, L, A].forEach((e) => {
|
|
391
|
+
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
405
392
|
});
|
|
406
393
|
}
|
|
407
394
|
_initMenus() {
|
|
408
|
-
this._menuManagerService.mergeMenu(
|
|
395
|
+
this._menuManagerService.mergeMenu(vt);
|
|
409
396
|
}
|
|
410
397
|
_initShortcuts() {
|
|
411
|
-
[
|
|
412
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
398
|
+
[Et, It].forEach((e) => {
|
|
399
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(e));
|
|
413
400
|
});
|
|
414
401
|
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
],
|
|
422
|
-
var
|
|
423
|
-
for (var
|
|
424
|
-
(
|
|
425
|
-
return
|
|
426
|
-
},
|
|
427
|
-
let
|
|
428
|
-
constructor(
|
|
429
|
-
super(), this._config =
|
|
430
|
-
const { menu, ...
|
|
431
|
-
|
|
402
|
+
};
|
|
403
|
+
N = Ot([
|
|
404
|
+
C(0, T),
|
|
405
|
+
C(1, G),
|
|
406
|
+
C(2, Me),
|
|
407
|
+
C(3, De)
|
|
408
|
+
], N);
|
|
409
|
+
var yt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Tt = (e, t, r, n) => {
|
|
410
|
+
for (var i = n > 1 ? void 0 : n ? Nt(t, r) : t, o = e.length - 1, s; o >= 0; o--)
|
|
411
|
+
(s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
|
|
412
|
+
return n && i && yt(t, r, i), i;
|
|
413
|
+
}, F = (e, t) => (r, n) => t(r, n, e), O;
|
|
414
|
+
let W = (O = class extends ve {
|
|
415
|
+
constructor(e = Fe, t, r) {
|
|
416
|
+
super(), this._config = e, this._injector = t, this._configService = r;
|
|
417
|
+
const { menu: n, ...i } = this._config;
|
|
418
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Ve, i), this._initializeDependencies(this._injector);
|
|
432
419
|
}
|
|
433
|
-
_initializeDependencies(
|
|
420
|
+
_initializeDependencies(e) {
|
|
434
421
|
[
|
|
435
|
-
[
|
|
436
|
-
[
|
|
437
|
-
[
|
|
438
|
-
].forEach((
|
|
422
|
+
[N],
|
|
423
|
+
[y],
|
|
424
|
+
[$, { useClass: We }]
|
|
425
|
+
].forEach((r) => e.add(r));
|
|
439
426
|
}
|
|
440
427
|
onReady() {
|
|
441
|
-
this._injector.get(
|
|
428
|
+
this._injector.get(N);
|
|
442
429
|
}
|
|
443
430
|
onSteady() {
|
|
444
|
-
this._injector.get(
|
|
431
|
+
this._injector.get(y);
|
|
445
432
|
}
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
],
|
|
433
|
+
}, v(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), v(O, "type", M.UNIVER_SHEET), O);
|
|
434
|
+
W = Tt([
|
|
435
|
+
F(1, Ee(Ie)),
|
|
436
|
+
F(2, Se)
|
|
437
|
+
], W);
|
|
451
438
|
export {
|
|
452
|
-
CancelZenEditCommand,
|
|
453
|
-
ConfirmZenEditCommand,
|
|
454
|
-
OpenZenEditorCommand,
|
|
455
|
-
UniverSheetsZenEditorPlugin
|
|
439
|
+
L as CancelZenEditCommand,
|
|
440
|
+
A as ConfirmZenEditCommand,
|
|
441
|
+
Z as OpenZenEditorCommand,
|
|
442
|
+
W as UniverSheetsZenEditorPlugin
|
|
456
443
|
};
|