@univerjs/sheets-zen-editor 0.8.0-beta.0 → 0.8.0-nightly.202505271607

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,7 +1,7 @@
1
- "use strict";var q=Object.defineProperty;var H=(e,t,i)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var p=(e,t,i)=>H(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),N=require("@univerjs/docs-ui"),F=require("@univerjs/engine-render"),h=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),S=require("react/jsx-runtime"),k=require("@univerjs/design"),v=require("react"),R=require("rxjs"),O=require("@univerjs/sheets"),U={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var y;const t=e.get(d.IZenZoneService),i=e.get(N.IEditorService),n=e.get(h.IEditorBridgeService),r=e.get(s.IUniverInstanceService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.open();const c=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=n.getLatestEditCellState();if(a==null)return!1;const l=(y=a.documentLayoutObject.documentModel)==null?void 0:y.getSnapshot();if(l==null)return!1;r.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:u,drawings:I,drawingsOrder:f,tableSource:_,settings:E}=s.Tools.deepClone(l),C={...c.getDocumentData(),body:u,drawings:I,drawingsOrder:f,tableSource:_,settings:E},m=[{startOffset:0,endOffset:0,collapsed:!0}];return c.focus(),c.setDocumentData(C,m),c.clearUndoRedoHistory(),!0}},Z={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const t=e.get(d.IZenZoneService),i=e.get(h.IEditorBridgeService),n=e.get(s.IUniverInstanceService),r=e.get(d.ISidebarService);r.visible&&(r.close(),await s.delayAnimationFrame()),t.close();const o=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return o?(n.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},P={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var u;const t=e.get(d.IZenZoneService),i=e.get(h.IEditorBridgeService),n=e.get(s.IUniverInstanceService),r=e.get(N.IEditorService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.close();const c=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=e.get(F.IRenderManagerService),l=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(l){const I=l.getUnitId(),f=(u=a.getRenderById(I))==null?void 0:u.with(h.EditingRenderController);if(f){const _=s.Tools.deepClone(c.getDocumentData());_.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,f.submitCellData(new s.DocumentDataModel(_))}return n.focusUnit(l.getUnitId()),i.refreshEditCellState(),!0}return!1}},G="sheets-zen-editor.config",B={};var g=function(){return g=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},g.apply(this,arguments)},X=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},j=v.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,o=e.extend,c=X(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),l=v.useRef("_".concat(ee()));return $(i,"".concat(n),{defIds:i.defIds,idSuffix:l.current},g({ref:t,className:a},c),o)});function $(e,t,i,n,r){return v.createElement(e.tag,g(g({key:t},J(e,i,r)),n),(Q(e,i).children||[]).map(function(o,c){return $(o,"".concat(t,"-").concat(e.tag,"-").concat(c),i,void 0,r)}))}function J(e,t,i){var n=g({},e.attrs);i!=null&&i.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=i.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(o){var c=o[0],a=o[1];c==="mask"&&typeof a=="string"&&(n[c]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var c=o[0],a=o[1];typeof a=="string"&&(n[c]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Q(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?g(g({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function ee(){return Math.random().toString(36).substring(2,8)}j.displayName="UniverIcon";var te={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},V=v.forwardRef(function(e,t){return v.createElement(j,Object.assign({},e,{id:"check-mark-single",ref:t,icon:te}))});V.displayName="CheckMarkSingle";var ne={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},Y=v.forwardRef(function(e,t){return v.createElement(j,Object.assign({},e,{id:"close-single",ref:t,icon:ne}))});Y.displayName="CloseSingle";class ie{constructor(){p(this,"_position",null);p(this,"_position$",new R.BehaviorSubject(null));p(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 z=s.createIdentifier("univer.sheet-zen-editor-manager.service"),re="ZEN_EDITOR_PLUGIN_",oe=`${re}ZEN_EDITOR_COMPONENT`,se={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ce(){const e=v.useRef(null),t=d.useDependency(z),i=d.useDependency(N.IEditorService),n=d.useDependency(s.ICommandService);v.useEffect(()=>{const a=e.current;if(!a)return;const l=i.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:se,scrollBar:!0,backScrollOffset:100},a),u=new ResizeObserver(()=>{t.setPosition(a.getBoundingClientRect())});return u.observe(a),()=>{l.dispose(),u.unobserve(a)}},[]);function r(){const a=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),n.executeCommand(Z.id)}function o(){const a=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),n.executeCommand(P.id)}const c="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return S.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white",children:[S.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[S.jsx("span",{className:k.clsx(c,`
1
+ "use strict";var q=Object.defineProperty;var H=(e,t,i)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var C=(e,t,i)=>H(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),N=require("@univerjs/docs-ui"),F=require("@univerjs/engine-render"),h=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),I=require("react/jsx-runtime"),k=require("@univerjs/design"),v=require("react"),R=require("rxjs"),O=require("@univerjs/sheets"),w={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var y;const t=e.get(d.IZenZoneService),i=e.get(N.IEditorService),n=e.get(h.IEditorBridgeService),r=e.get(s.IUniverInstanceService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.open();const c=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=n.getLatestEditCellState();if(a==null)return!1;const l=(y=a.documentLayoutObject.documentModel)==null?void 0:y.getSnapshot();if(l==null)return!1;r.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:u,drawings:S,drawingsOrder:f,tableSource:_,settings:E}=s.Tools.deepClone(l),p={...c.getDocumentData(),body:u,drawings:S,drawingsOrder:f,tableSource:_,settings:E},m=[{startOffset:0,endOffset:0,collapsed:!0}];return c.focus(),c.setDocumentData(p,m),c.clearUndoRedoHistory(),!0}},U={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const t=e.get(d.IZenZoneService),i=e.get(h.IEditorBridgeService),n=e.get(s.IUniverInstanceService),r=e.get(d.ISidebarService);r.visible&&(r.close(),await s.delayAnimationFrame()),t.close();const o=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return o?(n.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},Z={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var u;const t=e.get(d.IZenZoneService),i=e.get(h.IEditorBridgeService),n=e.get(s.IUniverInstanceService),r=e.get(N.IEditorService),o=e.get(d.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),t.close();const c=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(c==null)return!1;const a=e.get(F.IRenderManagerService),l=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(l){const S=l.getUnitId(),f=(u=a.getRenderById(S))==null?void 0:u.with(h.EditingRenderController);if(f){const _=s.Tools.deepClone(c.getDocumentData());_.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,f.submitCellData(new s.DocumentDataModel(_))}return n.focusUnit(l.getUnitId()),i.refreshEditCellState(),!0}return!1}},G="sheets-zen-editor.config",B={};var g=function(){return g=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},g.apply(this,arguments)},X=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i},j=v.forwardRef(function(e,t){var i=e.icon,n=e.id,r=e.className,o=e.extend,c=X(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),l=v.useRef("_".concat(ee()));return $(i,"".concat(n),{defIds:i.defIds,idSuffix:l.current},g({ref:t,className:a},c),o)});function $(e,t,i,n,r){return v.createElement(e.tag,g(g({key:t},J(e,i,r)),n),(Q(e,i).children||[]).map(function(o,c){return $(o,"".concat(t,"-").concat(e.tag,"-").concat(c),i,void 0,r)}))}function J(e,t,i){var n=g({},e.attrs);i!=null&&i.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=i.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(o){var c=o[0],a=o[1];c==="mask"&&typeof a=="string"&&(n[c]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var c=o[0],a=o[1];typeof a=="string"&&(n[c]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Q(e,t){var i,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?g(g({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function ee(){return Math.random().toString(36).substring(2,8)}j.displayName="UniverIcon";var te={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},V=v.forwardRef(function(e,t){return v.createElement(j,Object.assign({},e,{id:"check-mark-icon",ref:t,icon:te}))});V.displayName="CheckMarkIcon";var ne={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},Y=v.forwardRef(function(e,t){return v.createElement(j,Object.assign({},e,{id:"close-icon",ref:t,icon:ne}))});Y.displayName="CloseIcon";class ie{constructor(){C(this,"_position",null);C(this,"_position$",new R.BehaviorSubject(null));C(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 z=s.createIdentifier("univer.sheet-zen-editor-manager.service"),re="ZEN_EDITOR_PLUGIN_",oe=`${re}ZEN_EDITOR_COMPONENT`,se={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ce(){const e=v.useRef(null),t=d.useDependency(z),i=d.useDependency(N.IEditorService),n=d.useDependency(s.ICommandService);v.useEffect(()=>{const a=e.current;if(!a)return;const l=i.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:se,scrollBar:!0,backScrollOffset:100},a),u=new ResizeObserver(()=>{t.setPosition(a.getBoundingClientRect())});return u.observe(a),()=>{l.dispose(),u.unobserve(a)}},[]);function r(){const a=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),n.executeCommand(U.id)}function o(){const a=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);a==null||a.blur(),n.executeCommand(Z.id)}const c="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return I.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white",children:[I.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[I.jsx("span",{className:k.clsx(c,`
2
2
  univer-text-red-500
3
3
  hover:univer-text-red-600
4
- `),onClick:r,children:S.jsx(Y,{className:"univer-size-5"})}),S.jsx("span",{className:k.clsx(c,`
4
+ `),onClick:r,children:I.jsx(Y,{className:"univer-size-5"})}),I.jsx("span",{className:k.clsx(c,`
5
5
  univer-text-green-500
6
6
  hover:univer-text-green-600
7
- `),onClick:o,children:S.jsx(V,{className:"univer-size-5"})})]}),S.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}function ae(e){const t=e.get(h.IEditorBridgeService);return{id:U.id,type:d.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:h.getCurrentExclusiveRangeInterest$(e),disabled$:t.currentEditCell$.pipe(R.switchMap(i=>h.getCurrentRangeDisable$(e,{workbookTypes:[O.WorkbookEditablePermission],worksheetTypes:[O.WorksheetEditPermission,O.WorksheetSetCellValuePermission,O.WorksheetSetCellStylePermission],rangeTypes:[O.RangeProtectionPermissionEditPoint]}).pipe(R.map(n=>{var r,o,c,a;return n||((a=(c=(o=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:o.customBlocks)==null?void 0:c.length)!=null?a:0)>0}))))}}const de={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{[U.id]:{order:2,menuItemFactory:ae}}}},le={id:P.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ENTER|d.MetaKeys.ALT},ue={id:Z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ESC};function K(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var ge=Object.getOwnPropertyDescriptor,fe=(e,t,i,n)=>{for(var r=n>1?void 0:n?ge(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},D=(e,t)=>(i,n)=>t(i,n,e);let M=class extends s.Disposable{constructor(e,t,i,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=i,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(oe,ce))}_initCommands(){[U,Z,P].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(de)}_initShortcuts(){[le,ue].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};M=fe([D(0,d.IZenZoneService),D(1,s.ICommandService),D(2,d.IMenuManagerService),D(3,d.IShortcutService)],M);var ve=Object.getOwnPropertyDescriptor,he=(e,t,i,n)=>{for(var r=n>1?void 0:n?ve(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},A=(e,t)=>(i,n)=>t(i,n,e);let x=class extends s.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(R.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:i}=e,n=h.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,i),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:i,docBackground:n}=e,r=i==null?void 0:i.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:l}=t;if(r==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:u,height:I}=r;let f=0;const _=l;let E=0,T=0,C=Number.POSITIVE_INFINITY;const{scaleX:m,scaleY:y}=i.getAncestorScale();u>(o+a*2)*m?(f=u/2-o*m/2,f/=m,E=(u-a*2)/m,C=0):(f=a,E=o+a*2,C=(E-u/m)/2),I>c?T=(I-l*2)/y:T=c+l*2,i.resize(E,T),t.translate(f,_),n.translate(f,_);const w=i.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&w!=null){const W=w.transScroll2ViewportScrollValue(C,0).x;w.scrollToBarPos({x:W})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(N.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};x=he([A(0,z),A(1,F.IRenderManagerService)],x);var _e=Object.getOwnPropertyDescriptor,me=(e,t,i,n)=>{for(var r=n>1?void 0:n?_e(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},L=(e,t)=>(i,n)=>t(i,n,e),b;exports.UniverSheetsZenEditorPlugin=(b=class extends s.Plugin{constructor(t=B,i,n){super(),this._config=t,this._injector=i,this._configService=n;const{menu:r,...o}=s.merge({},B,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(G,o),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[M],[x],[z,{useClass:ie}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(x)}},p(b,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),p(b,"type",s.UniverInstanceType.UNIVER_SHEET),b);exports.UniverSheetsZenEditorPlugin=me([L(1,s.Inject(s.Injector)),L(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=Z;exports.ConfirmZenEditCommand=P;exports.OpenZenEditorCommand=U;
7
+ `),onClick:o,children:I.jsx(V,{className:"univer-size-5"})})]}),I.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}function ae(e){const t=e.get(h.IEditorBridgeService);return{id:w.id,type:d.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifyIcon",hidden$:h.getCurrentExclusiveRangeInterest$(e),disabled$:t.currentEditCell$.pipe(R.switchMap(i=>h.getCurrentRangeDisable$(e,{workbookTypes:[O.WorkbookEditablePermission],worksheetTypes:[O.WorksheetEditPermission,O.WorksheetSetCellValuePermission,O.WorksheetSetCellStylePermission],rangeTypes:[O.RangeProtectionPermissionEditPoint]}).pipe(R.map(n=>{var r,o,c,a;return n||((a=(c=(o=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:o.customBlocks)==null?void 0:c.length)!=null?a:0)>0}))))}}const de={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{[w.id]:{order:2,menuItemFactory:ae}}}},le={id:Z.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ENTER|d.MetaKeys.ALT},ue={id:U.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>K(e),binding:d.KeyCode.ESC};function K(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var ge=Object.getOwnPropertyDescriptor,fe=(e,t,i,n)=>{for(var r=n>1?void 0:n?ge(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},D=(e,t)=>(i,n)=>t(i,n,e);let x=class extends s.Disposable{constructor(e,t,i,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=i,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(oe,ce))}_initCommands(){[w,U,Z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(de)}_initShortcuts(){[le,ue].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};x=fe([D(0,d.IZenZoneService),D(1,s.ICommandService),D(2,d.IMenuManagerService),D(3,d.IShortcutService)],x);var ve=Object.getOwnPropertyDescriptor,he=(e,t,i,n)=>{for(var r=n>1?void 0:n?ve(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},A=(e,t)=>(i,n)=>t(i,n,e);let M=class extends s.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(R.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:i}=e,n=h.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,i),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:i,docBackground:n}=e,r=i==null?void 0:i.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:l}=t;if(r==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:u,height:S}=r;let f=0;const _=l;let E=0,T=0,p=Number.POSITIVE_INFINITY;const{scaleX:m,scaleY:y}=i.getAncestorScale();u>(o+a*2)*m?(f=u/2-o*m/2,f/=m,E=(u-a*2)/m,p=0):(f=a,E=o+a*2,p=(E-u/m)/2),S>c?T=(S-l*2)/y:T=c+l*2,i.resize(E,T),t.translate(f,_),n.translate(f,_);const P=i.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(p!==Number.POSITIVE_INFINITY&&P!=null){const W=P.transScroll2ViewportScrollValue(p,0).x;P.scrollToBarPos({x:W})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(N.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};M=he([A(0,z),A(1,F.IRenderManagerService)],M);var _e=Object.getOwnPropertyDescriptor,me=(e,t,i,n)=>{for(var r=n>1?void 0:n?_e(t,i):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},L=(e,t)=>(i,n)=>t(i,n,e),b;exports.UniverSheetsZenEditorPlugin=(b=class extends s.Plugin{constructor(t=B,i,n){super(),this._config=t,this._injector=i,this._configService=n;const{menu:r,...o}=s.merge({},B,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(G,o),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[x],[M],[z,{useClass:ie}]].forEach(n=>t.add(n))}onReady(){this._injector.get(x)}onSteady(){this._injector.get(M)}},C(b,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),C(b,"type",s.UniverInstanceType.UNIVER_SHEET),b);exports.UniverSheetsZenEditorPlugin=me([L(1,s.Inject(s.Injector)),L(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=U;exports.ConfirmZenEditCommand=Z;exports.OpenZenEditorCommand=w;
package/lib/es/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var se = Object.defineProperty;
2
2
  var ce = (e, t, i) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
3
  var _ = (e, t, i) => ce(e, typeof t != "symbol" ? t + "" : t, i);
4
- import { CommandType as R, IUniverInstanceService as x, delayAnimationFrame as P, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as K, UniverInstanceType as w, DocumentFlavor as X, DocumentDataModel as ae, createIdentifier as le, ICommandService as q, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as fe, FOCUSING_EDITOR_STANDALONE as he, Disposable as ve, RxDisposable as me, Plugin as pe, merge as _e, Inject as Se, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
4
+ import { CommandType as x, IUniverInstanceService as D, delayAnimationFrame as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as K, UniverInstanceType as P, DocumentFlavor as X, DocumentDataModel as ae, createIdentifier as le, ICommandService as q, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as fe, FOCUSING_EDITOR_STANDALONE as he, Disposable as ve, RxDisposable as me, Plugin as pe, merge as _e, Inject as Se, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
5
5
  import { IEditorService as z, VIEWPORT_KEY as Ee, DocBackScrollRenderController as Oe } from "@univerjs/docs-ui";
6
6
  import { IRenderManagerService as J } from "@univerjs/engine-render";
7
7
  import { IEditorBridgeService as b, EditingRenderController as Ne, getCurrentExclusiveRangeInterest$ as ye, getCurrentRangeDisable$ as be, getEditorObject as Te } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as T, ISidebarService as k, useDependency as D, MenuItemType as Me, ContextMenuPosition as De, ContextMenuGroup as Re, KeyCode as Q, MetaKeys as xe, IMenuManagerService as Pe, IShortcutService as we } from "@univerjs/ui";
8
+ import { IZenZoneService as T, ISidebarService as k, useDependency as w, MenuItemType as Me, ContextMenuPosition as we, ContextMenuGroup as xe, KeyCode as Q, MetaKeys as De, IMenuManagerService as Re, IShortcutService as Pe } from "@univerjs/ui";
9
9
  import { jsxs as V, jsx as S } from "react/jsx-runtime";
10
10
  import { clsx as F } from "@univerjs/design";
11
11
  import { forwardRef as U, useRef as ee, createElement as j, useEffect as ze } from "react";
@@ -13,11 +13,11 @@ import { BehaviorSubject as ke, switchMap as Ue, map as je, takeUntil as Ze } fr
13
13
  import { RangeProtectionPermissionEditPoint as Be, WorksheetEditPermission as Le, WorksheetSetCellValuePermission as Ae, WorksheetSetCellStylePermission as $e, WorkbookEditablePermission as Ve } from "@univerjs/sheets";
14
14
  const Z = {
15
15
  id: "zen-editor.command.open-zen-editor",
16
- type: R.COMMAND,
16
+ type: x.COMMAND,
17
17
  handler: async (e) => {
18
18
  var C;
19
- const t = e.get(T), i = e.get(z), n = e.get(b), r = e.get(x), o = e.get(k);
20
- o.visible && (o.close(), await P()), t.open();
19
+ const t = e.get(T), i = e.get(z), n = e.get(b), r = e.get(D), o = e.get(k);
20
+ o.visible && (o.close(), await R()), t.open();
21
21
  const s = i.getEditor(g);
22
22
  if (s == null)
23
23
  return !1;
@@ -46,24 +46,24 @@ const Z = {
46
46
  }
47
47
  }, B = {
48
48
  id: "zen-editor.command.cancel-zen-edit",
49
- type: R.COMMAND,
49
+ type: x.COMMAND,
50
50
  handler: async (e) => {
51
- const t = e.get(T), i = e.get(b), n = e.get(x), r = e.get(k);
52
- r.visible && (r.close(), await P()), t.close();
53
- const o = n.getCurrentUnitForType(w.UNIVER_SHEET);
51
+ const t = e.get(T), i = e.get(b), n = e.get(D), r = e.get(k);
52
+ r.visible && (r.close(), await R()), t.close();
53
+ const o = n.getCurrentUnitForType(P.UNIVER_SHEET);
54
54
  return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
55
55
  }
56
56
  }, L = {
57
57
  id: "zen-editor.command.confirm-zen-edit",
58
- type: R.COMMAND,
58
+ type: x.COMMAND,
59
59
  handler: async (e) => {
60
60
  var l;
61
- const t = e.get(T), i = e.get(b), n = e.get(x), r = e.get(z), o = e.get(k);
62
- o.visible && (o.close(), await P()), t.close();
61
+ const t = e.get(T), i = e.get(b), n = e.get(D), r = e.get(z), o = e.get(k);
62
+ o.visible && (o.close(), await R()), t.close();
63
63
  const s = r.getEditor(g);
64
64
  if (s == null)
65
65
  return !1;
66
- const c = e.get(J), a = n.getCurrentUnitForType(w.UNIVER_SHEET);
66
+ const c = e.get(J), a = n.getCurrentUnitForType(P.UNIVER_SHEET);
67
67
  if (a) {
68
68
  const v = a.getUnitId(), u = (l = c.getRenderById(v)) == null ? void 0 : l.with(Ne);
69
69
  if (u) {
@@ -121,22 +121,22 @@ function Ge() {
121
121
  return Math.random().toString(36).substring(2, 8);
122
122
  }
123
123
  A.displayName = "UniverIcon";
124
- var Ke = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ne = U(function(e, t) {
124
+ var Ke = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ne = U(function(e, t) {
125
125
  return j(A, Object.assign({}, e, {
126
- id: "check-mark-single",
126
+ id: "check-mark-icon",
127
127
  ref: t,
128
128
  icon: Ke
129
129
  }));
130
130
  });
131
- ne.displayName = "CheckMarkSingle";
132
- var Xe = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ie = U(function(e, t) {
131
+ ne.displayName = "CheckMarkIcon";
132
+ var Xe = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ie = U(function(e, t) {
133
133
  return j(A, Object.assign({}, e, {
134
- id: "close-single",
134
+ id: "close-icon",
135
135
  ref: t,
136
136
  icon: Xe
137
137
  }));
138
138
  });
139
- ie.displayName = "CloseSingle";
139
+ ie.displayName = "CloseIcon";
140
140
  class qe {
141
141
  constructor() {
142
142
  _(this, "_position", null);
@@ -194,7 +194,7 @@ const $ = le(
194
194
  drawingsOrder: []
195
195
  };
196
196
  function tt() {
197
- const e = ee(null), t = D($), i = D(z), n = D(q);
197
+ const e = ee(null), t = w($), i = w(z), n = w(q);
198
198
  ze(() => {
199
199
  const c = e.current;
200
200
  if (!c)
@@ -260,7 +260,7 @@ function nt(e) {
260
260
  id: Z.id,
261
261
  type: Me.BUTTON,
262
262
  title: "rightClick.zenEditor",
263
- icon: "AmplifySingle",
263
+ icon: "AmplifyIcon",
264
264
  hidden$: ye(e),
265
265
  disabled$: t.currentEditCell$.pipe(
266
266
  Ue((i) => be(e, { workbookTypes: [Ve], worksheetTypes: [Le, Ae, $e], rangeTypes: [Be] }).pipe(je((n) => {
@@ -271,8 +271,8 @@ function nt(e) {
271
271
  };
272
272
  }
273
273
  const it = {
274
- [De.MAIN_AREA]: {
275
- [Re.OTHERS]: {
274
+ [we.MAIN_AREA]: {
275
+ [xe.OTHERS]: {
276
276
  [Z.id]: {
277
277
  order: 2,
278
278
  menuItemFactory: nt
@@ -284,7 +284,7 @@ const it = {
284
284
  description: "shortcut.sheet.zen-edit-confirm",
285
285
  group: "4_sheet-edit",
286
286
  preconditions: (e) => re(e),
287
- binding: Q.ENTER | xe.ALT
287
+ binding: Q.ENTER | De.ALT
288
288
  }, ot = {
289
289
  id: B.id,
290
290
  description: "shortcut.sheet.zen-edit-cancel",
@@ -327,8 +327,8 @@ let N = class extends ve {
327
327
  N = ct([
328
328
  E(0, T),
329
329
  E(1, q),
330
- E(2, Pe),
331
- E(3, we)
330
+ E(2, Re),
331
+ E(3, Pe)
332
332
  ], N);
333
333
  var at = Object.getOwnPropertyDescriptor, lt = (e, t, i, n) => {
334
334
  for (var r = n > 1 ? void 0 : n ? at(t, i) : t, o = e.length - 1, s; o >= 0; o--)
@@ -413,7 +413,7 @@ let G = (O = class extends pe {
413
413
  onSteady() {
414
414
  this._injector.get(y);
415
415
  }
416
- }, _(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), _(O, "type", w.UNIVER_SHEET), O);
416
+ }, _(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), _(O, "type", P.UNIVER_SHEET), O);
417
417
  G = ut([
418
418
  Y(1, Se(Ie)),
419
419
  Y(2, Ce)
package/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var se = Object.defineProperty;
2
2
  var ce = (e, t, i) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
3
  var _ = (e, t, i) => ce(e, typeof t != "symbol" ? t + "" : t, i);
4
- import { CommandType as R, IUniverInstanceService as x, delayAnimationFrame as P, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as K, UniverInstanceType as w, DocumentFlavor as X, DocumentDataModel as ae, createIdentifier as le, ICommandService as q, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as fe, FOCUSING_EDITOR_STANDALONE as he, Disposable as ve, RxDisposable as me, Plugin as pe, merge as _e, Inject as Se, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
4
+ import { CommandType as x, IUniverInstanceService as D, delayAnimationFrame as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g, Tools as K, UniverInstanceType as P, DocumentFlavor as X, DocumentDataModel as ae, createIdentifier as le, ICommandService as q, DEFAULT_EMPTY_DOCUMENT_VALUE as de, FOCUSING_DOC as ue, FOCUSING_UNIVER_EDITOR as ge, EDITOR_ACTIVATED as fe, FOCUSING_EDITOR_STANDALONE as he, Disposable as ve, RxDisposable as me, Plugin as pe, merge as _e, Inject as Se, Injector as Ie, IConfigService as Ce } from "@univerjs/core";
5
5
  import { IEditorService as z, VIEWPORT_KEY as Ee, DocBackScrollRenderController as Oe } from "@univerjs/docs-ui";
6
6
  import { IRenderManagerService as J } from "@univerjs/engine-render";
7
7
  import { IEditorBridgeService as b, EditingRenderController as Ne, getCurrentExclusiveRangeInterest$ as ye, getCurrentRangeDisable$ as be, getEditorObject as Te } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as T, ISidebarService as k, useDependency as D, MenuItemType as Me, ContextMenuPosition as De, ContextMenuGroup as Re, KeyCode as Q, MetaKeys as xe, IMenuManagerService as Pe, IShortcutService as we } from "@univerjs/ui";
8
+ import { IZenZoneService as T, ISidebarService as k, useDependency as w, MenuItemType as Me, ContextMenuPosition as we, ContextMenuGroup as xe, KeyCode as Q, MetaKeys as De, IMenuManagerService as Re, IShortcutService as Pe } from "@univerjs/ui";
9
9
  import { jsxs as V, jsx as S } from "react/jsx-runtime";
10
10
  import { clsx as F } from "@univerjs/design";
11
11
  import { forwardRef as U, useRef as ee, createElement as j, useEffect as ze } from "react";
@@ -13,11 +13,11 @@ import { BehaviorSubject as ke, switchMap as Ue, map as je, takeUntil as Ze } fr
13
13
  import { RangeProtectionPermissionEditPoint as Be, WorksheetEditPermission as Le, WorksheetSetCellValuePermission as Ae, WorksheetSetCellStylePermission as $e, WorkbookEditablePermission as Ve } from "@univerjs/sheets";
14
14
  const Z = {
15
15
  id: "zen-editor.command.open-zen-editor",
16
- type: R.COMMAND,
16
+ type: x.COMMAND,
17
17
  handler: async (e) => {
18
18
  var C;
19
- const t = e.get(T), i = e.get(z), n = e.get(b), r = e.get(x), o = e.get(k);
20
- o.visible && (o.close(), await P()), t.open();
19
+ const t = e.get(T), i = e.get(z), n = e.get(b), r = e.get(D), o = e.get(k);
20
+ o.visible && (o.close(), await R()), t.open();
21
21
  const s = i.getEditor(g);
22
22
  if (s == null)
23
23
  return !1;
@@ -46,24 +46,24 @@ const Z = {
46
46
  }
47
47
  }, B = {
48
48
  id: "zen-editor.command.cancel-zen-edit",
49
- type: R.COMMAND,
49
+ type: x.COMMAND,
50
50
  handler: async (e) => {
51
- const t = e.get(T), i = e.get(b), n = e.get(x), r = e.get(k);
52
- r.visible && (r.close(), await P()), t.close();
53
- const o = n.getCurrentUnitForType(w.UNIVER_SHEET);
51
+ const t = e.get(T), i = e.get(b), n = e.get(D), r = e.get(k);
52
+ r.visible && (r.close(), await R()), t.close();
53
+ const o = n.getCurrentUnitForType(P.UNIVER_SHEET);
54
54
  return o ? (n.focusUnit(o.getUnitId()), i.refreshEditCellState(), !0) : !1;
55
55
  }
56
56
  }, L = {
57
57
  id: "zen-editor.command.confirm-zen-edit",
58
- type: R.COMMAND,
58
+ type: x.COMMAND,
59
59
  handler: async (e) => {
60
60
  var l;
61
- const t = e.get(T), i = e.get(b), n = e.get(x), r = e.get(z), o = e.get(k);
62
- o.visible && (o.close(), await P()), t.close();
61
+ const t = e.get(T), i = e.get(b), n = e.get(D), r = e.get(z), o = e.get(k);
62
+ o.visible && (o.close(), await R()), t.close();
63
63
  const s = r.getEditor(g);
64
64
  if (s == null)
65
65
  return !1;
66
- const c = e.get(J), a = n.getCurrentUnitForType(w.UNIVER_SHEET);
66
+ const c = e.get(J), a = n.getCurrentUnitForType(P.UNIVER_SHEET);
67
67
  if (a) {
68
68
  const v = a.getUnitId(), u = (l = c.getRenderById(v)) == null ? void 0 : l.with(Ne);
69
69
  if (u) {
@@ -121,22 +121,22 @@ function Ge() {
121
121
  return Math.random().toString(36).substring(2, 8);
122
122
  }
123
123
  A.displayName = "UniverIcon";
124
- var Ke = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ne = U(function(e, t) {
124
+ var Ke = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ne = U(function(e, t) {
125
125
  return j(A, Object.assign({}, e, {
126
- id: "check-mark-single",
126
+ id: "check-mark-icon",
127
127
  ref: t,
128
128
  icon: Ke
129
129
  }));
130
130
  });
131
- ne.displayName = "CheckMarkSingle";
132
- var Xe = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ie = U(function(e, t) {
131
+ ne.displayName = "CheckMarkIcon";
132
+ var Xe = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ie = U(function(e, t) {
133
133
  return j(A, Object.assign({}, e, {
134
- id: "close-single",
134
+ id: "close-icon",
135
135
  ref: t,
136
136
  icon: Xe
137
137
  }));
138
138
  });
139
- ie.displayName = "CloseSingle";
139
+ ie.displayName = "CloseIcon";
140
140
  class qe {
141
141
  constructor() {
142
142
  _(this, "_position", null);
@@ -194,7 +194,7 @@ const $ = le(
194
194
  drawingsOrder: []
195
195
  };
196
196
  function tt() {
197
- const e = ee(null), t = D($), i = D(z), n = D(q);
197
+ const e = ee(null), t = w($), i = w(z), n = w(q);
198
198
  ze(() => {
199
199
  const c = e.current;
200
200
  if (!c)
@@ -260,7 +260,7 @@ function nt(e) {
260
260
  id: Z.id,
261
261
  type: Me.BUTTON,
262
262
  title: "rightClick.zenEditor",
263
- icon: "AmplifySingle",
263
+ icon: "AmplifyIcon",
264
264
  hidden$: ye(e),
265
265
  disabled$: t.currentEditCell$.pipe(
266
266
  Ue((i) => be(e, { workbookTypes: [Ve], worksheetTypes: [Le, Ae, $e], rangeTypes: [Be] }).pipe(je((n) => {
@@ -271,8 +271,8 @@ function nt(e) {
271
271
  };
272
272
  }
273
273
  const it = {
274
- [De.MAIN_AREA]: {
275
- [Re.OTHERS]: {
274
+ [we.MAIN_AREA]: {
275
+ [xe.OTHERS]: {
276
276
  [Z.id]: {
277
277
  order: 2,
278
278
  menuItemFactory: nt
@@ -284,7 +284,7 @@ const it = {
284
284
  description: "shortcut.sheet.zen-edit-confirm",
285
285
  group: "4_sheet-edit",
286
286
  preconditions: (e) => re(e),
287
- binding: Q.ENTER | xe.ALT
287
+ binding: Q.ENTER | De.ALT
288
288
  }, ot = {
289
289
  id: B.id,
290
290
  description: "shortcut.sheet.zen-edit-cancel",
@@ -327,8 +327,8 @@ let N = class extends ve {
327
327
  N = ct([
328
328
  E(0, T),
329
329
  E(1, q),
330
- E(2, Pe),
331
- E(3, we)
330
+ E(2, Re),
331
+ E(3, Pe)
332
332
  ], N);
333
333
  var at = Object.getOwnPropertyDescriptor, lt = (e, t, i, n) => {
334
334
  for (var r = n > 1 ? void 0 : n ? at(t, i) : t, o = e.length - 1, s; o >= 0; o--)
@@ -413,7 +413,7 @@ let G = (O = class extends pe {
413
413
  onSteady() {
414
414
  this._injector.get(y);
415
415
  }
416
- }, _(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), _(O, "type", w.UNIVER_SHEET), O);
416
+ }, _(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), _(O, "type", P.UNIVER_SHEET), O);
417
417
  G = ut([
418
418
  Y(1, Se(Ie)),
419
419
  Y(2, Ce)
package/lib/umd/index.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs","@univerjs/sheets"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsZenEditor={},d.UniverCore,d.UniverDocsUi,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.React,d.UniverDesign,d.React,d.rxjs,d.UniverSheets))})(this,function(d,s,g,B,S,l,I,A,h,y,T){"use strict";var he=Object.defineProperty;var Se=(d,s,g)=>s in d?he(d,s,{enumerable:!0,configurable:!0,writable:!0,value:g}):d[s]=g;var N=(d,s,g)=>Se(d,typeof s!="symbol"?s+"":s,g);var U;const D={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var w;const n=e.get(l.IZenZoneService),i=e.get(g.IEditorService),t=e.get(S.IEditorBridgeService),r=e.get(s.IUniverInstanceService),o=e.get(l.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),n.open();const a=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(a==null)return!1;const c=t.getLatestEditCellState();if(c==null)return!1;const u=(w=c.documentLayoutObject.documentModel)==null?void 0:w.getSnapshot();if(u==null)return!1;r.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:f,drawings:C,drawingsOrder:_,tableSource:m,settings:p}=s.Tools.deepClone(u),O={...a.getDocumentData(),body:f,drawings:C,drawingsOrder:_,tableSource:m,settings:p},E=[{startOffset:0,endOffset:0,collapsed:!0}];return a.focus(),a.setDocumentData(O,E),a.clearUndoRedoHistory(),!0}},b={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const n=e.get(l.IZenZoneService),i=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),r=e.get(l.ISidebarService);r.visible&&(r.close(),await s.delayAnimationFrame()),n.close();const o=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return o?(t.focusUnit(o.getUnitId()),i.refreshEditCellState(),!0):!1}},M={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var f;const n=e.get(l.IZenZoneService),i=e.get(S.IEditorBridgeService),t=e.get(s.IUniverInstanceService),r=e.get(g.IEditorService),o=e.get(l.ISidebarService);o.visible&&(o.close(),await s.delayAnimationFrame()),n.close();const a=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(a==null)return!1;const c=e.get(B.IRenderManagerService),u=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(u){const C=u.getUnitId(),_=(f=c.getRenderById(C))==null?void 0:f.with(S.EditingRenderController);if(_){const m=s.Tools.deepClone(a.getDocumentData());m.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,_.submitCellData(new s.DocumentDataModel(m))}return t.focusUnit(u.getUnitId()),i.refreshEditCellState(),!0}return!1}},q="sheets-zen-editor.config",L={};var v=function(){return v=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(this,arguments)},H=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]]);return i},x=h.forwardRef(function(e,n){var i=e.icon,t=e.id,r=e.className,o=e.extend,a=H(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),u=h.useRef("_".concat(J()));return F(i,"".concat(t),{defIds:i.defIds,idSuffix:u.current},v({ref:n,className:c},a),o)});function F(e,n,i,t,r){return h.createElement(e.tag,v(v({key:n},G(e,i,r)),t),(X(e,i).children||[]).map(function(o,a){return F(o,"".concat(n,"-").concat(e.tag,"-").concat(a),i,void 0,r)}))}function G(e,n,i){var t=v({},e.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1),e.tag==="mask"&&t.id&&(t.id=t.id+n.idSuffix),Object.entries(t).forEach(function(o){var a=o[0],c=o[1];a==="mask"&&typeof c=="string"&&(t[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))});var r=n.defIds;return!r||r.length===0||(e.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(t[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function X(e,n){var i,t=n.defIds;return!t||t.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?v(v({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?v(v({},r),{attrs:v(v({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):e}function J(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";var Q={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"}}]},$=h.forwardRef(function(e,n){return h.createElement(x,Object.assign({},e,{id:"check-mark-single",ref:n,icon:Q}))});$.displayName="CheckMarkSingle";var ee={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},V=h.forwardRef(function(e,n){return h.createElement(x,Object.assign({},e,{id:"close-single",ref:n,icon:ee}))});V.displayName="CloseSingle";class te{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 z=s.createIdentifier("univer.sheet-zen-editor-manager.service"),ne="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",ie={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function re(){const e=h.useRef(null),n=l.useDependency(z),i=l.useDependency(g.IEditorService),t=l.useDependency(s.ICommandService);h.useEffect(()=>{const c=e.current;if(!c)return;const u=i.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:ie,scrollBar:!0,backScrollOffset:100},c),f=new ResizeObserver(()=>{n.setPosition(c.getBoundingClientRect())});return f.observe(c),()=>{u.dispose(),f.unobserve(c)}},[]);function r(){const c=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);c==null||c.blur(),t.executeCommand(b.id)}function o(){const c=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);c==null||c.blur(),t.executeCommand(M.id)}const a="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return I.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white",children:[I.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[I.jsx("span",{className:A.clsx(a,`
1
+ (function(d,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("rxjs"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","react/jsx-runtime","@univerjs/design","react","rxjs","@univerjs/sheets"],o):(d=typeof globalThis<"u"?globalThis:d||self,o(d.UniverSheetsZenEditor={},d.UniverCore,d.UniverDocsUi,d.UniverEngineRender,d.UniverSheetsUi,d.UniverUi,d.React,d.UniverDesign,d.React,d.rxjs,d.UniverSheets))})(this,function(d,o,g,B,I,l,m,A,_,y,T){"use strict";var _e=Object.defineProperty;var Ie=(d,o,g)=>o in d?_e(d,o,{enumerable:!0,configurable:!0,writable:!0,value:g}):d[o]=g;var N=(d,o,g)=>Ie(d,typeof o!="symbol"?o+"":o,g);var P;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var j;const n=e.get(l.IZenZoneService),i=e.get(g.IEditorService),t=e.get(I.IEditorBridgeService),r=e.get(o.IUniverInstanceService),s=e.get(l.ISidebarService);s.visible&&(s.close(),await o.delayAnimationFrame()),n.open();const a=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(a==null)return!1;const c=t.getLatestEditCellState();if(c==null)return!1;const u=(j=c.documentLayoutObject.documentModel)==null?void 0:j.getSnapshot();if(u==null)return!1;r.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:f,drawings:C,drawingsOrder:h,tableSource:S,settings:p}=o.Tools.deepClone(u),O={...a.getDocumentData(),body:f,drawings:C,drawingsOrder:h,tableSource:S,settings:p},E=[{startOffset:0,endOffset:0,collapsed:!0}];return a.focus(),a.setDocumentData(O,E),a.clearUndoRedoHistory(),!0}},b={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const n=e.get(l.IZenZoneService),i=e.get(I.IEditorBridgeService),t=e.get(o.IUniverInstanceService),r=e.get(l.ISidebarService);r.visible&&(r.close(),await o.delayAnimationFrame()),n.close();const s=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return s?(t.focusUnit(s.getUnitId()),i.refreshEditCellState(),!0):!1}},M={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var f;const n=e.get(l.IZenZoneService),i=e.get(I.IEditorBridgeService),t=e.get(o.IUniverInstanceService),r=e.get(g.IEditorService),s=e.get(l.ISidebarService);s.visible&&(s.close(),await o.delayAnimationFrame()),n.close();const a=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(a==null)return!1;const c=e.get(B.IRenderManagerService),u=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(u){const C=u.getUnitId(),h=(f=c.getRenderById(C))==null?void 0:f.with(I.EditingRenderController);if(h){const S=o.Tools.deepClone(a.getDocumentData());S.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,h.submitCellData(new o.DocumentDataModel(S))}return t.focusUnit(u.getUnitId()),i.refreshEditCellState(),!0}return!1}},q="sheets-zen-editor.config",L={};var v=function(){return v=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(this,arguments)},H=function(e,n){var i={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(i[t[r]]=e[t[r]]);return i},x=_.forwardRef(function(e,n){var i=e.icon,t=e.id,r=e.className,s=e.extend,a=H(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),u=_.useRef("_".concat(J()));return F(i,"".concat(t),{defIds:i.defIds,idSuffix:u.current},v({ref:n,className:c},a),s)});function F(e,n,i,t,r){return _.createElement(e.tag,v(v({key:n},G(e,i,r)),t),(X(e,i).children||[]).map(function(s,a){return F(s,"".concat(n,"-").concat(e.tag,"-").concat(a),i,void 0,r)}))}function G(e,n,i){var t=v({},e.attrs);i!=null&&i.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=i.colorChannel1),e.tag==="mask"&&t.id&&(t.id=t.id+n.idSuffix),Object.entries(t).forEach(function(s){var a=s[0],c=s[1];a==="mask"&&typeof c=="string"&&(t[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))});var r=n.defIds;return!r||r.length===0||(e.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(s){var a=s[0],c=s[1];typeof c=="string"&&(t[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function X(e,n){var i,t=n.defIds;return!t||t.length===0?e:e.tag==="defs"&&(!((i=e.children)===null||i===void 0)&&i.length)?v(v({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?v(v({},r),{attrs:v(v({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):e}function J(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";var Q={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},$=_.forwardRef(function(e,n){return _.createElement(x,Object.assign({},e,{id:"check-mark-icon",ref:n,icon:Q}))});$.displayName="CheckMarkIcon";var ee={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},V=_.forwardRef(function(e,n){return _.createElement(x,Object.assign({},e,{id:"close-icon",ref:n,icon:ee}))});V.displayName="CloseIcon";class te{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 z=o.createIdentifier("univer.sheet-zen-editor-manager.service"),ne="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",ie={id:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:o.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function re(){const e=_.useRef(null),n=l.useDependency(z),i=l.useDependency(g.IEditorService),t=l.useDependency(o.ICommandService);_.useEffect(()=>{const c=e.current;if(!c)return;const u=i.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:ie,scrollBar:!0,backScrollOffset:100},c),f=new ResizeObserver(()=>{n.setPosition(c.getBoundingClientRect())});return f.observe(c),()=>{u.dispose(),f.unobserve(c)}},[]);function r(){const c=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);c==null||c.blur(),t.executeCommand(b.id)}function s(){const c=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);c==null||c.blur(),t.executeCommand(M.id)}const a="univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors";return m.jsxs("div",{className:"univer-absolute univer-inset-0 univer-size-full univer-bg-white",children:[m.jsxs("div",{className:"univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",children:[m.jsx("span",{className:A.clsx(a,`
2
2
  univer-text-red-500
3
3
  hover:univer-text-red-600
4
- `),onClick:r,children:I.jsx(V,{className:"univer-size-5"})}),I.jsx("span",{className:A.clsx(a,`
4
+ `),onClick:r,children:m.jsx(V,{className:"univer-size-5"})}),m.jsx("span",{className:A.clsx(a,`
5
5
  univer-text-green-500
6
6
  hover:univer-text-green-600
7
- `),onClick:o,children:I.jsx($,{className:"univer-size-5"})})]}),I.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}function se(e){const n=e.get(S.IEditorBridgeService);return{id:D.id,type:l.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:S.getCurrentExclusiveRangeInterest$(e),disabled$:n.currentEditCell$.pipe(y.switchMap(i=>S.getCurrentRangeDisable$(e,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]}).pipe(y.map(t=>{var r,o,a,c;return t||((c=(a=(o=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:o.customBlocks)==null?void 0:a.length)!=null?c:0)>0}))))}}const oe={[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:se}}}},ae={id:M.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ENTER|l.MetaKeys.ALT},ce={id:b.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ESC};function Y(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var de=Object.getOwnPropertyDescriptor,le=(e,n,i,t)=>{for(var r=t>1?void 0:t?de(n,i):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(r=a(r)||r);return r},R=(e,n)=>(i,t)=>n(i,t,e);let Z=class extends s.Disposable{constructor(e,n,i,t){super(),this._zenZoneService=e,this._commandService=n,this._menuManagerService=i,this._shortcutService=t,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ne,re))}_initCommands(){[D,b,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(oe)}_initShortcuts(){[ae,ce].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};Z=le([R(0,l.IZenZoneService),R(1,s.ICommandService),R(2,l.IMenuManagerService),R(3,l.IShortcutService)],Z);var ue=Object.getOwnPropertyDescriptor,ve=(e,n,i,t)=>{for(var r=t>1?void 0:t?ue(n,i):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(r=a(r)||r);return r},K=(e,n)=>(i,t)=>n(i,t,e);let P=class extends s.RxDisposable{constructor(e,n){super(),this._zenEditorManagerService=e,this._renderManagerService=n,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(y.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:n,height:i}=e,t=S.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);t!=null&&requestIdleCallback(()=>{t.engine.resizeBySize(n,i),this._calculatePagePosition(t),this._scrollToTop()})})}_calculatePagePosition(e){const{document:n,scene:i,docBackground:t}=e,r=i==null?void 0:i.getParent(),{width:o,height:a,pageMarginLeft:c,pageMarginTop:u}=n;if(r==null||o===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:f,height:C}=r;let _=0;const m=u;let p=0,j=0,O=Number.POSITIVE_INFINITY;const{scaleX:E,scaleY:w}=i.getAncestorScale();f>(o+c*2)*E?(_=f/2-o*E/2,_/=E,p=(f-c*2)/E,O=0):(_=c,p=o+c*2,O=(p-f/E)/2),C>a?j=(C-u*2)/w:j=a+u*2,i.resize(p,j),n.translate(_,m),t.translate(_,m);const k=i.getViewport(g.VIEWPORT_KEY.VIEW_MAIN);if(O!==Number.POSITIVE_INFINITY&&k!=null){const _e=k.transScroll2ViewportScrollValue(O,0).x;k.scrollToBarPos({x:_e})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(g.DocBackScrollRenderController),n={startOffset:0,endOffset:0};e&&e.scrollToRange(n)}};P=ve([K(0,z),K(1,B.IRenderManagerService)],P);var fe=Object.getOwnPropertyDescriptor,ge=(e,n,i,t)=>{for(var r=t>1?void 0:t?fe(n,i):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(r=a(r)||r);return r},W=(e,n)=>(i,t)=>n(i,t,e);d.UniverSheetsZenEditorPlugin=(U=class extends s.Plugin{constructor(n=L,i,t){super(),this._config=n,this._injector=i,this._configService=t;const{menu:r,...o}=s.merge({},L,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(q,o),this._initializeDependencies(this._injector)}_initializeDependencies(n){[[Z],[P],[z,{useClass:te}]].forEach(t=>n.add(t))}onReady(){this._injector.get(Z)}onSteady(){this._injector.get(P)}},N(U,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),N(U,"type",s.UniverInstanceType.UNIVER_SHEET),U),d.UniverSheetsZenEditorPlugin=ge([W(1,s.Inject(s.Injector)),W(2,s.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=b,d.ConfirmZenEditCommand=M,d.OpenZenEditorCommand=D,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
7
+ `),onClick:s,children:m.jsx($,{className:"univer-size-5"})})]}),m.jsx("div",{ref:e,className:"univer-absolute univer-inset-0 univer-size-full"})]})}function oe(e){const n=e.get(I.IEditorBridgeService);return{id:D.id,type:l.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifyIcon",hidden$:I.getCurrentExclusiveRangeInterest$(e),disabled$:n.currentEditCell$.pipe(y.switchMap(i=>I.getCurrentRangeDisable$(e,{workbookTypes:[T.WorkbookEditablePermission],worksheetTypes:[T.WorksheetEditPermission,T.WorksheetSetCellValuePermission,T.WorksheetSetCellStylePermission],rangeTypes:[T.RangeProtectionPermissionEditPoint]}).pipe(y.map(t=>{var r,s,a,c;return t||((c=(a=(s=(r=i==null?void 0:i.documentLayoutObject.documentModel)==null?void 0:r.getBody())==null?void 0:s.customBlocks)==null?void 0:a.length)!=null?c:0)>0}))))}}const se={[l.ContextMenuPosition.MAIN_AREA]:{[l.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:oe}}}},ae={id:M.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ENTER|l.MetaKeys.ALT},ce={id:b.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>Y(e),binding:l.KeyCode.ESC};function Y(e){return e.getContextValue(o.FOCUSING_DOC)&&e.getContextValue(o.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(o.EDITOR_ACTIVATED)&&!e.getContextValue(o.FOCUSING_EDITOR_STANDALONE)}var de=Object.getOwnPropertyDescriptor,le=(e,n,i,t)=>{for(var r=t>1?void 0:t?de(n,i):n,s=e.length-1,a;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r},R=(e,n)=>(i,t)=>n(i,t,e);let w=class extends o.Disposable{constructor(e,n,i,t){super(),this._zenZoneService=e,this._commandService=n,this._menuManagerService=i,this._shortcutService=t,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ne,re))}_initCommands(){[D,b,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(se)}_initShortcuts(){[ae,ce].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};w=le([R(0,l.IZenZoneService),R(1,o.ICommandService),R(2,l.IMenuManagerService),R(3,l.IShortcutService)],w);var ue=Object.getOwnPropertyDescriptor,ve=(e,n,i,t)=>{for(var r=t>1?void 0:t?ue(n,i):n,s=e.length-1,a;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r},K=(e,n)=>(i,t)=>n(i,t,e);let Z=class extends o.RxDisposable{constructor(e,n){super(),this._zenEditorManagerService=e,this._renderManagerService=n,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(y.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:n,height:i}=e,t=I.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);t!=null&&requestIdleCallback(()=>{t.engine.resizeBySize(n,i),this._calculatePagePosition(t),this._scrollToTop()})})}_calculatePagePosition(e){const{document:n,scene:i,docBackground:t}=e,r=i==null?void 0:i.getParent(),{width:s,height:a,pageMarginLeft:c,pageMarginTop:u}=n;if(r==null||s===Number.POSITIVE_INFINITY||a===Number.POSITIVE_INFINITY)return;const{width:f,height:C}=r;let h=0;const S=u;let p=0,U=0,O=Number.POSITIVE_INFINITY;const{scaleX:E,scaleY:j}=i.getAncestorScale();f>(s+c*2)*E?(h=f/2-s*E/2,h/=E,p=(f-c*2)/E,O=0):(h=c,p=s+c*2,O=(p-f/E)/2),C>a?U=(C-u*2)/j:U=a+u*2,i.resize(p,U),n.translate(h,S),t.translate(h,S);const k=i.getViewport(g.VIEWPORT_KEY.VIEW_MAIN);if(O!==Number.POSITIVE_INFINITY&&k!=null){const he=k.transScroll2ViewportScrollValue(O,0).x;k.scrollToBarPos({x:he})}return this}_scrollToTop(){var i;const e=(i=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:i.with(g.DocBackScrollRenderController),n={startOffset:0,endOffset:0};e&&e.scrollToRange(n)}};Z=ve([K(0,z),K(1,B.IRenderManagerService)],Z);var fe=Object.getOwnPropertyDescriptor,ge=(e,n,i,t)=>{for(var r=t>1?void 0:t?fe(n,i):n,s=e.length-1,a;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r},W=(e,n)=>(i,t)=>n(i,t,e);d.UniverSheetsZenEditorPlugin=(P=class extends o.Plugin{constructor(n=L,i,t){super(),this._config=n,this._injector=i,this._configService=t;const{menu:r,...s}=o.merge({},L,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(q,s),this._initializeDependencies(this._injector)}_initializeDependencies(n){[[w],[Z],[z,{useClass:te}]].forEach(t=>n.add(t))}onReady(){this._injector.get(w)}onSteady(){this._injector.get(Z)}},N(P,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),N(P,"type",o.UniverInstanceType.UNIVER_SHEET),P),d.UniverSheetsZenEditorPlugin=ge([W(1,o.Inject(o.Injector)),W(2,o.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=b,d.ConfirmZenEditCommand=M,d.OpenZenEditorCommand=D,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.8.0-beta.0",
3
+ "version": "0.8.0-nightly.202505271607",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -64,15 +64,15 @@
64
64
  "rxjs": ">=7.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "@univerjs/icons": "^0.3.24",
68
- "@univerjs/core": "0.8.0-beta.0",
69
- "@univerjs/design": "0.8.0-beta.0",
70
- "@univerjs/docs-ui": "0.8.0-beta.0",
71
- "@univerjs/docs": "0.8.0-beta.0",
72
- "@univerjs/sheets": "0.8.0-beta.0",
73
- "@univerjs/sheets-ui": "0.8.0-beta.0",
74
- "@univerjs/ui": "0.8.0-beta.0",
75
- "@univerjs/engine-render": "0.8.0-beta.0"
67
+ "@univerjs/icons": "^0.4.3",
68
+ "@univerjs/core": "0.8.0-nightly.202505271607",
69
+ "@univerjs/design": "0.8.0-nightly.202505271607",
70
+ "@univerjs/docs-ui": "0.8.0-nightly.202505271607",
71
+ "@univerjs/docs": "0.8.0-nightly.202505271607",
72
+ "@univerjs/sheets-ui": "0.8.0-nightly.202505271607",
73
+ "@univerjs/engine-render": "0.8.0-nightly.202505271607",
74
+ "@univerjs/sheets": "0.8.0-nightly.202505271607",
75
+ "@univerjs/ui": "0.8.0-nightly.202505271607"
76
76
  },
77
77
  "devDependencies": {
78
78
  "postcss": "^8.5.3",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS