@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/index.js CHANGED
@@ -1,39 +1,39 @@
1
- var se = Object.defineProperty;
2
- var ce = (e, t, i) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
- var _ = (e, t, i) => ce(e, typeof t != "symbol" ? t + "" : t, i);
4
- import { CommandType as D, IUniverInstanceService as x, delayAnimationFrame as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as K, UniverInstanceType as P, DocumentFlavor as X, DocumentDataModel as ae, createIdentifier as le, ICommandService as q, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as fe, FOCUSING_EDITOR_STANDALONE as he, Disposable as ve, RxDisposable as me, Plugin as pe, merge as _e, Inject as Se, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
5
- import { IEditorService as z, VIEWPORT_KEY as Ee, DocBackScrollRenderController as Oe } from "@univerjs/docs-ui";
6
- import { IRenderManagerService as J } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as b, EditingRenderController as Ne, getCurrentExclusiveRangeInterest$ as ye, getCurrentRangeDisable$ as be, getEditorObject as Te } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as T, ISidebarService as k, useDependency as w, MenuItemType as Me, ContextMenuPosition as we, ContextMenuGroup as De, KeyCode as Q, MetaKeys as xe, IMenuManagerService as Re, IShortcutService as Pe } from "@univerjs/ui";
9
- import { jsxs as V, jsx as S } from "react/jsx-runtime";
10
- import { clsx as F } from "@univerjs/design";
11
- import { forwardRef as U, useRef as ee, createElement as j, useEffect as ze } from "react";
12
- import { BehaviorSubject as ke, switchMap as Ue, map as je, takeUntil as Ze } from "rxjs";
13
- import { RangeProtectionPermissionEditPoint as Be, WorksheetEditPermission as Le, WorksheetSetCellValuePermission as Ae, WorksheetSetCellStylePermission as $e, WorkbookEditablePermission as Ve } from "@univerjs/sheets";
14
- const Z = {
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 C;
19
- const t = e.get(T), i = e.get(z), n = e.get(b), r = e.get(x), o = e.get(k);
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 = i.getEditor(g);
21
+ const s = n.getEditor(u);
22
22
  if (s == null)
23
23
  return !1;
24
- const c = n.getLatestEditCellState();
24
+ const c = i.getLatestEditCellState();
25
25
  if (c == null)
26
26
  return !1;
27
- const a = (C = c.documentLayoutObject.documentModel) == null ? void 0 : C.getSnapshot();
27
+ const a = (I = c.documentLayoutObject.documentModel) == null ? void 0 : I.getSnapshot();
28
28
  if (a == null)
29
29
  return !1;
30
- r.focusUnit(g);
31
- const { body: l, drawings: v, drawingsOrder: u, tableSource: f, settings: m } = K.deepClone(a), p = {
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: v,
35
- drawingsOrder: u,
36
- tableSource: f,
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(p, h), s.clearUndoRedoHistory(), !0;
45
+ return s.focus(), s.setDocumentData(v, h), s.clearUndoRedoHistory(), !0;
46
46
  }
47
- }, B = {
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(T), i = e.get(b), n = e.get(x), r = e.get(k);
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 = n.getCurrentUnitForType(P.UNIVER_SHEET);
54
- return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
53
+ const o = i.getCurrentUnitForType(x.UNIVER_SHEET);
54
+ return o ? (i.focusUnit(o.getUnitId()), n.refreshEditCellState(), !0) : !1;
55
55
  }
