@univerjs/sheets-zen-editor 0.6.1 → 0.6.2-nightly.202503031606

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var G=Object.defineProperty;var X=(e,n,r)=>n in e?G(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var O=(e,n,r)=>X(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),N=require("@univerjs/docs-ui"),F=require("@univerjs/engine-render"),S=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),E=require("react/jsx-runtime"),_=require("react"),$=require("rxjs"),T=require("@univerjs/sheets"),U={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var D;const n=e.get(d.IZenZoneService),r=e.get(N.IEditorService),t=e.get(S.IEditorBridgeService),i=e.get(s.IUniverInstanceService),c=e.get(d.ISidebarService);c.visible&&(c.close(),await s.delayAnimationFrame()),n.open();const o=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const a=t.getLatestEditCellState();if(a==null)return!1;const l=(D=a.documentLayoutObject.documentModel)==null?void 0:D.getSnapshot();if(l==null)return!1;i.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:f,drawings:m,drawingsOrder:g,tableSource:h,settings:C}=s.Tools.deepClone(l),p={...o.getDocumentData(),body:f,drawings:m,drawingsOrder:g,tableSource:h,settings:C},I=[{startOffset:0,endOffset:0,collapsed:!0}];return o.focus(),o.setDocumentData(p,I),o.clearUndoRedoHistory(),!0}},Z={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const n=e.get(d.IZenZoneService),r=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),i=e.get(d.ISidebarService);i.visible&&(i.close(),await s.delayAnimationFrame()),n.close();const c=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return c?(t.focusUnit(c.getUnitId()),r.refreshEditCellState(),!0):!1}},P={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var f;const n=e.get(d.IZenZoneService),r=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),i=e.get(N.IEditorService),c=e.get(d.ISidebarService);c.visible&&(c.close(),await s.delayAnimationFrame()),n.close();const o=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const a=e.get(F.IRenderManagerService),l=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(l){const m=l.getUnitId(),g=(f=a.getRenderById(m))==null?void 0:f.with(S.EditingRenderController);if(g){const h=s.Tools.deepClone(o.getDocumentData());h.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,g.submitCellData(new s.DocumentDataModel(h))}return t.focusUnit(l.getUnitId()),r.refreshEditCellState(),!0}return!1}},J="sheets-zen-editor.config",k={};var u=function(){return u=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(this,arguments)},Q=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(e);i<t.length;i++)n.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(r[t[i]]=e[t[i]]);return r},w=_.forwardRef(function(e,n){var r=e.icon,t=e.id,i=e.className,c=e.extend,o=Q(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(t," ").concat(i||"").trim(),l=_.useRef("_".concat(ne()));return V(r,"".concat(t),{defIds:r.defIds,idSuffix:l.current},u({ref:n,className:a},o),c)});function V(e,n,r,t,i){return _.createElement(e.tag,u(u({key:n},ee(e,r,i)),t),(te(e,r).children||[]).map(function(c,o){return V(c,"".concat(n,"-").concat(e.tag,"-").concat(o),r,void 0,i)}))}function ee(e,n,r){var t=u({},e.attrs);r!=null&&r.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=r.colorChannel1),e.tag==="mask"&&t.id&&(t.id=t.id+n.idSuffix),Object.entries(t).forEach(function(c){var o=c[0],a=c[1];o==="mask"&&typeof a=="string"&&(t[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))});var i=n.defIds;return!i||i.length===0||(e.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(c){var o=c[0],a=c[1];typeof a=="string"&&(t[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function te(e,n){var r,t=n.defIds;return!t||t.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?u(u({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&t&&t.indexOf(i.attrs.id)>-1?u(u({},i),{attrs:u(u({},i.attrs),{id:i.attrs.id+n.idSuffix})}):i})}):e}function ne(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var re={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"}}]},Y=_.forwardRef(function(e,n){return _.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:n,icon:re}))});Y.displayName="CheckMarkSingle";var ie={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"}}]},W=_.forwardRef(function(e,n){return _.createElement(w,Object.assign({},e,{id:"close-single",ref:n,icon:ie}))});W.displayName="CloseSingle";function K(e){var n,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(r=K(e[n]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function A(){for(var e,n,r=0,t="",i=arguments.length;r<i;r++)(e=arguments[r])&&(n=K(e))&&(t&&(t+=" "),t+=n);return t}class oe{constructor(){O(this,"_position",null);O(this,"_position$",new $.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(n){this._position=n,this._refresh(n)}getPosition(){return this._position}_refresh(n){this._position$.next(n)}}const j=s.createIdentifier("univer.sheet-zen-editor-manager.service"),se="univer-zen-editor",ce="univer-zen-editor-icon-wrapper",ae="univer-zen-editor-icon-container",de="univer-zen-editor-icon-success",le="univer-zen-editor-icon-error",ue="univer-zen-editor-canvas-container",v={zenEditor:se,zenEditorIconWrapper:ce,zenEditorIconContainer:ae,zenEditorIconSuccess:de,zenEditorIconError:le,zenEditorCanvasContainer:ue},ge="ZEN_EDITOR_PLUGIN_",fe=`${ge}ZEN_EDITOR_COMPONENT`,_e={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function he(){const e=_.useRef(null),n=d.useDependency(j),r=d.useDependency(N.IEditorService),t=d.useDependency(s.ICommandService);_.useEffect(()=>{const o=e.current;if(!o)return;const a=r.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:_e,scrollBar:!0,backScrollOffset:100},o),l=new ResizeObserver(()=>{n.setPosition(o.getBoundingClientRect())});return l.observe(o),()=>{a.dispose(),l.unobserve(o)}},[]);function i(){const o=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);o==null||o.blur(),t.executeCommand(Z.id)}function c(){const o=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);o==null||o.blur(),t.executeCommand(P.id)}return E.jsxs("div",{className:v.zenEditor,children:[E.jsxs("div",{className:v.zenEditorIconWrapper,children:[E.jsx("span",{className:A(v.zenEditorIconContainer,v.zenEditorIconError),onClick:i,children:E.jsx(W,{style:{fontSize:"22px"}})}),E.jsx("span",{className:A(v.zenEditorIconContainer,v.zenEditorIconSuccess),onClick:c,children:E.jsx(Y,{style:{fontSize:"22px"}})})]}),E.jsx("div",{className:v.zenEditorCanvasContainer,ref:e})]})}function Ie(e){return{id:U.id,type:d.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:S.getCurrentExclusiveRangeInterest$(e),disabled$:S.getCurrentRangeDisable$(e,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]})}}const Ee={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{[U.id]:{order:2,menuItemFactory:Ie}}}},ve={id:P.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>H(e),binding:d.KeyCode.ENTER|d.MetaKeys.ALT},Se={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>H(e),binding:d.KeyCode.ESC};function H(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var me=Object.getOwnPropertyDescriptor,Ce=(e,n,r,t)=>{for(var i=t>1?void 0:t?me(n,r):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(i=o(i)||i);return i},b=(e,n)=>(r,t)=>n(r,t,e);let R=class extends s.Disposable{constructor(e,n,r,t){super(),this._zenZoneService=e,this._commandService=n,this._menuManagerService=r,this._shortcutService=t,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(fe,he))}_initCommands(){[U,Z,P].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Ee)}_initShortcuts(){[ve,Se].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};R=Ce([b(0,d.IZenZoneService),b(1,s.ICommandService),b(2,d.IMenuManagerService),b(3,d.IShortcutService)],R);var pe=Object.getOwnPropertyDescriptor,Oe=(e,n,r,t)=>{for(var i=t>1?void 0:t?pe(n,r):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(i=o(i)||i);return i},B=(e,n)=>(r,t)=>n(r,t,e);let M=class extends s.RxDisposable{constructor(e,n){super(),this._zenEditorManagerService=e,this._renderManagerService=n,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe($.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:n,height:r}=e,t=S.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);t!=null&&requestIdleCallback(()=>{t.engine.resizeBySize(n,r),this._calculatePagePosition(t),this._scrollToTop()})})}_calculatePagePosition(e){const{document:n,scene:r,docBackground:t}=e,i=r==null?void 0:r.getParent(),{width:c,height:o,pageMarginLeft:a,pageMarginTop:l}=n;if(i==null||c===Number.POSITIVE_INFINITY||o===Number.POSITIVE_INFINITY)return;const{width:f,height:m}=i;let g=0;const h=l;let C=0,y=0,p=Number.POSITIVE_INFINITY;const{scaleX:I,scaleY:D}=r.getAncestorScale();f>(c+a*2)*I?(g=f/2-c*I/2,g/=I,C=(f-a*2)/I,p=0):(g=a,C=c+a*2,p=(C-f/I)/2),m>o?y=(m-l*2)/D:y=o+l*2,r.resize(C,y),n.translate(g,h),t.translate(g,h);const x=r.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(p!==Number.POSITIVE_INFINITY&&x!=null){const q=x.transScroll2ViewportScrollValue(p,0).x;x.scrollToBarPos({x:q})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(N.DocBackScrollRenderController),n={startOffset:0,endOffset:0};e&&e.scrollToRange(n)}};M=Oe([B(0,j),B(1,F.IRenderManagerService)],M);var Te=Object.getOwnPropertyDescriptor,Ne=(e,n,r,t)=>{for(var i=t>1?void 0:t?Te(n,r):n,c=e.length-1,o;c>=0;c--)(o=e[c])&&(i=o(i)||i);return i},L=(e,n)=>(r,t)=>n(r,t,e),z;exports.UniverSheetsZenEditorPlugin=(z=class extends s.Plugin{constructor(n=k,r,t){super(),this._config=n,this._injector=r,this._configService=t;const{menu:i,...c}=s.merge({},k,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(J,c),this._initializeDependencies(this._injector)}_initializeDependencies(n){[[R],[M],[j,{useClass:oe}]].forEach(t=>n.add(t))}onReady(){this._injector.get(R)}onSteady(){this._injector.get(M)}},O(z,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),O(z,"type",s.UniverInstanceType.UNIVER_SHEET),z);exports.UniverSheetsZenEditorPlugin=Ne([L(1,s.Inject(s.Injector)),L(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=P;exports.OpenZenEditorCommand=U;
1
+ "use strict";var H=Object.defineProperty;var G=(e,t,i)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var O=(e,t,i)=>G(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),N=require("@univerjs/docs-ui"),$=require("@univerjs/engine-render"),I=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),v=require("react/jsx-runtime"),B=require("@univerjs/design"),E=require("react"),R=require("rxjs"),T=require("@univerjs/sheets"),Z={id:"zen-editor.command.open-zen-editor",type:c.CommandType.COMMAND,handler:async e=>{var D;const t=e.get(d.IZenZoneService),i=e.get(N.IEditorService),n=e.get(I.IEditorBridgeService),r=e.get(c.IUniverInstanceService),s=e.get(d.ISidebarService);s.visible&&(s.close(),await c.delayAnimationFrame()),t.open();const o=i.getEditor(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const a=n.getLatestEditCellState();if(a==null)return!1;const l=(D=a.documentLayoutObject.documentModel)==null?void 0:D.getSnapshot();if(l==null)return!1;r.focusUnit(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:f,drawings:m,drawingsOrder:g,tableSource:_,settings:C}=c.Tools.deepClone(l),p={...o.getDocumentData(),body:f,drawings:m,drawingsOrder:g,tableSource:_,settings:C},h=[{startOffset:0,endOffset:0,collapsed:!0}];return o.focus(),o.setDocumentData(p,h),o.clearUndoRedoHistory(),!0}},x={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async e=>{const t=e.get(d.IZenZoneService),i=e.get(I.IEditorBridgeService),n=e.get(c.IUniverInstanceService),r=e.get(d.ISidebarService);r.visible&&(r.close(),await c.delayAnimationFrame()),t.close();const s=n.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return s?(n.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}},P={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async e=>{var f;const t=e.get(d.IZenZoneService),i=e.get(I.IEditorBridgeService),n=e.get(c.IUniverInstanceService),r=e.get(N.IEditorService),s=e.get(d.ISidebarService);s.visible&&(s.close(),await c.delayAnimationFrame()),t.close();const o=r.getEditor(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const a=e.get($.IRenderManagerService),l=n.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(l){const m=l.getUnitId(),g=(f=a.getRenderById(m))==null?void 0:f.with(I.EditingRenderController);if(g){const _=c.Tools.deepClone(o.getDocumentData());_.documentStyle.documentFlavor=c.DocumentFlavor.UNSPECIFIED,g.submitCellData(new c.DocumentDataModel(_))}return n.focusUnit(l.getUnitId()),i.refreshEditCellState(),!0}return!1}},X="sheets-zen-editor.config",A={};var u=function(){return u=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u.apply(this,arguments)},J=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},j=E.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,s=e.extend,o=J(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),l=E.useRef("_".concat(te()));return V(i,"".concat(n),{defIds:i.defIds,idSuffix:l.current},u({ref:t,className:a},o),s)});function V(e,t,i,n,r){return E.createElement(e.tag,u(u({key:t},Q(e,i,r)),n),(ee(e,i).children||[]).map(function(s,o){return V(s,"".concat(t,"-").concat(e.tag,"-").concat(o),i,void 0,r)}))}function Q(e,t,i){var n=u({},e.attrs);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(s){var o=s[0],a=s[1];o==="mask"&&typeof a=="string"&&(n[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var o=s[0],a=s[1];typeof a=="string"&&(n[o]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function ee(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?u(u({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?u(u({},r),{attrs:u(u({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function te(){return Math.random().toString(36).substring(2,8)}j.displayName="UniverIcon";var ne={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"}}]},Y=E.forwardRef(function(e,t){return E.createElement(j,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ne}))});Y.displayName="CheckMarkSingle";var ie={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"}}]},W=E.forwardRef(function(e,t){return E.createElement(j,Object.assign({},e,{id:"close-single",ref:t,icon:ie}))});W.displayName="CloseSingle";class re{constructor(){O(this,"_position",null);O(this,"_position$",new R.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const k=c.createIdentifier("univer.sheet-zen-editor-manager.service"),oe="univer-zen-editor",se="univer-zen-editor-icon-wrapper",ce="univer-zen-editor-icon-container",ae="univer-zen-editor-icon-success",de="univer-zen-editor-icon-error",le="univer-zen-editor-canvas-container",S={zenEditor:oe,zenEditorIconWrapper:se,zenEditorIconContainer:ce,zenEditorIconSuccess:ae,zenEditorIconError:de,zenEditorCanvasContainer:le},ue="ZEN_EDITOR_PLUGIN_",ge=`${ue}ZEN_EDITOR_COMPONENT`,fe={id:c.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:c.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function Ee(){const e=E.useRef(null),t=d.useDependency(k),i=d.useDependency(N.IEditorService),n=d.useDependency(c.ICommandService);E.useEffect(()=>{const o=e.current;if(!o)return;const a=i.register({editorUnitId:c.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:fe,scrollBar:!0,backScrollOffset:100},o),l=new ResizeObserver(()=>{t.setPosition(o.getBoundingClientRect())});return l.observe(o),()=>{a.dispose(),l.unobserve(o)}},[]);function r(){const o=i.getEditor(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY);o==null||o.blur(),n.executeCommand(x.id)}function s(){const o=i.getEditor(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY);o==null||o.blur(),n.executeCommand(P.id)}return v.jsxs("div",{className:S.zenEditor,children:[v.jsxs("div",{className:S.zenEditorIconWrapper,children:[v.jsx("span",{className:B.clsx(S.zenEditorIconContainer,S.zenEditorIconError),onClick:r,children:v.jsx(W,{style:{fontSize:"22px"}})}),v.jsx("span",{className:B.clsx(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:s,children:v.jsx(Y,{style:{fontSize:"22px"}})})]}),v.jsx("div",{className:S.zenEditorCanvasContainer,ref:e})]})}function Ie(e){const t=e.get(I.IEditorBridgeService);return{id:Z.id,type:d.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:I.getCurrentExclusiveRangeInterest$(e),disabled$:t.currentEditCell$.pipe(R.switchMap(i=>I.getCurrentRangeDisable$(e,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]}).pipe(R.map(n=>{var r,s,o,a;return n||((a=(o=(s=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:s.customBlocks)==null?void 0:o.length)!=null?a:0)>0}))))}}const _e={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{[Z.id]:{order:2,menuItemFactory:Ie}}}},he={id:P.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ENTER|d.MetaKeys.ALT},ve={id:x.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ESC};function K(e){return e.getContextValue(c.FOCUSING_DOC)&&e.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(c.EDITOR_ACTIVATED)&&!e.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var Se=Object.getOwnPropertyDescriptor,me=(e,t,i,n)=>{for(var r=n>1?void 0:n?Se(t,i):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(r=o(r)||r);return r},b=(e,t)=>(i,n)=>t(i,n,e);let M=class extends c.Disposable{constructor(e,t,i,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=i,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ge,Ee))}_initCommands(){[Z,x,P].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(_e)}_initShortcuts(){[he,ve].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};M=me([b(0,d.IZenZoneService),b(1,c.ICommandService),b(2,d.IMenuManagerService),b(3,d.IShortcutService)],M);var Ce=Object.getOwnPropertyDescriptor,pe=(e,t,i,n)=>{for(var r=n>1?void 0:n?Ce(t,i):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(r=o(r)||r);return r},L=(e,t)=>(i,n)=>t(i,n,e);let U=class extends c.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(R.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:i}=e,n=I.getEditorObject(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,i),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:i,docBackground:n}=e,r=i==null?void 0:i.getParent(),{width:s,height:o,pageMarginLeft:a,pageMarginTop:l}=t;if(r==null||s===Number.POSITIVE_INFINITY||o===Number.POSITIVE_INFINITY)return;const{width:f,height:m}=r;let g=0;const _=l;let C=0,y=0,p=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:D}=i.getAncestorScale();f>(s+a*2)*h?(g=f/2-s*h/2,g/=h,C=(f-a*2)/h,p=0):(g=a,C=s+a*2,p=(C-f/h)/2),m>o?y=(m-l*2)/D:y=o+l*2,i.resize(C,y),t.translate(g,_),n.translate(g,_);const w=i.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(p!==Number.POSITIVE_INFINITY&&w!=null){const q=w.transScroll2ViewportScrollValue(p,0).x;w.scrollToBarPos({x:q})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(c.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(N.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};U=pe([L(0,k),L(1,$.IRenderManagerService)],U);var Oe=Object.getOwnPropertyDescriptor,Te=(e,t,i,n)=>{for(var r=n>1?void 0:n?Oe(t,i):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(r=o(r)||r);return r},F=(e,t)=>(i,n)=>t(i,n,e),z;exports.UniverSheetsZenEditorPlugin=(z=class extends c.Plugin{constructor(t=A,i,n){super(),this._config=t,this._injector=i,this._configService=n;const{menu:r,...s}=c.merge({},A,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(X,s),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[M],[U],[k,{useClass:re}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(U)}},O(z,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),O(z,"type",c.UniverInstanceType.UNIVER_SHEET),z);exports.UniverSheetsZenEditorPlugin=Te([F(1,c.Inject(c.Injector)),F(2,c.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=x;exports.ConfirmZenEditCommand=P;exports.OpenZenEditorCommand=Z;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}};module.exports=e;
1
+ "use strict";const e={rightClick:{zenEditor:"Full Screen Editor"},shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}};module.exports=e;
1
+ "use strict";const e={rightClick:{zenEditor:"ویرایشگر تمام صفحه"},shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}};module.exports=e;
1
+ "use strict";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"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}};module.exports=e;
1
+ "use strict";const e={rightClick:{zenEditor:"Редактор на весь экран"},shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={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)"}}};module.exports=e;
1
+ "use strict";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)"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}};module.exports=e;
1
+ "use strict";const e={rightClick:{zenEditor:"禅模式编辑"},shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}};module.exports=e;
@@ -1 +1 @@
1
- "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}};module.exports=e;
1
+ "use strict";const e={rightClick:{zenEditor:"禪模式編輯"},shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}};module.exports=e;
package/lib/es/index.js CHANGED
@@ -1,38 +1,39 @@
1
- var ae = Object.defineProperty;
2
- var le = (e, n, r) => n in e ? ae(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
- var E = (e, n, r) => le(e, typeof n != "symbol" ? n + "" : n, r);
4
- import { CommandType as D, IUniverInstanceService as R, delayAnimationFrame as P, DOCS_ZEN_EDITOR_UNIT_ID_KEY as f, Tools as X, UniverInstanceType as x, DocumentFlavor as q, DocumentDataModel as de, createIdentifier as ue, ICommandService as J, DEFAULT_EMPTY_DOCUMENT_VALUE as fe, FOCUSING_DOC as ge, FOCUSING_UNIVER_EDITOR as he, EDITOR_ACTIVATED as me, FOCUSING_EDITOR_STANDALONE as ve, Disposable as pe, RxDisposable as Se, Plugin as Ee, merge as _e, Inject as Ie, Injector as Ce, IConfigService as Oe } from "@univerjs/core";
5
- import { IEditorService as w, VIEWPORT_KEY as ye, DocBackScrollRenderController as Ne } from "@univerjs/docs-ui";
1
+ var ce = Object.defineProperty;
2
+ var ae = (e, t, i) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var E = (e, t, i) => ae(e, typeof t != "symbol" ? t + "" : t, i);
4
+ import { CommandType as R, IUniverInstanceService as P, delayAnimationFrame as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as X, UniverInstanceType as x, DocumentFlavor as q, DocumentDataModel as de, createIdentifier as le, ICommandService as J, DEFAULT_EMPTY_DOCUMENT_VALUE as ue, FOCUSING_DOC as ge, FOCUSING_UNIVER_EDITOR as fe, EDITOR_ACTIVATED as he, FOCUSING_EDITOR_STANDALONE as me, Disposable as ve, RxDisposable as pe, Plugin as Se, merge as Ee, Inject as _e, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
5
+ import { IEditorService as k, VIEWPORT_KEY as Oe, DocBackScrollRenderController as ye } from "@univerjs/docs-ui";
6
6
  import { IRenderManagerService as Q } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as U, EditingRenderController as be, getCurrentRangeDisable$ as Te, getCurrentExclusiveRangeInterest$ as ze, getEditorObject as Me } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as T, ISidebarService as k, useDependency as M, MenuItemType as De, ContextMenuPosition as Re, ContextMenuGroup as Pe, KeyCode as ee, MetaKeys as xe, IMenuManagerService as we, IShortcutService as Ue } from "@univerjs/ui";
7
+ import { IEditorBridgeService as b, EditingRenderController as Ne, getCurrentExclusiveRangeInterest$ as Te, getCurrentRangeDisable$ as be, getEditorObject as ze } from "@univerjs/sheets-ui";
8
+ import { IZenZoneService as z, ISidebarService as U, useDependency as D, MenuItemType as Me, ContextMenuPosition as De, ContextMenuGroup as Re, KeyCode as ee, MetaKeys as Pe, IMenuManagerService as we, IShortcutService as xe } from "@univerjs/ui";
9
9
  import { jsxs as F, jsx as _ } from "react/jsx-runtime";
10
+ import { clsx as W } from "@univerjs/design";
10
11
  import { forwardRef as Z, useRef as te, createElement as j, useEffect as ke } from "react";
11
- import { BehaviorSubject as Ze, takeUntil as je } from "rxjs";
12
- import { RangeProtectionPermissionEditPoint as Ae, WorksheetEditPermission as Be, WorksheetSetCellValuePermission as Le, WorksheetSetCellStylePermission as $e, WorkbookEditablePermission as Ve } from "@univerjs/sheets";
13
- const A = {
12
+ import { BehaviorSubject as Ue, switchMap as Ze, map as je, takeUntil as Be } from "rxjs";
13
+ import { RangeProtectionPermissionEditPoint as Le, WorksheetEditPermission as Ae, WorksheetSetCellValuePermission as $e, WorksheetSetCellStylePermission as Ve, WorkbookEditablePermission as Fe } from "@univerjs/sheets";
14
+ const B = {
14
15
  id: "zen-editor.command.open-zen-editor",
15
- type: D.COMMAND,
16
+ type: R.COMMAND,
16
17
  handler: async (e) => {
17
18
  var C;
18
- const n = e.get(T), r = e.get(w), t = e.get(U), i = e.get(R), s = e.get(k);
19
- s.visible && (s.close(), await P()), n.open();
20
- const o = r.getEditor(f);
19
+ const t = e.get(z), i = e.get(k), n = e.get(b), r = e.get(P), s = e.get(U);
20
+ s.visible && (s.close(), await w()), t.open();
21
+ const o = i.getEditor(g);
21
22
  if (o == null)
22
23
  return !1;
23
- const c = t.getLatestEditCellState();
24
+ const c = n.getLatestEditCellState();
24
25
  if (c == null)
25
26
  return !1;
26
27
  const a = (C = c.documentLayoutObject.documentModel) == null ? void 0 : C.getSnapshot();
27
28
  if (a == null)
28
29
  return !1;
29
- i.focusUnit(f);
30
- const { body: u, drawings: v, drawingsOrder: d, tableSource: g, settings: p } = X.deepClone(a), S = {
30
+ r.focusUnit(g);
31
+ const { body: u, drawings: v, drawingsOrder: l, tableSource: f, settings: p } = X.deepClone(a), S = {
31
32
  ...o.getDocumentData(),
32
33
  body: u,
33
34
  drawings: v,
34
- drawingsOrder: d,
35
- tableSource: g,
35
+ drawingsOrder: l,
36
+ tableSource: f,
36
37
  settings: p
37
38
  }, h = [
38
39
  {
@@ -43,144 +44,131 @@ const A = {
43
44
  ];
44
45
  return o.focus(), o.setDocumentData(S, h), o.clearUndoRedoHistory(), !0;
45
46
  }
46
- }, B = {
47
+ }, L = {
47
48
  id: "zen-editor.command.cancel-zen-edit",
48
- type: D.COMMAND,
49
+ type: R.COMMAND,
49
50
  handler: async (e) => {
50
- const n = e.get(T), r = e.get(U), t = e.get(R), i = e.get(k);
51
- i.visible && (i.close(), await P()), n.close();
52
- const s = t.getCurrentUnitForType(x.UNIVER_SHEET);
53
- return s ? (t.focusUnit(s.getUnitId()), r.refreshEditCellState(), !0) : !1;
51
+ const t = e.get(z), i = e.get(b), n = e.get(P), r = e.get(U);
52
+ r.visible && (r.close(), await w()), t.close();
53
+ const s = n.getCurrentUnitForType(x.UNIVER_SHEET);
54
+ return s ? (n.focusUnit(s.getUnitId()), i.refreshEditCellState(), !0) : !1;
54
55
  }
55
- }, L = {
56
+ }, A = {
56
57
  id: "zen-editor.command.confirm-zen-edit",
57
- type: D.COMMAND,
58
+ type: R.COMMAND,
58
59
  handler: async (e) => {
59
60
  var u;
60
- const n = e.get(T), r = e.get(U), t = e.get(R), i = e.get(w), s = e.get(k);
61
- s.visible && (s.close(), await P()), n.close();
62
- const o = i.getEditor(f);
61
+ const t = e.get(z), i = e.get(b), n = e.get(P), r = e.get(k), s = e.get(U);
62
+ s.visible && (s.close(), await w()), t.close();
63
+ const o = r.getEditor(g);
63
64
  if (o == null)
64
65
  return !1;
65
- const c = e.get(Q), a = t.getCurrentUnitForType(x.UNIVER_SHEET);
66
+ const c = e.get(Q), a = n.getCurrentUnitForType(x.UNIVER_SHEET);
66
67
  if (a) {
67
- const v = a.getUnitId(), d = (u = c.getRenderById(v)) == null ? void 0 : u.with(be);
68
- if (d) {
69
- const g = X.deepClone(o.getDocumentData());
70
- g.documentStyle.documentFlavor = q.UNSPECIFIED, d.submitCellData(new de(g));
68
+ const v = a.getUnitId(), l = (u = c.getRenderById(v)) == null ? void 0 : u.with(Ne);
69
+ if (l) {
70
+ const f = X.deepClone(o.getDocumentData());
71
+ f.documentStyle.documentFlavor = q.UNSPECIFIED, l.submitCellData(new de(f));
71
72
  }
72
- return t.focusUnit(a.getUnitId()), r.refreshEditCellState(), !0;
73
+ return n.focusUnit(a.getUnitId()), i.refreshEditCellState(), !0;
73
74
  }
74
75
  return !1;
75
76
  }
76
- }, Fe = "sheets-zen-editor.config", W = {};
77
- var l = function() {
78
- return l = Object.assign || function(e) {
79
- for (var n, r = 1, t = arguments.length; r < t; r++) {
80
- n = arguments[r];
81
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
77
+ }, We = "sheets-zen-editor.config", H = {};
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]);
82
83
  }
83
84
  return e;
84
- }, l.apply(this, arguments);
85
- }, We = function(e, n) {
86
- var r = {};
87
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (r[t] = e[t]);
85
+ }, d.apply(this, arguments);
86
+ }, He = 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]);
88
89
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
89
- for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
90
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (r[t[i]] = e[t[i]]);
91
- return r;
92
- }, $ = Z(function(e, n) {
93
- var r = e.icon, t = e.id, i = e.className, s = e.extend, o = We(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), a = te("_".concat(Ge()));
94
- return ne(r, "".concat(t), { defIds: r.defIds, idSuffix: a.current }, l({ ref: n, className: c }, o), s);
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
+ }, $ = Z(function(e, t) {
94
+ var i = e.icon, n = e.id, r = e.className, s = e.extend, o = He(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = te("_".concat(Ke()));
95
+ return ne(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, d({ ref: t, className: c }, o), s);
95
96
  });
96
- function ne(e, n, r, t, i) {
97
- return j(e.tag, l(l({ key: n }, He(e, r, i)), t), (Ye(e, r).children || []).map(function(s, o) {
98
- return ne(s, "".concat(n, "-").concat(e.tag, "-").concat(o), r, void 0, i);
97
+ function ne(e, t, i, n, r) {
98
+ return j(e.tag, d(d({ key: t }, Ye(e, i, r)), n), (Ge(e, i).children || []).map(function(s, o) {
99
+ return ne(s, "".concat(t, "-").concat(e.tag, "-").concat(o), i, void 0, r);
99
100
  }));
100
101
  }
101
- function He(e, n, r) {
102
- var t = l({}, e.attrs);
103
- r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1), e.tag === "mask" && t.id && (t.id = t.id + n.idSuffix), Object.entries(t).forEach(function(s) {
102
+ function Ye(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(s) {
104
105
  var o = s[0], c = s[1];
105
- o === "mask" && typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
106
+ o === "mask" && typeof c == "string" && (n[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
106
107
  });
107
- var i = n.defIds;
108
- return !i || i.length === 0 || (e.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + n.idSuffix), Object.entries(t).forEach(function(s) {
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(s) {
109
110
  var o = s[0], c = s[1];
110
- typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
111
- })), t;
111
+ typeof c == "string" && (n[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
112
+ })), n;
112
113
  }
113
- function Ye(e, n) {
114
- var r, t = n.defIds;
115
- return !t || t.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? l(l({}, e), { children: e.children.map(function(i) {
116
- return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? l(l({}, i), { attrs: l(l({}, i.attrs), { id: i.attrs.id + n.idSuffix }) }) : i;
114
+ function Ge(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.indexOf(r.attrs.id) > -1 ? d(d({}, r), { attrs: d(d({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
117
118
  }) }) : e;
118
119
  }
119
- function Ge() {
120
+ function Ke() {
120
121
  return Math.random().toString(36).substring(2, 8);
121
122
  }
122
123
  $.displayName = "UniverIcon";
123
- var Ke = { 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" } }] }, re = Z(function(e, n) {
124
+ var Xe = { 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" } }] }, ie = Z(function(e, t) {
124
125
  return j($, Object.assign({}, e, {
125
126
  id: "check-mark-single",
126
- ref: n,
127
- icon: Ke
127
+ ref: t,
128
+ icon: Xe
128
129
  }));
129
130
  });
130
- re.displayName = "CheckMarkSingle";
131
- var Xe = { 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" } }] }, ie = Z(function(e, n) {
131
+ ie.displayName = "CheckMarkSingle";
132
+ var qe = { 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" } }] }, re = Z(function(e, t) {
132
133
  return j($, Object.assign({}, e, {
133
134
  id: "close-single",
134
- ref: n,
135
- icon: Xe
135
+ ref: t,
136
+ icon: qe
136
137
  }));
137
138
  });
138
- ie.displayName = "CloseSingle";
139
- function oe(e) {
140
- var n, r, t = "";
141
- if (typeof e == "string" || typeof e == "number") t += e;
142
- else if (typeof e == "object") if (Array.isArray(e)) {
143
- var i = e.length;
144
- for (n = 0; n < i; n++) e[n] && (r = oe(e[n])) && (t && (t += " "), t += r);
145
- } else for (r in e) e[r] && (t && (t += " "), t += r);
146
- return t;
147
- }
148
- function H() {
149
- for (var e, n, r = 0, t = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (n = oe(e)) && (t && (t += " "), t += n);
150
- return t;
151
- }
152
- class qe {
139
+ re.displayName = "CloseSingle";
140
+ class Je {
153
141
  constructor() {
154
142
  E(this, "_position", null);
155
- E(this, "_position$", new Ze(null));
143
+ E(this, "_position$", new Ue(null));
156
144
  E(this, "position$", this._position$.asObservable());
157
145
  }
158
146
  dispose() {
159
147
  this._position$.complete(), this._position = null;
160
148
  }
161
- setPosition(n) {
162
- this._position = n, this._refresh(n);
149
+ setPosition(t) {
150
+ this._position = t, this._refresh(t);
163
151
  }
164
152
  getPosition() {
165
153
  return this._position;
166
154
  }
167
- _refresh(n) {
168
- this._position$.next(n);
155
+ _refresh(t) {
156
+ this._position$.next(t);
169
157
  }
170
158
  }
171
- const V = ue(
159
+ const V = le(
172
160
  "univer.sheet-zen-editor-manager.service"
173
- ), Je = "univer-zen-editor", Qe = "univer-zen-editor-icon-wrapper", et = "univer-zen-editor-icon-container", tt = "univer-zen-editor-icon-success", nt = "univer-zen-editor-icon-error", rt = "univer-zen-editor-canvas-container", m = {
174
- zenEditor: Je,
175
- zenEditorIconWrapper: Qe,
176
- zenEditorIconContainer: et,
177
- zenEditorIconSuccess: tt,
178
- zenEditorIconError: nt,
161
+ ), Qe = "univer-zen-editor", et = "univer-zen-editor-icon-wrapper", tt = "univer-zen-editor-icon-container", nt = "univer-zen-editor-icon-success", it = "univer-zen-editor-icon-error", rt = "univer-zen-editor-canvas-container", m = {
162
+ zenEditor: Qe,
163
+ zenEditorIconWrapper: et,
164
+ zenEditorIconContainer: tt,
165
+ zenEditorIconSuccess: nt,
166
+ zenEditorIconError: it,
179
167
  zenEditorCanvasContainer: rt
180
- }, it = "ZEN_EDITOR_PLUGIN_", ot = `${it}ZEN_EDITOR_COMPONENT`, st = {
181
- id: f,
168
+ }, ot = "ZEN_EDITOR_PLUGIN_", st = `${ot}ZEN_EDITOR_COMPONENT`, ct = {
169
+ id: g,
182
170
  body: {
183
- dataStream: `${fe}`,
171
+ dataStream: `${ue}`,
184
172
  textRuns: [],
185
173
  tables: [],
186
174
  customBlocks: [],
@@ -212,109 +200,112 @@ const V = ue(
212
200
  drawings: {},
213
201
  drawingsOrder: []
214
202
  };
215
- function ct() {
216
- const e = te(null), n = M(V), r = M(w), t = M(J);
203
+ function at() {
204
+ const e = te(null), t = D(V), i = D(k), n = D(J);
217
205
  ke(() => {
218
206
  const o = e.current;
219
207
  if (!o)
220
208
  return;
221
- const c = r.register(
222
- {
223
- editorUnitId: f,
224
- initialSnapshot: st,
225
- scrollBar: !0,
226
- backScrollOffset: 100
227
- },
228
- o
229
- ), a = new ResizeObserver(() => {
230
- n.setPosition(o.getBoundingClientRect());
209
+ const c = i.register({
210
+ editorUnitId: g,
211
+ initialSnapshot: ct,
212
+ scrollBar: !0,
213
+ backScrollOffset: 100
214
+ }, o), a = new ResizeObserver(() => {
215
+ t.setPosition(o.getBoundingClientRect());
231
216
  });
232
217
  return a.observe(o), () => {
233
218
  c.dispose(), a.unobserve(o);
234
219
  };
235
220
  }, []);
236
- function i() {
237
- const o = r.getEditor(f);
238
- o == null || o.blur(), t.executeCommand(B.id);
221
+ function r() {
222
+ const o = i.getEditor(g);
223
+ o == null || o.blur(), n.executeCommand(L.id);
239
224
  }
240
225
  function s() {
241
- const o = r.getEditor(f);
242
- o == null || o.blur(), t.executeCommand(L.id);
226
+ const o = i.getEditor(g);
227
+ o == null || o.blur(), n.executeCommand(A.id);
243
228
  }
244
229
  return /* @__PURE__ */ F("div", { className: m.zenEditor, children: [
245
230
  /* @__PURE__ */ F("div", { className: m.zenEditorIconWrapper, children: [
246
231
  /* @__PURE__ */ _(
247
232
  "span",
248
233
  {
249
- className: H(m.zenEditorIconContainer, m.zenEditorIconError),
250
- onClick: i,
251
- children: /* @__PURE__ */ _(ie, { style: { fontSize: "22px" } })
234
+ className: W(m.zenEditorIconContainer, m.zenEditorIconError),
235
+ onClick: r,
236
+ children: /* @__PURE__ */ _(re, { style: { fontSize: "22px" } })
252
237
  }
253
238
  ),
254
239
  /* @__PURE__ */ _(
255
240
  "span",
256
241
  {
257
- className: H(m.zenEditorIconContainer, m.zenEditorIconSuccess),
242
+ className: W(m.zenEditorIconContainer, m.zenEditorIconSuccess),
258
243
  onClick: s,
259
- children: /* @__PURE__ */ _(re, { style: { fontSize: "22px" } })
244
+ children: /* @__PURE__ */ _(ie, { style: { fontSize: "22px" } })
260
245
  }
261
246
  )
262
247
  ] }),
263
248
  /* @__PURE__ */ _("div", { className: m.zenEditorCanvasContainer, ref: e })
264
249
  ] });
265
250
  }
266
- function at(e) {
251
+ function dt(e) {
252
+ const t = e.get(b);
267
253
  return {
268
- id: A.id,
269
- type: De.BUTTON,
254
+ id: B.id,
255
+ type: Me.BUTTON,
270
256
  title: "rightClick.zenEditor",
271
257
  icon: "AmplifySingle",
272
- hidden$: ze(e),
273
- disabled$: Te(e, { workbookTypes: [Ve], worksheetTypes: [Be, Le, $e], rangeTypes: [Ae] })
258
+ hidden$: Te(e),
259
+ disabled$: t.currentEditCell$.pipe(
260
+ Ze((i) => be(e, { workbookTypes: [Fe], worksheetTypes: [Ae, $e, Ve], rangeTypes: [Le] }).pipe(je((n) => {
261
+ var r, s, o, c;
262
+ return n || ((c = (o = (s = (r = i == null ? void 0 : i.documentLayoutObject.documentModel) == null ? void 0 : r.getBody()) == null ? void 0 : s.customBlocks) == null ? void 0 : o.length) != null ? c : 0) > 0;
263
+ })))
264
+ )
274
265
  };
275
266
  }
276
267
  const lt = {
277
- [Re.MAIN_AREA]: {
278
- [Pe.OTHERS]: {
279
- [A.id]: {
268
+ [De.MAIN_AREA]: {
269
+ [Re.OTHERS]: {
270
+ [B.id]: {
280
271
  order: 2,
281
- menuItemFactory: at
272
+ menuItemFactory: dt
282
273
  }
283
274
  }
284
275
  }
285
- }, dt = {
286
- id: L.id,
276
+ }, ut = {
277
+ id: A.id,
287
278
  description: "shortcut.sheet.zen-edit-confirm",
288
279
  group: "4_sheet-edit",
289
- preconditions: (e) => se(e),
290
- binding: ee.ENTER | xe.ALT
291
- }, ut = {
292
- id: B.id,
280
+ preconditions: (e) => oe(e),
281
+ binding: ee.ENTER | Pe.ALT
282
+ }, gt = {
283
+ id: L.id,
293
284
  description: "shortcut.sheet.zen-edit-cancel",
294
285
  group: "4_sheet-edit",
295
- preconditions: (e) => se(e),
286
+ preconditions: (e) => oe(e),
296
287
  binding: ee.ESC
297
288
  };
298
- function se(e) {
299
- return e.getContextValue(ge) && e.getContextValue(he) && e.getContextValue(me) && !e.getContextValue(ve);
289
+ function oe(e) {
290
+ return e.getContextValue(ge) && e.getContextValue(fe) && e.getContextValue(he) && !e.getContextValue(me);
300
291
  }
301
- var ft = Object.getOwnPropertyDescriptor, gt = (e, n, r, t) => {
302
- for (var i = t > 1 ? void 0 : t ? ft(n, r) : n, s = e.length - 1, o; s >= 0; s--)
303
- (o = e[s]) && (i = o(i) || i);
304
- return i;
305
- }, O = (e, n) => (r, t) => n(r, t, e);
306
- let N = class extends pe {
307
- constructor(e, n, r, t) {
308
- super(), this._zenZoneService = e, this._commandService = n, this._menuManagerService = r, this._shortcutService = t, this._initialize();
292
+ var ft = Object.getOwnPropertyDescriptor, ht = (e, t, i, n) => {
293
+ for (var r = n > 1 ? void 0 : n ? ft(t, i) : t, s = e.length - 1, o; s >= 0; s--)
294
+ (o = e[s]) && (r = o(r) || r);
295
+ return r;
296
+ }, O = (e, t) => (i, n) => t(i, n, e);
297
+ let N = class extends ve {
298
+ constructor(e, t, i, n) {
299
+ super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = i, this._shortcutService = n, this._initialize();
309
300
  }
310
301
  _initialize() {
311
302
  this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
312
303
  }
313
304
  _initCustomComponents() {
314
- this.disposeWithMe(this._zenZoneService.set(ot, ct));
305
+ this.disposeWithMe(this._zenZoneService.set(st, at));
315
306
  }
316
307
  _initCommands() {
317
- [A, B, L].forEach((e) => {
308
+ [B, L, A].forEach((e) => {
318
309
  this.disposeWithMe(this._commandService.registerCommand(e));
319
310
  });
320
311
  }
@@ -322,108 +313,108 @@ let N = class extends pe {
322
313
  this._menuManagerService.mergeMenu(lt);
323
314
  }
324
315
  _initShortcuts() {
325
- [dt, ut].forEach((e) => {
316
+ [ut, gt].forEach((e) => {
326
317
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
327
318
  });
328
319
  }
329
320
  };
330
- N = gt([
331
- O(0, T),
321
+ N = ht([
322
+ O(0, z),
332
323
  O(1, J),
333
324
  O(2, we),
334
- O(3, Ue)
325
+ O(3, xe)
335
326
  ], N);
336
- var ht = Object.getOwnPropertyDescriptor, mt = (e, n, r, t) => {
337
- for (var i = t > 1 ? void 0 : t ? ht(n, r) : n, s = e.length - 1, o; s >= 0; s--)
338
- (o = e[s]) && (i = o(i) || i);
339
- return i;
340
- }, Y = (e, n) => (r, t) => n(r, t, e);
341
- let b = class extends Se {
342
- constructor(e, n) {
343
- super(), this._zenEditorManagerService = e, this._renderManagerService = n, this._initialize();
327
+ var mt = Object.getOwnPropertyDescriptor, vt = (e, t, i, n) => {
328
+ for (var r = n > 1 ? void 0 : n ? mt(t, i) : t, s = e.length - 1, o; s >= 0; s--)
329
+ (o = e[s]) && (r = o(r) || r);
330
+ return r;
331
+ }, Y = (e, t) => (i, n) => t(i, n, e);
332
+ let T = class extends pe {
333
+ constructor(e, t) {
334
+ super(), this._zenEditorManagerService = e, this._renderManagerService = t, this._initialize();
344
335
  }
345
336
  _initialize() {
346
337
  this._syncZenEditorSize();
347
338
  }
348
339
  // Listen to changes in the size of the zen editor container to set the size of the editor.
349
340
  _syncZenEditorSize() {
350
- this._zenEditorManagerService.position$.pipe(je(this.dispose$)).subscribe((e) => {
341
+ this._zenEditorManagerService.position$.pipe(Be(this.dispose$)).subscribe((e) => {
351
342
  if (e == null)
352
343
  return;
353
- const { width: n, height: r } = e, t = Me(f, this._renderManagerService);
354
- t != null && requestIdleCallback(() => {
355
- t.engine.resizeBySize(n, r), this._calculatePagePosition(t), this._scrollToTop();
344
+ const { width: t, height: i } = e, n = ze(g, this._renderManagerService);
345
+ n != null && requestIdleCallback(() => {
346
+ n.engine.resizeBySize(t, i), this._calculatePagePosition(n), this._scrollToTop();
356
347
  });
357
348
  });
358
349
  }
359
350
  _calculatePagePosition(e) {
360
- const { document: n, scene: r, docBackground: t } = e, i = r == null ? void 0 : r.getParent(), { width: s, height: o, pageMarginLeft: c, pageMarginTop: a } = n;
361
- if (i == null || s === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
351
+ const { document: t, scene: i, docBackground: n } = e, r = i == null ? void 0 : i.getParent(), { width: s, height: o, pageMarginLeft: c, pageMarginTop: a } = t;
352
+ if (r == null || s === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
362
353
  return;
363
- const { width: u, height: v } = i;
364
- let d = 0;
365
- const g = a;
354
+ const { width: u, height: v } = r;
355
+ let l = 0;
356
+ const f = a;
366
357
  let p = 0, I = 0, S = Number.POSITIVE_INFINITY;
367
- const { scaleX: h, scaleY: C } = r.getAncestorScale();
368
- u > (s + c * 2) * h ? (d = u / 2 - s * h / 2, d /= h, p = (u - c * 2) / h, S = 0) : (d = c, p = s + c * 2, S = (p - u / h) / 2), v > o ? I = (v - a * 2) / C : I = o + a * 2, r.resize(p, I), n.translate(d, g), t.translate(d, g);
369
- const z = r.getViewport(ye.VIEW_MAIN);
370
- if (S !== Number.POSITIVE_INFINITY && z != null) {
371
- const ce = z.transScroll2ViewportScrollValue(S, 0).x;
372
- z.scrollToBarPos({
373
- x: ce
358
+ const { scaleX: h, scaleY: C } = i.getAncestorScale();
359
+ u > (s + c * 2) * h ? (l = u / 2 - s * h / 2, l /= h, p = (u - c * 2) / h, S = 0) : (l = c, p = s + c * 2, S = (p - u / h) / 2), v > o ? I = (v - a * 2) / C : I = o + a * 2, i.resize(p, I), t.translate(l, f), n.translate(l, f);
360
+ const M = i.getViewport(Oe.VIEW_MAIN);
361
+ if (S !== Number.POSITIVE_INFINITY && M != null) {
362
+ const se = M.transScroll2ViewportScrollValue(S, 0).x;
363
+ M.scrollToBarPos({
364
+ x: se
374
365
  });
375
366
  }
376
367
  return this;
377
368
  }
378
369
  _scrollToTop() {
379
- var r;
380
- const e = (r = this._renderManagerService.getRenderById(f)) == null ? void 0 : r.with(Ne), n = {
370
+ var i;
371
+ const e = (i = this._renderManagerService.getRenderById(g)) == null ? void 0 : i.with(ye), t = {
381
372
  startOffset: 0,
382
373
  endOffset: 0
383
374
  };
384
- e && e.scrollToRange(n);
375
+ e && e.scrollToRange(t);
385
376
  }
386
377
  };
387
- b = mt([
378
+ T = vt([
388
379
  Y(0, V),
389
380
  Y(1, Q)
390
- ], b);
391
- var vt = Object.getOwnPropertyDescriptor, pt = (e, n, r, t) => {
392
- for (var i = t > 1 ? void 0 : t ? vt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
393
- (o = e[s]) && (i = o(i) || i);
394
- return i;
395
- }, G = (e, n) => (r, t) => n(r, t, e), y;
396
- let K = (y = class extends Ee {
397
- constructor(e = W, n, r) {
398
- super(), this._config = e, this._injector = n, this._configService = r;
399
- const { menu: t, ...i } = _e(
381
+ ], T);
382
+ var pt = Object.getOwnPropertyDescriptor, St = (e, t, i, n) => {
383
+ for (var r = n > 1 ? void 0 : n ? pt(t, i) : t, s = e.length - 1, o; s >= 0; s--)
384
+ (o = e[s]) && (r = o(r) || r);
385
+ return r;
386
+ }, G = (e, t) => (i, n) => t(i, n, e), y;
387
+ let K = (y = class extends Se {
388
+ constructor(e = H, t, i) {
389
+ super(), this._config = e, this._injector = t, this._configService = i;
390
+ const { menu: n, ...r } = Ee(
400
391
  {},
401
- W,
392
+ H,
402
393
  this._config
403
394
  );
404
- t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(Fe, i), this._initializeDependencies(this._injector);
395
+ n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(We, r), this._initializeDependencies(this._injector);
405
396
  }
406
397
  _initializeDependencies(e) {
407
398
  [
408
399
  [N],
409
- [b],
410
- [V, { useClass: qe }]
411
- ].forEach((r) => e.add(r));
400
+ [T],
401
+ [V, { useClass: Je }]
402
+ ].forEach((i) => e.add(i));
412
403
  }
413
404
  onReady() {
414
405
  this._injector.get(N);
415
406
  }
416
407
  onSteady() {
417
- this._injector.get(b);
408
+ this._injector.get(T);
418
409
  }
419
410
  }, E(y, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), E(y, "type", x.UNIVER_SHEET), y);
420
- K = pt([
421
- G(1, Ie(Ce)),
422
- G(2, Oe)
411
+ K = St([
412
+ G(1, _e(Ie)),
413
+ G(2, Ce)
423
414
  ], K);
424
415
  export {
425
- B as CancelZenEditCommand,
426
- L as ConfirmZenEditCommand,
427
- A as OpenZenEditorCommand,
416
+ L as CancelZenEditCommand,
417
+ A as ConfirmZenEditCommand,
418
+ B as OpenZenEditorCommand,
428
419
  K as UniverSheetsZenEditorPlugin
429
420
  };
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "Full Screen Editor"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "Cancel Zen Edit",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "ویرایشگر تمام صفحه"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "لغو ویرایش Zen",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "Éditeur plein écran"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "Annuler l'édition plein écran",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "Редактор на весь экран"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "Отменить Zen редактирование",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "Chế độ chỉnh sửa Zen"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "Hủy chỉnh sửa (trạng thái Zen mode)",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "禅模式编辑"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "取消编辑(禅模式状态)",
@@ -1,4 +1,7 @@
1
1
  const e = {
2
+ rightClick: {
3
+ zenEditor: "禪模式編輯"
4
+ },
2
5
  shortcut: {
3
6
  sheet: {
4
7
  "zen-edit-cancel": "取消編輯(禪模式狀態)",
@@ -5,10 +5,12 @@ import { FWorkbook } from '@univerjs/sheets/facade';
5
5
  export interface IFWorkbookSheetsZenEditorMixin {
6
6
  /**
7
7
  * Start the zen editing process
8
- * @returns A promise that resolves to a boolean indicating whether the zen editing process was started successfully.
8
+ * @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the zen editing process was started successfully.
9
9
  * @example
10
10
  * ```ts
11
- * univerAPI.getActiveWorkbook().startZenEditingAsync();
11
+ * const fWorkbook = univerAPI.getActiveWorkbook();
12
+ * const success = await fWorkbook.startZenEditingAsync();
13
+ * console.log(success);
12
14
  * ```
13
15
  */
14
16
  startZenEditingAsync(): Promise<boolean>;
@@ -16,10 +18,12 @@ export interface IFWorkbookSheetsZenEditorMixin {
16
18
  * End the zen editing process
17
19
  * @async
18
20
  * @param {boolean} save - Whether to save the changes, default is true
19
- * @returns A promise that resolves to a boolean indicating whether the zen editing process was ended successfully.
21
+ * @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the zen editing process was ended successfully.
20
22
  * @example
21
23
  * ```ts
22
- * univerAPI.getActiveWorkbook().endZenEditingAsync(false);
24
+ * const fWorkbook = univerAPI.getActiveWorkbook();
25
+ * const success = await fWorkbook.endZenEditingAsync(false);
26
+ * console.log(success);
23
27
  * ```
24
28
  */
25
29
  endZenEditingAsync(save?: boolean): Promise<boolean>;
@@ -14,6 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  declare const locale: {
17
+ rightClick: {
18
+ zenEditor: string;
19
+ };
17
20
  shortcut: {
18
21
  sheet: {
19
22
  'zen-edit-cancel': string;
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("rxjs"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","react/jsx-runtime","react","rxjs","@univerjs/sheets"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverSheetsZenEditor={},c.UniverCore,c.UniverDocsUi,c.UniverEngineRender,c.UniverSheetsUi,c.UniverUi,c.React,c.React,c.rxjs,c.UniverSheets))})(this,function(c,o,g,A,_,l,h,E,B,y){"use strict";var he=Object.defineProperty;var Se=(c,o,g)=>o in c?he(c,o,{enumerable:!0,configurable:!0,writable:!0,value:g}):c[o]=g;var N=(c,o,g)=>Se(c,typeof o!="symbol"?o+"":o,g);var P;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var j;const t=e.get(l.IZenZoneService),i=e.get(g.IEditorService),n=e.get(_.IEditorBridgeService),r=e.get(o.IUniverInstanceService),a=e.get(l.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.open();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=n.getLatestEditCellState();if(d==null)return!1;const u=(j=d.documentLayoutObject.documentModel)==null?void 0:j.getSnapshot();if(u==null)return!1;r.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:I,drawings:p,drawingsOrder:v,tableSource:m,settings:O}=o.Tools.deepClone(u),T={...s.getDocumentData(),body:I,drawings:p,drawingsOrder:v,tableSource:m,settings:O},C=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(T,C),s.clearUndoRedoHistory(),!0}},z={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const t=e.get(l.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(l.ISidebarService);r.visible&&(r.close(),await o.delayAnimationFrame()),t.close();const a=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return a?(n.focusUnit(a.getUnitId()),i.refreshEditCellState(),!0):!1}},b={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var I;const t=e.get(l.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(g.IEditorService),a=e.get(l.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.close();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=e.get(A.IRenderManagerService),u=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(u){const p=u.getUnitId(),v=(I=d.getRenderById(p))==null?void 0:I.with(_.EditingRenderController);if(v){const m=o.Tools.deepClone(s.getDocumentData());m.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,v.submitCellData(new o.DocumentDataModel(m))}return n.focusUnit(u.getUnitId()),i.refreshEditCellState(),!0}return!1}},G="sheets-zen-editor.config",L={};var f=function(){return f=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)},X=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},w=E.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,a=e.extend,s=X(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),u=E.useRef("_".concat(ee()));return F(i,"".concat(n),{defIds:i.defIds,idSuffix:u.current},f({ref:t,className:d},s),a)});function F(e,t,i,n,r){return E.createElement(e.tag,f(f({key:t},J(e,i,r)),n),(Q(e,i).children||[]).map(function(a,s){return F(a,"".concat(t,"-").concat(e.tag,"-").concat(s),i,void 0,r)}))}function J(e,t,i){var n=f({},e.attrs);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(a){var s=a[0],d=a[1];s==="mask"&&typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var s=a[0],d=a[1];typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Q(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?f(f({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?f(f({},r),{attrs:f(f({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function ee(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var ne={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"}}]},$=E.forwardRef(function(e,t){return E.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ne}))});$.displayName="CheckMarkSingle";var te={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"}}]},V=E.forwardRef(function(e,t){return E.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:te}))});V.displayName="CloseSingle";function Y(e){var t,i,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(i=Y(e[t]))&&(n&&(n+=" "),n+=i)}else for(i in e)e[i]&&(n&&(n+=" "),n+=i);return n}function W(){for(var e,t,i=0,n="",r=arguments.length;i<r;i++)(e=arguments[i])&&(t=Y(e))&&(n&&(n+=" "),n+=t);return n}class ie{constructor(){N(this,"_position",null);N(this,"_position$",new B.BehaviorSubject(null));N(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const x=o.createIdentifier("univer.sheet-zen-editor-manager.service"),S={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},re="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",oe={id:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:o.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function se(){const e=E.useRef(null),t=l.useDependency(x),i=l.useDependency(g.IEditorService),n=l.useDependency(o.ICommandService);E.useEffect(()=>{const s=e.current;if(!s)return;const d=i.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:oe,scrollBar:!0,backScrollOffset:100},s),u=new ResizeObserver(()=>{t.setPosition(s.getBoundingClientRect())});return u.observe(s),()=>{d.dispose(),u.unobserve(s)}},[]);function r(){const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);s==null||s.blur(),n.executeCommand(z.id)}function a(){const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);s==null||s.blur(),n.executeCommand(b.id)}return h.jsxs("div",{className:S.zenEditor,children:[h.jsxs("div",{className:S.zenEditorIconWrapper,children:[h.jsx("span",{className:W(S.zenEditorIconContainer,S.zenEditorIconError),onClick:r,children:h.jsx(V,{style:{fontSize:"22px"}})}),h.jsx("span",{className:W(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:a,children:h.jsx($,{style:{fontSize:"22px"}})})]}),h.jsx("div",{className:S.zenEditorCanvasContainer,ref:e})]})}function ae(e){return{id:D.id,type:l.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:_.getCurrentExclusiveRangeInterest$(e),disabled$:_.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const ce={[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:ae}}}},de={id:b.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>K(e),binding:l.KeyCode.ENTER|l.MetaKeys.ALT},le={id:z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>K(e),binding:l.KeyCode.ESC};function K(e){return e.getContextValue(o.FOCUSING_DOC)&&e.getContextValue(o.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(o.EDITOR_ACTIVATED)&&!e.getContextValue(o.FOCUSING_EDITOR_STANDALONE)}var ue=Object.getOwnPropertyDescriptor,fe=(e,t,i,n)=>{for(var r=n>1?void 0:n?ue(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},R=(e,t)=>(i,n)=>t(i,n,e);let M=class extends o.Disposable{constructor(e,t,i,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=i,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(re,se))}_initCommands(){[D,z,b].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ce)}_initShortcuts(){[de,le].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};M=fe([R(0,l.IZenZoneService),R(1,o.ICommandService),R(2,l.IMenuManagerService),R(3,l.IShortcutService)],M);var ge=Object.getOwnPropertyDescriptor,ve=(e,t,i,n)=>{for(var r=n>1?void 0:n?ge(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},H=(e,t)=>(i,n)=>t(i,n,e);let Z=class extends o.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(B.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:i}=e,n=_.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,i),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:i,docBackground:n}=e,r=i==null?void 0:i.getParent(),{width:a,height:s,pageMarginLeft:d,pageMarginTop:u}=t;if(r==null||a===Number.POSITIVE_INFINITY||s===Number.POSITIVE_INFINITY)return;const{width:I,height:p}=r;let v=0;const m=u;let O=0,U=0,T=Number.POSITIVE_INFINITY;const{scaleX:C,scaleY:j}=i.getAncestorScale();I>(a+d*2)*C?(v=I/2-a*C/2,v/=C,O=(I-d*2)/C,T=0):(v=d,O=a+d*2,T=(O-I/C)/2),p>s?U=(p-u*2)/j:U=s+u*2,i.resize(O,U),t.translate(v,m),n.translate(v,m);const k=i.getViewport(g.VIEWPORT_KEY.VIEW_MAIN);if(T!==Number.POSITIVE_INFINITY&&k!=null){const _e=k.transScroll2ViewportScrollValue(T,0).x;k.scrollToBarPos({x:_e})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(g.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};Z=ve([H(0,x),H(1,A.IRenderManagerService)],Z);var Ee=Object.getOwnPropertyDescriptor,Ie=(e,t,i,n)=>{for(var r=n>1?void 0:n?Ee(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},q=(e,t)=>(i,n)=>t(i,n,e);c.UniverSheetsZenEditorPlugin=(P=class extends o.Plugin{constructor(t=L,i,n){super(),this._config=t,this._injector=i,this._configService=n;const{menu:r,...a}=o.merge({},L,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(G,a),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[M],[Z],[x,{useClass:ie}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(Z)}},N(P,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),N(P,"type",o.UniverInstanceType.UNIVER_SHEET),P),c.UniverSheetsZenEditorPlugin=Ie([q(1,o.Inject(o.Injector)),q(2,o.IConfigService)],c.UniverSheetsZenEditorPlugin),c.CancelZenEditCommand=z,c.ConfirmZenEditCommand=b,c.OpenZenEditorCommand=D,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs","@univerjs/sheets"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverSheetsZenEditor={},c.UniverCore,c.UniverDocsUi,c.UniverEngineRender,c.UniverSheetsUi,c.UniverUi,c.React,c.UniverDesign,c.React,c.rxjs,c.UniverSheets))})(this,function(c,o,g,A,_,l,S,L,E,D,y){"use strict";var _e=Object.defineProperty;var Se=(c,o,g)=>o in c?_e(c,o,{enumerable:!0,configurable:!0,writable:!0,value:g}):c[o]=g;var N=(c,o,g)=>Se(c,typeof o!="symbol"?o+"":o,g);var U;const z={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var w;const t=e.get(l.IZenZoneService),i=e.get(g.IEditorService),n=e.get(_.IEditorBridgeService),r=e.get(o.IUniverInstanceService),a=e.get(l.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.open();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=n.getLatestEditCellState();if(d==null)return!1;const u=(w=d.documentLayoutObject.documentModel)==null?void 0:w.getSnapshot();if(u==null)return!1;r.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:I,drawings:p,drawingsOrder:v,tableSource:m,settings:O}=o.Tools.deepClone(u),T={...s.getDocumentData(),body:I,drawings:p,drawingsOrder:v,tableSource:m,settings:O},C=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(T,C),s.clearUndoRedoHistory(),!0}},b={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const t=e.get(l.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(l.ISidebarService);r.visible&&(r.close(),await o.delayAnimationFrame()),t.close();const a=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return a?(n.focusUnit(a.getUnitId()),i.refreshEditCellState(),!0):!1}},M={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var I;const t=e.get(l.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(g.IEditorService),a=e.get(l.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.close();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=e.get(A.IRenderManagerService),u=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(u){const p=u.getUnitId(),v=(I=d.getRenderById(p))==null?void 0:I.with(_.EditingRenderController);if(v){const m=o.Tools.deepClone(s.getDocumentData());m.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,v.submitCellData(new o.DocumentDataModel(m))}return n.focusUnit(u.getUnitId()),i.refreshEditCellState(),!0}return!1}},H="sheets-zen-editor.config",F={};var f=function(){return f=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)},G=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},x=E.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,a=e.extend,s=G(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),u=E.useRef("_".concat(Q()));return $(i,"".concat(n),{defIds:i.defIds,idSuffix:u.current},f({ref:t,className:d},s),a)});function $(e,t,i,n,r){return E.createElement(e.tag,f(f({key:t},X(e,i,r)),n),(J(e,i).children||[]).map(function(a,s){return $(a,"".concat(t,"-").concat(e.tag,"-").concat(s),i,void 0,r)}))}function X(e,t,i){var n=f({},e.attrs);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(a){var s=a[0],d=a[1];s==="mask"&&typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var s=a[0],d=a[1];typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function J(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?f(f({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?f(f({},r),{attrs:f(f({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function Q(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";var ee={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"}}]},V=E.forwardRef(function(e,t){return E.createElement(x,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ee}))});V.displayName="CheckMarkSingle";var ne={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"}}]},Y=E.forwardRef(function(e,t){return E.createElement(x,Object.assign({},e,{id:"close-single",ref:t,icon:ne}))});Y.displayName="CloseSingle";class te{constructor(){N(this,"_position",null);N(this,"_position$",new D.BehaviorSubject(null));N(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const k=o.createIdentifier("univer.sheet-zen-editor-manager.service"),h={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},ie="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",re={id:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:o.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function oe(){const e=E.useRef(null),t=l.useDependency(k),i=l.useDependency(g.IEditorService),n=l.useDependency(o.ICommandService);E.useEffect(()=>{const s=e.current;if(!s)return;const d=i.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:re,scrollBar:!0,backScrollOffset:100},s),u=new ResizeObserver(()=>{t.setPosition(s.getBoundingClientRect())});return u.observe(s),()=>{d.dispose(),u.unobserve(s)}},[]);function r(){const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);s==null||s.blur(),n.executeCommand(b.id)}function a(){const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);s==null||s.blur(),n.executeCommand(M.id)}return S.jsxs("div",{className:h.zenEditor,children:[S.jsxs("div",{className:h.zenEditorIconWrapper,children:[S.jsx("span",{className:L.clsx(h.zenEditorIconContainer,h.zenEditorIconError),onClick:r,children:S.jsx(Y,{style:{fontSize:"22px"}})}),S.jsx("span",{className:L.clsx(h.zenEditorIconContainer,h.zenEditorIconSuccess),onClick:a,children:S.jsx(V,{style:{fontSize:"22px"}})})]}),S.jsx("div",{className:h.zenEditorCanvasContainer,ref:e})]})}function se(e){const t=e.get(_.IEditorBridgeService);return{id:z.id,type:l.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:_.getCurrentExclusiveRangeInterest$(e),disabled$:t.currentEditCell$.pipe(D.switchMap(i=>_.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]}).pipe(D.map(n=>{var r,a,s,d;return n||((d=(s=(a=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:a.customBlocks)==null?void 0:s.length)!=null?d:0)>0}))))}}const ae={[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[z.id]:{order:2,menuItemFactory:se}}}},ce={id:M.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>W(e),binding:l.KeyCode.ENTER|l.MetaKeys.ALT},de={id:b.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>W(e),binding:l.KeyCode.ESC};function W(e){return e.getContextValue(o.FOCUSING_DOC)&&e.getContextValue(o.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(o.EDITOR_ACTIVATED)&&!e.getContextValue(o.FOCUSING_EDITOR_STANDALONE)}var le=Object.getOwnPropertyDescriptor,ue=(e,t,i,n)=>{for(var r=n>1?void 0:n?le(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},R=(e,t)=>(i,n)=>t(i,n,e);let Z=class extends o.Disposable{constructor(e,t,i,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=i,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ie,oe))}_initCommands(){[z,b,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(ae)}_initShortcuts(){[ce,de].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};Z=ue([R(0,l.IZenZoneService),R(1,o.ICommandService),R(2,l.IMenuManagerService),R(3,l.IShortcutService)],Z);var fe=Object.getOwnPropertyDescriptor,ge=(e,t,i,n)=>{for(var r=n>1?void 0:n?fe(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},K=(e,t)=>(i,n)=>t(i,n,e);let P=class extends o.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(D.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:i}=e,n=_.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,i),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:i,docBackground:n}=e,r=i==null?void 0:i.getParent(),{width:a,height:s,pageMarginLeft:d,pageMarginTop:u}=t;if(r==null||a===Number.POSITIVE_INFINITY||s===Number.POSITIVE_INFINITY)return;const{width:I,height:p}=r;let v=0;const m=u;let O=0,j=0,T=Number.POSITIVE_INFINITY;const{scaleX:C,scaleY:w}=i.getAncestorScale();I>(a+d*2)*C?(v=I/2-a*C/2,v/=C,O=(I-d*2)/C,T=0):(v=d,O=a+d*2,T=(O-I/C)/2),p>s?j=(p-u*2)/w:j=s+u*2,i.resize(O,j),t.translate(v,m),n.translate(v,m);const B=i.getViewport(g.VIEWPORT_KEY.VIEW_MAIN);if(T!==Number.POSITIVE_INFINITY&&B!=null){const Ie=B.transScroll2ViewportScrollValue(T,0).x;B.scrollToBarPos({x:Ie})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(g.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};P=ge([K(0,k),K(1,A.IRenderManagerService)],P);var ve=Object.getOwnPropertyDescriptor,Ee=(e,t,i,n)=>{for(var r=n>1?void 0:n?ve(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r},q=(e,t)=>(i,n)=>t(i,n,e);c.UniverSheetsZenEditorPlugin=(U=class extends o.Plugin{constructor(t=F,i,n){super(),this._config=t,this._injector=i,this._configService=n;const{menu:r,...a}=o.merge({},F,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(H,a),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[Z],[P],[k,{useClass:te}]].forEach(n=>t.add(n))}onReady(){this._injector.get(Z)}onSteady(){this._injector.get(P)}},N(U,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),N(U,"type",o.UniverInstanceType.UNIVER_SHEET),U),c.UniverSheetsZenEditorPlugin=Ee([q(1,o.Inject(o.Injector)),q(2,o.IConfigService)],c.UniverSheetsZenEditorPlugin),c.CancelZenEditCommand=b,c.ConfirmZenEditCommand=M,c.OpenZenEditorCommand=z,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorEnUS=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorEnUS=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"Full Screen Editor"},shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFaIR=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFaIR=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"ویرایشگر تمام صفحه"},shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFrFR=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFrFR=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"Éditeur plein écran"},shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorRuRU=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorRuRU=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"Редактор на весь экран"},shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorViVN=n())})(this,function(){"use strict";return{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)"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorViVN=n())})(this,function(){"use strict";return{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)"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhCN=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhCN=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"禅模式编辑"},shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}}});
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhTW=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}}});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhTW=n())})(this,function(){"use strict";return{rightClick:{zenEditor:"禪模式編輯"},shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.6.1",
3
+ "version": "0.6.2-nightly.202503031606",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -60,14 +60,14 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@univerjs/icons": "^0.2.20",
63
- "clsx": "^2.1.1",
64
- "@univerjs/docs": "0.6.1",
65
- "@univerjs/docs-ui": "0.6.1",
66
- "@univerjs/core": "0.6.1",
67
- "@univerjs/sheets": "0.6.1",
68
- "@univerjs/engine-render": "0.6.1",
69
- "@univerjs/sheets-ui": "0.6.1",
70
- "@univerjs/ui": "0.6.1"
63
+ "@univerjs/design": "0.6.2-nightly.202503031606",
64
+ "@univerjs/core": "0.6.2-nightly.202503031606",
65
+ "@univerjs/docs": "0.6.2-nightly.202503031606",
66
+ "@univerjs/engine-render": "0.6.2-nightly.202503031606",
67
+ "@univerjs/docs-ui": "0.6.2-nightly.202503031606",
68
+ "@univerjs/sheets": "0.6.2-nightly.202503031606",
69
+ "@univerjs/ui": "0.6.2-nightly.202503031606",
70
+ "@univerjs/sheets-ui": "0.6.2-nightly.202503031606"
71
71
  },
72
72
  "devDependencies": {
73
73
  "less": "^4.2.2",
@@ -75,10 +75,10 @@
75
75
  "react": "18.3.1",
76
76
  "rxjs": "^7.8.1",
77
77
  "tailwindcss": "^3.4.17",
78
- "typescript": "^5.7.3",
79
- "vite": "^6.1.1",
80
- "vitest": "^3.0.6",
81
- "@univerjs-infra/shared": "0.6.1"
78
+ "typescript": "^5.8.2",
79
+ "vite": "^6.2.0",
80
+ "vitest": "^3.0.7",
81
+ "@univerjs-infra/shared": "0.6.2"
82
82
  },
83
83
  "scripts": {
84
84
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS