@univerjs/sheets-zen-editor 0.17.0 → 0.18.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.
Files changed (80) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +9 -3
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -144
  16. package/lib/es/index.js +9 -466
  17. package/lib/es/locale/ca-ES.js +1 -14
  18. package/lib/es/locale/en-US.js +1 -14
  19. package/lib/es/locale/es-ES.js +1 -14
  20. package/lib/es/locale/fa-IR.js +1 -14
  21. package/lib/es/locale/fr-FR.js +1 -14
  22. package/lib/es/locale/ja-JP.js +1 -14
  23. package/lib/es/locale/ko-KR.js +1 -14
  24. package/lib/es/locale/ru-RU.js +1 -14
  25. package/lib/es/locale/sk-SK.js +1 -14
  26. package/lib/es/locale/vi-VN.js +1 -14
  27. package/lib/es/locale/zh-CN.js +1 -14
  28. package/lib/es/locale/zh-TW.js +1 -14
  29. package/lib/facade.js +1 -144
  30. package/lib/index.css +82 -1
  31. package/lib/index.js +9 -466
  32. package/lib/locale/ca-ES.js +1 -14
  33. package/lib/locale/en-US.js +1 -14
  34. package/lib/locale/es-ES.js +1 -14
  35. package/lib/locale/fa-IR.js +1 -14
  36. package/lib/locale/fr-FR.js +1 -14
  37. package/lib/locale/ja-JP.js +1 -14
  38. package/lib/locale/ko-KR.js +1 -14
  39. package/lib/locale/ru-RU.js +1 -14
  40. package/lib/locale/sk-SK.js +1 -14
  41. package/lib/locale/vi-VN.js +1 -14
  42. package/lib/locale/zh-CN.js +1 -14
  43. package/lib/locale/zh-TW.js +1 -14
  44. package/lib/types/commands/commands/zen-editor.command.d.ts +16 -1
  45. package/lib/types/config/config.d.ts +16 -1
  46. package/lib/types/controllers/shortcuts/zen-editor.shortcut.d.ts +17 -2
  47. package/lib/types/controllers/zen-editor-ui.controller.d.ts +15 -0
  48. package/lib/types/controllers/zen-editor.controller.d.ts +15 -0
  49. package/lib/types/facade/f-univer.d.ts +16 -1
  50. package/lib/types/facade/f-workbook.d.ts +15 -0
  51. package/lib/types/locale/ca-ES.d.ts +16 -1
  52. package/lib/types/locale/es-ES.d.ts +16 -1
  53. package/lib/types/locale/fa-IR.d.ts +16 -1
  54. package/lib/types/locale/fr-FR.d.ts +16 -1
  55. package/lib/types/locale/ja-JP.d.ts +16 -1
  56. package/lib/types/locale/ko-KR.d.ts +16 -1
  57. package/lib/types/locale/ru-RU.d.ts +16 -1
  58. package/lib/types/locale/sk-SK.d.ts +16 -1
  59. package/lib/types/locale/vi-VN.d.ts +16 -1
  60. package/lib/types/locale/zh-CN.d.ts +16 -1
  61. package/lib/types/locale/zh-TW.d.ts +16 -1
  62. package/lib/types/menu/menu.d.ts +17 -2
  63. package/lib/types/menu/schema.d.ts +16 -1
  64. package/lib/types/plugin.d.ts +16 -1
  65. package/lib/types/services/zen-editor.service.d.ts +18 -3
  66. package/lib/umd/facade.js +1 -1
  67. package/lib/umd/index.js +9 -3
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/en-US.js +1 -1
  70. package/lib/umd/locale/es-ES.js +1 -1
  71. package/lib/umd/locale/fa-IR.js +1 -1
  72. package/lib/umd/locale/fr-FR.js +1 -1
  73. package/lib/umd/locale/ja-JP.js +1 -1
  74. package/lib/umd/locale/ko-KR.js +1 -1
  75. package/lib/umd/locale/ru-RU.js +1 -1
  76. package/lib/umd/locale/sk-SK.js +1 -1
  77. package/lib/umd/locale/vi-VN.js +1 -1
  78. package/lib/umd/locale/zh-CN.js +1 -1
  79. package/lib/umd/locale/zh-TW.js +1 -1
  80. package/package.json +14 -13
package/lib/index.js CHANGED
@@ -1,470 +1,13 @@
1
- var se = Object.defineProperty;
2
- var ce = (e, t, n) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var g = (e, t, n) => ce(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 G, UniverInstanceType as x, DocumentFlavor as K, DocumentDataModel as ae, createIdentifier as le, ICommandService as X, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as he, FOCUSING_EDITOR_STANDALONE as fe, Disposable as me, RxDisposable as ve, 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 Ne } from "@univerjs/docs-ui";
6
- import { IRenderManagerService as q } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as T, EditingRenderController as Oe, getCurrentExclusiveRangeInterest$ as Te, getCurrentRangeDisable$ as be, getEditorObject as Me } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as b, ISidebarService as P, MenuItemType as ye, ContextMenuPosition as De, ContextMenuGroup as we, useDependency as y, KeyCode as J, MetaKeys as Re, IMenuManagerService as xe, IShortcutService as ze } from "@univerjs/ui";
9
- import { RangeProtectionPermissionEditPoint as Pe, WorksheetEditPermission as ke, WorksheetSetCellValuePermission as $e, WorksheetSetCellStylePermission as Ue, WorkbookEditablePermission as Ze } from "@univerjs/sheets";
10
- import { switchMap as Be, map as Le, BehaviorSubject as je, takeUntil as Ae } from "rxjs";
11
- import { jsxs as j, jsx as S } from "react/jsx-runtime";
12
- import { clsx as A } from "@univerjs/design";
13
- import { useRef as Q, createElement as k, forwardRef as ee, useEffect as Ve } from "react";
14
- const $ = {
15
- id: "zen-editor.command.open-zen-editor",
16
- type: D.COMMAND,
17
- handler: async (e) => {
18
- var C;
19
- const t = e.get(b), n = e.get(z), i = e.get(T), r = e.get(w), o = e.get(P);
20
- o.visible && (o.close(), await R()), t.open();
21
- const s = n.getEditor(u);
22
- if (s == null)
23
- return !1;
24
- const c = i.getLatestEditCellState();
25
- if (c == null)
26
- return !1;
27
- const a = (C = c.documentLayoutObject.documentModel) == null ? void 0 : C.getSnapshot();
28
- if (a == null)
29
- return !1;
30
- r.focusUnit(u);
31
- const { body: l, drawings: m, drawingsOrder: d, tableSource: h, settings: v } = G.deepClone(a), p = {
32
- ...s.getDocumentData(),
33
- body: l,
34
- drawings: m,
35
- drawingsOrder: d,
36
- tableSource: h,
37
- settings: v
38
- }, f = [
39
- {
40
- startOffset: 0,
41
- endOffset: 0,
42
- collapsed: !0
43
- }
44
- ];
45
- return s.focus(), s.setDocumentData(p, f), s.clearUndoRedoHistory(), !0;
46
- }
47
- }, U = {
48
- id: "zen-editor.command.cancel-zen-edit",
49
- type: D.COMMAND,
50
- handler: async (e) => {
51
- const t = e.get(b), n = e.get(T), i = e.get(w), r = e.get(P);
52
- r.visible && (r.close(), await R()), t.close();
53
- const o = i.getCurrentUnitForType(x.UNIVER_SHEET);
54
- return o ? (i.focusUnit(o.getUnitId()), n.refreshEditCellState(), !0) : !1;
55
- }
56
- }, Z = {
57
- id: "zen-editor.command.confirm-zen-edit",
58
- type: D.COMMAND,
59
- handler: async (e) => {
60
- var l;
61
- const t = e.get(b), n = e.get(T), i = e.get(w), r = e.get(z), o = e.get(P);
62
- o.visible && (o.close(), await R()), t.close();
63
- const s = r.getEditor(u);
64
- if (s == null)
65
- return !1;
66
- const c = e.get(q), a = i.getCurrentUnitForType(x.UNIVER_SHEET);
67
- if (a) {
68
- const m = a.getUnitId(), d = (l = c.getRenderById(m)) == null ? void 0 : l.with(Oe);
69
- if (d) {
70
- const h = G.deepClone(s.getDocumentData());
71
- h.documentStyle.documentFlavor = K.UNSPECIFIED, d.submitCellData(new ae(h));
72
- }
73
- return i.focusUnit(a.getUnitId()), n.refreshEditCellState(), !0;
74
- }
75
- return !1;
76
- }
77
- }, Fe = "@univerjs/sheets-zen-editor", We = "0.17.0", V = {
78
- name: Fe,
79
- version: We
80
- }, He = "sheets-zen-editor.config", F = {};
81
- function Ye(e) {
82
- const t = e.get(T);
83
- return {
84
- id: $.id,
85
- type: ye.BUTTON,
86
- title: "rightClick.zenEditor",
87
- icon: "AmplifyIcon",
88
- hidden$: Te(e),
89
- disabled$: t.currentEditCell$.pipe(
90
- Be((n) => be(e, { workbookTypes: [Ze], worksheetTypes: [ke, $e, Ue], rangeTypes: [Pe] }).pipe(Le((i) => {
91
- var r, o, s, c;
92
- 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;
93
- })))
94
- )
95
- };
96
- }
97
- const Ge = {
98
- [De.MAIN_AREA]: {
99
- [we.OTHERS]: {
100
- [$.id]: {
101
- order: 2,
102
- menuItemFactory: Ye
103
- }
104
- }
105
- }
106
- };
107
- function B({ ref: e, ...t }) {
108
- const { icon: n, id: i, className: r, extend: o, ...s } = t, c = `univerjs-icon univerjs-icon-${i} ${r || ""}`.trim(), a = Q(`_${qe()}`);
109
- return te(n, `${i}`, {
110
- defIds: n.defIds,
111
- idSuffix: a.current
112
- }, {
113
- ref: e,
114
- className: c,
115
- ...s
116
- }, o);
117
- }
118
- function te(e, t, n, i, r) {
119
- return k(e.tag, {
120
- key: t,
121
- ...Ke(e, n, r),
122
- ...i
123
- }, (Xe(e, n).children || []).map((o, s) => te(o, `${t}-${e.tag}-${s}`, n, void 0, r)));
124
- }
125
- function Ke(e, t, n) {
126
- const i = { ...e.attrs };
127
- 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]) => {
128
- o === "mask" && typeof s == "string" && (i[o] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
129
- });
130
- const { defIds: r } = t;
131
- 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]) => {
132
- typeof s == "string" && (i[o] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
133
- })), i;
134
- }
135
- function Xe(e, t) {
136
- var i;
137
- const { defIds: n } = t;
138
- return !n || n.length === 0 ? e : e.tag === "defs" && ((i = e.children) != null && i.length) ? {
139
- ...e,
140
- children: e.children.map((r) => typeof r.attrs.id == "string" && n && n.includes(r.attrs.id) ? {
141
- ...r,
142
- attrs: {
143
- ...r.attrs,
144
- id: r.attrs.id + t.idSuffix
145
- }
146
- } : r)
147
- } : e;
148
- }
149
- function qe() {
150
- return Math.random().toString(36).substring(2, 8);
151
- }
152
- B.displayName = "UniverIcon";
153
- const Je = {
154
- tag: "svg",
155
- attrs: {
156
- xmlns: "http://www.w3.org/2000/svg",
157
- fill: "none",
158
- viewBox: "0 0 16 16",
159
- width: "1em",
160
- height: "1em"
161
- },
162
- children: [{
163
- tag: "path",
164
- attrs: {
165
- fill: "currentColor",
166
- 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",
167
- fillRule: "evenodd",
168
- clipRule: "evenodd"
169
- }
170
- }]
171
- }, ne = ee(function(t, n) {
172
- return k(B, Object.assign({}, t, {
173
- id: "check-mark-icon",
174
- ref: n,
175
- icon: Je
176
- }));
177
- });
178
- ne.displayName = "CheckMarkIcon";
179
- const Qe = {
180
- tag: "svg",
181
- attrs: {
182
- xmlns: "http://www.w3.org/2000/svg",
183
- fill: "none",
184
- viewBox: "0 0 16 16",
185
- width: "1em",
186
- height: "1em"
187
- },
188
- children: [{
189
- tag: "path",
190
- attrs: {
191
- fill: "currentColor",
192
- 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"
193
- }
194
- }]
195
- }, ie = ee(function(t, n) {
196
- return k(B, Object.assign({}, t, {
197
- id: "close-icon",
198
- ref: n,
199
- icon: Qe
200
- }));
201
- });
202
- ie.displayName = "CloseIcon";
203
- class et {
204
- constructor() {
205
- g(this, "_position", null);
206
- g(this, "_position$", new je(null));
207
- g(this, "position$", this._position$.asObservable());
208
- }
209
- dispose() {
210
- this._position$.complete(), this._position = null;
211
- }
212
- setPosition(t) {
213
- this._position = t, this._refresh(t);
214
- }
215
- getPosition() {
216
- return this._position;
217
- }
218
- _refresh(t) {
219
- this._position$.next(t);
220
- }
221
- }
222
- const L = le(
223
- "univer.sheet-zen-editor-manager.service"
224
- ), tt = "ZEN_EDITOR_PLUGIN_", nt = `${tt}ZEN_EDITOR_COMPONENT`, it = {
225
- id: u,
226
- body: {
227
- dataStream: `${de}`,
228
- textRuns: [],
229
- tables: [],
230
- customBlocks: [],
231
- paragraphs: [
232
- {
233
- startIndex: 0
234
- }
235
- ],
236
- sectionBreaks: [{
237
- startIndex: 1
238
- }]
239
- },
240
- tableSource: {},
241
- documentStyle: {
242
- pageSize: {
243
- width: 595,
244
- height: Number.POSITIVE_INFINITY
245
- },
246
- documentFlavor: K.MODERN,
247
- marginTop: 0,
248
- marginBottom: 0,
249
- marginRight: 0,
250
- marginLeft: 0,
251
- renderConfig: {
252
- vertexAngle: 0,
253
- centerAngle: 0
254
- }
255
- },
256
- drawings: {},
257
- drawingsOrder: []
258
- };
259
- function rt() {
260
- const e = Q(null), t = y(L), n = y(z), i = y(X);
261
- Ve(() => {
262
- const c = e.current;
263
- if (!c)
264
- return;
265
- const a = n.register({
266
- editorUnitId: u,
267
- initialSnapshot: it,
268
- scrollBar: !0,
269
- backScrollOffset: 100
270
- }, c), l = new ResizeObserver(() => {
271
- t.setPosition(c.getBoundingClientRect());
272
- });
273
- return l.observe(c), () => {
274
- a.dispose(), l.unobserve(c);
275
- };
276
- }, []);
277
- function r() {
278
- const c = n.getEditor(u);
279
- c == null || c.blur(), i.executeCommand(U.id);
280
- }
281
- function o() {
282
- const c = n.getEditor(u);
283
- c == null || c.blur(), i.executeCommand(Z.id);
284
- }
285
- const s = "univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";
286
- return /* @__PURE__ */ j(
287
- "div",
288
- {
289
- className: "univer-absolute univer-inset-0 univer-size-full univer-bg-white dark:!univer-bg-gray-800",
290
- children: [
291
- /* @__PURE__ */ j(
292
- "div",
293
- {
294
- className: "univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",
295
- children: [
296
- /* @__PURE__ */ S(
297
- "span",
298
- {
299
- className: A(s, `
1
+ import{CommandType as e,DEFAULT_EMPTY_DOCUMENT_VALUE as t,DOCS_ZEN_EDITOR_UNIT_ID_KEY as n,Disposable as r,DocumentDataModel as i,DocumentFlavor as a,EDITOR_ACTIVATED as o,FOCUSING_DOC as s,FOCUSING_EDITOR_STANDALONE as c,FOCUSING_UNIVER_EDITOR as l,ICommandService as u,IConfigService as d,IUniverInstanceService as f,Inject as p,Injector as m,Plugin as h,RxDisposable as g,Tools as _,UniverInstanceType as v,createIdentifier as ee,delayAnimationFrame as y,merge as te}from"@univerjs/core";import{DocBackScrollRenderController as b,IEditorService as x,VIEWPORT_KEY as ne}from"@univerjs/docs-ui";import{IRenderManagerService as S}from"@univerjs/engine-render";import{EditingRenderController as re,IEditorBridgeService as C,getCurrentExclusiveRangeInterest$ as ie,getCurrentRangeDisable$ as ae,getEditorObject as oe}from"@univerjs/sheets-ui";import{ContextMenuGroup as se,ContextMenuPosition as ce,IMenuManagerService as le,IShortcutService as ue,ISidebarService as w,IZenZoneService as T,KeyCode as E,MenuItemType as de,MetaKeys as fe,useDependency as D}from"@univerjs/ui";import{RangeProtectionPermissionEditPoint as pe,WorkbookEditablePermission as me,WorksheetEditPermission as he,WorksheetSetCellStylePermission as ge,WorksheetSetCellValuePermission as _e}from"@univerjs/sheets";import{BehaviorSubject as O,map as k,switchMap as A,takeUntil as j}from"rxjs";import{clsx as M}from"@univerjs/design";import{CheckMarkIcon as N,CloseIcon as P}from"@univerjs/icons";import{useEffect as F,useRef as I}from"react";import{jsx as L,jsxs as R}from"react/jsx-runtime";const z={id:`zen-editor.command.open-zen-editor`,type:e.COMMAND,handler:async e=>{var t;let r=e.get(T),i=e.get(x),a=e.get(C),o=e.get(f),s=e.get(w);s.visible&&(s.close(),await y()),r.open();let c=i.getEditor(n);if(c==null)return!1;let l=a.getLatestEditCellState();if(l==null)return!1;let u=(t=l.documentLayoutObject.documentModel)==null?void 0:t.getSnapshot();if(u==null)return!1;o.focusUnit(n);let{body:d,drawings:p,drawingsOrder:m,tableSource:h,settings:g}=_.deepClone(u),v={...c.getDocumentData(),body:d,drawings:p,drawingsOrder:m,tableSource:h,settings:g};return c.focus(),c.setDocumentData(v,[{startOffset:0,endOffset:0,collapsed:!0}]),c.clearUndoRedoHistory(),!0}},B={id:`zen-editor.command.cancel-zen-edit`,type:e.COMMAND,handler:async e=>{let t=e.get(T),n=e.get(C),r=e.get(f),i=e.get(w);i.visible&&(i.close(),await y()),t.close();let a=r.getCurrentUnitForType(v.UNIVER_SHEET);return a?(r.focusUnit(a.getUnitId()),n.refreshEditCellState(),!0):!1}},V={id:`zen-editor.command.confirm-zen-edit`,type:e.COMMAND,handler:async e=>{let t=e.get(T),r=e.get(C),o=e.get(f),s=e.get(x),c=e.get(w);c.visible&&(c.close(),await y()),t.close();let l=s.getEditor(n);if(l==null)return!1;let u=e.get(S),d=o.getCurrentUnitForType(v.UNIVER_SHEET);if(d){var p;let e=d.getUnitId(),t=(p=u.getRenderById(e))==null?void 0:p.with(re);if(t){let e=_.deepClone(l.getDocumentData());e.documentStyle.documentFlavor=a.UNSPECIFIED,t.submitCellData(new i(e))}return o.focusUnit(d.getUnitId()),r.refreshEditCellState(),!0}return!1}};var ve=`@univerjs/sheets-zen-editor`,ye=`0.18.0`;const H=`sheets-zen-editor.config`;Symbol(H);const U={};function be(e){let t=e.get(C);return{id:z.id,type:de.BUTTON,title:`rightClick.zenEditor`,icon:`AmplifyIcon`,hidden$:ie(e),disabled$:t.currentEditCell$.pipe(A(t=>ae(e,{workbookTypes:[me],worksheetTypes:[he,_e,ge],rangeTypes:[pe]}).pipe(k(e=>{var n,r;return e||((n=t==null||(r=t.documentLayoutObject.documentModel)==null||(r=r.getBody())==null||(r=r.customBlocks)==null?void 0:r.length)==null?0:n)>0}))))}}const xe={[ce.MAIN_AREA]:{[se.OTHERS]:{[z.id]:{order:2,menuItemFactory:be}}}};function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function Se(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ce(e){var t=Se(e,`string`);return W(t)==`symbol`?t:t+``}function G(e,t,n){return(t=Ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var we=class{constructor(){G(this,`_position`,null),G(this,`_position$`,new O(null)),G(this,`position$`,this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}};const K=ee(`univer.sheet-zen-editor-manager.service`),Te={id:n,body:{dataStream:`${t}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:1/0},documentFlavor:a.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function Ee(){let e=I(null),t=D(K),r=D(x),i=D(u);F(()=>{let i=e.current;if(!i)return;let a=r.register({editorUnitId:n,initialSnapshot:Te,scrollBar:!0,backScrollOffset:100},i),o=new ResizeObserver(()=>{t.setPosition(i.getBoundingClientRect())});return o.observe(i),()=>{a.dispose(),o.unobserve(i)}},[]);function a(){let e=r.getEditor(n);e==null||e.blur(),i.executeCommand(B.id)}function o(){let e=r.getEditor(n);e==null||e.blur(),i.executeCommand(V.id)}let s=`univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors`;return R(`div`,{className:`
2
+ univer-absolute univer-inset-0 univer-size-full univer-bg-white
3
+ dark:!univer-bg-gray-800
4
+ `,children:[R(`div`,{className:`
5
+ univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
6
+ univer-justify-center
7
+ `,children:[L(`span`,{className:M(s,`
300
8
  univer-text-red-500
301
9
  hover:univer-text-red-600
302
- `),
303
- onClick: r,
304
- children: /* @__PURE__ */ S(ie, { className: "univer-size-5" })
305
- }
306
- ),
307
- /* @__PURE__ */ S(
308
- "span",
309
- {
310
- className: A(s, `
10
+ `),onClick:a,children:L(P,{className:`univer-size-5`})}),L(`span`,{className:M(s,`
311
11
  univer-text-green-500
312
12
  hover:univer-text-green-600
313
- `),
314
- onClick: o,
315
- children: /* @__PURE__ */ S(ne, { className: "univer-size-5" })
316
- }
317
- )
318
- ]
319
- }
320
- ),
321
- /* @__PURE__ */ S("div", { ref: e, className: "univer-absolute univer-inset-0 univer-size-full" })
322
- ]
323
- }
324
- );
325
- }
326
- const ot = {
327
- id: Z.id,
328
- description: "shortcut.sheet.zen-edit-confirm",
329
- group: "4_sheet-edit",
330
- preconditions: (e) => re(e),
331
- binding: J.ENTER | Re.ALT
332
- }, st = {
333
- id: U.id,
334
- description: "shortcut.sheet.zen-edit-cancel",
335
- group: "4_sheet-edit",
336
- preconditions: (e) => re(e),
337
- binding: J.ESC
338
- };
339
- function re(e) {
340
- return e.getContextValue(ue) && e.getContextValue(ge) && e.getContextValue(he) && !e.getContextValue(fe);
341
- }
342
- var ct = Object.getOwnPropertyDescriptor, at = (e, t, n, i) => {
343
- for (var r = i > 1 ? void 0 : i ? ct(t, n) : t, o = e.length - 1, s; o >= 0; o--)
344
- (s = e[o]) && (r = s(r) || r);
345
- return r;
346
- }, E = (e, t) => (n, i) => t(n, i, e);
347
- let N = class extends me {
348
- constructor(e, t, n, i) {
349
- super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = n, this._shortcutService = i, this._initialize();
350
- }
351
- _initialize() {
352
- this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
353
- }
354
- _initCustomComponents() {
355
- this.disposeWithMe(this._zenZoneService.set(nt, rt));
356
- }
357
- _initCommands() {
358
- [$, U, Z].forEach((e) => {
359
- this.disposeWithMe(this._commandService.registerCommand(e));
360
- });
361
- }
362
- _initMenus() {
363
- this._menuManagerService.mergeMenu(Ge);
364
- }
365
- _initShortcuts() {
366
- [ot, st].forEach((e) => {
367
- this.disposeWithMe(this._shortcutService.registerShortcut(e));
368
- });
369
- }
370
- };
371
- N = at([
372
- E(0, b),
373
- E(1, X),
374
- E(2, xe),
375
- E(3, ze)
376
- ], N);
377
- var lt = Object.getOwnPropertyDescriptor, dt = (e, t, n, i) => {
378
- for (var r = i > 1 ? void 0 : i ? lt(t, n) : t, o = e.length - 1, s; o >= 0; o--)
379
- (s = e[o]) && (r = s(r) || r);
380
- return r;
381
- }, W = (e, t) => (n, i) => t(n, i, e);
382
- let O = class extends ve {
383
- constructor(e, t) {
384
- super(), this._zenEditorManagerService = e, this._renderManagerService = t, this._initialize();
385
- }
386
- _initialize() {
387
- this._syncZenEditorSize();
388
- }
389
- // Listen to changes in the size of the zen editor container to set the size of the editor.
390
- _syncZenEditorSize() {
391
- this._zenEditorManagerService.position$.pipe(Ae(this.dispose$)).subscribe((e) => {
392
- if (e == null)
393
- return;
394
- const { width: t, height: n } = e, i = Me(u, this._renderManagerService);
395
- i != null && requestIdleCallback(() => {
396
- i.engine.resizeBySize(t, n), this._calculatePagePosition(i), this._scrollToTop();
397
- });
398
- });
399
- }
400
- _calculatePagePosition(e) {
401
- const { document: t, scene: n, docBackground: i } = e, r = n == null ? void 0 : n.getParent(), { width: o, height: s, pageMarginLeft: c, pageMarginTop: a } = t;
402
- if (r == null || o === Number.POSITIVE_INFINITY || s === Number.POSITIVE_INFINITY)
403
- return;
404
- const { width: l, height: m } = r;
405
- let d = 0;
406
- const h = a;
407
- let v = 0, I = 0, p = Number.POSITIVE_INFINITY;
408
- const { scaleX: f, scaleY: C } = n.getAncestorScale();
409
- l > (o + c * 2) * f ? (d = l / 2 - o * f / 2, d /= f, v = (l - c * 2) / f, p = 0) : (d = c, v = o + c * 2, p = (v - l / f) / 2), m > s ? I = (m - a * 2) / C : I = s + a * 2, n.resize(v, I), t.translate(d, h), i.translate(d, h);
410
- const M = n.getViewport(Ee.VIEW_MAIN);
411
- if (p !== Number.POSITIVE_INFINITY && M != null) {
412
- const oe = M.transScroll2ViewportScrollValue(p, 0).x;
413
- M.scrollToBarPos({
414
- x: oe
415
- });
416
- }
417
- return this;
418
- }
419
- _scrollToTop() {
420
- var n;
421
- const e = (n = this._renderManagerService.getRenderById(u)) == null ? void 0 : n.with(Ne), t = {
422
- startOffset: 0,
423
- endOffset: 0
424
- };
425
- e && e.scrollToRange(t);
426
- }
427
- };
428
- O = dt([
429
- W(0, L),
430
- W(1, q)
431
- ], O);
432
- var ut = Object.getOwnPropertyDescriptor, gt = (e, t, n, i) => {
433
- for (var r = i > 1 ? void 0 : i ? ut(t, n) : t, o = e.length - 1, s; o >= 0; o--)
434
- (s = e[o]) && (r = s(r) || r);
435
- return r;
436
- }, H = (e, t) => (n, i) => t(n, i, e), _;
437
- let Y = (_ = class extends pe {
438
- constructor(e = F, t, n) {
439
- super(), this._config = e, this._injector = t, this._configService = n;
440
- const { menu: i, ...r } = _e(
441
- {},
442
- F,
443
- this._config
444
- );
445
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(He, r), this._initializeDependencies(this._injector);
446
- }
447
- _initializeDependencies(e) {
448
- [
449
- [N],
450
- [O],
451
- [L, { useClass: et }]
452
- ].forEach((n) => e.add(n));
453
- }
454
- onReady() {
455
- this._injector.get(N);
456
- }
457
- onSteady() {
458
- this._injector.get(O);
459
- }
460
- }, g(_, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), g(_, "packageName", V.name), g(_, "version", V.version), g(_, "type", x.UNIVER_SHEET), _);
461
- Y = gt([
462
- H(1, Se(Ie)),
463
- H(2, Ce)
464
- ], Y);
465
- export {
466
- U as CancelZenEditCommand,
467
- Z as ConfirmZenEditCommand,
468
- $ as OpenZenEditorCommand,
469
- Y as UniverSheetsZenEditorPlugin
470
- };
13
+ `),onClick:o,children:L(N,{className:`univer-size-5`})})]}),L(`div`,{ref:e,className:`univer-absolute univer-inset-0 univer-size-full`})]})}const q={id:V.id,description:`shortcut.sheet.zen-edit-confirm`,group:`4_sheet-edit`,preconditions:e=>J(e),binding:E.ENTER|fe.ALT},De={id:B.id,description:`shortcut.sheet.zen-edit-cancel`,group:`4_sheet-edit`,preconditions:e=>J(e),binding:E.ESC};function J(e){return e.getContextValue(s)&&e.getContextValue(l)&&e.getContextValue(o)&&!e.getContextValue(c)}function Y(e,t){return function(n,r){t(n,r,e)}}function X(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let Z=class extends r{constructor(e,t,n,r){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=n,this._shortcutService=r,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(`ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT`,Ee))}_initCommands(){[z,B,V].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(xe)}_initShortcuts(){[q,De].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};Z=X([Y(0,T),Y(1,u),Y(2,le),Y(3,ue)],Z);let Q=class extends g{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(j(this.dispose$)).subscribe(e=>{if(e==null)return;let{width:t,height:r}=e,i=oe(n,this._renderManagerService);i!=null&&requestIdleCallback(()=>{i.engine.resizeBySize(t,r),this._calculatePagePosition(i),this._scrollToTop()})})}_calculatePagePosition(e){let{document:t,scene:n,docBackground:r}=e,i=n==null?void 0:n.getParent(),{width:a,height:o,pageMarginLeft:s,pageMarginTop:c}=t;if(i==null||a===1/0||o===1/0)return;let{width:l,height:u}=i,d=0,f=c,p=0,m=0,h=1/0,{scaleX:g,scaleY:_}=n.getAncestorScale();l>(a+s*2)*g?(d=l/2-a*g/2,d/=g,p=(l-s*2)/g,h=0):(d=s,p=a+s*2,h=(p-l/g)/2),m=u>o?(u-c*2)/_:o+c*2,n.resize(p,m),t.translate(d,f),r.translate(d,f);let v=n.getViewport(ne.VIEW_MAIN);if(h!==1/0&&v!=null){let e=v.transScroll2ViewportScrollValue(h,0).x;v.scrollToBarPos({x:e})}return this}_scrollToTop(){var e;let t=(e=this._renderManagerService.getRenderById(n))==null?void 0:e.with(b);t&&t.scrollToRange({startOffset:0,endOffset:0})}};Q=X([Y(0,K),Y(1,S)],Q);let $=class extends h{constructor(e=U,t,n){super(),this._config=e,this._injector=t,this._configService=n;let{menu:r,...i}=te({},U,this._config);r&&this._configService.setConfig(`menu`,r,{merge:!0}),this._configService.setConfig(H,i),this._initializeDependencies(this._injector)}_initializeDependencies(e){[[Z],[Q],[K,{useClass:we}]].forEach(t=>e.add(t))}onReady(){this._injector.get(Z)}onSteady(){this._injector.get(Q)}};G($,`pluginName`,`SHEET_ZEN_EDITOR_PLUGIN`),G($,`packageName`,ve),G($,`version`,ye),G($,`type`,v.UNIVER_SHEET),$=X([Y(1,p(m)),Y(2,d)],$);export{B as CancelZenEditCommand,V as ConfirmZenEditCommand,z as OpenZenEditorCommand,$ as UniverSheetsZenEditorPlugin};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Editor a pantalla completa"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Cancel·la edició Zen",
8
- "zen-edit-confirm": "Confirma edició Zen"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Editor a pantalla completa`},shortcut:{sheet:{"zen-edit-cancel":`Cancel·la edició Zen`,"zen-edit-confirm":`Confirma edició Zen`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Full Screen Editor"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Cancel Zen Edit",
8
- "zen-edit-confirm": "Confirm Zen Edit"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Full Screen Editor`},shortcut:{sheet:{"zen-edit-cancel":`Cancel Zen Edit`,"zen-edit-confirm":`Confirm Zen Edit`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Editor a pantalla completa"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Cancelar edición Zen",
8
- "zen-edit-confirm": "Confirmar edición Zen"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Editor a pantalla completa`},shortcut:{sheet:{"zen-edit-cancel":`Cancelar edición Zen`,"zen-edit-confirm":`Confirmar edición Zen`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "ویرایشگر تمام صفحه"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "لغو ویرایش Zen",
8
- "zen-edit-confirm": "تایید ویرایش Zen"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`ویرایشگر تمام صفحه`},shortcut:{sheet:{"zen-edit-cancel":`لغو ویرایش Zen`,"zen-edit-confirm":`تایید ویرایش Zen`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Éditeur plein écran"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Annuler l'édition plein écran",
8
- "zen-edit-confirm": "Confirmer l'édition plein écran"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Éditeur plein écran`},shortcut:{sheet:{"zen-edit-cancel":`Annuler l'édition plein écran`,"zen-edit-confirm":`Confirmer l'édition plein écran`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "禅モード"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "禅モードをキャンセル",
8
- "zen-edit-confirm": "禅モードに移行"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`禅モード`},shortcut:{sheet:{"zen-edit-cancel":`禅モードをキャンセル`,"zen-edit-confirm":`禅モードに移行`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "젠 에디터"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "젠 편집 취소",
8
- "zen-edit-confirm": "젠 편집 확인"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`젠 에디터`},shortcut:{sheet:{"zen-edit-cancel":`젠 편집 취소`,"zen-edit-confirm":`젠 편집 확인`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Редактор на весь экран"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Отменить Zen редактирование",
8
- "zen-edit-confirm": "Подтвердить Zen редактирование"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Редактор на весь экран`},shortcut:{sheet:{"zen-edit-cancel":`Отменить Zen редактирование`,"zen-edit-confirm":`Подтвердить Zen редактирование`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Editor na celú obrazovku"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Zrušiť zen úpravu",
8
- "zen-edit-confirm": "Potvrdiť zen úpravu"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Editor na celú obrazovku`},shortcut:{sheet:{"zen-edit-cancel":`Zrušiť zen úpravu`,"zen-edit-confirm":`Potvrdiť zen úpravu`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "Chế độ chỉnh sửa Zen"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "Hủy chỉnh sửa (trạng thái Zen mode)",
8
- "zen-edit-confirm": "Bỏ chỉnh sửa (trạng thái Zen mode)"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`Chế độ chỉnh sửa Zen`},shortcut:{sheet:{"zen-edit-cancel":`Hủy chỉnh sửa (trạng thái Zen mode)`,"zen-edit-confirm":`Bỏ chỉnh sửa (trạng thái Zen mode)`}}};export{e as default};
@@ -1,14 +1 @@
1
- const e = {
2
- rightClick: {
3
- zenEditor: "禅模式编辑"
4
- },
5
- shortcut: {
6
- sheet: {
7
- "zen-edit-cancel": "取消编辑(禅模式状态)",
8
- "zen-edit-confirm": "放弃编辑(禅模式状态)"
9
- }
10
- }
11
- };
12
- export {
13
- e as default
14
- };
1
+ const e={rightClick:{zenEditor:`禅模式编辑`},shortcut:{sheet:{"zen-edit-cancel":`取消编辑(禅模式状态)`,"zen-edit-confirm":`放弃编辑(禅模式状态)`}}};export{e as default};