@univerjs/sheets-zen-editor 0.6.0 → 0.6.1

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"),a=require("@univerjs/ui"),E=require("react/jsx-runtime"),_=require("react"),V=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(a.IZenZoneService),r=e.get(N.IEditorService),t=e.get(S.IEditorBridgeService),i=e.get(s.IUniverInstanceService),c=e.get(a.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 d=t.getLatestEditCellState();if(d==null)return!1;const l=(D=d.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:I,settings:C}=s.Tools.deepClone(l),p={...o.getDocumentData(),body:f,drawings:m,drawingsOrder:g,tableSource:I,settings:C},h=[{startOffset:0,endOffset:0,collapsed:!0}];return o.focus(),o.setDocumentData(p,h),o.clearUndoRedoHistory(),!0}},Z={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const n=e.get(a.IZenZoneService),r=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),i=e.get(a.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(a.IZenZoneService),r=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),i=e.get(N.IEditorService),c=e.get(a.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 d=e.get(F.IRenderManagerService),l=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(l){const m=l.getUnitId(),g=(f=d.getRenderById(m))==null?void 0:f.with(S.EditingRenderController);if(g){const I=s.Tools.deepClone(o.getDocumentData());I.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,g.submitCellData(new s.DocumentDataModel(I))}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"]),d="univerjs-icon univerjs-icon-".concat(t," ").concat(i||"").trim(),l=_.useRef("_".concat(ne()));return $(r,"".concat(t),{defIds:r.defIds,idSuffix:l.current},u({ref:n,className:d},o),c)});function $(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 $(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);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],d=c[1];typeof d=="string"&&(t[o]=d.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 V.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 Ie(){const e=_.useRef(null),n=a.useDependency(j),r=a.useDependency(N.IEditorService),t=a.useDependency(s.ICommandService);_.useEffect(()=>{const o=e.current;if(!o)return;const d=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),()=>{d.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 he(e){return{id:U.id,type:a.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={[a.ContextMenuPosition.MAIN_AREA]:{[a.ContextMenuGroup.OTHERS]:{[U.id]:{order:2,menuItemFactory:he}}}},ve={id:P.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>H(e),binding:a.KeyCode.ENTER|a.MetaKeys.ALT},Se={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>H(e),binding:a.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,Ie))}_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,a.IZenZoneService),b(1,s.ICommandService),b(2,a.IMenuManagerService),b(3,a.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(V.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:d,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 I=l;let C=0,y=0,p=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:D}=r.getAncestorScale();f>(c+d*2)*h?(g=f/2-c*h/2,g/=h,C=(f-d*2)/h,p=0):(g=d,C=c+d*2,p=(C-f/h)/2),m>o?y=(m-l*2)/D:y=o+l*2,r.resize(C,y),n.translate(g,I),t.translate(g,I);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 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;
package/lib/es/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  var ae = Object.defineProperty;
2
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 S = (e, n, r) => le(e, typeof n != "symbol" ? n + "" : n, r);
4
- import { CommandType as D, IUniverInstanceService as P, delayAnimationFrame as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as X, UniverInstanceType as w, DocumentFlavor as q, DocumentDataModel as de, createIdentifier as ue, ICommandService as J, DEFAULT_EMPTY_DOCUMENT_VALUE as ge, FOCUSING_DOC as fe, FOCUSING_UNIVER_EDITOR as he, EDITOR_ACTIVATED as me, FOCUSING_EDITOR_STANDALONE as ve, Disposable as pe, RxDisposable as Ee, Plugin as Se, merge as _e, Inject as Ie, Injector as Ce, IConfigService as Oe } from "@univerjs/core";
5
- import { IEditorService as x, VIEWPORT_KEY as ye, DocBackScrollRenderController as Ne } from "@univerjs/docs-ui";
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";
6
6
  import { IRenderManagerService as Q } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as U, EditingRenderController as Te, getCurrentRangeDisable$ as be, getCurrentExclusiveRangeInterest$ as ze, getEditorObject as Me } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as b, ISidebarService as Z, useDependency as M, MenuItemType as De, ContextMenuPosition as Pe, ContextMenuGroup as Re, KeyCode as ee, MetaKeys as we, IMenuManagerService as xe, IShortcutService as Ue } from "@univerjs/ui";
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";
9
9
  import { jsxs as F, jsx as _ } from "react/jsx-runtime";
10
- import { forwardRef as k, useRef as te, createElement as j, useEffect as Ze } from "react";
11
- import { BehaviorSubject as ke, takeUntil as je } from "rxjs";
12
- import { RangeProtectionPermissionEditPoint as Ae, WorksheetEditPermission as Be, WorksheetSetCellValuePermission as Le, WorksheetSetCellStylePermission as Ve, WorkbookEditablePermission as $e } from "@univerjs/sheets";
10
+ 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
13
  const A = {
14
14
  id: "zen-editor.command.open-zen-editor",
15
15
  type: D.COMMAND,
16
16
  handler: async (e) => {
17
17
  var C;
18
- const n = e.get(b), r = e.get(x), t = e.get(U), i = e.get(P), s = e.get(Z);
19
- s.visible && (s.close(), await R()), n.open();
20
- const o = r.getEditor(g);
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);
21
21
  if (o == null)
22
22
  return !1;
23
23
  const c = t.getLatestEditCellState();
@@ -26,13 +26,13 @@ const A = {
26
26
  const a = (C = c.documentLayoutObject.documentModel) == null ? void 0 : C.getSnapshot();
27
27
  if (a == null)
28
28
  return !1;
29
- i.focusUnit(g);
30
- const { body: u, drawings: v, drawingsOrder: d, tableSource: f, settings: p } = X.deepClone(a), E = {
29
+ i.focusUnit(f);
30
+ const { body: u, drawings: v, drawingsOrder: d, tableSource: g, settings: p } = X.deepClone(a), S = {
31
31
  ...o.getDocumentData(),
32
32
  body: u,
33
33
  drawings: v,
34
34
  drawingsOrder: d,
35
- tableSource: f,
35
+ tableSource: g,
36
36
  settings: p
37
37
  }, h = [
38
38
  {
@@ -41,15 +41,15 @@ const A = {
41
41
  collapsed: !0
42
42
  }
43
43
  ];
44
- return o.focus(), o.setDocumentData(E, h), o.clearUndoRedoHistory(), !0;
44
+ return o.focus(), o.setDocumentData(S, h), o.clearUndoRedoHistory(), !0;
45
45
  }
46
46
  }, B = {
47
47
  id: "zen-editor.command.cancel-zen-edit",
48
48
  type: D.COMMAND,
49
49
  handler: async (e) => {
50
- const n = e.get(b), r = e.get(U), t = e.get(P), i = e.get(Z);
51
- i.visible && (i.close(), await R()), n.close();
52
- const s = t.getCurrentUnitForType(w.UNIVER_SHEET);
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
53
  return s ? (t.focusUnit(s.getUnitId()), r.refreshEditCellState(), !0) : !1;
54
54
  }
55
55
  }, L = {
@@ -57,17 +57,17 @@ const A = {
57
57
  type: D.COMMAND,
58
58
  handler: async (e) => {
59
59
  var u;
60
- const n = e.get(b), r = e.get(U), t = e.get(P), i = e.get(x), s = e.get(Z);
61
- s.visible && (s.close(), await R()), n.close();
62
- const o = i.getEditor(g);
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);
63
63
  if (o == null)
64
64
  return !1;
65
- const c = e.get(Q), a = t.getCurrentUnitForType(w.UNIVER_SHEET);
65
+ const c = e.get(Q), a = t.getCurrentUnitForType(x.UNIVER_SHEET);
66
66
  if (a) {
67
- const v = a.getUnitId(), d = (u = c.getRenderById(v)) == null ? void 0 : u.with(Te);
67
+ const v = a.getUnitId(), d = (u = c.getRenderById(v)) == null ? void 0 : u.with(be);
68
68
  if (d) {
69
- const f = X.deepClone(o.getDocumentData());
70
- f.documentStyle.documentFlavor = q.UNSPECIFIED, d.submitCellData(new de(f));
69
+ const g = X.deepClone(o.getDocumentData());
70
+ g.documentStyle.documentFlavor = q.UNSPECIFIED, d.submitCellData(new de(g));
71
71
  }
72
72
  return t.focusUnit(a.getUnitId()), r.refreshEditCellState(), !0;
73
73
  }
@@ -89,7 +89,7 @@ var l = function() {
89
89
  for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
90
90
  n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (r[t[i]] = e[t[i]]);
91
91
  return r;
92
- }, V = k(function(e, n) {
92
+ }, $ = Z(function(e, n) {
93
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
94
  return ne(r, "".concat(t), { defIds: r.defIds, idSuffix: a.current }, l({ ref: n, className: c }, o), s);
95
95
  });
@@ -100,7 +100,10 @@ function ne(e, n, r, t, i) {
100
100
  }
101
101
  function He(e, n, r) {
102
102
  var t = l({}, e.attrs);
103
- r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1);
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) {
104
+ var o = s[0], c = s[1];
105
+ o === "mask" && typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
106
+ });
104
107
  var i = n.defIds;
105
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) {
106
109
  var o = s[0], c = s[1];
@@ -116,17 +119,17 @@ function Ye(e, n) {
116
119
  function Ge() {
117
120
  return Math.random().toString(36).substring(2, 8);
118
121
  }
119
- V.displayName = "UniverIcon";
120
- 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 = k(function(e, n) {
121
- return j(V, Object.assign({}, e, {
122
+ $.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
+ return j($, Object.assign({}, e, {
122
125
  id: "check-mark-single",
123
126
  ref: n,
124
127
  icon: Ke
125
128
  }));
126
129
  });
127
130
  re.displayName = "CheckMarkSingle";
128
- 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 = k(function(e, n) {
129
- return j(V, Object.assign({}, e, {
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) {
132
+ return j($, Object.assign({}, e, {
130
133
  id: "close-single",
131
134
  ref: n,
132
135
  icon: Xe
@@ -148,9 +151,9 @@ function H() {
148
151
  }
149
152
  class qe {
150
153
  constructor() {
151
- S(this, "_position", null);
152
- S(this, "_position$", new ke(null));
153
- S(this, "position$", this._position$.asObservable());
154
+ E(this, "_position", null);
155
+ E(this, "_position$", new Ze(null));
156
+ E(this, "position$", this._position$.asObservable());
154
157
  }
155
158
  dispose() {
156
159
  this._position$.complete(), this._position = null;
@@ -165,7 +168,7 @@ class qe {
165
168
  this._position$.next(n);
166
169
  }
167
170
  }
168
- const $ = ue(
171
+ const V = ue(
169
172
  "univer.sheet-zen-editor-manager.service"
170
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 = {
171
174
  zenEditor: Je,
@@ -175,9 +178,9 @@ const $ = ue(
175
178
  zenEditorIconError: nt,
176
179
  zenEditorCanvasContainer: rt
177
180
  }, it = "ZEN_EDITOR_PLUGIN_", ot = `${it}ZEN_EDITOR_COMPONENT`, st = {
178
- id: g,
181
+ id: f,
179
182
  body: {
180
- dataStream: `${ge}`,
183
+ dataStream: `${fe}`,
181
184
  textRuns: [],
182
185
  tables: [],
183
186
  customBlocks: [],
@@ -210,14 +213,14 @@ const $ = ue(
210
213
  drawingsOrder: []
211
214
  };
212
215
  function ct() {
213
- const e = te(null), n = M($), r = M(x), t = M(J);
214
- Ze(() => {
216
+ const e = te(null), n = M(V), r = M(w), t = M(J);
217
+ ke(() => {
215
218
  const o = e.current;
216
219
  if (!o)
217
220
  return;
218
221
  const c = r.register(
219
222
  {
220
- editorUnitId: g,
223
+ editorUnitId: f,
221
224
  initialSnapshot: st,
222
225
  scrollBar: !0,
223
226
  backScrollOffset: 100
@@ -231,11 +234,11 @@ function ct() {
231
234
  };
232
235
  }, []);
233
236
  function i() {
234
- const o = r.getEditor(g);
237
+ const o = r.getEditor(f);
235
238
  o == null || o.blur(), t.executeCommand(B.id);
236
239
  }
237
240
  function s() {
238
- const o = r.getEditor(g);
241
+ const o = r.getEditor(f);
239
242
  o == null || o.blur(), t.executeCommand(L.id);
240
243
  }
241
244
  return /* @__PURE__ */ F("div", { className: m.zenEditor, children: [
@@ -267,12 +270,12 @@ function at(e) {
267
270
  title: "rightClick.zenEditor",
268
271
  icon: "AmplifySingle",
269
272
  hidden$: ze(e),
270
- disabled$: be(e, { workbookTypes: [$e], worksheetTypes: [Be, Le, Ve], rangeTypes: [Ae] })
273
+ disabled$: Te(e, { workbookTypes: [Ve], worksheetTypes: [Be, Le, $e], rangeTypes: [Ae] })
271
274
  };
272
275
  }
273
276
  const lt = {
274
- [Pe.MAIN_AREA]: {
275
- [Re.OTHERS]: {
277
+ [Re.MAIN_AREA]: {
278
+ [Pe.OTHERS]: {
276
279
  [A.id]: {
277
280
  order: 2,
278
281
  menuItemFactory: at
@@ -284,7 +287,7 @@ const lt = {
284
287
  description: "shortcut.sheet.zen-edit-confirm",
285
288
  group: "4_sheet-edit",
286
289
  preconditions: (e) => se(e),
287
- binding: ee.ENTER | we.ALT
290
+ binding: ee.ENTER | xe.ALT
288
291
  }, ut = {
289
292
  id: B.id,
290
293
  description: "shortcut.sheet.zen-edit-cancel",
@@ -293,10 +296,10 @@ const lt = {
293
296
  binding: ee.ESC
294
297
  };
295
298
  function se(e) {
296
- return e.getContextValue(fe) && e.getContextValue(he) && e.getContextValue(me) && !e.getContextValue(ve);
299
+ return e.getContextValue(ge) && e.getContextValue(he) && e.getContextValue(me) && !e.getContextValue(ve);
297
300
  }
298
- var gt = Object.getOwnPropertyDescriptor, ft = (e, n, r, t) => {
299
- for (var i = t > 1 ? void 0 : t ? gt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
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--)
300
303
  (o = e[s]) && (i = o(i) || i);
301
304
  return i;
302
305
  }, O = (e, n) => (r, t) => n(r, t, e);
@@ -324,10 +327,10 @@ let N = class extends pe {
324
327
  });
325
328
  }
326
329
  };
327
- N = ft([
328
- O(0, b),
330
+ N = gt([
331
+ O(0, T),
329
332
  O(1, J),
330
- O(2, xe),
333
+ O(2, we),
331
334
  O(3, Ue)
332
335
  ], N);
333
336
  var ht = Object.getOwnPropertyDescriptor, mt = (e, n, r, t) => {
@@ -335,7 +338,7 @@ var ht = Object.getOwnPropertyDescriptor, mt = (e, n, r, t) => {
335
338
  (o = e[s]) && (i = o(i) || i);
336
339
  return i;
337
340
  }, Y = (e, n) => (r, t) => n(r, t, e);
338
- let T = class extends Ee {
341
+ let b = class extends Se {
339
342
  constructor(e, n) {
340
343
  super(), this._zenEditorManagerService = e, this._renderManagerService = n, this._initialize();
341
344
  }
@@ -347,7 +350,7 @@ let T = class extends Ee {
347
350
  this._zenEditorManagerService.position$.pipe(je(this.dispose$)).subscribe((e) => {
348
351
  if (e == null)
349
352
  return;
350
- const { width: n, height: r } = e, t = Me(g, this._renderManagerService);
353
+ const { width: n, height: r } = e, t = Me(f, this._renderManagerService);
351
354
  t != null && requestIdleCallback(() => {
352
355
  t.engine.resizeBySize(n, r), this._calculatePagePosition(t), this._scrollToTop();
353
356
  });
@@ -359,13 +362,13 @@ let T = class extends Ee {
359
362
  return;
360
363
  const { width: u, height: v } = i;
361
364
  let d = 0;
362
- const f = a;
363
- let p = 0, I = 0, E = Number.POSITIVE_INFINITY;
365
+ const g = a;
366
+ let p = 0, I = 0, S = Number.POSITIVE_INFINITY;
364
367
  const { scaleX: h, scaleY: C } = r.getAncestorScale();
365
- u > (s + c * 2) * h ? (d = u / 2 - s * h / 2, d /= h, p = (u - c * 2) / h, E = 0) : (d = c, p = s + c * 2, E = (p - u / h) / 2), v > o ? I = (v - a * 2) / C : I = o + a * 2, r.resize(p, I), n.translate(d, f), t.translate(d, f);
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);
366
369
  const z = r.getViewport(ye.VIEW_MAIN);
367
- if (E !== Number.POSITIVE_INFINITY && z != null) {
368
- const ce = z.transScroll2ViewportScrollValue(E, 0).x;
370
+ if (S !== Number.POSITIVE_INFINITY && z != null) {
371
+ const ce = z.transScroll2ViewportScrollValue(S, 0).x;
369
372
  z.scrollToBarPos({
370
373
  x: ce
371
374
  });
@@ -374,23 +377,23 @@ let T = class extends Ee {
374
377
  }
375
378
  _scrollToTop() {
376
379
  var r;
377
- const e = (r = this._renderManagerService.getRenderById(g)) == null ? void 0 : r.with(Ne), n = {
380
+ const e = (r = this._renderManagerService.getRenderById(f)) == null ? void 0 : r.with(Ne), n = {
378
381
  startOffset: 0,
379
382
  endOffset: 0
380
383
  };
381
384
  e && e.scrollToRange(n);
382
385
  }
383
386
  };
384
- T = mt([
385
- Y(0, $),
387
+ b = mt([
388
+ Y(0, V),
386
389
  Y(1, Q)
387
- ], T);
390
+ ], b);
388
391
  var vt = Object.getOwnPropertyDescriptor, pt = (e, n, r, t) => {
389
392
  for (var i = t > 1 ? void 0 : t ? vt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
390
393
  (o = e[s]) && (i = o(i) || i);
391
394
  return i;
392
395
  }, G = (e, n) => (r, t) => n(r, t, e), y;
393
- let K = (y = class extends Se {
396
+ let K = (y = class extends Ee {
394
397
  constructor(e = W, n, r) {
395
398
  super(), this._config = e, this._injector = n, this._configService = r;
396
399
  const { menu: t, ...i } = _e(
@@ -403,17 +406,17 @@ let K = (y = class extends Se {
403
406
  _initializeDependencies(e) {
404
407
  [
405
408
  [N],
406
- [T],
407
- [$, { useClass: qe }]
409
+ [b],
410
+ [V, { useClass: qe }]
408
411
  ].forEach((r) => e.add(r));
409
412
  }
410
413
  onReady() {
411
414
  this._injector.get(N);
412
415
  }
413
416
  onSteady() {
414
- this._injector.get(T);
417
+ this._injector.get(b);
415
418
  }
416
- }, S(y, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), S(y, "type", w.UNIVER_SHEET), y);
419
+ }, E(y, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), E(y, "type", x.UNIVER_SHEET), y);
417
420
  K = pt([
418
421
  G(1, Ie(Ce)),
419
422
  G(2, Oe)
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,_,d,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 Z;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var j;const t=e.get(d.IZenZoneService),i=e.get(g.IEditorService),n=e.get(_.IEditorBridgeService),r=e.get(o.IUniverInstanceService),a=e.get(d.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 l=n.getLatestEditCellState();if(l==null)return!1;const u=(j=l.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(d.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(d.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(d.IZenZoneService),i=e.get(_.IEditorBridgeService),n=e.get(o.IUniverInstanceService),r=e.get(g.IEditorService),a=e.get(d.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 l=e.get(A.IRenderManagerService),u=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(u){const p=u.getUnitId(),v=(I=l.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"]),l="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:l},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);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],l=a[1];typeof l=="string"&&(n[s]=l.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"}}]},V=E.forwardRef(function(e,t){return E.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ne}))});V.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"}}]},$=E.forwardRef(function(e,t){return E.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:te}))});$.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=d.useDependency(x),i=d.useDependency(g.IEditorService),n=d.useDependency(o.ICommandService);E.useEffect(()=>{const s=e.current;if(!s)return;const l=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),()=>{l.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($,{style:{fontSize:"22px"}})}),h.jsx("span",{className:W(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:a,children:h.jsx(V,{style:{fontSize:"22px"}})})]}),h.jsx("div",{className:S.zenEditorCanvasContainer,ref:e})]})}function ae(e){return{id:D.id,type:d.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={[d.ContextMenuPosition.MAIN_AREA]:{[d.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:d.KeyCode.ENTER|d.MetaKeys.ALT},le={id:z.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(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,d.IZenZoneService),R(1,o.ICommandService),R(2,d.IMenuManagerService),R(3,d.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 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(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:l,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+l*2)*C?(v=I/2-a*C/2,v/=C,O=(I-l*2)/C,T=0):(v=l,O=a+l*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)}};P=ve([H(0,x),H(1,A.IRenderManagerService)],P);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=(Z=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],[P],[x,{useClass:ie}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(P)}},N(Z,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),N(Z,"type",o.UniverInstanceType.UNIVER_SHEET),Z),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("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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -59,26 +59,26 @@
59
59
  "rxjs": ">=7.0.0"
60
60
  },
61
61
  "dependencies": {
62
- "@univerjs/icons": "^0.2.15",
62
+ "@univerjs/icons": "^0.2.20",
63
63
  "clsx": "^2.1.1",
64
- "@univerjs/core": "0.6.0",
65
- "@univerjs/docs-ui": "0.6.0",
66
- "@univerjs/docs": "0.6.0",
67
- "@univerjs/engine-render": "0.6.0",
68
- "@univerjs/sheets": "0.6.0",
69
- "@univerjs/sheets-ui": "0.6.0",
70
- "@univerjs/ui": "0.6.0"
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"
71
71
  },
72
72
  "devDependencies": {
73
73
  "less": "^4.2.2",
74
- "postcss": "^8.5.2",
74
+ "postcss": "^8.5.3",
75
75
  "react": "18.3.1",
76
76
  "rxjs": "^7.8.1",
77
77
  "tailwindcss": "^3.4.17",
78
78
  "typescript": "^5.7.3",
79
- "vite": "^6.1.0",
80
- "vitest": "^3.0.5",
81
- "@univerjs-infra/shared": "0.6.0"
79
+ "vite": "^6.1.1",
80
+ "vitest": "^3.0.6",
81
+ "@univerjs-infra/shared": "0.6.1"
82
82
  },
83
83
  "scripts": {
84
84
  "test": "vitest run",