@univerjs/sheets-zen-editor 0.7.0-nightly.202505111606 → 0.7.0-nightly.202505121607

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,4 @@
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:`
2
- univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
3
- univer-justify-center
4
- `,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 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,`
5
2
  univer-text-red-500
6
3
  hover:univer-text-red-600
7
4
  `),onClick:r,children:S.jsx(Y,{className:"univer-size-5"})}),S.jsx("span",{className:k.clsx(c,`
package/lib/es/index.js CHANGED
@@ -224,10 +224,7 @@ function tt() {
224
224
  /* @__PURE__ */ V(
225
225
  "div",
226
226
  {
227
- className: `
228
- univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
229
- univer-justify-center
230
- `,
227
+ className: "univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",
231
228
  children: [
232
229
  /* @__PURE__ */ S(
233
230
  "span",
package/lib/index.js CHANGED
@@ -224,10 +224,7 @@ function tt() {
224
224
  /* @__PURE__ */ V(
225
225
  "div",
226
226
  {
227
- className: `
228
- univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
229
- univer-justify-center
230
- `,
227
+ className: "univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center univer-justify-center",
231
228
  children: [
232
229
  /* @__PURE__ */ S(
233
230
  "span",
package/lib/umd/index.js CHANGED
@@ -1,7 +1,4 @@
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:`
2
- univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center
3
- univer-justify-center
4
- `,children:[I.jsx("span",{className:A.clsx(a,`
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,`
5
2
  univer-text-red-500
6
3
  hover:univer-text-red-600
7
4
  `),onClick:r,children:I.jsx(V,{className:"univer-size-5"})}),I.jsx("span",{className:A.clsx(a,`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.7.0-nightly.202505111606",
3
+ "version": "0.7.0-nightly.202505121607",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -65,19 +65,19 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@univerjs/icons": "^0.3.24",
68
- "@univerjs/core": "0.7.0-nightly.202505111606",
69
- "@univerjs/design": "0.7.0-nightly.202505111606",
70
- "@univerjs/docs": "0.7.0-nightly.202505111606",
71
- "@univerjs/engine-render": "0.7.0-nightly.202505111606",
72
- "@univerjs/docs-ui": "0.7.0-nightly.202505111606",
73
- "@univerjs/sheets": "0.7.0-nightly.202505111606",
74
- "@univerjs/sheets-ui": "0.7.0-nightly.202505111606",
75
- "@univerjs/ui": "0.7.0-nightly.202505111606"
68
+ "@univerjs/core": "0.7.0-nightly.202505121607",
69
+ "@univerjs/docs": "0.7.0-nightly.202505121607",
70
+ "@univerjs/design": "0.7.0-nightly.202505121607",
71
+ "@univerjs/engine-render": "0.7.0-nightly.202505121607",
72
+ "@univerjs/docs-ui": "0.7.0-nightly.202505121607",
73
+ "@univerjs/sheets": "0.7.0-nightly.202505121607",
74
+ "@univerjs/sheets-ui": "0.7.0-nightly.202505121607",
75
+ "@univerjs/ui": "0.7.0-nightly.202505121607"
76
76
  },
77
77
  "devDependencies": {
78
78
  "postcss": "^8.5.3",
79
79
  "react": "18.3.1",
80
- "rxjs": "^7.8.1",
80
+ "rxjs": "^7.8.2",
81
81
  "tailwindcss": "^3.4.17",
82
82
  "typescript": "^5.8.3",
83
83
  "vite": "^6.3.5",