@univerjs/sheets-zen-editor 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -0
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +116 -0
- package/lib/es/index.js +21 -21
- package/lib/types/facade/f-univer.d.ts +11 -0
- package/lib/types/facade/f-workbook.d.ts +31 -0
- package/lib/types/facade/index.d.ts +19 -0
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/package.json +17 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("@univerjs/core"),l=require("@univerjs/docs"),S=require("@univerjs/sheets-ui"),i=require("@univerjs/sheets-zen-editor"),C=require("@univerjs/sheets/facade");class Z extends t.FUniver{_initSheetZenEditorEvent(n){const m=n.get(t.ICommandService);this.disposeWithMe(m.beforeCommandExecuted(e=>{if(e.id===i.OpenZenEditorCommand.id||e.id===i.CancelZenEditCommand.id||e.id===i.ConfirmZenEditCommand.id){if(!this._eventListend(this.Event.BeforeSheetEditStart)&&!this._eventListend(this.Event.BeforeSheetEditEnd))return;const s=this.getCommandSheetTarget(e);if(!s)return;const{workbook:d,worksheet:c}=s,h=n.get(S.IEditorBridgeService),u=n.get(t.IUniverInstanceService),v=e.params,{keycode:a,eventType:o}=v,r=h.getEditLocation();if(e.id===i.OpenZenEditorCommand.id){const E={row:r.row,column:r.column,eventType:o,keycode:a,workbook:d,worksheet:c,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,E),E.cancel)throw new t.CanceledError}else{const E={row:r.row,column:r.column,eventType:o,keycode:a,workbook:d,worksheet:c,isZenEditor:!0,value:t.RichTextValue.create(u.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:e.id===i.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,E),E.cancel)throw new t.CanceledError}}})),this.disposeWithMe(m.onCommandExecuted(e=>{if(e.id===i.OpenZenEditorCommand.id||e.id===i.CancelZenEditCommand.id||e.id===i.ConfirmZenEditCommand.id){if(!this._eventListend(this.Event.SheetEditStarted)&&!this._eventListend(this.Event.SheetEditEnded))return;const s=this.getCommandSheetTarget(e);if(!s)return;const{workbook:d,worksheet:c}=s,h=n.get(S.IEditorBridgeService),u=e.params,{keycode:v,eventType:a}=u,o=h.getEditLocation();if(e.id===i.OpenZenEditorCommand.id){const r={row:o.row,column:o.column,eventType:a,keycode:v,workbook:d,worksheet:c,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,r)}else{const r={row:o.row,column:o.column,eventType:a,keycode:v,workbook:d,worksheet:c,isZenEditor:!0,isConfirm:e.id===i.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,r)}}if(e.id===l.RichTextEditingMutation.id){if(!this._eventListend(this.Event.SheetEditChanging))return;const s=this.getCommandSheetTarget(e);if(!s)return;const{workbook:d,worksheet:c}=s,h=n.get(S.IEditorBridgeService),u=n.get(t.IUniverInstanceService),v=e.params;if(!h.isVisible().visible)return;const{unitId:a}=v;if(a===t.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:o,column:r}=h.getEditLocation(),E={workbook:d,worksheet:c,row:o,column:r,value:t.RichTextValue.create(u.getUnit(t.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,E)}}}))}_initialize(n){this._initSheetZenEditorEvent(n)}}t.FUniver.extend(Z);class _ extends C.FWorkbook{startZenEditingAsync(){return this._injector.get(t.ICommandService).executeCommand(i.OpenZenEditorCommand.id)}endZenEditingAsync(n=!0){const m=this._injector.get(t.ICommandService);return n?m.executeCommand(i.ConfirmZenEditCommand.id):m.executeCommand(i.CancelZenEditCommand.id)}}C.FWorkbook.extend(_);
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ee=Object.defineProperty;var te=(e,n,r)=>n in e?ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var O=(e,n,r)=>te(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),T=require("@univerjs/docs-ui"),W=require("@univerjs/engine-render"),p=require("@univerjs/sheets-ui"),f=require("@univerjs/ui"),
|
|
1
|
+
"use strict";var ee=Object.defineProperty;var te=(e,n,r)=>n in e?ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var O=(e,n,r)=>te(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),T=require("@univerjs/docs-ui"),W=require("@univerjs/engine-render"),p=require("@univerjs/sheets-ui"),f=require("@univerjs/ui"),m=require("react"),q=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:h,settings:v}=o.Tools.deepClone(a),C={...s.getDocumentData(),body:g,drawings:l,drawingsOrder:u,tableSource:h,settings:v},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(W.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 h=o.Tools.deepClone(s.getDocumentData());h.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,u.submitCellData(new o.DocumentDataModel(h))}return t.focusUnit(a.getUnitId()),r.refreshEditCellState(),!0}return!1}},ne="sheets-zen-editor.config",L={};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 $;function re(){if($)return N;$=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 F;function ie(){return F||(F=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 K(r,"".concat(t),{defIds:r.defIds,idSuffix:a.current},_({ref:n,className:d},s),c)});function K(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 K(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"}}]},H=h.forwardRef(function(e,n){return h.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:n,icon:de}))});H.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"}}]},G=h.forwardRef(function(e,n){return h.createElement(A,Object.assign({},e,{id:"close-single",ref:n,icon:le}))});G.displayName="CloseSingle";function J(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=J(e[n]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function k(){for(var e,n,r=0,t="",i=arguments.length;r<i;r++)(e=arguments[r])&&(n=J(e))&&(t&&(t+=" "),t+=n);return t}class ue{constructor(){O(this,"_position",null);O(this,"_position$",new q.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(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:k(S.zenEditorIconContainer,S.zenEditorIconError),onClick:i,children:I.jsx(G,{style:{fontSize:"22px"}})}),I.jsx("span",{className:k(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:c,children:I.jsx(H,{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=>X(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ne={id:U.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>X(e),binding:f.KeyCode.ESC};function X(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},V=(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(q.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 Q=w.transScroll2ViewportScrollValue(C,0).x;w.scrollToBarPos({x:Q})}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([V(0,B),V(1,W.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},Y=(e,n)=>(r,t)=>n(r,t,e),z;exports.UniverSheetsZenEditorPlugin=(z=class extends o.Plugin{constructor(n=L,r,t){super(),this._config=n,this._injector=r,this._configService=t;const{menu:i,...c}=o.merge({},L,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ne,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([Y(1,o.Inject(o.Injector)),Y(2,o.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=U;exports.ConfirmZenEditCommand=Z;exports.OpenZenEditorCommand=M;
|
|
9
|
+
*/var $;function re(){if($)return N;$=1;var e=m,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={},h=null,v=null;g!==void 0&&(h=""+g),a.key!==void 0&&(h=""+a.key),a.ref!==void 0&&(v=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:h,ref:v,props:u,_owner:i.current}}return N.Fragment=r,N.jsx=s,N.jsxs=s,N}var F;function ie(){return F||(F=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=m.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=m.useRef("_".concat(ae()));return K(r,"".concat(t),{defIds:r.defIds,idSuffix:a.current},_({ref:n,className:d},s),c)});function K(e,n,r,t,i){return m.createElement(e.tag,_(_({key:n},se(e,r,i)),t),(ce(e,r).children||[]).map(function(c,s){return K(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"}}]},H=m.forwardRef(function(e,n){return m.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:n,icon:de}))});H.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"}}]},G=m.forwardRef(function(e,n){return m.createElement(A,Object.assign({},e,{id:"close-single",ref:n,icon:le}))});G.displayName="CloseSingle";function J(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=J(e[n]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function k(){for(var e,n,r=0,t="",i=arguments.length;r<i;r++)(e=arguments[r])&&(n=J(e))&&(t&&(t+=" "),t+=n);return t}class ue{constructor(){O(this,"_position",null);O(this,"_position$",new q.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(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",he="univer-zen-editor-icon-success",me="univer-zen-editor-icon-error",ve="univer-zen-editor-canvas-container",S={zenEditor:fe,zenEditorIconWrapper:ge,zenEditorIconContainer:_e,zenEditorIconSuccess:he,zenEditorIconError:me,zenEditorCanvasContainer:ve},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=m.useRef(null),n=o.useDependency(B),r=o.useDependency(T.IEditorService),t=o.useDependency(o.ICommandService);m.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:k(S.zenEditorIconContainer,S.zenEditorIconError),onClick:i,children:I.jsx(G,{style:{fontSize:"22px"}})}),I.jsx("span",{className:k(S.zenEditorIconContainer,S.zenEditorIconSuccess),onClick:c,children:I.jsx(H,{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=>X(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ne={id:U.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>X(e),binding:f.KeyCode.ESC};function X(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},V=(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(q.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 h=a;let v=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,v=(g-d*2)/E,C=0):(u=d,v=c+d*2,C=(v-g/E)/2),l>s?R=(l-a*2)/b:R=s+a*2,r.resize(v,R),n.translate(u,h),t.translate(u,h);const w=r.getViewport(T.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&w!=null){const Q=w.transScroll2ViewportScrollValue(C,0).x;w.scrollToBarPos({x:Q})}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([V(0,B),V(1,W.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},Y=(e,n)=>(r,t)=>n(r,t,e),z;exports.UniverSheetsZenEditorPlugin=(z=class extends o.Plugin{constructor(n=L,r,t){super(),this._config=n,this._injector=r,this._configService=t;const{menu:i,...c}=o.merge({},L,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ne,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([Y(1,o.Inject(o.Injector)),Y(2,o.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=U;exports.ConfirmZenEditCommand=Z;exports.OpenZenEditorCommand=M;
|
package/lib/es/facade.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { FUniver as k, ICommandService as l, IUniverInstanceService as w, CanceledError as f, RichTextValue as p, DOCS_ZEN_EDITOR_UNIT_ID_KEY as g } from "@univerjs/core";
|
|
2
|
+
import { RichTextEditingMutation as x } from "@univerjs/docs";
|
|
3
|
+
import { IEditorBridgeService as m } from "@univerjs/sheets-ui";
|
|
4
|
+
import { OpenZenEditorCommand as u, CancelZenEditCommand as C, ConfirmZenEditCommand as S } from "@univerjs/sheets-zen-editor";
|
|
5
|
+
import { FWorkbook as Z } from "@univerjs/sheets/facade";
|
|
6
|
+
class T extends k {
|
|
7
|
+
// eslint-disable-next-line max-lines-per-function
|
|
8
|
+
_initSheetZenEditorEvent(t) {
|
|
9
|
+
const E = t.get(l);
|
|
10
|
+
this.disposeWithMe(E.beforeCommandExecuted((e) => {
|
|
11
|
+
if (e.id === u.id || e.id === C.id || e.id === S.id) {
|
|
12
|
+
if (!this._eventListend(this.Event.BeforeSheetEditStart) && !this._eventListend(this.Event.BeforeSheetEditEnd))
|
|
13
|
+
return;
|
|
14
|
+
const r = this.getCommandSheetTarget(e);
|
|
15
|
+
if (!r)
|
|
16
|
+
return;
|
|
17
|
+
const { workbook: s, worksheet: o } = r, h = t.get(m), v = t.get(w), a = e.params, { keycode: d, eventType: n } = a, i = h.getEditLocation();
|
|
18
|
+
if (e.id === u.id) {
|
|
19
|
+
const c = {
|
|
20
|
+
row: i.row,
|
|
21
|
+
column: i.column,
|
|
22
|
+
eventType: n,
|
|
23
|
+
keycode: d,
|
|
24
|
+
workbook: s,
|
|
25
|
+
worksheet: o,
|
|
26
|
+
isZenEditor: !0
|
|
27
|
+
};
|
|
28
|
+
if (this.fireEvent(this.Event.BeforeSheetEditStart, c), c.cancel)
|
|
29
|
+
throw new f();
|
|
30
|
+
} else {
|
|
31
|
+
const c = {
|
|
32
|
+
row: i.row,
|
|
33
|
+
column: i.column,
|
|
34
|
+
eventType: n,
|
|
35
|
+
keycode: d,
|
|
36
|
+
workbook: s,
|
|
37
|
+
worksheet: o,
|
|
38
|
+
isZenEditor: !0,
|
|
39
|
+
value: p.create(v.getUnit(g).getSnapshot()),
|
|
40
|
+
isConfirm: e.id === S.id
|
|
41
|
+
};
|
|
42
|
+
if (this.fireEvent(this.Event.BeforeSheetEditEnd, c), c.cancel)
|
|
43
|
+
throw new f();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})), this.disposeWithMe(E.onCommandExecuted((e) => {
|
|
47
|
+
if (e.id === u.id || e.id === C.id || e.id === S.id) {
|
|
48
|
+
if (!this._eventListend(this.Event.SheetEditStarted) && !this._eventListend(this.Event.SheetEditEnded))
|
|
49
|
+
return;
|
|
50
|
+
const r = this.getCommandSheetTarget(e);
|
|
51
|
+
if (!r)
|
|
52
|
+
return;
|
|
53
|
+
const { workbook: s, worksheet: o } = r, h = t.get(m), v = e.params, { keycode: a, eventType: d } = v, n = h.getEditLocation();
|
|
54
|
+
if (e.id === u.id) {
|
|
55
|
+
const i = {
|
|
56
|
+
row: n.row,
|
|
57
|
+
column: n.column,
|
|
58
|
+
eventType: d,
|
|
59
|
+
keycode: a,
|
|
60
|
+
workbook: s,
|
|
61
|
+
worksheet: o,
|
|
62
|
+
isZenEditor: !0
|
|
63
|
+
};
|
|
64
|
+
this.fireEvent(this.Event.SheetEditStarted, i);
|
|
65
|
+
} else {
|
|
66
|
+
const i = {
|
|
67
|
+
row: n.row,
|
|
68
|
+
column: n.column,
|
|
69
|
+
eventType: d,
|
|
70
|
+
keycode: a,
|
|
71
|
+
workbook: s,
|
|
72
|
+
worksheet: o,
|
|
73
|
+
isZenEditor: !0,
|
|
74
|
+
isConfirm: e.id === S.id
|
|
75
|
+
};
|
|
76
|
+
this.fireEvent(this.Event.SheetEditEnded, i);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (e.id === x.id) {
|
|
80
|
+
if (!this._eventListend(this.Event.SheetEditChanging))
|
|
81
|
+
return;
|
|
82
|
+
const r = this.getCommandSheetTarget(e);
|
|
83
|
+
if (!r)
|
|
84
|
+
return;
|
|
85
|
+
const { workbook: s, worksheet: o } = r, h = t.get(m), v = t.get(w), a = e.params;
|
|
86
|
+
if (!h.isVisible().visible) return;
|
|
87
|
+
const { unitId: d } = a;
|
|
88
|
+
if (d === g) {
|
|
89
|
+
const { row: n, column: i } = h.getEditLocation(), c = {
|
|
90
|
+
workbook: s,
|
|
91
|
+
worksheet: o,
|
|
92
|
+
row: n,
|
|
93
|
+
column: i,
|
|
94
|
+
value: p.create(v.getUnit(g).getSnapshot()),
|
|
95
|
+
isZenEditor: !0
|
|
96
|
+
};
|
|
97
|
+
this.fireEvent(this.Event.SheetEditChanging, c);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
_initialize(t) {
|
|
103
|
+
this._initSheetZenEditorEvent(t);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
k.extend(T);
|
|
107
|
+
class b extends Z {
|
|
108
|
+
startZenEditingAsync() {
|
|
109
|
+
return this._injector.get(l).executeCommand(u.id);
|
|
110
|
+
}
|
|
111
|
+
endZenEditingAsync(t = !0) {
|
|
112
|
+
const E = this._injector.get(l);
|
|
113
|
+
return t ? E.executeCommand(S.id) : E.executeCommand(C.id);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
Z.extend(b);
|
package/lib/es/index.js
CHANGED
|
@@ -26,11 +26,11 @@ const B = {
|
|
|
26
26
|
if (c == null)
|
|
27
27
|
return !1;
|
|
28
28
|
i.focusUnit(v);
|
|
29
|
-
const { body: u, drawings:
|
|
29
|
+
const { body: u, drawings: d, drawingsOrder: l, tableSource: g, settings: h } = Q.deepClone(c), E = {
|
|
30
30
|
...o.getDocumentData(),
|
|
31
31
|
body: u,
|
|
32
|
-
drawings:
|
|
33
|
-
drawingsOrder:
|
|
32
|
+
drawings: d,
|
|
33
|
+
drawingsOrder: l,
|
|
34
34
|
tableSource: g,
|
|
35
35
|
settings: h
|
|
36
36
|
}, m = [
|
|
@@ -63,10 +63,10 @@ const B = {
|
|
|
63
63
|
return !1;
|
|
64
64
|
const a = e.get(ne), c = t.getCurrentUnitForType(j.UNIVER_SHEET);
|
|
65
65
|
if (c) {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
66
|
+
const d = c.getUnitId(), l = (u = a.getRenderById(d)) == null ? void 0 : u.with(ze);
|
|
67
|
+
if (l) {
|
|
68
68
|
const g = Q.deepClone(o.getDocumentData());
|
|
69
|
-
g.documentStyle.documentFlavor = ee.UNSPECIFIED,
|
|
69
|
+
g.documentStyle.documentFlavor = ee.UNSPECIFIED, l.submitCellData(new ge(g));
|
|
70
70
|
}
|
|
71
71
|
return t.focusUnit(c.getUnitId()), r.refreshEditCellState(), !0;
|
|
72
72
|
}
|
|
@@ -89,11 +89,11 @@ function qe() {
|
|
|
89
89
|
Y = 1;
|
|
90
90
|
var e = Le, 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
91
|
function o(a, c, u) {
|
|
92
|
-
var
|
|
92
|
+
var d, l = {}, g = null, h = null;
|
|
93
93
|
u !== void 0 && (g = "" + u), c.key !== void 0 && (g = "" + c.key), c.ref !== void 0 && (h = c.ref);
|
|
94
|
-
for (
|
|
95
|
-
if (a && a.defaultProps) for (
|
|
96
|
-
return { $$typeof: n, type: a, key: g, ref: h, props:
|
|
94
|
+
for (d in c) t.call(c, d) && !s.hasOwnProperty(d) && (l[d] = c[d]);
|
|
95
|
+
if (a && a.defaultProps) for (d in c = a.defaultProps, c) l[d] === void 0 && (l[d] = c[d]);
|
|
96
|
+
return { $$typeof: n, type: a, key: g, ref: h, props: l, _owner: i.current };
|
|
97
97
|
}
|
|
98
98
|
return I.Fragment = r, I.jsx = o, I.jsxs = o, I;
|
|
99
99
|
}
|
|
@@ -194,14 +194,14 @@ class rt {
|
|
|
194
194
|
}
|
|
195
195
|
const W = he(
|
|
196
196
|
"univer.sheet-zen-editor-manager.service"
|
|
197
|
-
), it = "univer-zen-editor", ot = "univer-zen-editor-icon-wrapper", st = "univer-zen-editor-icon-container", ct = "univer-zen-editor-icon-success", at = "univer-zen-editor-icon-error",
|
|
197
|
+
), it = "univer-zen-editor", ot = "univer-zen-editor-icon-wrapper", st = "univer-zen-editor-icon-container", ct = "univer-zen-editor-icon-success", at = "univer-zen-editor-icon-error", dt = "univer-zen-editor-canvas-container", p = {
|
|
198
198
|
zenEditor: it,
|
|
199
199
|
zenEditorIconWrapper: ot,
|
|
200
200
|
zenEditorIconContainer: st,
|
|
201
201
|
zenEditorIconSuccess: ct,
|
|
202
202
|
zenEditorIconError: at,
|
|
203
|
-
zenEditorCanvasContainer:
|
|
204
|
-
},
|
|
203
|
+
zenEditorCanvasContainer: dt
|
|
204
|
+
}, lt = "ZEN_EDITOR_PLUGIN_", ut = `${lt}ZEN_EDITOR_COMPONENT`, ft = {
|
|
205
205
|
id: v,
|
|
206
206
|
body: {
|
|
207
207
|
dataStream: `${me}`,
|
|
@@ -309,16 +309,16 @@ const mt = {
|
|
|
309
309
|
id: F.id,
|
|
310
310
|
description: "shortcut.sheet.zen-edit-confirm",
|
|
311
311
|
group: "4_sheet-edit",
|
|
312
|
-
preconditions: (e) =>
|
|
312
|
+
preconditions: (e) => de(e),
|
|
313
313
|
binding: re.ENTER | Ue.ALT
|
|
314
314
|
}, pt = {
|
|
315
315
|
id: k.id,
|
|
316
316
|
description: "shortcut.sheet.zen-edit-cancel",
|
|
317
317
|
group: "4_sheet-edit",
|
|
318
|
-
preconditions: (e) =>
|
|
318
|
+
preconditions: (e) => de(e),
|
|
319
319
|
binding: re.ESC
|
|
320
320
|
};
|
|
321
|
-
function
|
|
321
|
+
function de(e) {
|
|
322
322
|
return e.getContextValue(_e) && e.getContextValue(pe) && e.getContextValue(ve) && !e.getContextValue(Ee);
|
|
323
323
|
}
|
|
324
324
|
var vt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, St = (e, n, r, t) => {
|
|
@@ -383,17 +383,17 @@ let T = class extends Ie {
|
|
|
383
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
384
|
if (i == null || s === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
|
|
385
385
|
return;
|
|
386
|
-
const { width: u, height:
|
|
387
|
-
let
|
|
386
|
+
const { width: u, height: d } = i;
|
|
387
|
+
let l = 0;
|
|
388
388
|
const g = c;
|
|
389
389
|
let h = 0, C = 0, E = Number.POSITIVE_INFINITY;
|
|
390
390
|
const { scaleX: m, scaleY: O } = r.getAncestorScale();
|
|
391
|
-
u > (s + a * 2) * m ? (
|
|
391
|
+
u > (s + a * 2) * m ? (l = u / 2 - s * m / 2, l /= m, h = (u - a * 2) / m, E = 0) : (l = a, h = s + a * 2, E = (h - u / m) / 2), d > o ? C = (d - c * 2) / O : C = o + c * 2, r.resize(h, C), n.translate(l, g), t.translate(l, g);
|
|
392
392
|
const z = r.getViewport(Te.VIEW_MAIN);
|
|
393
393
|
if (E !== Number.POSITIVE_INFINITY && z != null) {
|
|
394
|
-
const
|
|
394
|
+
const le = z.transScroll2ViewportScrollValue(E, 0).x;
|
|
395
395
|
z.scrollToBarPos({
|
|
396
|
-
x:
|
|
396
|
+
x: le
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
return this;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Injector, FUniver } from '@univerjs/core';
|
|
2
|
+
export interface IFUniverSheetsZenEditorMixin {
|
|
3
|
+
}
|
|
4
|
+
export declare class FUniverSheetsZenEditorMixin extends FUniver implements IFUniverSheetsZenEditorMixin {
|
|
5
|
+
private _initSheetZenEditorEvent;
|
|
6
|
+
_initialize(injector: Injector): void;
|
|
7
|
+
}
|
|
8
|
+
declare module '@univerjs/core' {
|
|
9
|
+
interface FUniver extends IFUniverSheetsZenEditorMixin {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
2
|
+
export interface IFWorkbookSheetsZenEditorMixin {
|
|
3
|
+
/**
|
|
4
|
+
* Start the zen editing process
|
|
5
|
+
* @returns A promise that resolves to a boolean indicating whether the zen editing process was started successfully.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* univerAPI.getActiveWorkbook().startZenEditingAsync();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
startZenEditingAsync(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* End the zen editing process
|
|
14
|
+
* @async
|
|
15
|
+
* @param {boolean} save - Whether to save the changes, default is true
|
|
16
|
+
* @returns A promise that resolves to a boolean indicating whether the zen editing process was ended successfully.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* univerAPI.getActiveWorkbook().endZenEditingAsync(false);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
endZenEditingAsync(save?: boolean): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare class FWorkbookSheetsZenEditorMixin extends FWorkbook implements IFWorkbookSheetsZenEditorMixin {
|
|
25
|
+
startZenEditingAsync(): Promise<boolean>;
|
|
26
|
+
endZenEditingAsync(save?: boolean): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
declare module '@univerjs/sheets/facade' {
|
|
29
|
+
interface FWorkbook extends IFWorkbookSheetsZenEditorMixin {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import './f-univer';
|
|
17
|
+
import './f-workbook';
|
|
18
|
+
export type * from './f-univer';
|
|
19
|
+
export type * from './f-workbook';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,h){typeof exports=="object"&&typeof module<"u"?h(require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/sheets-ui"),require("@univerjs/sheets-zen-editor"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/docs","@univerjs/sheets-ui","@univerjs/sheets-zen-editor","@univerjs/sheets/facade"],h):(e=typeof globalThis<"u"?globalThis:e||self,h(e.UniverCore,e.UniverDocs,e.UniverSheetsUi,e.UniverSheetsZenEditor,e.UniverSheetsFacade))})(this,function(e,h,C,i,g){"use strict";class f extends e.FUniver{_initSheetZenEditorEvent(n){const m=n.get(e.ICommandService);this.disposeWithMe(m.beforeCommandExecuted(t=>{if(t.id===i.OpenZenEditorCommand.id||t.id===i.CancelZenEditCommand.id||t.id===i.ConfirmZenEditCommand.id){if(!this._eventListend(this.Event.BeforeSheetEditStart)&&!this._eventListend(this.Event.BeforeSheetEditEnd))return;const s=this.getCommandSheetTarget(t);if(!s)return;const{workbook:o,worksheet:a}=s,E=n.get(C.IEditorBridgeService),S=n.get(e.IUniverInstanceService),u=t.params,{keycode:c,eventType:d}=u,r=E.getEditLocation();if(t.id===i.OpenZenEditorCommand.id){const v={row:r.row,column:r.column,eventType:d,keycode:c,workbook:o,worksheet:a,isZenEditor:!0};if(this.fireEvent(this.Event.BeforeSheetEditStart,v),v.cancel)throw new e.CanceledError}else{const v={row:r.row,column:r.column,eventType:d,keycode:c,workbook:o,worksheet:a,isZenEditor:!0,value:e.RichTextValue.create(S.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:t.id===i.ConfirmZenEditCommand.id};if(this.fireEvent(this.Event.BeforeSheetEditEnd,v),v.cancel)throw new e.CanceledError}}})),this.disposeWithMe(m.onCommandExecuted(t=>{if(t.id===i.OpenZenEditorCommand.id||t.id===i.CancelZenEditCommand.id||t.id===i.ConfirmZenEditCommand.id){if(!this._eventListend(this.Event.SheetEditStarted)&&!this._eventListend(this.Event.SheetEditEnded))return;const s=this.getCommandSheetTarget(t);if(!s)return;const{workbook:o,worksheet:a}=s,E=n.get(C.IEditorBridgeService),S=t.params,{keycode:u,eventType:c}=S,d=E.getEditLocation();if(t.id===i.OpenZenEditorCommand.id){const r={row:d.row,column:d.column,eventType:c,keycode:u,workbook:o,worksheet:a,isZenEditor:!0};this.fireEvent(this.Event.SheetEditStarted,r)}else{const r={row:d.row,column:d.column,eventType:c,keycode:u,workbook:o,worksheet:a,isZenEditor:!0,isConfirm:t.id===i.ConfirmZenEditCommand.id};this.fireEvent(this.Event.SheetEditEnded,r)}}if(t.id===h.RichTextEditingMutation.id){if(!this._eventListend(this.Event.SheetEditChanging))return;const s=this.getCommandSheetTarget(t);if(!s)return;const{workbook:o,worksheet:a}=s,E=n.get(C.IEditorBridgeService),S=n.get(e.IUniverInstanceService),u=t.params;if(!E.isVisible().visible)return;const{unitId:c}=u;if(c===e.DOCS_ZEN_EDITOR_UNIT_ID_KEY){const{row:d,column:r}=E.getEditLocation(),v={workbook:o,worksheet:a,row:d,column:r,value:e.RichTextValue.create(S.getUnit(e.DOCS_ZEN_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!0};this.fireEvent(this.Event.SheetEditChanging,v)}}}))}_initialize(n){this._initSheetZenEditorEvent(n)}}e.FUniver.extend(f);class _ extends g.FWorkbook{startZenEditingAsync(){return this._injector.get(e.ICommandService).executeCommand(i.OpenZenEditorCommand.id)}endZenEditingAsync(n=!0){const m=this._injector.get(e.ICommandService);return n?m.executeCommand(i.ConfirmZenEditCommand.id):m.executeCommand(i.CancelZenEditCommand.id)}}g.FWorkbook.extend(_)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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,m,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:
|
|
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,m,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:v,drawings:u,drawingsOrder:_,tableSource:E,settings:I}=o.Tools.deepClone(c),y={...s.getDocumentData(),body:v,drawings:u,drawingsOrder:_,tableSource:E,settings:I},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 v;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=l.getRenderById(u))==null?void 0:v.with(S.EditingRenderController);if(_){const E=o.Tools.deepClone(s.getDocumentData());E.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,_.submitCellData(new o.DocumentDataModel(E))}return n.focusUnit(c.getUnitId()),r.refreshEditCellState(),!0}return!1}},ee="sheets-zen-editor.config",V={};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 W;function ne(){if(W)return R;W=1;var e=m,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,I=null;g!==void 0&&(E=""+g),c.key!==void 0&&(E=""+c.key),c.ref!==void 0&&(I=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:I,props:v,_owner:i.current}}return R.Fragment=r,R.jsx=s,R.jsxs=s,R}var Y;function te(){return Y||(Y=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=m.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=m.useRef("_".concat(se()));return K(r,"".concat(n),{defIds:r.defIds,idSuffix:c.current},_({ref:t,className:l},s),a)});function K(e,t,r,n,i){return m.createElement(e.tag,_(_({key:t},ie(e,r,i)),n),(oe(e,r).children||[]).map(function(a,s){return K(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"}}]},H=m.forwardRef(function(e,t){return m.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ae}))});H.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"}}]},G=m.forwardRef(function(e,t){return m.createElement(A,Object.assign({},e,{id:"close-single",ref:t,icon:ce}))});G.displayName="CloseSingle";function $(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=$(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function q(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=$(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=m.useRef(null),t=o.useDependency(B),r=o.useDependency(h.IEditorService),n=o.useDependency(o.ICommandService);m.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:q(C.zenEditorIconContainer,C.zenEditorIconError),onClick:i,children:p.jsx(G,{style:{fontSize:"22px"}})}),p.jsx("span",{className:q(C.zenEditorIconContainer,C.zenEditorIconSuccess),onClick:a,children:p.jsx(H,{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=>J(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ee={id:z.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 he=Object.defineProperty,me=Object.getOwnPropertyDescriptor,Ie=(e,t,r,n)=>{for(var i=n>1?void 0:n?me(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=Ie([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},X=(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 I=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,I=(g-l*2)/O,y=0):(v=l,I=a+l*2,y=(I-g/O)/2),u>s?Z=(u-c*2)/U:Z=s+c*2,r.resize(I,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([X(0,B),X(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},Q=(e,t)=>(r,n)=>t(r,n,e);d.UniverSheetsZenEditorPlugin=(M=class extends o.Plugin{constructor(t=V,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...a}=o.merge({},V,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ee,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([Q(1,o.Inject(o.Injector)),Q(2,o.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=z,d.ConfirmZenEditCommand=b,d.OpenZenEditorCommand=D,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
*/var W;function ne(){if(W)return R;W=1;var e=m,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,v){var u,_={},E=null,I=null;v!==void 0&&(E=""+v),c.key!==void 0&&(E=""+c.key),c.ref!==void 0&&(I=c.ref);for(u in c)n.call(c,u)&&!a.hasOwnProperty(u)&&(_[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)_[u]===void 0&&(_[u]=c[u]);return{$$typeof:t,type:l,key:E,ref:I,props:_,_owner:i.current}}return R.Fragment=r,R.jsx=s,R.jsxs=s,R}var Y;function te(){return Y||(Y=1,w.exports=ne()),w.exports}var p=te(),g=function(){return g=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},g.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=m.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=m.useRef("_".concat(se()));return K(r,"".concat(n),{defIds:r.defIds,idSuffix:c.current},g({ref:t,className:l},s),a)});function K(e,t,r,n,i){return m.createElement(e.tag,g(g({key:t},ie(e,r,i)),n),(oe(e,r).children||[]).map(function(a,s){return K(a,"".concat(t,"-").concat(e.tag,"-").concat(s),r,void 0,i)}))}function ie(e,t,r){var n=g({},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)?g(g({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?g(g({},i),{attrs:g(g({},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"}}]},H=m.forwardRef(function(e,t){return m.createElement(A,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ae}))});H.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"}}]},G=m.forwardRef(function(e,t){return m.createElement(A,Object.assign({},e,{id:"close-single",ref:t,icon:ce}))});G.displayName="CloseSingle";function $(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=$(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function q(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=$(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=m.useRef(null),t=o.useDependency(B),r=o.useDependency(h.IEditorService),n=o.useDependency(o.ICommandService);m.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:q(C.zenEditorIconContainer,C.zenEditorIconError),onClick:i,children:p.jsx(G,{style:{fontSize:"22px"}})}),p.jsx("span",{className:q(C.zenEditorIconContainer,C.zenEditorIconSuccess),onClick:a,children:p.jsx(H,{style:{fontSize:"22px"}})})]}),p.jsx("div",{className:C.zenEditorCanvasContainer,ref:e})]})}function _e(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 ge={[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:_e}}}},ve={id:b.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>J(e),binding:f.KeyCode.ENTER|f.MetaKeys.ALT},Ee={id:z.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 he=Object.defineProperty,me=Object.getOwnPropertyDescriptor,Ie=(e,t,r,n)=>{for(var i=n>1?void 0:n?me(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(ge)}_initShortcuts(){[ve,Ee].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};j=Ie([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},X=(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:v,height:u}=i;let _=0;const E=c;let I=0,Z=0,y=Number.POSITIVE_INFINITY;const{scaleX:O,scaleY:U}=r.getAncestorScale();v>(a+l*2)*O?(_=v/2-a*O/2,_/=O,I=(v-l*2)/O,y=0):(_=l,I=a+l*2,y=(I-v/O)/2),u>s?Z=(u-c*2)/U:Z=s+c*2,r.resize(I,Z),t.translate(_,E),n.translate(_,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([X(0,B),X(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},Q=(e,t)=>(r,n)=>t(r,n,e);d.UniverSheetsZenEditorPlugin=(M=class extends o.Plugin{constructor(t=V,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...a}=o.merge({},V,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ee,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([Q(1,o.Inject(o.Injector)),Q(2,o.IConfigService)],d.UniverSheetsZenEditorPlugin),d.CancelZenEditCommand=z,d.ConfirmZenEditCommand=b,d.OpenZenEditorCommand=D,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-zen-editor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Zen Editor plugin for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"require": "./lib/cjs/locale/*.js",
|
|
37
37
|
"types": "./lib/types/locale/*.d.ts"
|
|
38
38
|
},
|
|
39
|
+
"./facade": {
|
|
40
|
+
"import": "./lib/es/facade.js",
|
|
41
|
+
"require": "./lib/cjs/facade.js",
|
|
42
|
+
"types": "./lib/types/facade/index.d.ts"
|
|
43
|
+
},
|
|
39
44
|
"./lib/*": "./lib/*"
|
|
40
45
|
},
|
|
41
46
|
"main": "./lib/es/index.js",
|
|
@@ -54,24 +59,26 @@
|
|
|
54
59
|
"rxjs": ">=7.0.0"
|
|
55
60
|
},
|
|
56
61
|
"dependencies": {
|
|
57
|
-
"@univerjs/icons": "^0.2.
|
|
62
|
+
"@univerjs/icons": "^0.2.12",
|
|
58
63
|
"clsx": "^2.1.1",
|
|
59
|
-
"@univerjs/docs
|
|
60
|
-
"@univerjs/core": "0.5.
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/sheets": "0.5.
|
|
63
|
-
"@univerjs/ui": "0.5.
|
|
64
|
-
"@univerjs/
|
|
64
|
+
"@univerjs/docs": "0.5.4",
|
|
65
|
+
"@univerjs/core": "0.5.4",
|
|
66
|
+
"@univerjs/docs-ui": "0.5.4",
|
|
67
|
+
"@univerjs/sheets": "0.5.4",
|
|
68
|
+
"@univerjs/sheets-ui": "0.5.4",
|
|
69
|
+
"@univerjs/ui": "0.5.4",
|
|
70
|
+
"@univerjs/engine-render": "0.5.4"
|
|
65
71
|
},
|
|
66
72
|
"devDependencies": {
|
|
67
73
|
"less": "^4.2.1",
|
|
68
74
|
"postcss": "^8.4.49",
|
|
69
75
|
"react": "18.3.1",
|
|
70
76
|
"rxjs": "^7.8.1",
|
|
77
|
+
"tailwindcss": "^3.4.17",
|
|
71
78
|
"typescript": "^5.7.2",
|
|
72
|
-
"vite": "^6.0.
|
|
79
|
+
"vite": "^6.0.7",
|
|
73
80
|
"vitest": "^2.1.8",
|
|
74
|
-
"@univerjs-infra/shared": "0.5.
|
|
81
|
+
"@univerjs-infra/shared": "0.5.4"
|
|
75
82
|
},
|
|
76
83
|
"scripts": {
|
|
77
84
|
"test": "vitest run",
|