56
- }, L = {
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(T), i = e.get(b), n = e.get(x), r = e.get(z), o = e.get(k);
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(g);
63
+ const s = r.getEditor(u);
64
64
  if (s == null)
65
65
  return !1;
66
- const c = e.get(J), a = n.getCurrentUnitForType(P.UNIVER_SHEET);
66
+ const c = e.get(X), a = i.getCurrentUnitForType(x.UNIVER_SHEET);
67
67
  if (a) {
68
- const v = a.getUnitId(), u = (l = c.getRenderById(v)) == null ? void 0 : l.with(Ne);
69
- if (u) {
70
- const f = K.deepClone(s.getDocumentData());
71
- f.documentStyle.documentFlavor = X.UNSPECIFIED, u.submitCellData(new ae(f));
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 n.focusUnit(a.getUnitId()), i.refreshEditCellState(), !0;
73
+ return i.focusUnit(a.getUnitId()), n.refreshEditCellState(), !0;
74
74
  }
75
75
  return !1;
76
76
  }
77
- }, Fe = "sheets-zen-editor.config", W = {};
78
- var d = function() {
79
- return d = Object.assign || function(e) {
80
- for (var t, i = 1, n = arguments.length; i < n; i++) {
81
- t = arguments[i];
82
- for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
83
- }
84
- return e;
85
- }, d.apply(this, arguments);
86
- }, We = function(e, t) {
87
- var i = {};
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 He(e, t, i) {
103
- var n = d({}, e.attrs);
104
- i != null && i.colorChannel1 && n.fill === "colorChannel1" && (n.fill = i.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(o) {
105
- var s = o[0], c = o[1];
106
- s === "mask" && typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
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
- var r = t.defIds;
109
- return !r || r.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(o) {
110
- var s = o[0], c = o[1];
111
- typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
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 Ye(e, t) {
115
- var i, n = t.defIds;
116
- return !n || n.length === 0 ? e : e.tag === "defs" && (!((i = e.children) === null || i === void 0) && i.length) ? d(d({}, e), { children: e.children.map(function(r) {
117
- return typeof r.attrs.id == "string" && n && n.includes(r.attrs.id) ? d(d({}, r), { attrs: d(d({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
118
- }) }) : e;
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 Ge() {
120
+ function He() {
121
121
  return Math.random().toString(36).substring(2, 8);
122
122
  }
123
- A.displayName = "UniverIcon";
124
- var Ke = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, ne = U(function(e, t) {
125
- return j(A, Object.assign({}, e, {
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: t,
128
- icon: Ke
145
+ ref: n,
146
+ icon: Ye
129
147
  }));
130
148
  });
131
- ne.displayName = "CheckMarkIcon";
132
- var Xe = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, ie = U(function(e, t) {
133
- return j(A, Object.assign({}, e, {
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: t,
136
- icon: Xe
169
+ ref: n,
170
+ icon: Ge
137
171
  }));
138
172
  });
139
- ie.displayName = "CloseIcon";
140
- class qe {
173
+ ne.displayName = "CloseIcon";
174
+ class Ke {
141
175
  constructor() {
142
- _(this, "_position", null);
143
- _(this, "_position$", new ke(null));
144
- _(this, "position$", this._position$.asObservable());
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 $ = le(
193
+ const L = ae(
160
194
  "univer.sheet-zen-editor-manager.service"
161
- ), Je = "ZEN_EDITOR_PLUGIN_", Qe = `${Je}ZEN_EDITOR_COMPONENT`, et = {
162
- id: g,
195
+ ), Xe = "ZEN_EDITOR_PLUGIN_", qe = `${Xe}ZEN_EDITOR_COMPONENT`, Je = {
196
+ id: u,
163
197
  body: {
164
- dataStream: `${de}`,
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: X.MODERN,
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 tt() {
197
- const e = ee(null), t = w($), i = w(z), n = w(q);
198
- ze(() => {
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 = i.register({
203
- editorUnitId: g,
204
- initialSnapshot: et,
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 = i.getEditor(g);
216
- c == null || c.blur(), n.executeCommand(B.id);
249
+ const c = n.getEditor(u);
250
+ c == null || c.blur(), i.executeCommand(U.id);
217
251
  }
218
252
  function o() {
219
- const c = i.getEditor(g);
220
- c == null || c.blur(), n.executeCommand(L.id);
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__ */ V(
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__ */ V(
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__ */ S(
267
+ /* @__PURE__ */ _(
234
268
  "span",
235
269
  {
236
- className: F(s, `
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__ */ S(ie, { className: "univer-size-5" })
275
+ children: /* @__PURE__ */ _(ne, { className: "univer-size-5" })
242
276
  }
243
277
  ),
244
- /* @__PURE__ */ S(
278
+ /* @__PURE__ */ _(
245
279
  "span",
246
280
  {
247
- className: F(s, `
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__ */ S(ne, { className: "univer-size-5" })
286
+ children: /* @__PURE__ */ _(te, { className: "univer-size-5" })
253
287
  }
254
288
  )
255
289
  ]
256
290
  }
257
291
  ),
258
- /* @__PURE__ */ S("div", { ref: e, className: "univer-absolute univer-inset-0 univer-size-full" })
292
+ /* @__PURE__ */ _("div", { ref: e, className: "univer-absolute univer-inset-0 univer-size-full" })
259
293
  ]
260
294
  }
261
295
  );
262
296
  }
263
- function nt(e) {
264
- const t = e.get(b);
297
+ function et(e) {
298
+ const t = e.get(T);
265
299
  return {
266
- id: Z.id,
300
+ id: k.id,
267
301
  type: Me.BUTTON,
268
302
  title: "rightClick.zenEditor",
269
303
  icon: "AmplifyIcon",
270
- hidden$: ye(e),
304
+ hidden$: Oe(e),
271
305
  disabled$: t.currentEditCell$.pipe(
272
- Ue((i) => be(e, { workbookTypes: [Ve], worksheetTypes: [Le, Ae, $e], rangeTypes: [Be] }).pipe(je((n) => {
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 n || ((c = (s = (o = (r = i == null ? void 0 : i.documentLayoutObject.documentModel) == null ? void 0 : r.getBody()) == null ? void 0 : o.customBlocks) == null ? void 0 : s.length) != null ? c : 0) > 0;
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 it = {
280
- [we.MAIN_AREA]: {
313
+ const tt = {
314
+ [ye.MAIN_AREA]: {
281
315
  [De.OTHERS]: {
282
- [Z.id]: {
316
+ [k.id]: {
283
317
  order: 2,
284
- menuItemFactory: nt
318
+ menuItemFactory: et
285
319
  }
286
320
  }
287
321
  }
288
- }, rt = {
289
- id: L.id,
322
+ }, nt = {
323
+ id: Z.id,
290
324
  description: "shortcut.sheet.zen-edit-confirm",
291
325
  group: "4_sheet-edit",
292
- preconditions: (e) => re(e),
293
- binding: Q.ENTER | xe.ALT
294
- }, ot = {
295
- id: B.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) => re(e),
299
- binding: Q.ESC
332
+ preconditions: (e) => ie(e),
333
+ binding: q.ESC
300
334
  };
301
- function re(e) {
302
- return e.getContextValue(ue) && e.getContextValue(ge) && e.getContextValue(fe) && !e.getContextValue(he);
335
+ function ie(e) {
336
+ return e.getContextValue(de) && e.getContextValue(ue) && e.getContextValue(ge) && !e.getContextValue(he);
303
337
  }
304
- var st = Object.getOwnPropertyDescriptor, ct = (e, t, i, n) => {
305
- for (var r = n > 1 ? void 0 : n ? st(t, i) : t, o = e.length - 1, s; o >= 0; o--)
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
- }, E = (e, t) => (i, n) => t(i, n, e);
309
- let N = class extends ve {
310
- constructor(e, t, i, n) {
311
- super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = i, this._shortcutService = n, this._initialize();
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(Qe, tt));
351
+ this.disposeWithMe(this._zenZoneService.set(qe, Qe));
318
352
  }
319
353
  _initCommands() {
320
- [Z, B, L].forEach((e) => {
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(it);
359
+ this._menuManagerService.mergeMenu(tt);
326
360
  }
327
361
  _initShortcuts() {
328
- [rt, ot].forEach((e) => {
362
+ [nt, it].forEach((e) => {
329
363
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
330
364
  });
331
365
  }
332
366
  };
333
- N = ct([
334
- E(0, T),
335
- E(1, q),
336
- E(2, Re),
337
- E(3, Pe)
367
+ N = ot([
368
+ C(0, b),
369
+ C(1, K),
370
+ C(2, Re),
371
+ C(3, xe)
338
372
  ], N);
339
- var at = Object.getOwnPropertyDescriptor, lt = (e, t, i, n) => {
340
- for (var r = n > 1 ? void 0 : n ? at(t, i) : t, o = e.length - 1, s; o >= 0; o--)
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
- }, H = (e, t) => (i, n) => t(i, n, e);
344
- let y = class extends me {
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(Ze(this.dispose$)).subscribe((e) => {
387
+ this._zenEditorManagerService.position$.pipe(Ue(this.dispose$)).subscribe((e) => {
354
388
  if (e == null)
355
389
  return;
356
- const { width: t, height: i } = e, n = Te(g, this._renderManagerService);
357
- n != null && requestIdleCallback(() => {
358
- n.engine.resizeBySize(t, i), this._calculatePagePosition(n), this._scrollToTop();
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: i, docBackground: n } = e, r = i == null ? void 0 : i.getParent(), { width: o, height: s, pageMarginLeft: c, pageMarginTop: a } = t;
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: v } = r;
367
- let u = 0;
368
- const f = a;
369
- let m = 0, I = 0, p = Number.POSITIVE_INFINITY;
370
- const { scaleX: h, scaleY: C } = i.getAncestorScale();
371
- l > (o + c * 2) * h ? (u = l / 2 - o * h / 2, u /= h, m = (l - c * 2) / h, p = 0) : (u = c, m = o + c * 2, p = (m - l / h) / 2), v > s ? I = (v - a * 2) / C : I = s + a * 2, i.resize(m, I), t.translate(u, f), n.translate(u, f);
372
- const M = i.getViewport(Ee.VIEW_MAIN);
373
- if (p !== Number.POSITIVE_INFINITY && M != null) {
374
- const oe = M.transScroll2ViewportScrollValue(p, 0).x;
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: oe
410
+ x: re
377
411
  });
378
412
  }
379
413
  return this;
380
414
  }
381
415
  _scrollToTop() {
382
- var i;
383
- const e = (i = this._renderManagerService.getRenderById(g)) == null ? void 0 : i.with(Oe), t = {
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
- y = lt([
391
- H(0, $),
392
- H(1, J)
393
- ], y);
394
- var dt = Object.getOwnPropertyDescriptor, ut = (e, t, i, n) => {
395
- for (var r = n > 1 ? void 0 : n ? dt(t, i) : t, o = e.length - 1, s; o >= 0; o--)
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
- }, Y = (e, t) => (i, n) => t(i, n, e), O;
399
- let G = (O = class extends pe {
400
- constructor(e = W, t, i) {
401
- super(), this._config = e, this._injector = t, this._configService = i;
402
- const { menu: n, ...r } = _e(
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
- W,
438
+ V,
405
439
  this._config
406
440
  );
407
- n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Fe, r), this._initializeDependencies(this._injector);
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
- [y],
413
- [$, { useClass: qe }]
414
- ].forEach((i) => e.add(i));
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(y);
454
+ this._injector.get(O);
421
455
  }
422
- }, _(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), _(O, "type", P.UNIVER_SHEET), O);
423
- G = ut([
424
- Y(1, Se(Ie)),
425
- Y(2, Ce)
426
- ], G);
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
- B as CancelZenEditCommand,
429
- L as ConfirmZenEditCommand,
430
- Z as OpenZenEditorCommand,
431
- G as UniverSheetsZenEditorPlugin
462
+ U as CancelZenEditCommand,
463
+ Z as ConfirmZenEditCommand,
464
+ k as OpenZenEditorCommand,
465
+ H as UniverSheetsZenEditorPlugin
432
466
  };