@univerjs/sheets-zen-editor 0.5.0 → 0.5.1-nightly.202411301606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var J=Object.defineProperty;var Q=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var S=(e,t,r)=>Q(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),N=require("@univerjs/docs-ui"),B=require("@univerjs/engine-render"),m=require("@univerjs/sheets-ui"),u=require("@univerjs/ui"),k=require("rxjs"),g=require("react"),y=require("@univerjs/sheets"),P={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var h;const t=e.get(u.IZenZoneService),r=e.get(N.IEditorService),n=e.get(m.IEditorBridgeService),i=e.get(s.IUniverInstanceService);t.open();const o=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const c=n.getLatestEditCellState();if(c==null)return!1;const a=(h=c.documentLayoutObject.documentModel)==null?void 0:h.getSnapshot();if(a==null)return!1;i.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:d,drawings:_,drawingsOrder:v,tableSource:f,settings:T}=s.Tools.deepClone(a),O={...o.getDocumentData(),body:d,drawings:_,drawingsOrder:v,tableSource:f,settings:T},p=[{startOffset:0,endOffset:0,collapsed:!0}];return o.focus(),o.setDocumentData(O,p),o.clearUndoRedoHistory(),!0}},x={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const t=e.get(u.IZenZoneService),r=e.get(m.IEditorBridgeService),n=e.get(s.IUniverInstanceService);t.close();const i=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return i?(n.focusUnit(i.getUnitId()),r.refreshEditCellState(),!0):!1}},M={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var d;const t=e.get(u.IZenZoneService),r=e.get(m.IEditorBridgeService),n=e.get(s.IUniverInstanceService),i=e.get(N.IEditorService);t.close();const o=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const c=e.get(B.IRenderManagerService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(a){const _=a.getUnitId(),v=(d=c.getRenderById(_))==null?void 0:d.with(m.EditingRenderController);if(v){const f=s.Tools.deepClone(o.getDocumentData());f.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,v.submitCellData(new s.DocumentDataModel(f))}return n.focusUnit(a.getUnitId()),r.refreshEditCellState(),!0}return!1}},ee="sheets-zen-editor.config",te={};class ne{constructor(){S(this,"_position",null);S(this,"_position$",new k.BehaviorSubject(null));S(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 j=s.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,oe=(e,t,r,n)=>{for(var i=n>1?void 0:n?ie(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&re(t,r,i),i},L=(e,t)=>(r,n)=>t(r,n,e);let R=class extends s.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(k.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:r}=e,n=m.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,r),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:r,docBackground:n}=e,i=r==null?void 0:r.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:d}=t;if(i==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:_,height:v}=i;let f=0;const T=d;let C=0,O=0,p=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:G}=r.getAncestorScale();_>(o+a*2)*h?(f=_/2-o*h/2,f/=h,C=(_-a*2)/h,p=0):(f=a,C=o+a*2,p=(C-_/h)/2),v>c?O=(v-d*2)/G:O=c+d*2,r.resize(C,O),t.translate(f,T),n.translate(f,T);const Z=r.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(p!==Number.POSITIVE_INFINITY&&Z!=null){const X=Z.transScroll2ViewportScrollValue(p,0).x;Z.scrollToBarPos({x:X})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(N.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};R=oe([L(0,j),L(1,B.IRenderManagerService)],R);var F={exports:{}},U={};/**
1
+ "use strict";var Q=Object.defineProperty;var ee=(e,n,r)=>n in e?Q(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var O=(e,n,r)=>ee(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),T=require("@univerjs/docs-ui"),Y=require("@univerjs/engine-render"),p=require("@univerjs/sheets-ui"),f=require("@univerjs/ui"),h=require("react"),W=require("rxjs"),y=require("@univerjs/sheets"),M={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var b;const n=e.get(f.IZenZoneService),r=e.get(T.IEditorService),t=e.get(p.IEditorBridgeService),i=e.get(o.IUniverInstanceService),c=e.get(f.ISidebarService);c.visible&&(c.close(),await o.delayAnimationFrame()),n.open();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=t.getLatestEditCellState();if(d==null)return!1;const a=(b=d.documentLayoutObject.documentModel)==null?void 0:b.getSnapshot();if(a==null)return!1;i.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:g,drawings:l,drawingsOrder:u,tableSource:v,settings:m}=o.Tools.deepClone(a),C={...s.getDocumentData(),body:g,drawings:l,drawingsOrder:u,tableSource:v,settings:m},E=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(C,E),s.clearUndoRedoHistory(),!0}},U={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const n=e.get(f.IZenZoneService),r=e.get(p.IEditorBridgeService),t=e.get(o.IUniverInstanceService),i=e.get(f.ISidebarService);i.visible&&(i.close(),await o.delayAnimationFrame()),n.close();const c=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return c?(t.focusUnit(c.getUnitId()),r.refreshEditCellState(),!0):!1}},Z={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var g;const n=e.get(f.IZenZoneService),r=e.get(p.IEditorBridgeService),t=e.get(o.IUniverInstanceService),i=e.get(T.IEditorService),c=e.get(f.ISidebarService);c.visible&&(c.close(),await o.delayAnimationFrame()),n.close();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const d=e.get(Y.IRenderManagerService),a=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(a){const l=a.getUnitId(),u=(g=d.getRenderById(l))==null?void 0:g.with(p.EditingRenderController);if(u){const v=o.Tools.deepClone(s.getDocumentData());v.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,u.submitCellData(new o.DocumentDataModel(v))}return t.focusUnit(a.getUnitId()),r.refreshEditCellState(),!0}return!1}},te="sheets-zen-editor.config",ne={};var j={exports:{}},N={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var se=g,ce=Symbol.for("react.element"),ae=Symbol.for("react.fragment"),de=Object.prototype.hasOwnProperty,le=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ue={key:!0,ref:!0,__self:!0,__source:!0};function V(e,t,r){var n,i={},o=null,c=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)de.call(t,n)&&!ue.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:ce,type:e,key:o,ref:c,props:i,_owner:le.current}}U.Fragment=ae;U.jsx=V;U.jsxs=V;F.exports=U;var E=F.exports,l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(this,arguments)},fe=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},w=g.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,o=e.extend,c=fe(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),d=g.useRef("_".concat(he()));return Y(r,"".concat(n),{defIds:r.defIds,idSuffix:d.current},l({ref:t,className:a},c),o)});function Y(e,t,r,n,i){return g.createElement(e.tag,l(l({key:t},ge(e,r,i)),n),(_e(e,r).children||[]).map(function(o,c){return Y(o,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,i)}))}function ge(e,t,r){var n=l({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.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 _e(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?l(l({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?l(l({},i),{attrs:l(l({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function he(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var ve={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"}}]},W=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ve}))});W.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"}}]},K=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:Ee}))});K.displayName="CloseSingle";function q(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=q(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function A(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=q(e))&&(n&&(n+=" "),n+=t);return n}const Ie="univer-zen-editor",me="univer-zen-editor-icon-wrapper",pe="univer-zen-editor-icon-container",Se="univer-zen-editor-icon-success",Ce="univer-zen-editor-icon-error",Oe="univer-zen-editor-canvas-container",I={zenEditor:Ie,zenEditorIconWrapper:me,zenEditorIconContainer:pe,zenEditorIconSuccess:Se,zenEditorIconError:Ce,zenEditorCanvasContainer:Oe},ye="ZEN_EDITOR_PLUGIN_",Ne=`${ye}ZEN_EDITOR_COMPONENT`,Te={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 De(){const e=g.useRef(null),t=s.useDependency(j),r=s.useDependency(N.IEditorService),n=s.useDependency(s.ICommandService);g.useEffect(()=>{const c=e.current;if(!c)return;const a=r.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:Te,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},c),d=new ResizeObserver(()=>{t.setPosition(c.getBoundingClientRect())});return d.observe(c),()=>{a.dispose(),d.unobserve(c)}},[]);function i(){n.executeCommand(x.id)}function o(){n.executeCommand(M.id)}return E.jsxs("div",{className:I.zenEditor,children:[E.jsxs("div",{className:I.zenEditorIconWrapper,children:[E.jsx("span",{className:A(I.zenEditorIconContainer,I.zenEditorIconError),onClick:i,children:E.jsx(K,{style:{fontSize:"22px"}})}),E.jsx("span",{className:A(I.zenEditorIconContainer,I.zenEditorIconSuccess),onClick:o,children:E.jsx(W,{style:{fontSize:"22px"}})})]}),E.jsx("div",{className:I.zenEditorCanvasContainer,ref:e})]})}function be(e){return{id:P.id,type:u.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:m.getCurrentExclusiveRangeInterest$(e),disabled$:m.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const Re={[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.OTHERS]:{[P.id]:{order:2,menuItemFactory:be}}}},ze={id:M.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>H(e),binding:u.KeyCode.ENTER|u.MetaKeys.ALT},Pe={id:x.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>H(e),binding:u.KeyCode.ESC};function H(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ue=(e,t,r,n)=>{for(var i=n>1?void 0:n?Me(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&xe(t,r,i),i},D=(e,t)=>(r,n)=>t(r,n,e);let z=class extends s.Disposable{constructor(e,t,r,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=r,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(Ne,De))}_initCommands(){[P,x,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Re)}_initShortcuts(){[ze,Pe].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};z=Ue([D(0,u.IZenZoneService),D(1,s.ICommandService),D(2,u.IMenuManagerService),D(3,u.IShortcutService)],z);var Ze=Object.defineProperty,je=Object.getOwnPropertyDescriptor,we=(e,t,r,n)=>{for(var i=n>1?void 0:n?je(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ze(t,r,i),i},$=(e,t)=>(r,n)=>t(r,n,e),b;exports.UniverSheetsZenEditorPlugin=(b=class extends s.Plugin{constructor(t=te,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...o}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ee,o),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[z],[R],[j,{useClass:ne}]].forEach(n=>t.add(n))}onReady(){this._injector.get(z)}onSteady(){this._injector.get(R)}},S(b,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),S(b,"type",s.UniverInstanceType.UNIVER_SHEET),b);exports.UniverSheetsZenEditorPlugin=we([$(1,s.Inject(s.Injector)),$(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=x;exports.ConfirmZenEditCommand=M;exports.OpenZenEditorCommand=P;
9
+ */var L;function re(){if(L)return N;L=1;var e=h,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function s(d,a,g){var l,u={},v=null,m=null;g!==void 0&&(v=""+g),a.key!==void 0&&(v=""+a.key),a.ref!==void 0&&(m=a.ref);for(l in a)t.call(a,l)&&!c.hasOwnProperty(l)&&(u[l]=a[l]);if(d&&d.defaultProps)for(l in a=d.defaultProps,a)u[l]===void 0&&(u[l]=a[l]);return{$$typeof:n,type:d,key:v,ref:m,props:u,_owner:i.current}}return N.Fragment=r,N.jsx=s,N.jsxs=s,N}var $;function ie(){return $||($=1,j.exports=re()),j.exports}var I=ie(),_=function(){return _=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},_.apply(this,arguments)},oe=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(e);i<t.length;i++)n.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(r[t[i]]=e[t[i]]);return r},A=h.forwardRef(function(e,n){var r=e.icon,t=e.id,i=e.className,c=e.extend,s=oe(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(t," ").concat(i||"").trim(),a=h.useRef("_".concat(ae()));return q(r,"".concat(t),{defIds:r.defIds,idSuffix:a.current},_({ref:n,className:d},s),c)});function q(e,n,r,t,i){return h.createElement(e.tag,_(_({key:n},se(e,r,i)),t),(ce(e,r).children||[]).map(function(c,s){return q(c,"".concat(n,"-").concat(e.tag,"-").concat(s),r,void 0,i)}))}function se(e,n,r){var t=_({},e.attrs);r!=null&&r.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=r.colorChannel1);var i=n.defIds;return!i||i.length===0||(e.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(c){var s=c[0],d=c[1];typeof d=="string"&&(t[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function ce(e,n){var r,t=n.defIds;return!t||t.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?_(_({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&t&&t.indexOf(i.attrs.id)>-1?_(_({},i),{attrs:_(_({},i.attrs),{id:i.attrs.id+n.idSuffix})}):i})}):e}function ae(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var de={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"}}]},K=h.forwardRef(function(e,n){return h.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:n,icon:de}))});K.displayName="CheckMarkSingle";var le={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"}}]},H=h.forwardRef(function(e,n){return h.createElement(A,Object.assign({},e,{id:"close-single",ref:n,icon:le}))});H.displayName="CloseSingle";function G(e){var n,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(r=G(e[n]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function F(){for(var e,n,r=0,t="",i=arguments.length;r<i;r++)(e=arguments[r])&&(n=G(e))&&(t&&(t+=" "),t+=n);return t}class ue{constructor(){O(this,"_position",null);O(this,"_position$",new W.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(n){this._position=n,this._refresh(n)}getPosition(){return this._position}_refresh(n){this._position$.next(n)}}const B=o.createIdentifier("univer.sheet-zen-editor-manager.service"),fe="univer-zen-editor",ge="univer-zen-editor-icon-wrapper",_e="univer-zen-editor-icon-container",ve="univer-zen-editor-icon-success",he="univer-zen-editor-icon-error",me="univer-zen-editor-canvas-container",S={zenEditor:fe,zenEditorIconWrapper:ge,zenEditorIconContainer:_e,zenEditorIconSuccess:ve,zenEditorIconError:he,zenEditorCanvasContainer:me},Ee="ZEN_EDITOR_PLUGIN_",Ie=`${Ee}ZEN_EDITOR_COMPONENT`,Se={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 pe(){const e=h.useRef(null),n=o.useDependency(B),r=o.useDependency(T.IEditorService),t=o.useDependency(o.ICommandService);h.useEffect(()=>{const s=e.current;if(!s)return;const d=r.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:Se,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},s),a=new ResizeObserver(()=>{n.setPosition(s.getBoundingClientRect())});return a.observe(s),()=>{d.dispose(),a.unobserve(s)}},[]);function i(){t.executeCommand(U.id)}function c(){t.executeCommand(Z.id)}return I.jsxs("div",{className:S.zenEditor,children:[I.jsxs("div",{className:S.zenEditorIconWrapper,children:[I.jsx("span",{className:F(S.zenEditorIconContainer,S.zenEditorIconError),onClick:i,children:I.jsx(H,{style:{fontSize:"22px"}})}),I.jsx("span",{className:F(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:c,children:I.jsx(K,{style:{fontSize:"22px"}})})]}),I.jsx("div",{className:S.zenEditorCanvasContainer,ref:e})]})}function Ce(e){return{id:M.id,type:f.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:p.getCurrentExclusiveRangeInterest$(e),disabled$:p.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const Oe={[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[M.id]:{order:2,menuItemFactory:Ce}}}},ye={id:Z.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>J(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ne={id:U.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>J(e),binding:f.KeyCode.ESC};function J(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 Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,be=(e,n,r,t)=>{for(var i=t>1?void 0:t?Re(n,r):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(t?s(n,r,i):s(i))||i);return t&&i&&Te(n,r,i),i},D=(e,n)=>(r,t)=>n(r,t,e);let P=class extends o.Disposable{constructor(e,n,r,t){super(),this._zenZoneService=e,this._commandService=n,this._menuManagerService=r,this._shortcutService=t,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(Ie,pe))}_initCommands(){[M,U,Z].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Oe)}_initShortcuts(){[ye,Ne].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};P=be([D(0,f.IZenZoneService),D(1,o.ICommandService),D(2,f.IMenuManagerService),D(3,f.IShortcutService)],P);var De=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,Pe=(e,n,r,t)=>{for(var i=t>1?void 0:t?ze(n,r):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(t?s(n,r,i):s(i))||i);return t&&i&&De(n,r,i),i},k=(e,n)=>(r,t)=>n(r,t,e);let x=class extends o.RxDisposable{constructor(e,n){super(),this._zenEditorManagerService=e,this._renderManagerService=n,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(W.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:n,height:r}=e,t=p.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);t!=null&&requestIdleCallback(()=>{t.engine.resizeBySize(n,r),this._calculatePagePosition(t),this._scrollToTop()})})}_calculatePagePosition(e){const{document:n,scene:r,docBackground:t}=e,i=r==null?void 0:r.getParent(),{width:c,height:s,pageMarginLeft:d,pageMarginTop:a}=n;if(i==null||c===Number.POSITIVE_INFINITY||s===Number.POSITIVE_INFINITY)return;const{width:g,height:l}=i;let u=0;const v=a;let m=0,R=0,C=Number.POSITIVE_INFINITY;const{scaleX:E,scaleY:b}=r.getAncestorScale();g>(c+d*2)*E?(u=g/2-c*E/2,u/=E,m=(g-d*2)/E,C=0):(u=d,m=c+d*2,C=(m-g/E)/2),l>s?R=(l-a*2)/b:R=s+a*2,r.resize(m,R),n.translate(u,v),t.translate(u,v);const w=r.getViewport(T.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&w!=null){const X=w.transScroll2ViewportScrollValue(C,0).x;w.scrollToBarPos({x:X})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(T.DocBackScrollRenderController),n={startOffset:0,endOffset:0};e&&e.scrollToRange(n)}};x=Pe([k(0,B),k(1,Y.IRenderManagerService)],x);var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ue=(e,n,r,t)=>{for(var i=t>1?void 0:t?Me(n,r):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(t?s(n,r,i):s(i))||i);return t&&i&&xe(n,r,i),i},V=(e,n)=>(r,t)=>n(r,t,e),z;exports.UniverSheetsZenEditorPlugin=(z=class extends o.Plugin{constructor(n=ne,r,t){super(),this._config=n,this._injector=r,this._configService=t;const{menu:i,...c}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(te,c),this._initializeDependencies(this._injector)}_initializeDependencies(n){[[P],[x],[B,{useClass:ue}]].forEach(t=>n.add(t))}onReady(){this._injector.get(P)}onSteady(){this._injector.get(x)}},O(z,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),O(z,"type",o.UniverInstanceType.UNIVER_SHEET),z);exports.UniverSheetsZenEditorPlugin=Ue([V(1,o.Inject(o.Injector)),V(2,o.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=U;exports.ConfirmZenEditCommand=Z;exports.OpenZenEditorCommand=M;
@@ -0,0 +1 @@
1
+ "use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}};module.exports=e;
package/lib/es/index.js CHANGED
@@ -1,156 +1,79 @@
1
- var ce = Object.defineProperty;
2
- var ae = (e, t, r) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var v = (e, t, r) => ae(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { CommandType as x, IUniverInstanceService as R, DOCS_ZEN_EDITOR_UNIT_ID_KEY as p, Tools as Y, UniverInstanceType as M, DocumentFlavor as H, DocumentDataModel as le, createIdentifier as de, RxDisposable as ue, DEFAULT_EMPTY_DOCUMENT_VALUE as fe, useDependency as P, ICommandService as G, FOCUSING_DOC as ge, FOCUSING_UNIVER_EDITOR as he, EDITOR_ACTIVATED as me, FOCUSING_EDITOR_STANDALONE as pe, Disposable as _e, Plugin as ve, Inject as Ee, Injector as Ie, IConfigService as Se } from "@univerjs/core";
5
- import { IEditorService as D, VIEWPORT_KEY as Ce, DocBackScrollRenderController as Oe } from "@univerjs/docs-ui";
6
- import { IRenderManagerService as K } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as j, EditingRenderController as ye, getEditorObject as Ne, getCurrentExclusiveRangeInterest$ as Te, getCurrentRangeDisable$ as be } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as T, MenuItemType as ze, ContextMenuPosition as Pe, ContextMenuGroup as xe, KeyCode as X, MetaKeys as Re, IMenuManagerService as Me, IShortcutService as De } from "@univerjs/ui";
9
- import { BehaviorSubject as je, takeUntil as we } from "rxjs";
10
- import Ue, { forwardRef as w, useRef as q, createElement as U, useEffect as Ze } from "react";
11
- import { WorkbookEditablePermission as Le, WorksheetEditPermission as Ae, WorksheetSetCellValuePermission as $e, WorksheetSetCellStylePermission as Be, RangeProtectionPermissionEditPoint as ke } from "@univerjs/sheets";
12
- const Z = {
1
+ var de = Object.defineProperty;
2
+ var ue = (e, n, r) => n in e ? de(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
+ var S = (e, n, r) => ue(e, typeof n != "symbol" ? n + "" : n, r);
4
+ import { CommandType as M, IUniverInstanceService as D, delayAnimationFrame as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as v, Tools as X, UniverInstanceType as j, DocumentFlavor as Q, DocumentDataModel as fe, createIdentifier as ge, DEFAULT_EMPTY_DOCUMENT_VALUE as he, useDependency as x, ICommandService as ee, FOCUSING_DOC as me, FOCUSING_UNIVER_EDITOR as _e, EDITOR_ACTIVATED as pe, FOCUSING_EDITOR_STANDALONE as ve, Disposable as Ee, RxDisposable as Se, Plugin as Ie, Inject as Ce, Injector as Oe, IConfigService as ye } from "@univerjs/core";
5
+ import { IEditorService as U, VIEWPORT_KEY as Ne, DocBackScrollRenderController as be } from "@univerjs/docs-ui";
6
+ import { IRenderManagerService as te } from "@univerjs/engine-render";
7
+ import { IEditorBridgeService as Z, EditingRenderController as Te, getCurrentExclusiveRangeInterest$ as Re, getCurrentRangeDisable$ as ze, getEditorObject as xe } from "@univerjs/sheets-ui";
8
+ import { IZenZoneService as R, ISidebarService as A, MenuItemType as Pe, ContextMenuPosition as Me, ContextMenuGroup as De, KeyCode as ne, MetaKeys as we, IMenuManagerService as je, IShortcutService as Ue } from "@univerjs/ui";
9
+ import Ze, { forwardRef as L, useRef as re, createElement as $, useEffect as Ae } from "react";
10
+ import { BehaviorSubject as Le, takeUntil as $e } from "rxjs";
11
+ import { WorkbookEditablePermission as Be, WorksheetEditPermission as ke, WorksheetSetCellValuePermission as Fe, WorksheetSetCellStylePermission as Ve, RangeProtectionPermissionEditPoint as We } from "@univerjs/sheets";
12
+ const B = {
13
13
  id: "zen-editor.command.open-zen-editor",
14
- type: x.COMMAND,
14
+ type: M.COMMAND,
15
15
  handler: async (e) => {
16
- var f;
17
- const t = e.get(T), r = e.get(D), n = e.get(j), i = e.get(R);
18
- t.open();
19
- const o = r.getEditor(p);
16
+ var O;
17
+ const n = e.get(R), r = e.get(U), t = e.get(Z), i = e.get(D), s = e.get(A);
18
+ s.visible && (s.close(), await w()), n.open();
19
+ const o = r.getEditor(v);
20
20
  if (o == null)
21
21
  return !1;
22
- const s = n.getLatestEditCellState();
23
- if (s == null)
22
+ const a = t.getLatestEditCellState();
23
+ if (a == null)
24
24
  return !1;
25
- const c = (f = s.documentLayoutObject.documentModel) == null ? void 0 : f.getSnapshot();
25
+ const c = (O = a.documentLayoutObject.documentModel) == null ? void 0 : O.getSnapshot();
26
26
  if (c == null)
27
27
  return !1;
28
- i.focusUnit(p);
29
- const { body: a, drawings: u, drawingsOrder: g, tableSource: d, settings: S } = Y.deepClone(c), I = {
28
+ i.focusUnit(v);
29
+ const { body: u, drawings: l, drawingsOrder: d, tableSource: g, settings: h } = X.deepClone(c), E = {
30
30
  ...o.getDocumentData(),
31
- body: a,
32
- drawings: u,
33
- drawingsOrder: g,
34
- tableSource: d,
35
- settings: S
36
- }, _ = [
31
+ body: u,
32
+ drawings: l,
33
+ drawingsOrder: d,
34
+ tableSource: g,
35
+ settings: h
36
+ }, m = [
37
37
  {
38
38
  startOffset: 0,
39
39
  endOffset: 0,
40
40
  collapsed: !0
41
41
  }
42
42
  ];
43
- return o.focus(), o.setDocumentData(I, _), o.clearUndoRedoHistory(), !0;
43
+ return o.focus(), o.setDocumentData(E, m), o.clearUndoRedoHistory(), !0;
44
44
  }
45
- }, L = {
45
+ }, k = {
46
46
  id: "zen-editor.command.cancel-zen-edit",
47
- type: x.COMMAND,
47
+ type: M.COMMAND,
48
48
  handler: async (e) => {
49
- const t = e.get(T), r = e.get(j), n = e.get(R);
50
- t.close();
51
- const i = n.getCurrentUnitForType(M.UNIVER_SHEET);
52
- return i ? (n.focusUnit(i.getUnitId()), r.refreshEditCellState(), !0) : !1;
49
+ const n = e.get(R), r = e.get(Z), t = e.get(D), i = e.get(A);
50
+ i.visible && (i.close(), await w()), n.close();
51
+ const s = t.getCurrentUnitForType(j.UNIVER_SHEET);
52
+ return s ? (t.focusUnit(s.getUnitId()), r.refreshEditCellState(), !0) : !1;
53
53
  }
54
- }, A = {
54
+ }, F = {
55
55
  id: "zen-editor.command.confirm-zen-edit",
56
- type: x.COMMAND,
56
+ type: M.COMMAND,
57
57
  handler: async (e) => {
58
- var a;
59
- const t = e.get(T), r = e.get(j), n = e.get(R), i = e.get(D);
60
- t.close();
61
- const o = i.getEditor(p);
58
+ var u;
59
+ const n = e.get(R), r = e.get(Z), t = e.get(D), i = e.get(U), s = e.get(A);
60
+ s.visible && (s.close(), await w()), n.close();
61
+ const o = i.getEditor(v);
62
62
  if (o == null)
63
63
  return !1;
64
- const s = e.get(K), c = n.getCurrentUnitForType(M.UNIVER_SHEET);
64
+ const a = e.get(te), c = t.getCurrentUnitForType(j.UNIVER_SHEET);
65
65
  if (c) {
66
- const u = c.getUnitId(), g = (a = s.getRenderById(u)) == null ? void 0 : a.with(ye);
67
- if (g) {
68
- const d = Y.deepClone(o.getDocumentData());
69
- d.documentStyle.documentFlavor = H.UNSPECIFIED, g.submitCellData(new le(d));
66
+ const l = c.getUnitId(), d = (u = a.getRenderById(l)) == null ? void 0 : u.with(Te);
67
+ if (d) {
68
+ const g = X.deepClone(o.getDocumentData());
69
+ g.documentStyle.documentFlavor = Q.UNSPECIFIED, d.submitCellData(new fe(g));
70
70
  }
71
- return n.focusUnit(c.getUnitId()), r.refreshEditCellState(), !0;
71
+ return t.focusUnit(c.getUnitId()), r.refreshEditCellState(), !0;
72
72
  }
73
73
  return !1;
74
74
  }
75
- }, Ve = "sheets-zen-editor.config", Fe = {};
76
- class We {
77
- constructor() {
78
- v(this, "_position", null);
79
- v(this, "_position$", new je(null));
80
- v(this, "position$", this._position$.asObservable());
81
- }
82
- dispose() {
83
- this._position$.complete(), this._position = null;
84
- }
85
- setPosition(t) {
86
- this._position = t, this._refresh(t);
87
- }
88
- getPosition() {
89
- return this._position;
90
- }
91
- _refresh(t) {
92
- this._position$.next(t);
93
- }
94
- }
95
- const $ = de(
96
- "univer.sheet-zen-editor-manager.service"
97
- );
98
- var Ye = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Ge = (e, t, r, n) => {
99
- for (var i = n > 1 ? void 0 : n ? He(t, r) : t, o = e.length - 1, s; o >= 0; o--)
100
- (s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
101
- return n && i && Ye(t, r, i), i;
102
- }, k = (e, t) => (r, n) => t(r, n, e);
103
- let y = class extends ue {
104
- constructor(e, t) {
105
- super(), this._zenEditorManagerService = e, this._renderManagerService = t, this._initialize();
106
- }
107
- _initialize() {
108
- this._syncZenEditorSize();
109
- }
110
- // Listen to changes in the size of the zen editor container to set the size of the editor.
111
- _syncZenEditorSize() {
112
- this._zenEditorManagerService.position$.pipe(we(this.dispose$)).subscribe((e) => {
113
- if (e == null)
114
- return;
115
- const { width: t, height: r } = e, n = Ne(p, this._renderManagerService);
116
- n != null && requestIdleCallback(() => {
117
- n.engine.resizeBySize(t, r), this._calculatePagePosition(n), this._scrollToTop();
118
- });
119
- });
120
- }
121
- _calculatePagePosition(e) {
122
- const { document: t, scene: r, docBackground: n } = e, i = r == null ? void 0 : r.getParent(), { width: o, height: s, pageMarginLeft: c, pageMarginTop: a } = t;
123
- if (i == null || o === Number.POSITIVE_INFINITY || s === Number.POSITIVE_INFINITY)
124
- return;
125
- const { width: u, height: g } = i;
126
- let d = 0;
127
- const S = a;
128
- let E = 0, I = 0, _ = Number.POSITIVE_INFINITY;
129
- const { scaleX: f, scaleY: oe } = r.getAncestorScale();
130
- u > (o + c * 2) * f ? (d = u / 2 - o * f / 2, d /= f, E = (u - c * 2) / f, _ = 0) : (d = c, E = o + c * 2, _ = (E - u / f) / 2), g > s ? I = (g - a * 2) / oe : I = s + a * 2, r.resize(E, I), t.translate(d, S), n.translate(d, S);
131
- const z = r.getViewport(Ce.VIEW_MAIN);
132
- if (_ !== Number.POSITIVE_INFINITY && z != null) {
133
- const se = z.transScroll2ViewportScrollValue(_, 0).x;
134
- z.scrollToBarPos({
135
- x: se
136
- });
137
- }
138
- return this;
139
- }
140
- _scrollToTop() {
141
- var r;
142
- const e = (r = this._renderManagerService.getRenderById(p)) == null ? void 0 : r.with(Oe), t = {
143
- startOffset: 0,
144
- endOffset: 0
145
- };
146
- e && e.scrollToRange(t);
147
- }
148
- };
149
- y = Ge([
150
- k(0, $),
151
- k(1, K)
152
- ], y);
153
- var J = { exports: {} }, b = {};
75
+ }, He = "sheets-zen-editor.config", Ye = {};
76
+ var P = { exports: {} }, I = {};
154
77
  /**
155
78
  * @license React
156
79
  * react-jsx-runtime.production.min.js
@@ -160,101 +83,128 @@ var J = { exports: {} }, b = {};
160
83
  * This source code is licensed under the MIT license found in the
161
84
  * LICENSE file in the root directory of this source tree.
162
85
  */
163
- var Ke = Ue, Xe = Symbol.for("react.element"), qe = Symbol.for("react.fragment"), Je = Object.prototype.hasOwnProperty, Qe = Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, et = { key: !0, ref: !0, __self: !0, __source: !0 };
164
- function Q(e, t, r) {
165
- var n, i = {}, o = null, s = null;
166
- r !== void 0 && (o = "" + r), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
167
- for (n in t) Je.call(t, n) && !et.hasOwnProperty(n) && (i[n] = t[n]);
168
- if (e && e.defaultProps) for (n in t = e.defaultProps, t) i[n] === void 0 && (i[n] = t[n]);
169
- return { $$typeof: Xe, type: e, key: o, ref: s, props: i, _owner: Qe.current };
86
+ var H;
87
+ function Ge() {
88
+ if (H) return I;
89
+ H = 1;
90
+ var e = Ze, n = Symbol.for("react.element"), r = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
91
+ function o(a, c, u) {
92
+ var l, d = {}, g = null, h = null;
93
+ u !== void 0 && (g = "" + u), c.key !== void 0 && (g = "" + c.key), c.ref !== void 0 && (h = c.ref);
94
+ for (l in c) t.call(c, l) && !s.hasOwnProperty(l) && (d[l] = c[l]);
95
+ if (a && a.defaultProps) for (l in c = a.defaultProps, c) d[l] === void 0 && (d[l] = c[l]);
96
+ return { $$typeof: n, type: a, key: g, ref: h, props: d, _owner: i.current };
97
+ }
98
+ return I.Fragment = r, I.jsx = o, I.jsxs = o, I;
170
99
  }
171
- b.Fragment = qe;
172
- b.jsx = Q;
173
- b.jsxs = Q;
174
- J.exports = b;
175
- var h = J.exports, l = function() {
176
- return l = Object.assign || function(e) {
177
- for (var t, r = 1, n = arguments.length; r < n; r++) {
178
- t = arguments[r];
179
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
100
+ var Y;
101
+ function qe() {
102
+ return Y || (Y = 1, P.exports = Ge()), P.exports;
103
+ }
104
+ var _ = qe(), f = function() {
105
+ return f = Object.assign || function(e) {
106
+ for (var n, r = 1, t = arguments.length; r < t; r++) {
107
+ n = arguments[r];
108
+ for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
180
109
  }
181
110
  return e;
182
- }, l.apply(this, arguments);
183
- }, tt = function(e, t) {
111
+ }, f.apply(this, arguments);
112
+ }, Je = function(e, n) {
184
113
  var r = {};
185
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
114
+ for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (r[t] = e[t]);
186
115
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
187
- for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
188
- t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
116
+ for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
117
+ n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (r[t[i]] = e[t[i]]);
189
118
  return r;
190
- }, B = w(function(e, t) {
191
- var r = e.icon, n = e.id, i = e.className, o = e.extend, s = tt(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), a = q("_".concat(it()));
192
- return ee(r, "".concat(n), { defIds: r.defIds, idSuffix: a.current }, l({ ref: t, className: c }, s), o);
119
+ }, V = L(function(e, n) {
120
+ var r = e.icon, t = e.id, i = e.className, s = e.extend, o = Je(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), c = re("_".concat(Qe()));
121
+ return ie(r, "".concat(t), { defIds: r.defIds, idSuffix: c.current }, f({ ref: n, className: a }, o), s);
193
122
  });
194
- function ee(e, t, r, n, i) {
195
- return U(e.tag, l(l({ key: t }, nt(e, r, i)), n), (rt(e, r).children || []).map(function(o, s) {
196
- return ee(o, "".concat(t, "-").concat(e.tag, "-").concat(s), r, void 0, i);
123
+ function ie(e, n, r, t, i) {
124
+ return $(e.tag, f(f({ key: n }, Ke(e, r, i)), t), (Xe(e, r).children || []).map(function(s, o) {
125
+ return ie(s, "".concat(n, "-").concat(e.tag, "-").concat(o), r, void 0, i);
197
126
  }));
198
127
  }
199
- function nt(e, t, r) {
200
- var n = l({}, e.attrs);
201
- r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
202
- var i = t.defIds;
203
- return !i || i.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(o) {
204
- var s = o[0], c = o[1];
205
- typeof c == "string" && (n[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
206
- })), n;
128
+ function Ke(e, n, r) {
129
+ var t = f({}, e.attrs);
130
+ r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1);
131
+ var i = n.defIds;
132
+ return !i || i.length === 0 || (e.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + n.idSuffix), Object.entries(t).forEach(function(s) {
133
+ var o = s[0], a = s[1];
134
+ typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
135
+ })), t;
207
136
  }
208
- function rt(e, t) {
209
- var r, n = t.defIds;
210
- return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? l(l({}, e), { children: e.children.map(function(i) {
211
- return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? l(l({}, i), { attrs: l(l({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
137
+ function Xe(e, n) {
138
+ var r, t = n.defIds;
139
+ return !t || t.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? f(f({}, e), { children: e.children.map(function(i) {
140
+ return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? f(f({}, i), { attrs: f(f({}, i.attrs), { id: i.attrs.id + n.idSuffix }) }) : i;
212
141
  }) }) : e;
213
142
  }
214
- function it() {
143
+ function Qe() {
215
144
  return Math.random().toString(36).substring(2, 8);
216
145
  }
217
- B.displayName = "UniverIcon";
218
- var ot = { 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" } }] }, te = w(function(e, t) {
219
- return U(B, Object.assign({}, e, {
146
+ V.displayName = "UniverIcon";
147
+ var et = { 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" } }] }, oe = L(function(e, n) {
148
+ return $(V, Object.assign({}, e, {
220
149
  id: "check-mark-single",
221
- ref: t,
222
- icon: ot
150
+ ref: n,
151
+ icon: et
223
152
  }));
224
153
  });
225
- te.displayName = "CheckMarkSingle";
226
- var st = { 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" } }] }, ne = w(function(e, t) {
227
- return U(B, Object.assign({}, e, {
154
+ oe.displayName = "CheckMarkSingle";
155
+ var tt = { 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" } }] }, se = L(function(e, n) {
156
+ return $(V, Object.assign({}, e, {
228
157
  id: "close-single",
229
- ref: t,
230
- icon: st
158
+ ref: n,
159
+ icon: tt
231
160
  }));
232
161
  });
233
- ne.displayName = "CloseSingle";
234
- function re(e) {
235
- var t, r, n = "";
236
- if (typeof e == "string" || typeof e == "number") n += e;
162
+ se.displayName = "CloseSingle";
163
+ function ce(e) {
164
+ var n, r, t = "";
165
+ if (typeof e == "string" || typeof e == "number") t += e;
237
166
  else if (typeof e == "object") if (Array.isArray(e)) {
238
167
  var i = e.length;
239
- for (t = 0; t < i; t++) e[t] && (r = re(e[t])) && (n && (n += " "), n += r);
240
- } else for (r in e) e[r] && (n && (n += " "), n += r);
241
- return n;
168
+ for (n = 0; n < i; n++) e[n] && (r = ce(e[n])) && (t && (t += " "), t += r);
169
+ } else for (r in e) e[r] && (t && (t += " "), t += r);
170
+ return t;
171
+ }
172
+ function G() {
173
+ for (var e, n, r = 0, t = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (n = ce(e)) && (t && (t += " "), t += n);
174
+ return t;
242
175
  }
243
- function V() {
244
- for (var e, t, r = 0, n = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t = re(e)) && (n && (n += " "), n += t);
245
- return n;
176
+ class nt {
177
+ constructor() {
178
+ S(this, "_position", null);
179
+ S(this, "_position$", new Le(null));
180
+ S(this, "position$", this._position$.asObservable());
181
+ }
182
+ dispose() {
183
+ this._position$.complete(), this._position = null;
184
+ }
185
+ setPosition(n) {
186
+ this._position = n, this._refresh(n);
187
+ }
188
+ getPosition() {
189
+ return this._position;
190
+ }
191
+ _refresh(n) {
192
+ this._position$.next(n);
193
+ }
246
194
  }
247
- const ct = "univer-zen-editor", at = "univer-zen-editor-icon-wrapper", lt = "univer-zen-editor-icon-container", dt = "univer-zen-editor-icon-success", ut = "univer-zen-editor-icon-error", ft = "univer-zen-editor-canvas-container", m = {
248
- zenEditor: ct,
249
- zenEditorIconWrapper: at,
250
- zenEditorIconContainer: lt,
251
- zenEditorIconSuccess: dt,
252
- zenEditorIconError: ut,
253
- zenEditorCanvasContainer: ft
254
- }, gt = "ZEN_EDITOR_PLUGIN_", ht = `${gt}ZEN_EDITOR_COMPONENT`, mt = {
255
- id: p,
195
+ const W = ge(
196
+ "univer.sheet-zen-editor-manager.service"
197
+ ), rt = "univer-zen-editor", it = "univer-zen-editor-icon-wrapper", ot = "univer-zen-editor-icon-container", st = "univer-zen-editor-icon-success", ct = "univer-zen-editor-icon-error", at = "univer-zen-editor-canvas-container", p = {
198
+ zenEditor: rt,
199
+ zenEditorIconWrapper: it,
200
+ zenEditorIconContainer: ot,
201
+ zenEditorIconSuccess: st,
202
+ zenEditorIconError: ct,
203
+ zenEditorCanvasContainer: at
204
+ }, lt = "ZEN_EDITOR_PLUGIN_", dt = `${lt}ZEN_EDITOR_COMPONENT`, ut = {
205
+ id: v,
256
206
  body: {
257
- dataStream: `${fe}`,
207
+ dataStream: `${he}`,
258
208
  textRuns: [],
259
209
  tables: [],
260
210
  customBlocks: [],
@@ -273,7 +223,7 @@ const ct = "univer-zen-editor", at = "univer-zen-editor-icon-wrapper", lt = "uni
273
223
  width: 595,
274
224
  height: Number.POSITIVE_INFINITY
275
225
  },
276
- documentFlavor: H.MODERN,
226
+ documentFlavor: Q.MODERN,
277
227
  marginTop: 0,
278
228
  marginBottom: 0,
279
229
  marginRight: 0,
@@ -286,158 +236,213 @@ const ct = "univer-zen-editor", at = "univer-zen-editor-icon-wrapper", lt = "uni
286
236
  drawings: {},
287
237
  drawingsOrder: []
288
238
  };
289
- function pt() {
290
- const e = q(null), t = P($), r = P(D), n = P(G);
291
- Ze(() => {
292
- const s = e.current;
293
- if (!s)
239
+ function ft() {
240
+ const e = re(null), n = x(W), r = x(U), t = x(ee);
241
+ Ae(() => {
242
+ const o = e.current;
243
+ if (!o)
294
244
  return;
295
- const c = r.register(
245
+ const a = r.register(
296
246
  {
297
- editorUnitId: p,
298
- initialSnapshot: mt,
247
+ editorUnitId: v,
248
+ initialSnapshot: ut,
299
249
  scrollBar: !0,
300
250
  noNeedVerticalAlign: !0,
301
251
  backScrollOffset: 100
302
252
  },
303
- s
304
- ), a = new ResizeObserver(() => {
305
- t.setPosition(s.getBoundingClientRect());
253
+ o
254
+ ), c = new ResizeObserver(() => {
255
+ n.setPosition(o.getBoundingClientRect());
306
256
  });
307
- return a.observe(s), () => {
308
- c.dispose(), a.unobserve(s);
257
+ return c.observe(o), () => {
258
+ a.dispose(), c.unobserve(o);
309
259
  };
310
260
  }, []);
311
261
  function i() {
312
- n.executeCommand(L.id);
262
+ t.executeCommand(k.id);
313
263
  }
314
- function o() {
315
- n.executeCommand(A.id);
264
+ function s() {
265
+ t.executeCommand(F.id);
316
266
  }
317
- return /* @__PURE__ */ h.jsxs("div", { className: m.zenEditor, children: [
318
- /* @__PURE__ */ h.jsxs("div", { className: m.zenEditorIconWrapper, children: [
319
- /* @__PURE__ */ h.jsx(
267
+ return /* @__PURE__ */ _.jsxs("div", { className: p.zenEditor, children: [
268
+ /* @__PURE__ */ _.jsxs("div", { className: p.zenEditorIconWrapper, children: [
269
+ /* @__PURE__ */ _.jsx(
320
270
  "span",
321
271
  {
322
- className: V(m.zenEditorIconContainer, m.zenEditorIconError),
272
+ className: G(p.zenEditorIconContainer, p.zenEditorIconError),
323
273
  onClick: i,
324
- children: /* @__PURE__ */ h.jsx(ne, { style: { fontSize: "22px" } })
274
+ children: /* @__PURE__ */ _.jsx(se, { style: { fontSize: "22px" } })
325
275
  }
326
276
  ),
327
- /* @__PURE__ */ h.jsx(
277
+ /* @__PURE__ */ _.jsx(
328
278
  "span",
329
279
  {
330
- className: V(m.zenEditorIconContainer, m.zenEditorIconSuccess),
331
- onClick: o,
332
- children: /* @__PURE__ */ h.jsx(te, { style: { fontSize: "22px" } })
280
+ className: G(p.zenEditorIconContainer, p.zenEditorIconSuccess),
281
+ onClick: s,
282
+ children: /* @__PURE__ */ _.jsx(oe, { style: { fontSize: "22px" } })
333
283
  }
334
284
  )
335
285
  ] }),
336
- /* @__PURE__ */ h.jsx("div", { className: m.zenEditorCanvasContainer, ref: e })
286
+ /* @__PURE__ */ _.jsx("div", { className: p.zenEditorCanvasContainer, ref: e })
337
287
  ] });
338
288
  }
339
- function _t(e) {
289
+ function gt(e) {
340
290
  return {
341
- id: Z.id,
342
- type: ze.BUTTON,
291
+ id: B.id,
292
+ type: Pe.BUTTON,
343
293
  title: "rightClick.zenEditor",
344
294
  icon: "AmplifySingle",
345
- hidden$: Te(e),
346
- disabled$: be(e, { workbookTypes: [Le], worksheetTypes: [Ae, $e, Be], rangeTypes: [ke] })
295
+ hidden$: Re(e),
296
+ disabled$: ze(e, { workbookTypes: [Be], worksheetTypes: [ke, Fe, Ve], rangeTypes: [We] })
347
297
  };
348
298
  }
349
- const vt = {
350
- [Pe.MAIN_AREA]: {
351
- [xe.OTHERS]: {
352
- [Z.id]: {
299
+ const ht = {
300
+ [Me.MAIN_AREA]: {
301
+ [De.OTHERS]: {
302
+ [B.id]: {
353
303
  order: 2,
354
- menuItemFactory: _t
304
+ menuItemFactory: gt
355
305
  }
356
306
  }
357
307
  }
358
- }, Et = {
359
- id: A.id,
308
+ }, mt = {
309
+ id: F.id,
360
310
  description: "shortcut.sheet.zen-edit-confirm",
361
311
  group: "4_sheet-edit",
362
- preconditions: (e) => ie(e),
363
- binding: X.ENTER | Re.ALT
364
- }, It = {
365
- id: L.id,
312
+ preconditions: (e) => ae(e),
313
+ binding: ne.ENTER | we.ALT
314
+ }, _t = {
315
+ id: k.id,
366
316
  description: "shortcut.sheet.zen-edit-cancel",
367
317
  group: "4_sheet-edit",
368
- preconditions: (e) => ie(e),
369
- binding: X.ESC
318
+ preconditions: (e) => ae(e),
319
+ binding: ne.ESC
370
320
  };
371
- function ie(e) {
372
- return e.getContextValue(ge) && e.getContextValue(he) && e.getContextValue(me) && !e.getContextValue(pe);
321
+ function ae(e) {
322
+ return e.getContextValue(me) && e.getContextValue(_e) && e.getContextValue(pe) && !e.getContextValue(ve);
373
323
  }
374
- var St = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, Ot = (e, t, r, n) => {
375
- for (var i = n > 1 ? void 0 : n ? Ct(t, r) : t, o = e.length - 1, s; o >= 0; o--)
376
- (s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
377
- return n && i && St(t, r, i), i;
378
- }, C = (e, t) => (r, n) => t(r, n, e);
379
- let N = class extends _e {
380
- constructor(e, t, r, n) {
381
- super(), this._zenZoneService = e, this._commandService = t, this._menuManagerService = r, this._shortcutService = n, this._initialize();
324
+ var pt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Et = (e, n, r, t) => {
325
+ for (var i = t > 1 ? void 0 : t ? vt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
326
+ (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
327
+ return t && i && pt(n, r, i), i;
328
+ }, y = (e, n) => (r, t) => n(r, t, e);
329
+ let b = class extends Ee {
330
+ constructor(e, n, r, t) {
331
+ super(), this._zenZoneService = e, this._commandService = n, this._menuManagerService = r, this._shortcutService = t, this._initialize();
382
332
  }
383
333
  _initialize() {
384
334
  this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
385
335
  }
386
336
  _initCustomComponents() {
387
- this.disposeWithMe(this._zenZoneService.set(ht, pt));
337
+ this.disposeWithMe(this._zenZoneService.set(dt, ft));
388
338
  }
389
339
  _initCommands() {
390
- [Z, L, A].forEach((e) => {
340
+ [B, k, F].forEach((e) => {
391
341
  this.disposeWithMe(this._commandService.registerCommand(e));
392
342
  });
393
343
  }
394
344
  _initMenus() {
395
- this._menuManagerService.mergeMenu(vt);
345
+ this._menuManagerService.mergeMenu(ht);
396
346
  }
397
347
  _initShortcuts() {
398
- [Et, It].forEach((e) => {
348
+ [mt, _t].forEach((e) => {
399
349
  this.disposeWithMe(this._shortcutService.registerShortcut(e));
400
350
  });
401
351
  }
402
352
  };
403
- N = Ot([
404
- C(0, T),
405
- C(1, G),
406
- C(2, Me),
407
- C(3, De)
408
- ], N);
409
- var yt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Tt = (e, t, r, n) => {
410
- for (var i = n > 1 ? void 0 : n ? Nt(t, r) : t, o = e.length - 1, s; o >= 0; o--)
411
- (s = e[o]) && (i = (n ? s(t, r, i) : s(i)) || i);
412
- return n && i && yt(t, r, i), i;
413
- }, F = (e, t) => (r, n) => t(r, n, e), O;
414
- let W = (O = class extends ve {
415
- constructor(e = Fe, t, r) {
416
- super(), this._config = e, this._injector = t, this._configService = r;
417
- const { menu: n, ...i } = this._config;
418
- n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Ve, i), this._initializeDependencies(this._injector);
353
+ b = Et([
354
+ y(0, R),
355
+ y(1, ee),
356
+ y(2, je),
357
+ y(3, Ue)
358
+ ], b);
359
+ var St = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Ct = (e, n, r, t) => {
360
+ for (var i = t > 1 ? void 0 : t ? It(n, r) : n, s = e.length - 1, o; s >= 0; s--)
361
+ (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
362
+ return t && i && St(n, r, i), i;
363
+ }, q = (e, n) => (r, t) => n(r, t, e);
364
+ let T = class extends Se {
365
+ constructor(e, n) {
366
+ super(), this._zenEditorManagerService = e, this._renderManagerService = n, this._initialize();
367
+ }
368
+ _initialize() {
369
+ this._syncZenEditorSize();
370
+ }
371
+ // Listen to changes in the size of the zen editor container to set the size of the editor.
372
+ _syncZenEditorSize() {
373
+ this._zenEditorManagerService.position$.pipe($e(this.dispose$)).subscribe((e) => {
374
+ if (e == null)
375
+ return;
376
+ const { width: n, height: r } = e, t = xe(v, this._renderManagerService);
377
+ t != null && requestIdleCallback(() => {
378
+ t.engine.resizeBySize(n, r), this._calculatePagePosition(t), this._scrollToTop();
379
+ });
380
+ });
381
+ }
382
+ _calculatePagePosition(e) {
383
+ const { document: n, scene: r, docBackground: t } = e, i = r == null ? void 0 : r.getParent(), { width: s, height: o, pageMarginLeft: a, pageMarginTop: c } = n;
384
+ if (i == null || s === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
385
+ return;
386
+ const { width: u, height: l } = i;
387
+ let d = 0;
388
+ const g = c;
389
+ let h = 0, C = 0, E = Number.POSITIVE_INFINITY;
390
+ const { scaleX: m, scaleY: O } = r.getAncestorScale();
391
+ u > (s + a * 2) * m ? (d = u / 2 - s * m / 2, d /= m, h = (u - a * 2) / m, E = 0) : (d = a, h = s + a * 2, E = (h - u / m) / 2), l > o ? C = (l - c * 2) / O : C = o + c * 2, r.resize(h, C), n.translate(d, g), t.translate(d, g);
392
+ const z = r.getViewport(Ne.VIEW_MAIN);
393
+ if (E !== Number.POSITIVE_INFINITY && z != null) {
394
+ const le = z.transScroll2ViewportScrollValue(E, 0).x;
395
+ z.scrollToBarPos({
396
+ x: le
397
+ });
398
+ }
399
+ return this;
400
+ }
401
+ _scrollToTop() {
402
+ var r;
403
+ const e = (r = this._renderManagerService.getRenderById(v)) == null ? void 0 : r.with(be), n = {
404
+ startOffset: 0,
405
+ endOffset: 0
406
+ };
407
+ e && e.scrollToRange(n);
408
+ }
409
+ };
410
+ T = Ct([
411
+ q(0, W),
412
+ q(1, te)
413
+ ], T);
414
+ var Ot = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, Nt = (e, n, r, t) => {
415
+ for (var i = t > 1 ? void 0 : t ? yt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
416
+ (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
417
+ return t && i && Ot(n, r, i), i;
418
+ }, J = (e, n) => (r, t) => n(r, t, e), N;
419
+ let K = (N = class extends Ie {
420
+ constructor(e = Ye, n, r) {
421
+ super(), this._config = e, this._injector = n, this._configService = r;
422
+ const { menu: t, ...i } = this._config;
423
+ t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(He, i), this._initializeDependencies(this._injector);
419
424
  }
420
425
  _initializeDependencies(e) {
421
426
  [
422
- [N],
423
- [y],
424
- [$, { useClass: We }]
427
+ [b],
428
+ [T],
429
+ [W, { useClass: nt }]
425
430
  ].forEach((r) => e.add(r));
426
431
  }
427
432
  onReady() {
428
- this._injector.get(N);
433
+ this._injector.get(b);
429
434
  }
430
435
  onSteady() {
431
- this._injector.get(y);
436
+ this._injector.get(T);
432
437
  }
433
- }, v(O, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), v(O, "type", M.UNIVER_SHEET), O);
434
- W = Tt([
435
- F(1, Ee(Ie)),
436
- F(2, Se)
437
- ], W);
438
+ }, S(N, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), S(N, "type", j.UNIVER_SHEET), N);
439
+ K = Nt([
440
+ J(1, Ce(Oe)),
441
+ J(2, ye)
442
+ ], K);
438
443
  export {
439
- L as CancelZenEditCommand,
440
- A as ConfirmZenEditCommand,
441
- Z as OpenZenEditorCommand,
442
- W as UniverSheetsZenEditorPlugin
444
+ k as CancelZenEditCommand,
445
+ F as ConfirmZenEditCommand,
446
+ B as OpenZenEditorCommand,
447
+ K as UniverSheetsZenEditorPlugin
443
448
  };
@@ -0,0 +1,11 @@
1
+ const e = {
2
+ shortcut: {
3
+ sheet: {
4
+ "zen-edit-cancel": "Annuler l'édition plein écran",
5
+ "zen-edit-confirm": "Confirmer l'édition plein écran"
6
+ }
7
+ }
8
+ };
9
+ export {
10
+ e as default
11
+ };
@@ -1,5 +1,5 @@
1
1
  import { MenuConfig } from '@univerjs/ui';
2
- export declare const PLUGIN_CONFIG_KEY = "sheets-zen-editor.config";
2
+ export declare const SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY = "sheets-zen-editor.config";
3
3
  export declare const configSymbol: unique symbol;
4
4
  export interface IUniverSheetsZenEditorConfig {
5
5
  menu?: MenuConfig;
@@ -13,5 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import './global.css';
16
17
  export { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from './commands/commands/zen-editor.command';
17
18
  export { UniverSheetsZenEditorPlugin } from './plugin';
@@ -0,0 +1,3 @@
1
+ import { default as enUS } from './en-US';
2
+ declare const locale: typeof enUS;
3
+ export default locale;
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(a,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("rxjs"),require("react"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets"],o):(a=typeof globalThis<"u"?globalThis:a||self,o(a.UniverSheetsZenEditor={},a.UniverCore,a.UniverDocsUi,a.UniverEngineRender,a.UniverSheetsUi,a.UniverUi,a.rxjs,a.React,a.UniverSheets))})(this,function(a,o,v,A,I,u,B,g,y){"use strict";var Pe=Object.defineProperty;var be=(a,o,v)=>o in a?Pe(a,o,{enumerable:!0,configurable:!0,writable:!0,value:v}):a[o]=v;var O=(a,o,v)=>be(a,typeof o!="symbol"?o+"":o,v);var x;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var h;const t=e.get(u.IZenZoneService),r=e.get(v.IEditorService),n=e.get(I.IEditorBridgeService),i=e.get(o.IUniverInstanceService);t.open();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const c=n.getLatestEditCellState();if(c==null)return!1;const d=(h=c.documentLayoutObject.documentModel)==null?void 0:h.getSnapshot();if(d==null)return!1;i.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:l,drawings:E,drawingsOrder:S,tableSource:_,settings:U}=o.Tools.deepClone(d),T={...s.getDocumentData(),body:l,drawings:E,drawingsOrder:S,tableSource:_,settings:U},C=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(T,C),s.clearUndoRedoHistory(),!0}},z={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const t=e.get(u.IZenZoneService),r=e.get(I.IEditorBridgeService),n=e.get(o.IUniverInstanceService);t.close();const i=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return i?(n.focusUnit(i.getUnitId()),r.refreshEditCellState(),!0):!1}},R={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var l;const t=e.get(u.IZenZoneService),r=e.get(I.IEditorBridgeService),n=e.get(o.IUniverInstanceService),i=e.get(v.IEditorService);t.close();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const c=e.get(A.IRenderManagerService),d=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(d){const E=d.getUnitId(),S=(l=c.getRenderById(E))==null?void 0:l.with(I.EditingRenderController);if(S){const _=o.Tools.deepClone(s.getDocumentData());_.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,S.submitCellData(new o.DocumentDataModel(_))}return n.focusUnit(d.getUnitId()),r.refreshEditCellState(),!0}return!1}},q="sheets-zen-editor.config",J={};class Q{constructor(){O(this,"_position",null);O(this,"_position$",new B.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const Z=o.createIdentifier("univer.sheet-zen-editor-manager.service");var ee=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,te=(e,t,r,n)=>{for(var i=n>1?void 0:n?ne(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&ee(t,r,i),i},F=(e,t)=>(r,n)=>t(r,n,e);let P=class extends o.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(B.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:r}=e,n=I.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,r),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:r,docBackground:n}=e,i=r==null?void 0:r.getParent(),{width:s,height:c,pageMarginLeft:d,pageMarginTop:l}=t;if(i==null||s===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:E,height:S}=i;let _=0;const U=l;let N=0,T=0,C=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:ze}=r.getAncestorScale();E>(s+d*2)*h?(_=E/2-s*h/2,_/=h,N=(E-d*2)/h,C=0):(_=d,N=s+d*2,C=(N-E/h)/2),S>c?T=(S-l*2)/ze:T=c+l*2,r.resize(N,T),t.translate(_,U),n.translate(_,U);const L=r.getViewport(v.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&L!=null){const Re=L.transScroll2ViewportScrollValue(C,0).x;L.scrollToBarPos({x:Re})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(v.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};P=te([F(0,Z),F(1,A.IRenderManagerService)],P);var k={exports:{}},b={};/**
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"),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","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.rxjs,d.UniverSheets))})(this,function(d,o,h,F,S,f,I,k,N){"use strict";var Re=Object.defineProperty;var De=(d,o,h)=>o in d?Re(d,o,{enumerable:!0,configurable:!0,writable:!0,value:h}):d[o]=h;var T=(d,o,h)=>De(d,typeof o!="symbol"?o+"":o,h);var M;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var U;const t=e.get(f.IZenZoneService),r=e.get(h.IEditorService),n=e.get(S.IEditorBridgeService),i=e.get(o.IUniverInstanceService),a=e.get(f.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.open();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const l=n.getLatestEditCellState();if(l==null)return!1;const c=(U=l.documentLayoutObject.documentModel)==null?void 0:U.getSnapshot();if(c==null)return!1;i.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:g,drawings:u,drawingsOrder:v,tableSource:E,settings:m}=o.Tools.deepClone(c),y={...s.getDocumentData(),body:g,drawings:u,drawingsOrder:v,tableSource:E,settings:m},O=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(y,O),s.clearUndoRedoHistory(),!0}},z={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const t=e.get(f.IZenZoneService),r=e.get(S.IEditorBridgeService),n=e.get(o.IUniverInstanceService),i=e.get(f.ISidebarService);i.visible&&(i.close(),await o.delayAnimationFrame()),t.close();const a=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return a?(n.focusUnit(a.getUnitId()),r.refreshEditCellState(),!0):!1}},b={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var g;const t=e.get(f.IZenZoneService),r=e.get(S.IEditorBridgeService),n=e.get(o.IUniverInstanceService),i=e.get(h.IEditorService),a=e.get(f.ISidebarService);a.visible&&(a.close(),await o.delayAnimationFrame()),t.close();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const l=e.get(F.IRenderManagerService),c=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(c){const u=c.getUnitId(),v=(g=l.getRenderById(u))==null?void 0:g.with(S.EditingRenderController);if(v){const E=o.Tools.deepClone(s.getDocumentData());E.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,v.submitCellData(new o.DocumentDataModel(E))}return n.focusUnit(c.getUnitId()),r.refreshEditCellState(),!0}return!1}},Q="sheets-zen-editor.config",ee={};var w={exports:{}},R={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var re=g,ie=Symbol.for("react.element"),oe=Symbol.for("react.fragment"),se=Object.prototype.hasOwnProperty,ce=re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ae={key:!0,ref:!0,__self:!0,__source:!0};function V(e,t,r){var n,i={},s=null,c=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)se.call(t,n)&&!ae.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:ie,type:e,key:s,ref:c,props:i,_owner:ce.current}}b.Fragment=oe,b.jsx=V,b.jsxs=V,k.exports=b;var m=k.exports,f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},f.apply(this,arguments)},de=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},w=g.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,c=de(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=g.useRef("_".concat(fe()));return W(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},f({ref:t,className:d},c),s)});function W(e,t,r,n,i){return g.createElement(e.tag,f(f({key:t},le(e,r,i)),n),(ue(e,r).children||[]).map(function(s,c){return W(s,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,i)}))}function le(e,t,r){var n=f({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],d=s[1];typeof d=="string"&&(n[c]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function ue(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?f(f({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?f(f({},i),{attrs:f(f({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function fe(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Y=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ve}))});Y.displayName="CheckMarkSingle";var ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},K=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:ge}))});K.displayName="CloseSingle";function H(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=H(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function G(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=H(e))&&(n&&(n+=" "),n+=t);return n}const p={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},_e="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",Ee={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 he(){const e=g.useRef(null),t=o.useDependency(Z),r=o.useDependency(v.IEditorService),n=o.useDependency(o.ICommandService);g.useEffect(()=>{const c=e.current;if(!c)return;const d=r.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:Ee,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},c),l=new ResizeObserver(()=>{t.setPosition(c.getBoundingClientRect())});return l.observe(c),()=>{d.dispose(),l.unobserve(c)}},[]);function i(){n.executeCommand(z.id)}function s(){n.executeCommand(R.id)}return m.jsxs("div",{className:p.zenEditor,children:[m.jsxs("div",{className:p.zenEditorIconWrapper,children:[m.jsx("span",{className:G(p.zenEditorIconContainer,p.zenEditorIconError),onClick:i,children:m.jsx(K,{style:{fontSize:"22px"}})}),m.jsx("span",{className:G(p.zenEditorIconContainer,p.zenEditorIconSuccess),onClick:s,children:m.jsx(Y,{style:{fontSize:"22px"}})})]}),m.jsx("div",{className:p.zenEditorCanvasContainer,ref:e})]})}function Ie(e){return{id:D.id,type:u.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:I.getCurrentExclusiveRangeInterest$(e),disabled$:I.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const me={[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:Ie}}}},pe={id:R.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>$(e),binding:u.KeyCode.ENTER|u.MetaKeys.ALT},Se={id:z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>$(e),binding:u.KeyCode.ESC};function $(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 Ce=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ye=(e,t,r,n)=>{for(var i=n>1?void 0:n?Oe(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ce(t,r,i),i},j=(e,t)=>(r,n)=>t(r,n,e);let M=class extends o.Disposable{constructor(e,t,r,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=r,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(_e,he))}_initCommands(){[D,z,R].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(me)}_initShortcuts(){[pe,Se].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};M=ye([j(0,u.IZenZoneService),j(1,o.ICommandService),j(2,u.IMenuManagerService),j(3,u.IShortcutService)],M);var Ne=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,De=(e,t,r,n)=>{for(var i=n>1?void 0:n?Te(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ne(t,r,i),i},X=(e,t)=>(r,n)=>t(r,n,e);a.UniverSheetsZenEditorPlugin=(x=class extends o.Plugin{constructor(t=J,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...s}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(q,s),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[M],[P],[Z,{useClass:Q}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(P)}},O(x,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),O(x,"type",o.UniverInstanceType.UNIVER_SHEET),x),a.UniverSheetsZenEditorPlugin=De([X(1,o.Inject(o.Injector)),X(2,o.IConfigService)],a.UniverSheetsZenEditorPlugin),a.CancelZenEditCommand=z,a.ConfirmZenEditCommand=R,a.OpenZenEditorCommand=D,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
9
+ */var V;function ne(){if(V)return R;V=1;var e=I,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(l,c,g){var u,v={},E=null,m=null;g!==void 0&&(E=""+g),c.key!==void 0&&(E=""+c.key),c.ref!==void 0&&(m=c.ref);for(u in c)n.call(c,u)&&!a.hasOwnProperty(u)&&(v[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)v[u]===void 0&&(v[u]=c[u]);return{$$typeof:t,type:l,key:E,ref:m,props:v,_owner:i.current}}return R.Fragment=r,R.jsx=s,R.jsxs=s,R}var W;function te(){return W||(W=1,w.exports=ne()),w.exports}var p=te(),_=function(){return _=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},_.apply(this,arguments)},re=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},A=I.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,a=e.extend,s=re(e,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),c=I.useRef("_".concat(se()));return Y(r,"".concat(n),{defIds:r.defIds,idSuffix:c.current},_({ref:t,className:l},s),a)});function Y(e,t,r,n,i){return I.createElement(e.tag,_(_({key:t},ie(e,r,i)),n),(oe(e,r).children||[]).map(function(a,s){return Y(a,"".concat(t,"-").concat(e.tag,"-").concat(s),r,void 0,i)}))}function ie(e,t,r){var n=_({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var s=a[0],l=a[1];typeof l=="string"&&(n[s]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function oe(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?_(_({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?_(_({},i),{attrs:_(_({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function se(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var ae={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"}}]},K=I.forwardRef(function(e,t){return I.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ae}))});K.displayName="CheckMarkSingle";var ce={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"}}]},H=I.forwardRef(function(e,t){return I.createElement(A,Object.assign({},e,{id:"close-single",ref:t,icon:ce}))});H.displayName="CloseSingle";function G(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=G(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function $(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=G(e))&&(n&&(n+=" "),n+=t);return n}class de{constructor(){T(this,"_position",null);T(this,"_position$",new k.BehaviorSubject(null));T(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const B=o.createIdentifier("univer.sheet-zen-editor-manager.service"),C={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},le="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",ue={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 fe(){const e=I.useRef(null),t=o.useDependency(B),r=o.useDependency(h.IEditorService),n=o.useDependency(o.ICommandService);I.useEffect(()=>{const s=e.current;if(!s)return;const l=r.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:ue,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},s),c=new ResizeObserver(()=>{t.setPosition(s.getBoundingClientRect())});return c.observe(s),()=>{l.dispose(),c.unobserve(s)}},[]);function i(){n.executeCommand(z.id)}function a(){n.executeCommand(b.id)}return p.jsxs("div",{className:C.zenEditor,children:[p.jsxs("div",{className:C.zenEditorIconWrapper,children:[p.jsx("span",{className:$(C.zenEditorIconContainer,C.zenEditorIconError),onClick:i,children:p.jsx(H,{style:{fontSize:"22px"}})}),p.jsx("span",{className:$(C.zenEditorIconContainer,C.zenEditorIconSuccess),onClick:a,children:p.jsx(K,{style:{fontSize:"22px"}})})]}),p.jsx("div",{className:C.zenEditorCanvasContainer,ref:e})]})}function ve(e){return{id:D.id,type:f.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:S.getCurrentExclusiveRangeInterest$(e),disabled$:S.getCurrentRangeDisable$(e,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission,N.WorksheetSetCellValuePermission,N.WorksheetSetCellStylePermission],rangeTypes:[N.RangeProtectionPermissionEditPoint]})}}const _e={[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:ve}}}},ge={id:b.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>q(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ee={id:z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>q(e),binding:f.KeyCode.ESC};function q(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 he=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,me=(e,t,r,n)=>{for(var i=n>1?void 0:n?Ie(t,r):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(i=(n?s(t,r,i):s(i))||i);return n&&i&&he(t,r,i),i},P=(e,t)=>(r,n)=>t(r,n,e);let j=class extends o.Disposable{constructor(e,t,r,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=r,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(le,fe))}_initCommands(){[D,z,b].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(_e)}_initShortcuts(){[ge,Ee].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};j=me([P(0,f.IZenZoneService),P(1,o.ICommandService),P(2,f.IMenuManagerService),P(3,f.IShortcutService)],j);var Se=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,Ce=(e,t,r,n)=>{for(var i=n>1?void 0:n?pe(t,r):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(i=(n?s(t,r,i):s(i))||i);return n&&i&&Se(t,r,i),i},J=(e,t)=>(r,n)=>t(r,n,e);let x=class extends o.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(k.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:r}=e,n=S.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,r),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:r,docBackground:n}=e,i=r==null?void 0:r.getParent(),{width:a,height:s,pageMarginLeft:l,pageMarginTop:c}=t;if(i==null||a===Number.POSITIVE_INFINITY||s===Number.POSITIVE_INFINITY)return;const{width:g,height:u}=i;let v=0;const E=c;let m=0,Z=0,y=Number.POSITIVE_INFINITY;const{scaleX:O,scaleY:U}=r.getAncestorScale();g>(a+l*2)*O?(v=g/2-a*O/2,v/=O,m=(g-l*2)/O,y=0):(v=l,m=a+l*2,y=(m-g/O)/2),u>s?Z=(u-c*2)/U:Z=s+c*2,r.resize(m,Z),t.translate(v,E),n.translate(v,E);const L=r.getViewport(h.VIEWPORT_KEY.VIEW_MAIN);if(y!==Number.POSITIVE_INFINITY&&L!=null){const Ne=L.transScroll2ViewportScrollValue(y,0).x;L.scrollToBarPos({x:Ne})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(h.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};x=Ce([J(0,B),J(1,F.IRenderManagerService)],x);var Oe=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Te=(e,t,r,n)=>{for(var i=n>1?void 0:n?ye(t,r):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(i=(n?s(t,r,i):s(i))||i);return n&&i&&Oe(t,r,i),i},X=(e,t)=>(r,n)=>t(r,n,e);d.UniverSheetsZenEditorPlugin=(M=class extends o.Plugin{constructor(t=ee,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...a}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Q,a),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[j],[x],[B,{useClass:de}]].forEach(n=>t.add(n))}onReady(){this._injector.get(j)}onSteady(){this._injector.get(x)}},T(M,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),T(M,"type",o.UniverInstanceType.UNIVER_SHEET),M),d.UniverSheetsZenEditorPlugin=Te([X(1,o.Inject(o.Injector)),X(2,o.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=z,d.ConfirmZenEditCommand=b,d.OpenZenEditorCommand=D,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1 @@
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFrFR=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Annuler l'édition plein écran","zen-edit-confirm":"Confirmer l'édition plein écran"}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-zen-editor",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-nightly.202411301606",
4
4
  "private": false,
5
5
  "description": "Zen Editor plugin for Univer Sheets.",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -54,23 +54,25 @@
54
54
  "rxjs": ">=7.0.0"
55
55
  },
56
56
  "dependencies": {
57
- "@univerjs/icons": "^0.2.7",
57
+ "@univerjs/icons": "^0.2.8",
58
58
  "clsx": "^2.1.1",
59
- "@univerjs/core": "0.5.0",
60
- "@univerjs/docs-ui": "0.5.0",
61
- "@univerjs/sheets": "0.5.0",
62
- "@univerjs/sheets-ui": "0.5.0",
63
- "@univerjs/engine-render": "0.5.0",
64
- "@univerjs/ui": "0.5.0"
59
+ "@univerjs/core": "0.5.1-nightly.202411301606",
60
+ "@univerjs/docs-ui": "0.5.1-nightly.202411301606",
61
+ "@univerjs/engine-render": "0.5.1-nightly.202411301606",
62
+ "@univerjs/sheets": "0.5.1-nightly.202411301606",
63
+ "@univerjs/sheets-ui": "0.5.1-nightly.202411301606",
64
+ "@univerjs/ui": "0.5.1-nightly.202411301606"
65
65
  },
66
66
  "devDependencies": {
67
- "less": "^4.2.0",
67
+ "less": "^4.2.1",
68
+ "postcss": "^8.4.49",
68
69
  "react": "18.3.1",
69
70
  "rxjs": "^7.8.1",
70
- "typescript": "^5.6.3",
71
- "vite": "^5.4.11",
72
- "vitest": "^2.1.5",
73
- "@univerjs-infra/shared": "0.5.0"
71
+ "tailwindcss": "^3.4.15",
72
+ "typescript": "^5.7.2",
73
+ "vite": "^6.0.1",
74
+ "vitest": "^2.1.6",
75
+ "@univerjs-infra/shared": "0.5.1"
74
76
  },
75
77
  "space": {
76
78
  ".": {
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