@univerjs/sheets-zen-editor 0.2.3 → 0.2.4

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,4 +1,4 @@
1
- "use strict";var te=Object.defineProperty;var ne=(n,e,i)=>e in n?te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var O=(n,e,i)=>ne(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),m=require("@wendellhu/redi"),b=require("@univerjs/docs"),M=require("@univerjs/engine-render"),U=require("@univerjs/sheets-ui"),_=require("@univerjs/ui"),q=require("rxjs"),z=require("@univerjs/sheets"),S=require("react"),V=require("@wendellhu/redi/react-bindings"),F=require("clsx"),w={id:"zen-editor.operation.open-zen-editor",type:a.CommandType.OPERATION,handler:n=>!0};class ie{constructor(){O(this,"_position",null);O(this,"_position$",new q.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}}const k=m.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,oe=(n,e,i,t)=>{for(var r=t>1?void 0:t?se(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&re(e,i,r),r},I=(n,e)=>(i,t)=>e(i,t,n);const f="__defaultDocumentZenEditorSpecialUnitId_20231218__";let j=class extends a.RxDisposable{constructor(e,i,t,r,o,s,c,d,l){super();O(this,"_zenEditorInitialState",!1);this._injector=e,this._univerInstanceService=i,this._zenEditorManagerService=t,this._renderManagerService=r,this._commandService=o,this._zenZoneService=s,this._editorBridgeService=c,this._undoRedoService=d,this._textSelectionManagerService=l,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const e={id:f,body:{dataStream:`${a.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],customBlocks:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:a.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};return this._univerInstanceService.createUnit(a.UniverInstanceType.UNIVER_DOC,e)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(q.takeUntil(this.dispose$)).subscribe(e=>{var d;if(e==null)return;const i=U.getEditorObject(f,this._renderManagerService),t=this._univerInstanceService.getUniverDocInstance(f);if(i==null||t==null)return;const{width:r,height:o}=e,{engine:s}=i,c=(d=this._renderManagerService.getRenderById(f))==null?void 0:d.with(b.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),c&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(f),this._univerInstanceService.focusUnit(f),this._univerInstanceService.setCurrentUnitForType(f),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:M.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const t=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(t)}_editorSyncHandler(e){var s,c;const i=(s=e.documentLayoutObject.documentModel)==null?void 0:s.getBody(),t=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];t==null||r==null||((c=i==null?void 0:i.textRuns)!=null&&c.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(f,t,r,o))}_syncContentAndRender(e,i,t,r=[],o=[],s={},c=[]){var C;const d=[f,a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],l=(C=this._renderManagerService.getRenderById(e))==null?void 0:C.with(b.DocSkeletonManagerService),u=l==null?void 0:l.getSkeleton(),h=this._univerInstanceService.getUniverDocInstance(e),p=l==null?void 0:l.getViewModel();if(h==null||p==null||u==null)return;const v=h.getBody(),E=h.getSnapshot();v.dataStream=i,v.paragraphs=t,v.customBlocks=o,E.drawings=s,E.drawingsOrder=c,e===a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(v.textRuns=[]),r.length>0&&(v.textRuns=r),p.reset(h);const R=this._getDocObject();R!=null&&(u.calculate(),d.includes(e)&&R.document.makeDirty())}_calculatePagePosition(e){const{document:i,scene:t,docBackground:r}=e,o=t==null?void 0:t.getParent(),{width:s,height:c,pageMarginLeft:d,pageMarginTop:l}=i;if(o==null||s===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:u,height:h}=o;let p=0,v=0,E=0,R=0,C=Number.POSITIVE_INFINITY;const{scaleX:N,scaleY:Q}=t.getAncestorScale();u>(s+d*2)*N?(p=u/2-s*N/2,p/=N,E=(u-d*2)/N,C=0):(p=d,E=s+d*2,C=(E-u/N)/2),h>c?(v=h/2-c/2,R=(h-l*2)/Q):(v=l,R=c+l*2),t.resize(E,R+200),i.translate(p,v),r.translate(p,v);const B=t.getViewport(b.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&B!=null){const ee=B.transScroll2ViewportScrollValue(C,0).x;B.scrollTo({x:ee})}return this}_commandExecutedListener(){const e=[w.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{e.includes(t.id)&&this._handleOpenZenEditor()}));const i=[b.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)){const r=t.params,{unitId:o}=r;if(o===f){const s=this._univerInstanceService.getUniverDocInstance(o),c=s==null?void 0:s.getBody(),d=c==null?void 0:c.dataStream,l=c==null?void 0:c.paragraphs,u=c==null?void 0:c.textRuns,h=c==null?void 0:c.customBlocks,p=s==null?void 0:s.getDrawings(),v=s==null?void 0:s.getDrawingsOrder();if(this._editorBridgeService.changeEditorDirty(!0),d==null||l==null)return;this._syncContentAndRender(a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,d,l,u,h,p,v)}}}))}_getDocObject(){return b.getDocObject(this._univerInstanceService,this._renderManagerService)}};j=oe([a.OnLifecycle(a.LifecycleStages.Steady,j),I(0,m.Inject(m.Injector)),I(1,a.IUniverInstanceService),I(2,k),I(3,M.IRenderManagerService),I(4,a.ICommandService),I(5,_.IZenZoneService),I(6,U.IEditorBridgeService),I(7,a.IUndoRedoService),I(8,m.Inject(b.TextSelectionManagerService))],j);const Z={id:"zen-editor.command.cancel-zen-edit",type:a.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(U.IEditorBridgeService),t=n.get(a.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC}),e.close();const o=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},L={id:"zen-editor.command.confirm-zen-edit",type:a.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(U.IEditorBridgeService),t=n.get(a.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.PointerDown}),e.close();const o=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function ce(n){return{id:w.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:U.getCurrentRangeDisable$(n,{workbookTypes:[z.WorkbookEditablePermission],worksheetTypes:[z.WorksheetEditPermission,z.WorksheetSetCellValuePermission,z.WorksheetSetCellStylePermission],rangeTypes:[z.RangeProtectionPermissionEditPoint]})}}var Y={exports:{}},A={};/**
1
+ "use strict";var te=Object.defineProperty;var ne=(n,e,i)=>e in n?te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var O=(n,e,i)=>ne(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),R=require("@wendellhu/redi"),N=require("@univerjs/docs"),M=require("@univerjs/engine-render"),D=require("@univerjs/sheets-ui"),_=require("@univerjs/ui"),q=require("rxjs"),z=require("@univerjs/sheets"),S=require("react"),B=require("@wendellhu/redi/react-bindings"),F=require("clsx"),w={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:n=>!0};class ie{constructor(){O(this,"_position",null);O(this,"_position$",new q.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(e){this._position=e,this._refresh(e)}getPosition(){return this._position}_refresh(e){this._position$.next(e)}}const k=R.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,oe=(n,e,i,t)=>{for(var r=t>1?void 0:t?se(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&re(e,i,r),r},E=(n,e)=>(i,t)=>e(i,t,n);const f="__defaultDocumentZenEditorSpecialUnitId_20231218__";let j=class extends c.RxDisposable{constructor(e,i,t,r,o,s,a,d){super();O(this,"_zenEditorInitialState",!1);this._univerInstanceService=e,this._zenEditorManagerService=i,this._renderManagerService=t,this._commandService=r,this._zenZoneService=o,this._editorBridgeService=s,this._undoRedoService=a,this._textSelectionManagerService=d,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const e={id:f,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],customBlocks:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:c.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,e)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(q.takeUntil(this.dispose$)).subscribe(e=>{var d;if(e==null)return;const i=D.getEditorObject(f,this._renderManagerService),t=this._univerInstanceService.getUniverDocInstance(f);if(i==null||t==null)return;const{width:r,height:o}=e,{engine:s}=i,a=(d=this._renderManagerService.getRenderById(f))==null?void 0:d.with(N.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){var o;this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open();const e=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);this._undoRedoService.clearUndoRedo(f),this._univerInstanceService.focusUnit(f),this._univerInstanceService.setCurrentUnitForType(f),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:M.DeviceInputEventType.PointerDown,unitId:(o=e==null?void 0:e.getUnitId())!=null?o:""});const t=this._editorBridgeService.getLatestEditCellState();if(t==null)return;this._editorSyncHandler(t);const r=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(r)}_editorSyncHandler(e){var s,a;const i=(s=e.documentLayoutObject.documentModel)==null?void 0:s.getBody(),t=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];t==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(f,t,r,o))}_syncContentAndRender(e,i,t,r=[],o=[],s={},a=[],d=[]){var m;const h=[f,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],l=(m=this._renderManagerService.getRenderById(e))==null?void 0:m.with(N.DocSkeletonManagerService),p=l==null?void 0:l.getSkeleton(),v=this._univerInstanceService.getUniverDocInstance(e),I=l==null?void 0:l.getViewModel();if(v==null||I==null||p==null)return;const u=v.getBody(),b=v.getSnapshot();u.dataStream=i,u.paragraphs=t,u.customBlocks=o,u.customRanges=d,b.drawings=s,b.drawingsOrder=a,e===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(u.textRuns=[]),r.length>0&&(u.textRuns=r),I.reset(v);const C=this._getDocObject();C!=null&&(p.calculate(),h.includes(e)&&C.document.makeDirty())}_calculatePagePosition(e){const{document:i,scene:t,docBackground:r}=e,o=t==null?void 0:t.getParent(),{width:s,height:a,pageMarginLeft:d,pageMarginTop:h}=i;if(o==null||s===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:l,height:p}=o;let v=0,I=0,u=0,b=0,C=Number.POSITIVE_INFINITY;const{scaleX:m,scaleY:Q}=t.getAncestorScale();l>(s+d*2)*m?(v=l/2-s*m/2,v/=m,u=(l-d*2)/m,C=0):(v=d,u=s+d*2,C=(u-l/m)/2),p>a?(I=p/2-a/2,b=(p-h*2)/Q):(I=h,b=a+h*2),t.resize(u,b+200),i.translate(v,I),r.translate(v,I);const V=t.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&V!=null){const ee=V.transScroll2ViewportScrollValue(C,0).x;V.scrollTo({x:ee})}return this}_commandExecutedListener(){const e=[w.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{e.includes(t.id)&&this._handleOpenZenEditor()}));const i=[N.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)){const r=t.params,{unitId:o}=r;if(o===f){const s=this._univerInstanceService.getUniverDocInstance(o),a=s==null?void 0:s.getBody(),d=a==null?void 0:a.dataStream,h=a==null?void 0:a.paragraphs,l=a==null?void 0:a.textRuns,p=a==null?void 0:a.customBlocks,v=s==null?void 0:s.getDrawings(),I=s==null?void 0:s.getDrawingsOrder(),u=s==null?void 0:s.getCustomRanges();if(this._editorBridgeService.changeEditorDirty(!0),d==null||h==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,d,h,l,p,v,I,u)}}}))}_getDocObject(){return N.getDocObject(this._univerInstanceService,this._renderManagerService)}};j=oe([c.OnLifecycle(c.LifecycleStages.Steady,j),E(0,c.IUniverInstanceService),E(1,k),E(2,M.IRenderManagerService),E(3,c.ICommandService),E(4,_.IZenZoneService),E(5,D.IEditorBridgeService),E(6,c.IUndoRedoService),E(7,R.Inject(N.TextSelectionManagerService))],j);const Z={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(D.IEditorBridgeService),t=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.Keyboard,keycode:_.KeyCode.ESC,unitId:""}),e.close();const o=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},L={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const e=n.get(_.IZenZoneService),i=n.get(D.IEditorBridgeService),t=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:M.DeviceInputEventType.PointerDown,unitId:""}),e.close();const o=t.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function ce(n){return{id:w.id,group:_.MenuGroup.CONTEXT_MENU_OTHERS,type:_.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[_.MenuPosition.CONTEXT_MENU],disabled$:D.getCurrentRangeDisable$(n,{workbookTypes:[z.WorkbookEditablePermission],worksheetTypes:[z.WorksheetEditPermission,z.WorksheetSetCellValuePermission,z.WorksheetSetCellStylePermission],rangeTypes:[z.RangeProtectionPermissionEditPoint]})}}var Y={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ae=S,de=Symbol.for("react.element"),le=Symbol.for("react.fragment"),ue=Object.prototype.hasOwnProperty,he=ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_e={key:!0,ref:!0,__self:!0,__source:!0};function K(n,e,i){var t,r={},o=null,s=null;i!==void 0&&(o=""+i),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(t in e)ue.call(e,t)&&!_e.hasOwnProperty(t)&&(r[t]=e[t]);if(n&&n.defaultProps)for(t in e=n.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:de,type:n,key:o,ref:s,props:r,_owner:he.current}}A.Fragment=le;A.jsx=K;A.jsxs=K;Y.exports=A;var y=Y.exports,g=function(){return g=Object.assign||function(n){for(var e,i=1,t=arguments.length;i<t;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},g.apply(this,arguments)},ve=function(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(n);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(n,t[r])&&(i[t[r]]=n[t[r]]);return i},$=S.forwardRef(function(n,e){var i=n.icon,t=n.id,r=n.className,o=n.extend,s=ve(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),d=S.useRef("_".concat(pe()));return H(i,"".concat(t),{defIds:i.defIds,idSuffix:d.current},g({ref:e,className:c},s),o)});function H(n,e,i,t,r){return S.createElement(n.tag,g(g({key:e},fe(n,i,r)),t),(ge(n,i).children||[]).map(function(o,s){return H(o,"".concat(e,"-").concat(n.tag,"-").concat(s),i,void 0,r)}))}function fe(n,e,i){var t=g({},n.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(t[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function ge(n,e){var i,t=e.defIds;return!t||t.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?g(g({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function pe(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var Se={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"}}]},X=S.forwardRef(function(n,e){return S.createElement($,Object.assign({},n,{id:"check-mark-single",ref:e,icon:Se}))});X.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"}}]},G=S.forwardRef(function(n,e){return S.createElement($,Object.assign({},n,{id:"close-single",ref:e,icon:Ie}))});G.displayName="CloseSingle";const me="univer-zen-editor",Ee="univer-zen-editor-icon-wrapper",Ce="univer-zen-editor-icon-container",Oe="univer-zen-editor-icon-success",ye="univer-zen-editor-icon-error",Te="univer-zen-editor-canvas-container",T={zenEditor:me,zenEditorIconWrapper:Ee,zenEditorIconContainer:Ce,zenEditorIconSuccess:Oe,zenEditorIconError:ye,zenEditorCanvasContainer:Te},Re="ZEN_EDITOR_PLUGIN_",be=`${Re}ZEN_EDITOR_COMPONENT`;function Ne(){const n=S.useRef(null),e=V.useDependency(M.IRenderManagerService),i=V.useDependency(k),t=V.useDependency(a.ICommandService);S.useEffect(()=>{const s=n.current;if(!s)return;const c=e.currentRender$.subscribe(l=>{var h;if(l!==f)return;const u=(h=e.getRenderById(f))==null?void 0:h.engine;u==null||u.setContainer(s)}),d=new ResizeObserver(()=>{const l=s.getBoundingClientRect();i.setPosition(l)});return d.observe(s),()=>{d.unobserve(s),c.unsubscribe()}},[]);function r(){t.executeCommand(Z.id)}function o(){t.executeCommand(L.id)}return y.jsxs("div",{className:T.zenEditor,children:[y.jsxs("div",{className:T.zenEditorIconWrapper,children:[y.jsx("span",{className:F(T.zenEditorIconContainer,T.zenEditorIconError),onClick:r,children:y.jsx(G,{style:{fontSize:"22px"}})}),y.jsx("span",{className:F(T.zenEditorIconContainer,T.zenEditorIconSuccess),onClick:o,children:y.jsx(X,{style:{fontSize:"22px"}})})]}),y.jsx("div",{className:T.zenEditorCanvasContainer,ref:n})]})}const ze={id:L.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},xe={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(a.FOCUSING_DOC)&&n.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(a.EDITOR_ACTIVATED)&&!n.getContextValue(a.FOCUSING_EDITOR_STANDALONE)}var De=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ue=(n,e,i,t)=>{for(var r=t>1?void 0:t?Me(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&De(e,i,r),r},x=(n,e)=>(i,t)=>e(i,t,n);const Pe={};let D=class extends a.Disposable{constructor(n,e,i,t,r,o){super(),this._config=n,this._injector=e,this._zenZoneService=i,this._commandService=t,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(be,Ne))}_initCommands(){[w,Z,L].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[ce].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e),n))})}_initShortcuts(){[ze,xe].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};D=Ue([a.OnLifecycle(a.LifecycleStages.Rendered,D),x(1,m.Inject(m.Injector)),x(2,_.IZenZoneService),x(3,a.ICommandService),x(4,_.IMenuService),x(5,_.IShortcutService)],D);var je=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ze=(n,e,i,t)=>{for(var r=t>1?void 0:t?we(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&je(e,i,r),r},W=(n,e)=>(i,t)=>e(i,t,n),P;exports.UniverSheetsZenEditorPlugin=(P=class extends a.Plugin{constructor(e={},i,t){super(),this._config=e,this._injector=i,this._localeService=t,this._initializeDependencies(this._injector),this._config=a.Tools.deepMerge({},Pe,this._config)}_initializeDependencies(e){[[D,{useFactory:()=>this._injector.createInstance(D,this._config)}],[j],[k,{useClass:ie}]].forEach(t=>e.add(t))}},O(P,"pluginName","zen-editor"),O(P,"type",a.UniverInstanceType.UNIVER_DOC),P);exports.UniverSheetsZenEditorPlugin=Ze([W(1,m.Inject(m.Injector)),W(2,m.Inject(a.LocaleService))],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=L;exports.OpenZenEditorOperation=w;
9
+ */var ae=S,de=Symbol.for("react.element"),le=Symbol.for("react.fragment"),ue=Object.prototype.hasOwnProperty,_e=ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,he={key:!0,ref:!0,__self:!0,__source:!0};function K(n,e,i){var t,r={},o=null,s=null;i!==void 0&&(o=""+i),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(t in e)ue.call(e,t)&&!he.hasOwnProperty(t)&&(r[t]=e[t]);if(n&&n.defaultProps)for(t in e=n.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:de,type:n,key:o,ref:s,props:r,_owner:_e.current}}A.Fragment=le;A.jsx=K;A.jsxs=K;Y.exports=A;var y=Y.exports,g=function(){return g=Object.assign||function(n){for(var e,i=1,t=arguments.length;i<t;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},g.apply(this,arguments)},ve=function(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(n);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(n,t[r])&&(i[t[r]]=n[t[r]]);return i},$=S.forwardRef(function(n,e){var i=n.icon,t=n.id,r=n.className,o=n.extend,s=ve(n,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),d=S.useRef("_".concat(pe()));return H(i,"".concat(t),{defIds:i.defIds,idSuffix:d.current},g({ref:e,className:a},s),o)});function H(n,e,i,t,r){return S.createElement(n.tag,g(g({key:e},fe(n,i,r)),t),(ge(n,i).children||[]).map(function(o,s){return H(o,"".concat(e,"-").concat(n.tag,"-").concat(s),i,void 0,r)}))}function fe(n,e,i){var t=g({},n.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1);var r=e.defIds;return!r||r.length===0||(n.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(o){var s=o[0],a=o[1];typeof a=="string"&&(t[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function ge(n,e){var i,t=e.defIds;return!t||t.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?g(g({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):n}function pe(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var Se={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"}}]},X=S.forwardRef(function(n,e){return S.createElement($,Object.assign({},n,{id:"check-mark-single",ref:e,icon:Se}))});X.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"}}]},G=S.forwardRef(function(n,e){return S.createElement($,Object.assign({},n,{id:"close-single",ref:e,icon:Ie}))});G.displayName="CloseSingle";const me="univer-zen-editor",Ee="univer-zen-editor-icon-wrapper",Ce="univer-zen-editor-icon-container",Oe="univer-zen-editor-icon-success",ye="univer-zen-editor-icon-error",Te="univer-zen-editor-canvas-container",T={zenEditor:me,zenEditorIconWrapper:Ee,zenEditorIconContainer:Ce,zenEditorIconSuccess:Oe,zenEditorIconError:ye,zenEditorCanvasContainer:Te},Re="ZEN_EDITOR_PLUGIN_",be=`${Re}ZEN_EDITOR_COMPONENT`;function Ne(){const n=S.useRef(null),e=B.useDependency(M.IRenderManagerService),i=B.useDependency(k),t=B.useDependency(c.ICommandService);S.useEffect(()=>{const s=n.current;if(!s)return;const a=e.currentRender$.subscribe(h=>{var p;if(h!==f)return;const l=(p=e.getRenderById(f))==null?void 0:p.engine;l==null||l.setContainer(s)}),d=new ResizeObserver(()=>{const h=s.getBoundingClientRect();i.setPosition(h)});return d.observe(s),()=>{d.unobserve(s),a.unsubscribe()}},[]);function r(){t.executeCommand(Z.id)}function o(){t.executeCommand(L.id)}return y.jsxs("div",{className:T.zenEditor,children:[y.jsxs("div",{className:T.zenEditorIconWrapper,children:[y.jsx("span",{className:F(T.zenEditorIconContainer,T.zenEditorIconError),onClick:r,children:y.jsx(G,{style:{fontSize:"22px"}})}),y.jsx("span",{className:F(T.zenEditorIconContainer,T.zenEditorIconSuccess),onClick:o,children:y.jsx(X,{style:{fontSize:"22px"}})})]}),y.jsx("div",{className:T.zenEditorCanvasContainer,ref:n})]})}const ze={id:L.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ENTER|_.MetaKeys.ALT},xe={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:_.KeyCode.ESC};function J(n){return n.getContextValue(c.FOCUSING_DOC)&&n.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(c.EDITOR_ACTIVATED)&&!n.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var Ue=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,De=(n,e,i,t)=>{for(var r=t>1?void 0:t?Me(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&Ue(e,i,r),r},x=(n,e)=>(i,t)=>e(i,t,n);const Pe={};let U=class extends c.Disposable{constructor(n,e,i,t,r,o){super(),this._config=n,this._injector=e,this._zenZoneService=i,this._commandService=t,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(be,Ne))}_initCommands(){[w,Z,L].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[ce].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e),n))})}_initShortcuts(){[ze,xe].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};U=De([c.OnLifecycle(c.LifecycleStages.Rendered,U),x(1,R.Inject(R.Injector)),x(2,_.IZenZoneService),x(3,c.ICommandService),x(4,_.IMenuService),x(5,_.IShortcutService)],U);var je=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Ze=(n,e,i,t)=>{for(var r=t>1?void 0:t?we(e,i):e,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(t?s(e,i,r):s(r))||r);return t&&r&&je(e,i,r),r},W=(n,e)=>(i,t)=>e(i,t,n),P;exports.UniverSheetsZenEditorPlugin=(P=class extends c.Plugin{constructor(e={},i,t){super(),this._config=e,this._injector=i,this._localeService=t,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},Pe,this._config)}_initializeDependencies(e){[[U,{useFactory:()=>this._injector.createInstance(U,this._config)}],[j],[k,{useClass:ie}]].forEach(t=>e.add(t))}},O(P,"pluginName","zen-editor"),O(P,"type",c.UniverInstanceType.UNIVER_DOC),P);exports.UniverSheetsZenEditorPlugin=Ze([W(1,R.Inject(R.Injector)),W(2,R.Inject(c.LocaleService))],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=L;exports.OpenZenEditorOperation=w;
package/lib/es/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  var he = Object.defineProperty;
2
2
  var _e = (t, e, i) => e in t ? he(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var S = (t, e, i) => _e(t, typeof e != "symbol" ? e + "" : e, i);
4
- import { CommandType as w, RxDisposable as fe, DEFAULT_EMPTY_DOCUMENT_VALUE as ge, DocumentFlavor as ve, UniverInstanceType as z, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as K, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as X, OnLifecycle as ee, LifecycleStages as te, IUniverInstanceService as U, ICommandService as j, IUndoRedoService as pe, FOCUSING_DOC as me, FOCUSING_UNIVER_EDITOR as Se, EDITOR_ACTIVATED as Ee, FOCUSING_EDITOR_STANDALONE as Ie, Disposable as Ce, Plugin as Oe, Tools as ye, LocaleService as be } from "@univerjs/core";
5
- import { createIdentifier as Te, Inject as T, Injector as L } from "@wendellhu/redi";
6
- import { DocSkeletonManagerService as G, VIEWPORT_KEY as Re, RichTextEditingMutation as Ne, getDocObject as ze, TextSelectionManagerService as xe } from "@univerjs/docs";
7
- import { DeviceInputEventType as Z, IRenderManagerService as ne } from "@univerjs/engine-render";
8
- import { getEditorObject as Me, IEditorBridgeService as V, getCurrentRangeDisable$ as Pe } from "@univerjs/sheets-ui";
9
- import { IZenZoneService as x, KeyCode as A, MenuGroup as De, MenuItemType as we, MenuPosition as Ue, MetaKeys as je, IMenuService as Le, IShortcutService as Ze } from "@univerjs/ui";
3
+ var E = (t, e, i) => _e(t, typeof e != "symbol" ? e + "" : e, i);
4
+ import { CommandType as w, RxDisposable as fe, DEFAULT_EMPTY_DOCUMENT_VALUE as ge, DocumentFlavor as ve, UniverInstanceType as T, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as H, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as K, OnLifecycle as Q, LifecycleStages as ee, IUniverInstanceService as D, ICommandService as j, IUndoRedoService as pe, FOCUSING_DOC as me, FOCUSING_UNIVER_EDITOR as Se, EDITOR_ACTIVATED as Ee, FOCUSING_EDITOR_STANDALONE as Ie, Disposable as Ce, Plugin as Oe, Tools as Re, LocaleService as ye } from "@univerjs/core";
5
+ import { createIdentifier as Te, Inject as z, Injector as te } from "@wendellhu/redi";
6
+ import { DocSkeletonManagerService as X, VIEWPORT_KEY as be, RichTextEditingMutation as Ne, getDocObject as ze, TextSelectionManagerService as xe } from "@univerjs/docs";
7
+ import { DeviceInputEventType as L, IRenderManagerService as ne } from "@univerjs/engine-render";
8
+ import { getEditorObject as Me, IEditorBridgeService as Z, getCurrentRangeDisable$ as Pe } from "@univerjs/sheets-ui";
9
+ import { IZenZoneService as x, KeyCode as V, MenuGroup as Ue, MenuItemType as we, MenuPosition as De, MetaKeys as je, IMenuService as Le, IShortcutService as Ze } from "@univerjs/ui";
10
10
  import { BehaviorSubject as Ve, takeUntil as Ae } from "rxjs";
11
11
  import { WorkbookEditablePermission as ke, WorksheetEditPermission as $e, WorksheetSetCellValuePermission as Be, WorksheetSetCellStylePermission as Fe, RangeProtectionPermissionEditPoint as We } from "@univerjs/sheets";
12
- import Ye, { forwardRef as k, useRef as ie, createElement as $, useEffect as He } from "react";
13
- import { useDependency as D } from "@wendellhu/redi/react-bindings";
14
- import q from "clsx";
15
- const B = {
12
+ import Ye, { forwardRef as A, useRef as ie, createElement as k, useEffect as He } from "react";
13
+ import { useDependency as U } from "@wendellhu/redi/react-bindings";
14
+ import G from "clsx";
15
+ const $ = {
16
16
  id: "zen-editor.operation.open-zen-editor",
17
17
  type: w.OPERATION,
18
18
  handler: (t) => !0
19
19
  };
20
20
  class Ke {
21
21
  constructor() {
22
- S(this, "_position", null);
23
- S(this, "_position$", new Ve(null));
24
- S(this, "position$", this._position$.asObservable());
22
+ E(this, "_position", null);
23
+ E(this, "_position$", new Ve(null));
24
+ E(this, "position$", this._position$.asObservable());
25
25
  }
26
26
  dispose() {
27
27
  this._position$.complete(), this._position = null;
@@ -36,20 +36,20 @@ class Ke {
36
36
  this._position$.next(e);
37
37
  }
38
38
  }
39
- const F = Te(
39
+ const B = Te(
40
40
  "univer.sheet-zen-editor-manager.service"
41
41
  );
42
42
  var Xe = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, qe = (t, e, i, n) => {
43
43
  for (var r = n > 1 ? void 0 : n ? Ge(e, i) : e, o = t.length - 1, s; o >= 0; o--)
44
44
  (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
45
45
  return n && r && Xe(e, i, r), r;
46
- }, v = (t, e) => (i, n) => e(i, n, t);
46
+ }, m = (t, e) => (i, n) => e(i, n, t);
47
47
  const _ = "__defaultDocumentZenEditorSpecialUnitId_20231218__";
48
48
  let N = class extends fe {
49
- constructor(e, i, n, r, o, s, c, a, d) {
49
+ constructor(e, i, n, r, o, s, c, a) {
50
50
  super();
51
- S(this, "_zenEditorInitialState", !1);
52
- this._injector = e, this._univerInstanceService = i, this._zenEditorManagerService = n, this._renderManagerService = r, this._commandService = o, this._zenZoneService = s, this._editorBridgeService = c, this._undoRedoService = a, this._textSelectionManagerService = d, this._initialize();
51
+ E(this, "_zenEditorInitialState", !1);
52
+ this._univerInstanceService = e, this._zenEditorManagerService = i, this._renderManagerService = n, this._commandService = r, this._zenZoneService = o, this._editorBridgeService = s, this._undoRedoService = c, this._textSelectionManagerService = a, this._initialize();
53
53
  }
54
54
  _initialize() {
55
55
  this._syncZenEditorSize(), this._commandExecutedListener();
@@ -85,7 +85,7 @@ let N = class extends fe {
85
85
  drawings: {},
86
86
  drawingsOrder: []
87
87
  };
88
- return this._univerInstanceService.createUnit(z.UNIVER_DOC, e);
88
+ return this._univerInstanceService.createUnit(T.UNIVER_DOC, e);
89
89
  }
90
90
  // Listen to changes in the size of the zen editor container to set the size of the editor.
91
91
  _syncZenEditorSize() {
@@ -96,28 +96,32 @@ let N = class extends fe {
96
96
  const i = Me(_, this._renderManagerService), n = this._univerInstanceService.getUniverDocInstance(_);
97
97
  if (i == null || n == null)
98
98
  return;
99
- const { width: r, height: o } = e, { engine: s } = i, c = (a = this._renderManagerService.getRenderById(_)) == null ? void 0 : a.with(G).getSkeleton();
99
+ const { width: r, height: o } = e, { engine: s } = i, c = (a = this._renderManagerService.getRenderById(_)) == null ? void 0 : a.with(X).getSkeleton();
100
100
  requestIdleCallback(() => {
101
101
  s.resizeBySize(r, o), this._calculatePagePosition(i), c && this._textSelectionManagerService.refreshSelection();
102
102
  });
103
103
  });
104
104
  }
105
105
  _handleOpenZenEditor() {
106
- this._zenEditorInitialState || (this._createZenEditorInstance(), this._zenEditorInitialState = !0), this._zenZoneService.open(), this._undoRedoService.clearUndoRedo(_), this._univerInstanceService.focusUnit(_), this._univerInstanceService.setCurrentUnitForType(_), this._editorBridgeService.isVisible().visible === !1 && this._editorBridgeService.changeVisible({
106
+ var o;
107
+ this._zenEditorInitialState || (this._createZenEditorInstance(), this._zenEditorInitialState = !0), this._zenZoneService.open();
108
+ const e = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET);
109
+ this._undoRedoService.clearUndoRedo(_), this._univerInstanceService.focusUnit(_), this._univerInstanceService.setCurrentUnitForType(_), this._editorBridgeService.isVisible().visible === !1 && this._editorBridgeService.changeVisible({
107
110
  visible: !0,
108
- eventType: Z.PointerDown
111
+ eventType: L.PointerDown,
112
+ unitId: (o = e == null ? void 0 : e.getUnitId()) != null ? o : ""
109
113
  });
110
- const i = this._editorBridgeService.getLatestEditCellState();
111
- if (i == null)
114
+ const n = this._editorBridgeService.getLatestEditCellState();
115
+ if (n == null)
112
116
  return;
113
- this._editorSyncHandler(i);
114
- const n = [
117
+ this._editorSyncHandler(n);
118
+ const r = [
115
119
  {
116
120
  startOffset: 0,
117
121
  endOffset: 0
118
122
  }
119
123
  ];
120
- this._textSelectionManagerService.replaceTextRanges(n);
124
+ this._textSelectionManagerService.replaceTextRanges(r);
121
125
  }
122
126
  _editorSyncHandler(e) {
123
127
  var s, c;
@@ -125,31 +129,31 @@ let N = class extends fe {
125
129
  let o = [];
126
130
  n == null || r == null || ((c = i == null ? void 0 : i.textRuns) != null && c.length && (o = i == null ? void 0 : i.textRuns), this._syncContentAndRender(_, n, r, o));
127
131
  }
128
- _syncContentAndRender(e, i, n, r = [], o = [], s = {}, c = []) {
129
- var m;
130
- const a = [
132
+ _syncContentAndRender(e, i, n, r = [], o = [], s = {}, c = [], a = []) {
133
+ var p;
134
+ const u = [
131
135
  _,
132
- X,
133
- K
134
- ], d = (m = this._renderManagerService.getRenderById(e)) == null ? void 0 : m.with(G), l = d == null ? void 0 : d.getSkeleton(), u = this._univerInstanceService.getUniverDocInstance(e), g = d == null ? void 0 : d.getViewModel();
135
- if (u == null || g == null || l == null)
136
+ K,
137
+ H
138
+ ], d = (p = this._renderManagerService.getRenderById(e)) == null ? void 0 : p.with(X), g = d == null ? void 0 : d.getSkeleton(), h = this._univerInstanceService.getUniverDocInstance(e), v = d == null ? void 0 : d.getViewModel();
139
+ if (h == null || v == null || g == null)
136
140
  return;
137
- const h = u.getBody(), p = u.getSnapshot();
138
- h.dataStream = i, h.paragraphs = n, h.customBlocks = o, p.drawings = s, p.drawingsOrder = c, e === K && (h.textRuns = []), r.length > 0 && (h.textRuns = r), g.reset(u);
139
- const C = this._getDocObject();
140
- C != null && (l.calculate(), a.includes(e) && C.document.makeDirty());
141
+ const l = h.getBody(), O = h.getSnapshot();
142
+ l.dataStream = i, l.paragraphs = n, l.customBlocks = o, l.customRanges = a, O.drawings = s, O.drawingsOrder = c, e === H && (l.textRuns = []), r.length > 0 && (l.textRuns = r), v.reset(h);
143
+ const S = this._getDocObject();
144
+ S != null && (g.calculate(), u.includes(e) && S.document.makeDirty());
141
145
  }
142
146
  _calculatePagePosition(e) {
143
- const { document: i, scene: n, docBackground: r } = e, o = n == null ? void 0 : n.getParent(), { width: s, height: c, pageMarginLeft: a, pageMarginTop: d } = i;
147
+ const { document: i, scene: n, docBackground: r } = e, o = n == null ? void 0 : n.getParent(), { width: s, height: c, pageMarginLeft: a, pageMarginTop: u } = i;
144
148
  if (o == null || s === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
145
149
  return;
146
- const { width: l, height: u } = o;
147
- let g = 0, h = 0, p = 0, C = 0, m = Number.POSITIVE_INFINITY;
148
- const { scaleX: O, scaleY: le } = n.getAncestorScale();
149
- l > (s + a * 2) * O ? (g = l / 2 - s * O / 2, g /= O, p = (l - a * 2) / O, m = 0) : (g = a, p = s + a * 2, m = (p - l / O) / 2), u > c ? (h = u / 2 - c / 2, C = (u - d * 2) / le) : (h = d, C = c + d * 2), n.resize(p, C + 200), i.translate(g, h), r.translate(g, h);
150
- const P = n.getViewport(Re.VIEW_MAIN);
151
- if (m !== Number.POSITIVE_INFINITY && P != null) {
152
- const ue = P.transScroll2ViewportScrollValue(m, 0).x;
150
+ const { width: d, height: g } = o;
151
+ let h = 0, v = 0, l = 0, O = 0, S = Number.POSITIVE_INFINITY;
152
+ const { scaleX: p, scaleY: le } = n.getAncestorScale();
153
+ d > (s + a * 2) * p ? (h = d / 2 - s * p / 2, h /= p, l = (d - a * 2) / p, S = 0) : (h = a, l = s + a * 2, S = (l - d / p) / 2), g > c ? (v = g / 2 - c / 2, O = (g - u * 2) / le) : (v = u, O = c + u * 2), n.resize(l, O + 200), i.translate(h, v), r.translate(h, v);
154
+ const P = n.getViewport(be.VIEW_MAIN);
155
+ if (S !== Number.POSITIVE_INFINITY && P != null) {
156
+ const ue = P.transScroll2ViewportScrollValue(S, 0).x;
153
157
  P.scrollTo({
154
158
  x: ue
155
159
  });
@@ -157,7 +161,7 @@ let N = class extends fe {
157
161
  return this;
158
162
  }
159
163
  _commandExecutedListener() {
160
- const e = [B.id];
164
+ const e = [$.id];
161
165
  this.disposeWithMe(
162
166
  this._commandService.onCommandExecuted((n) => {
163
167
  e.includes(n.id) && this._handleOpenZenEditor();
@@ -169,10 +173,10 @@ let N = class extends fe {
169
173
  if (i.includes(n.id)) {
170
174
  const r = n.params, { unitId: o } = r;
171
175
  if (o === _) {
172
- const s = this._univerInstanceService.getUniverDocInstance(o), c = s == null ? void 0 : s.getBody(), a = c == null ? void 0 : c.dataStream, d = c == null ? void 0 : c.paragraphs, l = c == null ? void 0 : c.textRuns, u = c == null ? void 0 : c.customBlocks, g = s == null ? void 0 : s.getDrawings(), h = s == null ? void 0 : s.getDrawingsOrder();
173
- if (this._editorBridgeService.changeEditorDirty(!0), a == null || d == null)
176
+ const s = this._univerInstanceService.getUniverDocInstance(o), c = s == null ? void 0 : s.getBody(), a = c == null ? void 0 : c.dataStream, u = c == null ? void 0 : c.paragraphs, d = c == null ? void 0 : c.textRuns, g = c == null ? void 0 : c.customBlocks, h = s == null ? void 0 : s.getDrawings(), v = s == null ? void 0 : s.getDrawingsOrder(), l = s == null ? void 0 : s.getCustomRanges();
177
+ if (this._editorBridgeService.changeEditorDirty(!0), a == null || u == null)
174
178
  return;
175
- this._syncContentAndRender(X, a, d, l, u, g, h);
179
+ this._syncContentAndRender(K, a, u, d, g, h, v, l);
176
180
  }
177
181
  }
178
182
  })
@@ -183,51 +187,52 @@ let N = class extends fe {
183
187
  }
184
188
  };
185
189
  N = qe([
186
- ee(te.Steady, N),
187
- v(0, T(L)),
188
- v(1, U),
189
- v(2, F),
190
- v(3, ne),
191
- v(4, j),
192
- v(5, x),
193
- v(6, V),
194
- v(7, pe),
195
- v(8, T(xe))
190
+ Q(ee.Steady, N),
191
+ m(0, D),
192
+ m(1, B),
193
+ m(2, ne),
194
+ m(3, j),
195
+ m(4, x),
196
+ m(5, Z),
197
+ m(6, pe),
198
+ m(7, z(xe))
196
199
  ], N);
197
- const W = {
200
+ const F = {
198
201
  id: "zen-editor.command.cancel-zen-edit",
199
202
  type: w.COMMAND,
200
203
  handler: async (t) => {
201
- const e = t.get(x), i = t.get(V), n = t.get(U);
204
+ const e = t.get(x), i = t.get(Z), n = t.get(D);
202
205
  i.isVisible().visible && i.changeVisible({
203
206
  visible: !1,
204
- eventType: Z.Keyboard,
205
- keycode: A.ESC
207
+ eventType: L.Keyboard,
208
+ keycode: V.ESC,
209
+ unitId: ""
206
210
  }), e.close();
207
- const o = n.getCurrentUnitForType(z.UNIVER_SHEET);
211
+ const o = n.getCurrentUnitForType(T.UNIVER_SHEET);
208
212
  return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
209
213
  }
210
- }, Y = {
214
+ }, W = {
211
215
  id: "zen-editor.command.confirm-zen-edit",
212
216
  type: w.COMMAND,
213
217
  handler: async (t) => {
214
- const e = t.get(x), i = t.get(V), n = t.get(U);
218
+ const e = t.get(x), i = t.get(Z), n = t.get(D);
215
219
  i.isVisible().visible && i.changeVisible({
216
220
  visible: !1,
217
- eventType: Z.PointerDown
221
+ eventType: L.PointerDown,
222
+ unitId: ""
218
223
  }), e.close();
219
- const o = n.getCurrentUnitForType(z.UNIVER_SHEET);
224
+ const o = n.getCurrentUnitForType(T.UNIVER_SHEET);
220
225
  return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
221
226
  }
222
227
  };
223
228
  function Je(t) {
224
229
  return {
225
- id: B.id,
226
- group: De.CONTEXT_MENU_OTHERS,
230
+ id: $.id,
231
+ group: Ue.CONTEXT_MENU_OTHERS,
227
232
  type: we.BUTTON,
228
233
  title: "rightClick.zenEditor",
229
234
  icon: "AmplifySingle",
230
- positions: [Ue.CONTEXT_MENU],
235
+ positions: [De.CONTEXT_MENU],
231
236
  disabled$: Pe(t, { workbookTypes: [ke], worksheetTypes: [$e, Be, Fe], rangeTypes: [We] })
232
237
  };
233
238
  }
@@ -253,7 +258,7 @@ M.Fragment = tt;
253
258
  M.jsx = se;
254
259
  M.jsxs = se;
255
260
  re.exports = M;
256
- var E = re.exports, f = function() {
261
+ var I = re.exports, f = function() {
257
262
  return f = Object.assign || function(t) {
258
263
  for (var e, i = 1, n = arguments.length; i < n; i++) {
259
264
  e = arguments[i];
@@ -268,12 +273,12 @@ var E = re.exports, f = function() {
268
273
  for (var r = 0, n = Object.getOwnPropertySymbols(t); r < n.length; r++)
269
274
  e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (i[n[r]] = t[n[r]]);
270
275
  return i;
271
- }, H = k(function(t, e) {
276
+ }, Y = A(function(t, e) {
272
277
  var i = t.icon, n = t.id, r = t.className, o = t.extend, s = st(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = ie("_".concat(at()));
273
278
  return oe(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, f({ ref: e, className: c }, s), o);
274
279
  });
275
280
  function oe(t, e, i, n, r) {
276
- return $(t.tag, f(f({ key: e }, ot(t, i, r)), n), (ct(t, i).children || []).map(function(o, s) {
281
+ return k(t.tag, f(f({ key: e }, ot(t, i, r)), n), (ct(t, i).children || []).map(function(o, s) {
277
282
  return oe(o, "".concat(e, "-").concat(t.tag, "-").concat(s), i, void 0, r);
278
283
  }));
279
284
  }
@@ -295,24 +300,24 @@ function ct(t, e) {
295
300
  function at() {
296
301
  return Math.random().toString(36).substring(2, 8);
297
302
  }
298
- H.displayName = "UniverIcon";
299
- var dt = { 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" } }] }, ce = k(function(t, e) {
300
- return $(H, Object.assign({}, t, {
303
+ Y.displayName = "UniverIcon";
304
+ var dt = { 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" } }] }, ce = A(function(t, e) {
305
+ return k(Y, Object.assign({}, t, {
301
306
  id: "check-mark-single",
302
307
  ref: e,
303
308
  icon: dt
304
309
  }));
305
310
  });
306
311
  ce.displayName = "CheckMarkSingle";
307
- var lt = { 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" } }] }, ae = k(function(t, e) {
308
- return $(H, Object.assign({}, t, {
312
+ var lt = { 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" } }] }, ae = A(function(t, e) {
313
+ return k(Y, Object.assign({}, t, {
309
314
  id: "close-single",
310
315
  ref: e,
311
316
  icon: lt
312
317
  }));
313
318
  });
314
319
  ae.displayName = "CloseSingle";
315
- const ut = "univer-zen-editor", ht = "univer-zen-editor-icon-wrapper", _t = "univer-zen-editor-icon-container", ft = "univer-zen-editor-icon-success", gt = "univer-zen-editor-icon-error", vt = "univer-zen-editor-canvas-container", I = {
320
+ const ut = "univer-zen-editor", ht = "univer-zen-editor-icon-wrapper", _t = "univer-zen-editor-icon-container", ft = "univer-zen-editor-icon-success", gt = "univer-zen-editor-icon-error", vt = "univer-zen-editor-canvas-container", C = {
316
321
  zenEditor: ut,
317
322
  zenEditorIconWrapper: ht,
318
323
  zenEditorIconContainer: _t,
@@ -321,76 +326,76 @@ const ut = "univer-zen-editor", ht = "univer-zen-editor-icon-wrapper", _t = "uni
321
326
  zenEditorCanvasContainer: vt
322
327
  }, pt = "ZEN_EDITOR_PLUGIN_", mt = `${pt}ZEN_EDITOR_COMPONENT`;
323
328
  function St() {
324
- const t = ie(null), e = D(ne), i = D(F), n = D(j);
329
+ const t = ie(null), e = U(ne), i = U(B), n = U(j);
325
330
  He(() => {
326
331
  const s = t.current;
327
332
  if (!s)
328
333
  return;
329
- const c = e.currentRender$.subscribe((d) => {
330
- var u;
331
- if (d !== _)
334
+ const c = e.currentRender$.subscribe((u) => {
335
+ var g;
336
+ if (u !== _)
332
337
  return;
333
- const l = (u = e.getRenderById(_)) == null ? void 0 : u.engine;
334
- l == null || l.setContainer(s);
338
+ const d = (g = e.getRenderById(_)) == null ? void 0 : g.engine;
339
+ d == null || d.setContainer(s);
335
340
  }), a = new ResizeObserver(() => {
336
- const d = s.getBoundingClientRect();
337
- i.setPosition(d);
341
+ const u = s.getBoundingClientRect();
342
+ i.setPosition(u);
338
343
  });
339
344
  return a.observe(s), () => {
340
345
  a.unobserve(s), c.unsubscribe();
341
346
  };
342
347
  }, []);
343
348
  function r() {
344
- n.executeCommand(W.id);
349
+ n.executeCommand(F.id);
345
350
  }
346
351
  function o() {
347
- n.executeCommand(Y.id);
352
+ n.executeCommand(W.id);
348
353
  }
349
- return /* @__PURE__ */ E.jsxs("div", { className: I.zenEditor, children: [
350
- /* @__PURE__ */ E.jsxs("div", { className: I.zenEditorIconWrapper, children: [
351
- /* @__PURE__ */ E.jsx(
354
+ return /* @__PURE__ */ I.jsxs("div", { className: C.zenEditor, children: [
355
+ /* @__PURE__ */ I.jsxs("div", { className: C.zenEditorIconWrapper, children: [
356
+ /* @__PURE__ */ I.jsx(
352
357
  "span",
353
358
  {
354
- className: q(I.zenEditorIconContainer, I.zenEditorIconError),
359
+ className: G(C.zenEditorIconContainer, C.zenEditorIconError),
355
360
  onClick: r,
356
- children: /* @__PURE__ */ E.jsx(ae, { style: { fontSize: "22px" } })
361
+ children: /* @__PURE__ */ I.jsx(ae, { style: { fontSize: "22px" } })
357
362
  }
358
363
  ),
359
- /* @__PURE__ */ E.jsx(
364
+ /* @__PURE__ */ I.jsx(
360
365
  "span",
361
366
  {
362
- className: q(I.zenEditorIconContainer, I.zenEditorIconSuccess),
367
+ className: G(C.zenEditorIconContainer, C.zenEditorIconSuccess),
363
368
  onClick: o,
364
- children: /* @__PURE__ */ E.jsx(ce, { style: { fontSize: "22px" } })
369
+ children: /* @__PURE__ */ I.jsx(ce, { style: { fontSize: "22px" } })
365
370
  }
366
371
  )
367
372
  ] }),
368
- /* @__PURE__ */ E.jsx("div", { className: I.zenEditorCanvasContainer, ref: t })
373
+ /* @__PURE__ */ I.jsx("div", { className: C.zenEditorCanvasContainer, ref: t })
369
374
  ] });
370
375
  }
371
376
  const Et = {
372
- id: Y.id,
377
+ id: W.id,
373
378
  description: "shortcut.sheet.zen-edit-confirm",
374
379
  group: "4_sheet-edit",
375
380
  preconditions: (t) => de(t),
376
- binding: A.ENTER | je.ALT
381
+ binding: V.ENTER | je.ALT
377
382
  }, It = {
378
- id: W.id,
383
+ id: F.id,
379
384
  description: "shortcut.sheet.zen-edit-cancel",
380
385
  group: "4_sheet-edit",
381
386
  preconditions: (t) => de(t),
382
- binding: A.ESC
387
+ binding: V.ESC
383
388
  };
384
389
  function de(t) {
385
390
  return t.getContextValue(me) && t.getContextValue(Se) && t.getContextValue(Ee) && !t.getContextValue(Ie);
386
391
  }
387
- var Ct = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, yt = (t, e, i, n) => {
392
+ var Ct = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Rt = (t, e, i, n) => {
388
393
  for (var r = n > 1 ? void 0 : n ? Ot(e, i) : e, o = t.length - 1, s; o >= 0; o--)
389
394
  (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
390
395
  return n && r && Ct(e, i, r), r;
391
- }, y = (t, e) => (i, n) => e(i, n, t);
392
- const bt = {};
393
- let b = class extends Ce {
396
+ }, R = (t, e) => (i, n) => e(i, n, t);
397
+ const yt = {};
398
+ let y = class extends Ce {
394
399
  constructor(t, e, i, n, r, o) {
395
400
  super(), this._config = t, this._injector = e, this._zenZoneService = i, this._commandService = n, this._menuService = r, this._shortcutService = o, this._initialize();
396
401
  }
@@ -401,7 +406,7 @@ let b = class extends Ce {
401
406
  this.disposeWithMe(this._zenZoneService.set(mt, St));
402
407
  }
403
408
  _initCommands() {
404
- [B, W, Y].forEach((t) => {
409
+ [$, F, W].forEach((t) => {
405
410
  this.disposeWithMe(this._commandService.registerCommand(t));
406
411
  });
407
412
  }
@@ -420,43 +425,43 @@ let b = class extends Ce {
420
425
  });
421
426
  }
422
427
  };
423
- b = yt([
424
- ee(te.Rendered, b),
425
- y(1, T(L)),
426
- y(2, x),
427
- y(3, j),
428
- y(4, Le),
429
- y(5, Ze)
430
- ], b);
431
- var Tt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Nt = (t, e, i, n) => {
432
- for (var r = n > 1 ? void 0 : n ? Rt(e, i) : e, o = t.length - 1, s; o >= 0; o--)
428
+ y = Rt([
429
+ Q(ee.Rendered, y),
430
+ R(1, z(te)),
431
+ R(2, x),
432
+ R(3, j),
433
+ R(4, Le),
434
+ R(5, Ze)
435
+ ], y);
436
+ var Tt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, Nt = (t, e, i, n) => {
437
+ for (var r = n > 1 ? void 0 : n ? bt(e, i) : e, o = t.length - 1, s; o >= 0; o--)
433
438
  (s = t[o]) && (r = (n ? s(e, i, r) : s(r)) || r);
434
439
  return n && r && Tt(e, i, r), r;
435
- }, J = (t, e) => (i, n) => e(i, n, t), R;
436
- let Q = (R = class extends Oe {
440
+ }, q = (t, e) => (i, n) => e(i, n, t), b;
441
+ let J = (b = class extends Oe {
437
442
  constructor(t = {}, e, i) {
438
- super(), this._config = t, this._injector = e, this._localeService = i, this._initializeDependencies(this._injector), this._config = ye.deepMerge({}, bt, this._config);
443
+ super(), this._config = t, this._injector = e, this._localeService = i, this._initializeDependencies(this._injector), this._config = Re.deepMerge({}, yt, this._config);
439
444
  }
440
445
  _initializeDependencies(t) {
441
446
  [
442
447
  [
443
- b,
448
+ y,
444
449
  {
445
- useFactory: () => this._injector.createInstance(b, this._config)
450
+ useFactory: () => this._injector.createInstance(y, this._config)
446
451
  }
447
452
  ],
448
453
  [N],
449
- [F, { useClass: Ke }]
454
+ [B, { useClass: Ke }]
450
455
  ].forEach((i) => t.add(i));
451
456
  }
452
- }, S(R, "pluginName", "zen-editor"), S(R, "type", z.UNIVER_DOC), R);
453
- Q = Nt([
454
- J(1, T(L)),
455
- J(2, T(be))
456
- ], Q);
457
+ }, E(b, "pluginName", "zen-editor"), E(b, "type", T.UNIVER_DOC), b);
458
+ J = Nt([
459
+ q(1, z(te)),
460
+ q(2, z(ye))
461
+ ], J);
457
462
  export {
458
- W as CancelZenEditCommand,
459
- Y as ConfirmZenEditCommand,
460
- B as OpenZenEditorOperation,
461
- Q as UniverSheetsZenEditorPlugin
463
+ F as CancelZenEditCommand,
464
+ W as ConfirmZenEditCommand,
465
+ $ as OpenZenEditorOperation,
466
+ J as UniverSheetsZenEditorPlugin
462
467
  };
@@ -3,12 +3,10 @@ import { TextSelectionManagerService } from '@univerjs/docs';
3
3
  import { IRenderManagerService } from '@univerjs/engine-render';
4
4
  import { IEditorBridgeService } from '@univerjs/sheets-ui';
5
5
  import { IZenZoneService } from '@univerjs/ui';
6
- import { Injector } from '@wendellhu/redi';
7
6
  import { IZenEditorManagerService } from '../services/zen-editor.service';
8
7
 
9
8
  export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "__defaultDocumentZenEditorSpecialUnitId_20231218__";
10
9
  export declare class ZenEditorController extends RxDisposable {
11
- private readonly _injector;
12
10
  private readonly _univerInstanceService;
13
11
  private readonly _zenEditorManagerService;
14
12
  private readonly _renderManagerService;
@@ -17,7 +15,7 @@ export declare class ZenEditorController extends RxDisposable {
17
15
  private readonly _editorBridgeService;
18
16
  private readonly _undoRedoService;
19
17
  private readonly _textSelectionManagerService;
20
- constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _zenEditorManagerService: IZenEditorManagerService, _renderManagerService: IRenderManagerService, _commandService: ICommandService, _zenZoneService: IZenZoneService, _editorBridgeService: IEditorBridgeService, _undoRedoService: IUndoRedoService, _textSelectionManagerService: TextSelectionManagerService);
18
+ constructor(_univerInstanceService: IUniverInstanceService, _zenEditorManagerService: IZenEditorManagerService, _renderManagerService: IRenderManagerService, _commandService: ICommandService, _zenZoneService: IZenZoneService, _editorBridgeService: IEditorBridgeService, _undoRedoService: IUndoRedoService, _textSelectionManagerService: TextSelectionManagerService);
21
19
  private _initialize;
22
20
  private _createZenEditorInstance;
23
21
  private _syncZenEditorSize;
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(d,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/sheets","react","@wendellhu/redi/react-bindings","clsx"],c):(d=typeof globalThis<"u"?globalThis:d||self,c(d.UniverSheetsZenEditor={},d.UniverCore,d["@wendellhu/redi"],d.UniverDocs,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverSheets,d.React,d["@wendellhu/redi/react-bindings"],d.clsx))})(this,function(d,c,v,N,j,b,h,Y,x,E,k,K){"use strict";var be=Object.defineProperty;var xe=(d,c,v)=>c in d?be(d,c,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[c]=v;var R=(d,c,v)=>xe(d,typeof c!="symbol"?c+"":c,v);var V;const P={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:n=>!0};class ee{constructor(){R(this,"_position",null);R(this,"_position$",new Y.BehaviorSubject(null));R(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 B=v.createIdentifier("univer.sheet-zen-editor-manager.service");var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(n,t,i,e)=>{for(var r=e>1?void 0:e?ne(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&te(t,i,r),r},m=(n,t)=>(i,e)=>t(i,e,n);const g="__defaultDocumentZenEditorSpecialUnitId_20231218__";let w=class extends c.RxDisposable{constructor(t,i,e,r,o,s,a,l,u){super();R(this,"_zenEditorInitialState",!1);this._injector=t,this._univerInstanceService=i,this._zenEditorManagerService=e,this._renderManagerService=r,this._commandService=o,this._zenZoneService=s,this._editorBridgeService=a,this._undoRedoService=l,this._textSelectionManagerService=u,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const t={id:g,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],customBlocks:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:c.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,t)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(Y.takeUntil(this.dispose$)).subscribe(t=>{var l;if(t==null)return;const i=b.getEditorObject(g,this._renderManagerService),e=this._univerInstanceService.getUniverDocInstance(g);if(i==null||e==null)return;const{width:r,height:o}=t,{engine:s}=i,a=(l=this._renderManagerService.getRenderById(g))==null?void 0:l.with(N.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open(),this._undoRedoService.clearUndoRedo(g),this._univerInstanceService.focusUnit(g),this._univerInstanceService.setCurrentUnitForType(g),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:j.DeviceInputEventType.PointerDown});const i=this._editorBridgeService.getLatestEditCellState();if(i==null)return;this._editorSyncHandler(i);const e=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(e)}_editorSyncHandler(t){var s,a;const i=(s=t.documentLayoutObject.documentModel)==null?void 0:s.getBody(),e=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];e==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(g,e,r,o))}_syncContentAndRender(t,i,e,r=[],o=[],s={},a=[]){var T;const l=[g,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],u=(T=this._renderManagerService.getRenderById(t))==null?void 0:T.with(N.DocSkeletonManagerService),_=u==null?void 0:u.getSkeleton(),f=this._univerInstanceService.getUniverDocInstance(t),I=u==null?void 0:u.getViewModel();if(f==null||I==null||_==null)return;const p=f.getBody(),y=f.getSnapshot();p.dataStream=i,p.paragraphs=e,p.customBlocks=o,y.drawings=s,y.drawingsOrder=a,t===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(p.textRuns=[]),r.length>0&&(p.textRuns=r),I.reset(f);const z=this._getDocObject();z!=null&&(_.calculate(),l.includes(t)&&z.document.makeDirty())}_calculatePagePosition(t){const{document:i,scene:e,docBackground:r}=t,o=e==null?void 0:e.getParent(),{width:s,height:a,pageMarginLeft:l,pageMarginTop:u}=i;if(o==null||s===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:_,height:f}=o;let I=0,p=0,y=0,z=0,T=Number.POSITIVE_INFINITY;const{scaleX:U,scaleY:ze}=e.getAncestorScale();_>(s+l*2)*U?(I=_/2-s*U/2,I/=U,y=(_-l*2)/U,T=0):(I=l,y=s+l*2,T=(y-_/U)/2),f>a?(p=f/2-a/2,z=(f-u*2)/ze):(p=u,z=a+u*2),e.resize(y,z+200),i.translate(I,p),r.translate(I,p);const W=e.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(T!==Number.POSITIVE_INFINITY&&W!=null){const je=W.transScroll2ViewportScrollValue(T,0).x;W.scrollTo({x:je})}return this}_commandExecutedListener(){const t=[P.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{t.includes(e.id)&&this._handleOpenZenEditor()}));const i=[N.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(i.includes(e.id)){const r=e.params,{unitId:o}=r;if(o===g){const s=this._univerInstanceService.getUniverDocInstance(o),a=s==null?void 0:s.getBody(),l=a==null?void 0:a.dataStream,u=a==null?void 0:a.paragraphs,_=a==null?void 0:a.textRuns,f=a==null?void 0:a.customBlocks,I=s==null?void 0:s.getDrawings(),p=s==null?void 0:s.getDrawingsOrder();if(this._editorBridgeService.changeEditorDirty(!0),l==null||u==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,l,u,_,f,I,p)}}}))}_getDocObject(){return N.getDocObject(this._univerInstanceService,this._renderManagerService)}};w=ie([c.OnLifecycle(c.LifecycleStages.Steady,w),m(0,v.Inject(v.Injector)),m(1,c.IUniverInstanceService),m(2,B),m(3,j.IRenderManagerService),m(4,c.ICommandService),m(5,h.IZenZoneService),m(6,b.IEditorBridgeService),m(7,c.IUndoRedoService),m(8,v.Inject(N.TextSelectionManagerService))],w);const Z={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(h.IZenZoneService),i=n.get(b.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:j.DeviceInputEventType.Keyboard,keycode:h.KeyCode.ESC}),t.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},L={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async n=>{const t=n.get(h.IZenZoneService),i=n.get(b.IEditorBridgeService),e=n.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:j.DeviceInputEventType.PointerDown}),t.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function re(n){return{id:P.id,group:h.MenuGroup.CONTEXT_MENU_OTHERS,type:h.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[h.MenuPosition.CONTEXT_MENU],disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[x.WorkbookEditablePermission],worksheetTypes:[x.WorksheetEditPermission,x.WorksheetSetCellValuePermission,x.WorksheetSetCellStylePermission],rangeTypes:[x.RangeProtectionPermissionEditPoint]})}}var H={exports:{}},A={};/**
1
+ (function(d,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets"),require("react"),require("@wendellhu/redi/react-bindings"),require("clsx")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/sheets","react","@wendellhu/redi/react-bindings","clsx"],c):(d=typeof globalThis<"u"?globalThis:d||self,c(d.UniverSheetsZenEditor={},d.UniverCore,d["@wendellhu/redi"],d.UniverDocs,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverSheets,d.React,d["@wendellhu/redi/react-bindings"],d.clsx))})(this,function(d,c,_,z,U,j,v,Y,x,E,k,K){"use strict";var Ue=Object.defineProperty;var je=(d,c,_)=>c in d?Ue(d,c,{enumerable:!0,configurable:!0,writable:!0,value:_}):d[c]=_;var N=(d,c,_)=>je(d,typeof c!="symbol"?c+"":c,_);var V;const P={id:"zen-editor.operation.open-zen-editor",type:c.CommandType.OPERATION,handler:t=>!0};class ee{constructor(){N(this,"_position",null);N(this,"_position$",new Y.BehaviorSubject(null));N(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 B=_.createIdentifier("univer.sheet-zen-editor-manager.service");var ne=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ie=(t,n,i,e)=>{for(var r=e>1?void 0:e?te(n,i):n,o=t.length-1,s;o>=0;o--)(s=t[o])&&(r=(e?s(n,i,r):s(r))||r);return e&&r&&ne(n,i,r),r},C=(t,n)=>(i,e)=>n(i,e,t);const f="__defaultDocumentZenEditorSpecialUnitId_20231218__";let w=class extends c.RxDisposable{constructor(n,i,e,r,o,s,a,l){super();N(this,"_zenEditorInitialState",!1);this._univerInstanceService=n,this._zenEditorManagerService=i,this._renderManagerService=e,this._commandService=r,this._zenZoneService=o,this._editorBridgeService=s,this._undoRedoService=a,this._textSelectionManagerService=l,this._initialize()}_initialize(){this._syncZenEditorSize(),this._commandExecutedListener()}_createZenEditorInstance(){const n={id:f,body:{dataStream:`${c.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],customBlocks:[],paragraphs:[{startIndex:0}]},documentStyle:{pageSize:{width:595,height:842},documentFlavor:c.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};return this._univerInstanceService.createUnit(c.UniverInstanceType.UNIVER_DOC,n)}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(Y.takeUntil(this.dispose$)).subscribe(n=>{var l;if(n==null)return;const i=j.getEditorObject(f,this._renderManagerService),e=this._univerInstanceService.getUniverDocInstance(f);if(i==null||e==null)return;const{width:r,height:o}=n,{engine:s}=i,a=(l=this._renderManagerService.getRenderById(f))==null?void 0:l.with(z.DocSkeletonManagerService).getSkeleton();requestIdleCallback(()=>{s.resizeBySize(r,o),this._calculatePagePosition(i),a&&this._textSelectionManagerService.refreshSelection()})})}_handleOpenZenEditor(){var o;this._zenEditorInitialState||(this._createZenEditorInstance(),this._zenEditorInitialState=!0),this._zenZoneService.open();const n=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);this._undoRedoService.clearUndoRedo(f),this._univerInstanceService.focusUnit(f),this._univerInstanceService.setCurrentUnitForType(f),this._editorBridgeService.isVisible().visible===!1&&this._editorBridgeService.changeVisible({visible:!0,eventType:U.DeviceInputEventType.PointerDown,unitId:(o=n==null?void 0:n.getUnitId())!=null?o:""});const e=this._editorBridgeService.getLatestEditCellState();if(e==null)return;this._editorSyncHandler(e);const r=[{startOffset:0,endOffset:0}];this._textSelectionManagerService.replaceTextRanges(r)}_editorSyncHandler(n){var s,a;const i=(s=n.documentLayoutObject.documentModel)==null?void 0:s.getBody(),e=i==null?void 0:i.dataStream,r=i==null?void 0:i.paragraphs;let o=[];e==null||r==null||((a=i==null?void 0:i.textRuns)!=null&&a.length&&(o=i==null?void 0:i.textRuns),this._syncContentAndRender(f,e,r,o))}_syncContentAndRender(n,i,e,r=[],o=[],s={},a=[],l=[]){var O;const p=[f,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY],u=(O=this._renderManagerService.getRenderById(n))==null?void 0:O.with(z.DocSkeletonManagerService),I=u==null?void 0:u.getSkeleton(),S=this._univerInstanceService.getUniverDocInstance(n),m=u==null?void 0:u.getViewModel();if(S==null||m==null||I==null)return;const h=S.getBody(),b=S.getSnapshot();h.dataStream=i,h.paragraphs=e,h.customBlocks=o,h.customRanges=l,b.drawings=s,b.drawingsOrder=a,n===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&(h.textRuns=[]),r.length>0&&(h.textRuns=r),m.reset(S);const R=this._getDocObject();R!=null&&(I.calculate(),p.includes(n)&&R.document.makeDirty())}_calculatePagePosition(n){const{document:i,scene:e,docBackground:r}=n,o=e==null?void 0:e.getParent(),{width:s,height:a,pageMarginLeft:l,pageMarginTop:p}=i;if(o==null||s===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:u,height:I}=o;let S=0,m=0,h=0,b=0,R=Number.POSITIVE_INFINITY;const{scaleX:O,scaleY:ze}=e.getAncestorScale();u>(s+l*2)*O?(S=u/2-s*O/2,S/=O,h=(u-l*2)/O,R=0):(S=l,h=s+l*2,R=(h-u/O)/2),I>a?(m=I/2-a/2,b=(I-p*2)/ze):(m=p,b=a+p*2),e.resize(h,b+200),i.translate(S,m),r.translate(S,m);const W=e.getViewport(z.VIEWPORT_KEY.VIEW_MAIN);if(R!==Number.POSITIVE_INFINITY&&W!=null){const be=W.transScroll2ViewportScrollValue(R,0).x;W.scrollTo({x:be})}return this}_commandExecutedListener(){const n=[P.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{n.includes(e.id)&&this._handleOpenZenEditor()}));const i=[z.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(i.includes(e.id)){const r=e.params,{unitId:o}=r;if(o===f){const s=this._univerInstanceService.getUniverDocInstance(o),a=s==null?void 0:s.getBody(),l=a==null?void 0:a.dataStream,p=a==null?void 0:a.paragraphs,u=a==null?void 0:a.textRuns,I=a==null?void 0:a.customBlocks,S=s==null?void 0:s.getDrawings(),m=s==null?void 0:s.getDrawingsOrder(),h=s==null?void 0:s.getCustomRanges();if(this._editorBridgeService.changeEditorDirty(!0),l==null||p==null)return;this._syncContentAndRender(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,l,p,u,I,S,m,h)}}}))}_getDocObject(){return z.getDocObject(this._univerInstanceService,this._renderManagerService)}};w=ie([c.OnLifecycle(c.LifecycleStages.Steady,w),C(0,c.IUniverInstanceService),C(1,B),C(2,U.IRenderManagerService),C(3,c.ICommandService),C(4,v.IZenZoneService),C(5,j.IEditorBridgeService),C(6,c.IUndoRedoService),C(7,_.Inject(z.TextSelectionManagerService))],w);const Z={id:"zen-editor.command.cancel-zen-edit",type:c.CommandType.COMMAND,handler:async t=>{const n=t.get(v.IZenZoneService),i=t.get(j.IEditorBridgeService),e=t.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:U.DeviceInputEventType.Keyboard,keycode:v.KeyCode.ESC,unitId:""}),n.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},L={id:"zen-editor.command.confirm-zen-edit",type:c.CommandType.COMMAND,handler:async t=>{const n=t.get(v.IZenZoneService),i=t.get(j.IEditorBridgeService),e=t.get(c.IUniverInstanceService);i.isVisible().visible&&i.changeVisible({visible:!1,eventType:U.DeviceInputEventType.PointerDown,unitId:""}),n.close();const o=e.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);return o?(e.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}};function re(t){return{id:P.id,group:v.MenuGroup.CONTEXT_MENU_OTHERS,type:v.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",positions:[v.MenuPosition.CONTEXT_MENU],disabled$:j.getCurrentRangeDisable$(t,{workbookTypes:[x.WorkbookEditablePermission],worksheetTypes:[x.WorksheetEditPermission,x.WorksheetSetCellValuePermission,x.WorksheetSetCellStylePermission],rangeTypes:[x.RangeProtectionPermissionEditPoint]})}}var H={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var se=E,oe=Symbol.for("react.element"),ce=Symbol.for("react.fragment"),ae=Object.prototype.hasOwnProperty,de=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,le={key:!0,ref:!0,__self:!0,__source:!0};function X(n,t,i){var e,r={},o=null,s=null;i!==void 0&&(o=""+i),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(e in t)ae.call(t,e)&&!le.hasOwnProperty(e)&&(r[e]=t[e]);if(n&&n.defaultProps)for(e in t=n.defaultProps,t)r[e]===void 0&&(r[e]=t[e]);return{$$typeof:oe,type:n,key:o,ref:s,props:r,_owner:de.current}}A.Fragment=ce,A.jsx=X,A.jsxs=X,H.exports=A;var C=H.exports,S=function(){return S=Object.assign||function(n){for(var t,i=1,e=arguments.length;i<e;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},S.apply(this,arguments)},ue=function(n,t){var i={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(n);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(n,e[r])&&(i[e[r]]=n[e[r]]);return i},F=E.forwardRef(function(n,t){var i=n.icon,e=n.id,r=n.className,o=n.extend,s=ue(n,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),l=E.useRef("_".concat(_e()));return $(i,"".concat(e),{defIds:i.defIds,idSuffix:l.current},S({ref:t,className:a},s),o)});function $(n,t,i,e,r){return E.createElement(n.tag,S(S({key:t},ve(n,i,r)),e),(he(n,i).children||[]).map(function(o,s){return $(o,"".concat(t,"-").concat(n.tag,"-").concat(s),i,void 0,r)}))}function ve(n,t,i){var e=S({},n.attrs);i!=null&&i.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=i.colorChannel1);var r=t.defIds;return!r||r.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],a=o[1];typeof a=="string"&&(e[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function he(n,t){var i,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((i=n.children)===null||i===void 0)&&i.length)?S(S({},n),{children:n.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):n}function _e(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";var fe={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"}}]},G=E.forwardRef(function(n,t){return E.createElement(F,Object.assign({},n,{id:"check-mark-single",ref:t,icon:fe}))});G.displayName="CheckMarkSingle";var ge={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"}}]},q=E.forwardRef(function(n,t){return E.createElement(F,Object.assign({},n,{id:"close-single",ref:t,icon:ge}))});q.displayName="CloseSingle";const O={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"},Se="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT";function pe(){const n=E.useRef(null),t=k.useDependency(j.IRenderManagerService),i=k.useDependency(B),e=k.useDependency(c.ICommandService);E.useEffect(()=>{const s=n.current;if(!s)return;const a=t.currentRender$.subscribe(u=>{var f;if(u!==g)return;const _=(f=t.getRenderById(g))==null?void 0:f.engine;_==null||_.setContainer(s)}),l=new ResizeObserver(()=>{const u=s.getBoundingClientRect();i.setPosition(u)});return l.observe(s),()=>{l.unobserve(s),a.unsubscribe()}},[]);function r(){e.executeCommand(Z.id)}function o(){e.executeCommand(L.id)}return C.jsxs("div",{className:O.zenEditor,children:[C.jsxs("div",{className:O.zenEditorIconWrapper,children:[C.jsx("span",{className:K(O.zenEditorIconContainer,O.zenEditorIconError),onClick:r,children:C.jsx(q,{style:{fontSize:"22px"}})}),C.jsx("span",{className:K(O.zenEditorIconContainer,O.zenEditorIconSuccess),onClick:o,children:C.jsx(G,{style:{fontSize:"22px"}})})]}),C.jsx("div",{className:O.zenEditorCanvasContainer,ref:n})]})}const Ee={id:L.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:n=>J(n),binding:h.KeyCode.ENTER|h.MetaKeys.ALT},Ie={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:n=>J(n),binding:h.KeyCode.ESC};function J(n){return n.getContextValue(c.FOCUSING_DOC)&&n.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&n.getContextValue(c.EDITOR_ACTIVATED)&&!n.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var me=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Oe=(n,t,i,e)=>{for(var r=e>1?void 0:e?Ce(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&me(t,i,r),r},D=(n,t)=>(i,e)=>t(i,e,n);const ye={};let M=class extends c.Disposable{constructor(n,t,i,e,r,o){super(),this._config=n,this._injector=t,this._zenZoneService=i,this._commandService=e,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(Se,pe))}_initCommands(){[P,Z,L].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initMenus(){const{menu:n={}}=this._config;[re].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t),n))})}_initShortcuts(){[Ee,Ie].forEach(n=>{this.disposeWithMe(this._shortcutService.registerShortcut(n))})}};M=Oe([c.OnLifecycle(c.LifecycleStages.Rendered,M),D(1,v.Inject(v.Injector)),D(2,h.IZenZoneService),D(3,c.ICommandService),D(4,h.IMenuService),D(5,h.IShortcutService)],M);var Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Ne=(n,t,i,e)=>{for(var r=e>1?void 0:e?Re(t,i):t,o=n.length-1,s;o>=0;o--)(s=n[o])&&(r=(e?s(t,i,r):s(r))||r);return e&&r&&Te(t,i,r),r},Q=(n,t)=>(i,e)=>t(i,e,n);d.UniverSheetsZenEditorPlugin=(V=class extends c.Plugin{constructor(t={},i,e){super(),this._config=t,this._injector=i,this._localeService=e,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},ye,this._config)}_initializeDependencies(t){[[M,{useFactory:()=>this._injector.createInstance(M,this._config)}],[w],[B,{useClass:ee}]].forEach(e=>t.add(e))}},R(V,"pluginName","zen-editor"),R(V,"type",c.UniverInstanceType.UNIVER_DOC),V),d.UniverSheetsZenEditorPlugin=Ne([Q(1,v.Inject(v.Injector)),Q(2,v.Inject(c.LocaleService))],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=Z,d.ConfirmZenEditCommand=L,d.OpenZenEditorOperation=P,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
9
+ */var se=E,oe=Symbol.for("react.element"),ce=Symbol.for("react.fragment"),ae=Object.prototype.hasOwnProperty,de=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,le={key:!0,ref:!0,__self:!0,__source:!0};function X(t,n,i){var e,r={},o=null,s=null;i!==void 0&&(o=""+i),n.key!==void 0&&(o=""+n.key),n.ref!==void 0&&(s=n.ref);for(e in n)ae.call(n,e)&&!le.hasOwnProperty(e)&&(r[e]=n[e]);if(t&&t.defaultProps)for(e in n=t.defaultProps,n)r[e]===void 0&&(r[e]=n[e]);return{$$typeof:oe,type:t,key:o,ref:s,props:r,_owner:de.current}}A.Fragment=ce,A.jsx=X,A.jsxs=X,H.exports=A;var y=H.exports,g=function(){return g=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g.apply(this,arguments)},ue=function(t,n){var i={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(i[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(t);r<e.length;r++)n.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(t,e[r])&&(i[e[r]]=t[e[r]]);return i},F=E.forwardRef(function(t,n){var i=t.icon,e=t.id,r=t.className,o=t.extend,s=ue(t,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),l=E.useRef("_".concat(_e()));return $(i,"".concat(e),{defIds:i.defIds,idSuffix:l.current},g({ref:n,className:a},s),o)});function $(t,n,i,e,r){return E.createElement(t.tag,g(g({key:n},ve(t,i,r)),e),(he(t,i).children||[]).map(function(o,s){return $(o,"".concat(n,"-").concat(t.tag,"-").concat(s),i,void 0,r)}))}function ve(t,n,i){var e=g({},t.attrs);i!=null&&i.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=i.colorChannel1);var r=n.defIds;return!r||r.length===0||(t.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+n.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],a=o[1];typeof a=="string"&&(e[s]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),e}function he(t,n){var i,e=n.defIds;return!e||e.length===0?t:t.tag==="defs"&&(!((i=t.children)===null||i===void 0)&&i.length)?g(g({},t),{children:t.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):t}function _e(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";var fe={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"}}]},G=E.forwardRef(function(t,n){return E.createElement(F,Object.assign({},t,{id:"check-mark-single",ref:n,icon:fe}))});G.displayName="CheckMarkSingle";var ge={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"}}]},q=E.forwardRef(function(t,n){return E.createElement(F,Object.assign({},t,{id:"close-single",ref:n,icon:ge}))});q.displayName="CloseSingle";const T={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"},pe="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT";function Se(){const t=E.useRef(null),n=k.useDependency(U.IRenderManagerService),i=k.useDependency(B),e=k.useDependency(c.ICommandService);E.useEffect(()=>{const s=t.current;if(!s)return;const a=n.currentRender$.subscribe(p=>{var I;if(p!==f)return;const u=(I=n.getRenderById(f))==null?void 0:I.engine;u==null||u.setContainer(s)}),l=new ResizeObserver(()=>{const p=s.getBoundingClientRect();i.setPosition(p)});return l.observe(s),()=>{l.unobserve(s),a.unsubscribe()}},[]);function r(){e.executeCommand(Z.id)}function o(){e.executeCommand(L.id)}return y.jsxs("div",{className:T.zenEditor,children:[y.jsxs("div",{className:T.zenEditorIconWrapper,children:[y.jsx("span",{className:K(T.zenEditorIconContainer,T.zenEditorIconError),onClick:r,children:y.jsx(q,{style:{fontSize:"22px"}})}),y.jsx("span",{className:K(T.zenEditorIconContainer,T.zenEditorIconSuccess),onClick:o,children:y.jsx(G,{style:{fontSize:"22px"}})})]}),y.jsx("div",{className:T.zenEditorCanvasContainer,ref:t})]})}const Ie={id:L.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:t=>J(t),binding:v.KeyCode.ENTER|v.MetaKeys.ALT},Ee={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:t=>J(t),binding:v.KeyCode.ESC};function J(t){return t.getContextValue(c.FOCUSING_DOC)&&t.getContextValue(c.FOCUSING_UNIVER_EDITOR)&&t.getContextValue(c.EDITOR_ACTIVATED)&&!t.getContextValue(c.FOCUSING_EDITOR_STANDALONE)}var me=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,Oe=(t,n,i,e)=>{for(var r=e>1?void 0:e?Ce(n,i):n,o=t.length-1,s;o>=0;o--)(s=t[o])&&(r=(e?s(n,i,r):s(r))||r);return e&&r&&me(n,i,r),r},M=(t,n)=>(i,e)=>n(i,e,t);const ye={};let D=class extends c.Disposable{constructor(t,n,i,e,r,o){super(),this._config=t,this._injector=n,this._zenZoneService=i,this._commandService=e,this._menuService=r,this._shortcutService=o,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(pe,Se))}_initCommands(){[P,Z,L].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenus(){const{menu:t={}}=this._config;[re].forEach(n=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(n),t))})}_initShortcuts(){[Ie,Ee].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}};D=Oe([c.OnLifecycle(c.LifecycleStages.Rendered,D),M(1,_.Inject(_.Injector)),M(2,v.IZenZoneService),M(3,c.ICommandService),M(4,v.IMenuService),M(5,v.IShortcutService)],D);var Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Ne=(t,n,i,e)=>{for(var r=e>1?void 0:e?Re(n,i):n,o=t.length-1,s;o>=0;o--)(s=t[o])&&(r=(e?s(n,i,r):s(r))||r);return e&&r&&Te(n,i,r),r},Q=(t,n)=>(i,e)=>n(i,e,t);d.UniverSheetsZenEditorPlugin=(V=class extends c.Plugin{constructor(n={},i,e){super(),this._config=n,this._injector=i,this._localeService=e,this._initializeDependencies(this._injector),this._config=c.Tools.deepMerge({},ye,this._config)}_initializeDependencies(n){[[D,{useFactory:()=>this._injector.createInstance(D,this._config)}],[w],[B,{useClass:ee}]].forEach(e=>n.add(e))}},N(V,"pluginName","zen-editor"),N(V,"type",c.UniverInstanceType.UNIVER_DOC),V),d.UniverSheetsZenEditorPlugin=Ne([Q(1,_.Inject(_.Injector)),Q(2,_.Inject(c.LocaleService))],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=Z,d.ConfirmZenEditCommand=L,d.OpenZenEditorOperation=P,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -50,38 +50,38 @@
50
50
  "lib"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@wendellhu/redi": "0.15.5",
53
+ "@wendellhu/redi": "0.16.0",
54
54
  "clsx": ">=2.0.0",
55
55
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
56
56
  "rxjs": ">=7.0.0",
57
- "@univerjs/core": "0.2.3",
58
- "@univerjs/engine-render": "0.2.3",
59
- "@univerjs/docs": "0.2.3",
60
- "@univerjs/sheets": "0.2.3",
61
- "@univerjs/sheets-ui": "0.2.3",
62
- "@univerjs/ui": "0.2.3"
57
+ "@univerjs/core": "0.2.4",
58
+ "@univerjs/engine-render": "0.2.4",
59
+ "@univerjs/docs": "0.2.4",
60
+ "@univerjs/sheets": "0.2.4",
61
+ "@univerjs/ui": "0.2.4",
62
+ "@univerjs/sheets-ui": "0.2.4"
63
63
  },
64
64
  "dependencies": {
65
- "@univerjs/icons": "^0.1.58",
66
- "@univerjs/sheets": "0.2.3"
65
+ "@univerjs/icons": "^0.1.65",
66
+ "@univerjs/sheets": "0.2.4"
67
67
  },
68
68
  "devDependencies": {
69
- "@wendellhu/redi": "0.15.5",
69
+ "@wendellhu/redi": "0.16.0",
70
70
  "clsx": "^2.1.1",
71
71
  "less": "^4.2.0",
72
72
  "react": "18.3.1",
73
73
  "rxjs": "^7.8.1",
74
74
  "typescript": "^5.5.3",
75
- "vite": "^5.3.3",
76
- "vitest": "^1.6.0",
77
- "@univerjs/design": "0.2.3",
78
- "@univerjs/docs": "0.2.3",
79
- "@univerjs/core": "0.2.3",
80
- "@univerjs/engine-render": "0.2.3",
81
- "@univerjs/shared": "0.2.3",
82
- "@univerjs/sheets-ui": "0.2.3",
83
- "@univerjs/sheets": "0.2.3",
84
- "@univerjs/ui": "0.2.3"
75
+ "vite": "^5.3.4",
76
+ "vitest": "^2.0.3",
77
+ "@univerjs/core": "0.2.4",
78
+ "@univerjs/design": "0.2.4",
79
+ "@univerjs/engine-render": "0.2.4",
80
+ "@univerjs/docs": "0.2.4",
81
+ "@univerjs/shared": "0.2.4",
82
+ "@univerjs/sheets": "0.2.4",
83
+ "@univerjs/sheets-ui": "0.2.4",
84
+ "@univerjs/ui": "0.2.4"
85
85
  },
86
86
  "univerSpace": {
87
87
  ".": {