@univerjs/sheets-zen-editor 0.4.1 → 0.4.2
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 +2 -2
- package/lib/es/index.js +11 -9
- package/lib/index.css +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +11 -11
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),docsUi=require("@univerjs/docs-ui"),engineRender=require("@univerjs/engine-render"),sheetsUi=require("@univerjs/sheets-ui"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),require$$0=require("react"),sheets=require("@univerjs/sheets"),OpenZenEditorCommand={id:"zen-editor.command.open-zen-editor",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a4;const zenZoneService=accessor.get(ui.IZenZoneService),editorService=accessor.get(docsUi.IEditorService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceService=accessor.get(core.IUniverInstanceService);zenZoneService.open();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const editCellState=editorBridgeService.getLatestEditCellState();if(editCellState==null)return!1;const snapshot=(_a4=editCellState.documentLayoutObject.documentModel)==null?void 0:_a4.getSnapshot();if(snapshot==null)return!1;univerInstanceService.focusUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body,drawings,drawingsOrder,tableSource,settings}=core.Tools.deepClone(snapshot),newSnapshot={...editor.getDocumentData(),body,drawings,drawingsOrder,tableSource,settings},textRanges=[{startOffset:0,endOffset:0,collapsed:!0}];return editor.focus(),editor.setDocumentData(newSnapshot,textRanges),editor.clearUndoRedoHistory(),!0},"handler")},CancelZenEditCommand={id:"zen-editor.command.cancel-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService);zenZoneEditorService.close();const currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);return currentSheetInstance?(univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0):!1},"handler")},ConfirmZenEditCommand={id:"zen-editor.command.confirm-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a4;const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService),editorService=accessor.get(docsUi.IEditorService);zenZoneEditorService.close();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const renderManagerService=accessor.get(engineRender.IRenderManagerService),currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(currentSheetInstance){const currentSheetId=currentSheetInstance.getUnitId(),editingRenderController=(_a4=renderManagerService.getRenderById(currentSheetId))==null?void 0:_a4.with(sheetsUi.EditingRenderController);if(editingRenderController){const snapshot=core.Tools.deepClone(editor.getDocumentData());editingRenderController.submitCellData(new core.DocumentDataModel(snapshot))}return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0}return!1},"handler")},PLUGIN_CONFIG_KEY="sheets-zen-editor.config",defaultPluginConfig={},_ZenEditorManagerService=class _ZenEditorManagerService{constructor(){__publicField(this,"_position",null);__publicField(this,"_position$",new rxjs.BehaviorSubject(null));__publicField(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(param){this._position=param,this._refresh(param)}getPosition(){return this._position}_refresh(param){this._position$.next(param)}};__name(_ZenEditorManagerService,"ZenEditorManagerService");let ZenEditorManagerService=_ZenEditorManagerService;const IZenEditorManagerService=core.createIdentifier("univer.sheet-zen-editor-manager.service");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a;let ZenEditorController=(_a=class extends core.RxDisposable{constructor(_zenEditorManagerService,_renderManagerService){super(),this._zenEditorManagerService=_zenEditorManagerService,this._renderManagerService=_renderManagerService,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(position=>{if(position==null)return;const{width,height}=position,editorObject=sheetsUi.getEditorObject(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);editorObject!=null&&requestIdleCallback(()=>{editorObject.engine.resizeBySize(width,height),this._calculatePagePosition(editorObject),this._scrollToTop()})})}_calculatePagePosition(currentRender){const{document:docsComponent,scene,docBackground}=currentRender,parent=scene==null?void 0:scene.getParent(),{width:docsWidth,height:docsHeight,pageMarginLeft,pageMarginTop}=docsComponent;if(parent==null||docsWidth===Number.POSITIVE_INFINITY||docsHeight===Number.POSITIVE_INFINITY)return;const{width:engineWidth,height:engineHeight}=parent;let docsLeft=0
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),docsUi=require("@univerjs/docs-ui"),engineRender=require("@univerjs/engine-render"),sheetsUi=require("@univerjs/sheets-ui"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),require$$0=require("react"),sheets=require("@univerjs/sheets"),OpenZenEditorCommand={id:"zen-editor.command.open-zen-editor",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a4;const zenZoneService=accessor.get(ui.IZenZoneService),editorService=accessor.get(docsUi.IEditorService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceService=accessor.get(core.IUniverInstanceService);zenZoneService.open();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const editCellState=editorBridgeService.getLatestEditCellState();if(editCellState==null)return!1;const snapshot=(_a4=editCellState.documentLayoutObject.documentModel)==null?void 0:_a4.getSnapshot();if(snapshot==null)return!1;univerInstanceService.focusUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body,drawings,drawingsOrder,tableSource,settings}=core.Tools.deepClone(snapshot),newSnapshot={...editor.getDocumentData(),body,drawings,drawingsOrder,tableSource,settings},textRanges=[{startOffset:0,endOffset:0,collapsed:!0}];return editor.focus(),editor.setDocumentData(newSnapshot,textRanges),editor.clearUndoRedoHistory(),!0},"handler")},CancelZenEditCommand={id:"zen-editor.command.cancel-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService);zenZoneEditorService.close();const currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);return currentSheetInstance?(univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0):!1},"handler")},ConfirmZenEditCommand={id:"zen-editor.command.confirm-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a4;const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService),editorService=accessor.get(docsUi.IEditorService);zenZoneEditorService.close();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const renderManagerService=accessor.get(engineRender.IRenderManagerService),currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(currentSheetInstance){const currentSheetId=currentSheetInstance.getUnitId(),editingRenderController=(_a4=renderManagerService.getRenderById(currentSheetId))==null?void 0:_a4.with(sheetsUi.EditingRenderController);if(editingRenderController){const snapshot=core.Tools.deepClone(editor.getDocumentData());snapshot.documentStyle.documentFlavor=core.DocumentFlavor.UNSPECIFIED,editingRenderController.submitCellData(new core.DocumentDataModel(snapshot))}return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0}return!1},"handler")},PLUGIN_CONFIG_KEY="sheets-zen-editor.config",defaultPluginConfig={},_ZenEditorManagerService=class _ZenEditorManagerService{constructor(){__publicField(this,"_position",null);__publicField(this,"_position$",new rxjs.BehaviorSubject(null));__publicField(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(param){this._position=param,this._refresh(param)}getPosition(){return this._position}_refresh(param){this._position$.next(param)}};__name(_ZenEditorManagerService,"ZenEditorManagerService");let ZenEditorManagerService=_ZenEditorManagerService;const IZenEditorManagerService=core.createIdentifier("univer.sheet-zen-editor-manager.service");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2"),_a;let ZenEditorController=(_a=class extends core.RxDisposable{constructor(_zenEditorManagerService,_renderManagerService){super(),this._zenEditorManagerService=_zenEditorManagerService,this._renderManagerService=_renderManagerService,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(position=>{if(position==null)return;const{width,height}=position,editorObject=sheetsUi.getEditorObject(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);editorObject!=null&&requestIdleCallback(()=>{editorObject.engine.resizeBySize(width,height),this._calculatePagePosition(editorObject),this._scrollToTop()})})}_calculatePagePosition(currentRender){const{document:docsComponent,scene,docBackground}=currentRender,parent=scene==null?void 0:scene.getParent(),{width:docsWidth,height:docsHeight,pageMarginLeft,pageMarginTop}=docsComponent;if(parent==null||docsWidth===Number.POSITIVE_INFINITY||docsHeight===Number.POSITIVE_INFINITY)return;const{width:engineWidth,height:engineHeight}=parent;let docsLeft=0;const docsTop=pageMarginTop;let sceneWidth=0,sceneHeight=0,scrollToX=Number.POSITIVE_INFINITY;const{scaleX,scaleY}=scene.getAncestorScale();engineWidth>(docsWidth+pageMarginLeft*2)*scaleX?(docsLeft=engineWidth/2-docsWidth*scaleX/2,docsLeft/=scaleX,sceneWidth=(engineWidth-pageMarginLeft*2)/scaleX,scrollToX=0):(docsLeft=pageMarginLeft,sceneWidth=docsWidth+pageMarginLeft*2,scrollToX=(sceneWidth-engineWidth/scaleX)/2),engineHeight>docsHeight?sceneHeight=(engineHeight-pageMarginTop*2)/scaleY:sceneHeight=docsHeight+pageMarginTop*2,scene.resize(sceneWidth,sceneHeight),docsComponent.translate(docsLeft,docsTop),docBackground.translate(docsLeft,docsTop);const viewport=scene.getViewport(docsUi.VIEWPORT_KEY.VIEW_MAIN);if(scrollToX!==Number.POSITIVE_INFINITY&&viewport!=null){const actualX=viewport.transScroll2ViewportScrollValue(scrollToX,0).x;viewport.scrollToBarPos({x:actualX})}return this}_scrollToTop(){var _a4;const backScrollController=(_a4=this._renderManagerService.getRenderById(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:_a4.with(docsUi.DocBackScrollRenderController),textRange={startOffset:0,endOffset:0};backScrollController&&backScrollController.scrollToRange(textRange)}},__name(_a,"ZenEditorController"),_a);ZenEditorController=__decorateClass$2([__decorateParam$2(0,IZenEditorManagerService),__decorateParam$2(1,engineRender.IRenderManagerService)],ZenEditorController);var jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/**
|
|
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 f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q");reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,__assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a4){var key=_a4[0],value=_a4[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a4,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a4=node.children)===null||_a4===void 0)&&_a4.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$1={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"}}]},CheckMarkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$1}))});CheckMarkSingle.displayName="CheckMarkSingle";var element={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"}}]},CloseSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"close-single",ref,icon:element}))});CloseSingle.displayName="CloseSingle";function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const 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",styles={zenEditor,zenEditorIconWrapper,zenEditorIconContainer,zenEditorIconSuccess,zenEditorIconError,zenEditorCanvasContainer},COMPONENT_PREFIX="ZEN_EDITOR_PLUGIN_",ZEN_EDITOR_COMPONENT=`${COMPONENT_PREFIX}ZEN_EDITOR_COMPONENT`,INITIAL_SNAPSHOT={id:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${core.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:842},documentFlavor:core.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ZenEditor(){const editorRef=require$$0.useRef(null),zenEditorService=core.useDependency(IZenEditorManagerService),editorService=core.useDependency(docsUi.IEditorService),commandService=core.useDependency(core.ICommandService);require$$0.useEffect(()=>{const editorDom=editorRef.current;if(!editorDom)return;const registerSubscription=editorService.register({editorUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:INITIAL_SNAPSHOT,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},editorDom),resizeObserver=new ResizeObserver(()=>{zenEditorService.setPosition(editorDom.getBoundingClientRect())});return resizeObserver.observe(editorDom),()=>{registerSubscription.dispose(),resizeObserver.unobserve(editorDom)}},[]);function handleCloseBtnClick(){commandService.executeCommand(CancelZenEditCommand.id)}__name(handleCloseBtnClick,"handleCloseBtnClick");function handleConfirmBtnClick(){commandService.executeCommand(ConfirmZenEditCommand.id)}return __name(handleConfirmBtnClick,"handleConfirmBtnClick"),jsxRuntimeExports.jsxs("div",{className:styles.zenEditor,children:[jsxRuntimeExports.jsxs("div",{className:styles.zenEditorIconWrapper,children:[jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconError),onClick:handleCloseBtnClick,children:jsxRuntimeExports.jsx(CloseSingle,{style:{fontSize:"22px"}})}),jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconSuccess),onClick:handleConfirmBtnClick,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{fontSize:"22px"}})})]}),jsxRuntimeExports.jsx("div",{className:styles.zenEditorCanvasContainer,ref:editorRef})]})}__name(ZenEditor,"ZenEditor");function ZenEditorMenuItemFactory(accessor){return{id:OpenZenEditorCommand.id,type:ui.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:sheetsUi.getCurrentExclusiveRangeInterest$(accessor),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetSetCellStylePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(ZenEditorMenuItemFactory,"ZenEditorMenuItemFactory");const menuSchema={[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{[OpenZenEditorCommand.id]:{order:2,menuItemFactory:ZenEditorMenuItemFactory}}}},ZenEditorConfirmShortcut={id:ConfirmZenEditCommand.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ENTER|ui.MetaKeys.ALT},ZenEditorCancelShortcut={id:CancelZenEditCommand.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ESC};function whenZenEditorActivated(contextService){return contextService.getContextValue(core.FOCUSING_DOC)&&contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)&&contextService.getContextValue(core.EDITOR_ACTIVATED)&&!contextService.getContextValue(core.FOCUSING_EDITOR_STANDALONE)}__name(whenZenEditorActivated,"whenZenEditorActivated");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a2;let ZenEditorUIController=(_a2=class extends core.Disposable{constructor(_zenZoneService,_commandService,_menuManagerService,_shortcutService){super(),this._zenZoneService=_zenZoneService,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT,ZenEditor))}_initCommands(){[OpenZenEditorCommand,CancelZenEditCommand,ConfirmZenEditCommand].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortcuts(){[ZenEditorConfirmShortcut,ZenEditorCancelShortcut].forEach(item=>{this.disposeWithMe(this._shortcutService.registerShortcut(item))})}},__name(_a2,"ZenEditorUIController"),_a2);ZenEditorUIController=__decorateClass$1([__decorateParam$1(0,ui.IZenZoneService),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],ZenEditorUIController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a3;exports.UniverSheetsZenEditorPlugin=(_a3=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(this._injector)}_initializeDependencies(injector){[[ZenEditorUIController],[ZenEditorController],[IZenEditorManagerService,{useClass:ZenEditorManagerService}]].forEach(dependency=>injector.add(dependency))}onReady(){this._injector.get(ZenEditorUIController)}onSteady(){this._injector.get(ZenEditorController)}},__name(_a3,"UniverSheetsZenEditorPlugin"),__publicField(_a3,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),__publicField(_a3,"type",core.UniverInstanceType.UNIVER_SHEET),_a3);exports.UniverSheetsZenEditorPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=CancelZenEditCommand;exports.ConfirmZenEditCommand=ConfirmZenEditCommand;exports.OpenZenEditorCommand=OpenZenEditorCommand;
|
|
9
|
+
*/var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q");reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,__assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a4){var key=_a4[0],value=_a4[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a4,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a4=node.children)===null||_a4===void 0)&&_a4.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$1={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"}}]},CheckMarkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$1}))});CheckMarkSingle.displayName="CheckMarkSingle";var element={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"}}]},CloseSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"close-single",ref,icon:element}))});CloseSingle.displayName="CloseSingle";function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const 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",styles={zenEditor,zenEditorIconWrapper,zenEditorIconContainer,zenEditorIconSuccess,zenEditorIconError,zenEditorCanvasContainer},COMPONENT_PREFIX="ZEN_EDITOR_PLUGIN_",ZEN_EDITOR_COMPONENT=`${COMPONENT_PREFIX}ZEN_EDITOR_COMPONENT`,INITIAL_SNAPSHOT={id:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${core.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:core.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ZenEditor(){const editorRef=require$$0.useRef(null),zenEditorService=core.useDependency(IZenEditorManagerService),editorService=core.useDependency(docsUi.IEditorService),commandService=core.useDependency(core.ICommandService);require$$0.useEffect(()=>{const editorDom=editorRef.current;if(!editorDom)return;const registerSubscription=editorService.register({editorUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:INITIAL_SNAPSHOT,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},editorDom),resizeObserver=new ResizeObserver(()=>{zenEditorService.setPosition(editorDom.getBoundingClientRect())});return resizeObserver.observe(editorDom),()=>{registerSubscription.dispose(),resizeObserver.unobserve(editorDom)}},[]);function handleCloseBtnClick(){commandService.executeCommand(CancelZenEditCommand.id)}__name(handleCloseBtnClick,"handleCloseBtnClick");function handleConfirmBtnClick(){commandService.executeCommand(ConfirmZenEditCommand.id)}return __name(handleConfirmBtnClick,"handleConfirmBtnClick"),jsxRuntimeExports.jsxs("div",{className:styles.zenEditor,children:[jsxRuntimeExports.jsxs("div",{className:styles.zenEditorIconWrapper,children:[jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconError),onClick:handleCloseBtnClick,children:jsxRuntimeExports.jsx(CloseSingle,{style:{fontSize:"22px"}})}),jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconSuccess),onClick:handleConfirmBtnClick,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{fontSize:"22px"}})})]}),jsxRuntimeExports.jsx("div",{className:styles.zenEditorCanvasContainer,ref:editorRef})]})}__name(ZenEditor,"ZenEditor");function ZenEditorMenuItemFactory(accessor){return{id:OpenZenEditorCommand.id,type:ui.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:sheetsUi.getCurrentExclusiveRangeInterest$(accessor),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetSetCellStylePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(ZenEditorMenuItemFactory,"ZenEditorMenuItemFactory");const menuSchema={[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{[OpenZenEditorCommand.id]:{order:2,menuItemFactory:ZenEditorMenuItemFactory}}}},ZenEditorConfirmShortcut={id:ConfirmZenEditCommand.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ENTER|ui.MetaKeys.ALT},ZenEditorCancelShortcut={id:CancelZenEditCommand.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ESC};function whenZenEditorActivated(contextService){return contextService.getContextValue(core.FOCUSING_DOC)&&contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)&&contextService.getContextValue(core.EDITOR_ACTIVATED)&&!contextService.getContextValue(core.FOCUSING_EDITOR_STANDALONE)}__name(whenZenEditorActivated,"whenZenEditorActivated");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a2;let ZenEditorUIController=(_a2=class extends core.Disposable{constructor(_zenZoneService,_commandService,_menuManagerService,_shortcutService){super(),this._zenZoneService=_zenZoneService,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT,ZenEditor))}_initCommands(){[OpenZenEditorCommand,CancelZenEditCommand,ConfirmZenEditCommand].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortcuts(){[ZenEditorConfirmShortcut,ZenEditorCancelShortcut].forEach(item=>{this.disposeWithMe(this._shortcutService.registerShortcut(item))})}},__name(_a2,"ZenEditorUIController"),_a2);ZenEditorUIController=__decorateClass$1([__decorateParam$1(0,ui.IZenZoneService),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],ZenEditorUIController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),_a3;exports.UniverSheetsZenEditorPlugin=(_a3=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(this._injector)}_initializeDependencies(injector){[[ZenEditorUIController],[ZenEditorController],[IZenEditorManagerService,{useClass:ZenEditorManagerService}]].forEach(dependency=>injector.add(dependency))}onReady(){this._injector.get(ZenEditorUIController)}onSteady(){this._injector.get(ZenEditorController)}},__name(_a3,"UniverSheetsZenEditorPlugin"),__publicField(_a3,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),__publicField(_a3,"type",core.UniverInstanceType.UNIVER_SHEET),_a3);exports.UniverSheetsZenEditorPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=CancelZenEditCommand;exports.ConfirmZenEditCommand=ConfirmZenEditCommand;exports.OpenZenEditorCommand=OpenZenEditorCommand;
|
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { CommandType, IUniverInstanceService, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Tools, UniverInstanceType, DocumentDataModel, createIdentifier, RxDisposable, DEFAULT_EMPTY_DOCUMENT_VALUE,
|
|
5
|
+
import { CommandType, IUniverInstanceService, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Tools, UniverInstanceType, DocumentFlavor, DocumentDataModel, createIdentifier, RxDisposable, DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, ICommandService, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, Disposable, Plugin, Inject, Injector, IConfigService } from "@univerjs/core";
|
|
6
6
|
import { IEditorService, VIEWPORT_KEY, DocBackScrollRenderController } from "@univerjs/docs-ui";
|
|
7
7
|
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
8
8
|
import { IEditorBridgeService, EditingRenderController, getEditorObject, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
|
|
@@ -67,7 +67,7 @@ const OpenZenEditorCommand = {
|
|
|
67
67
|
const currentSheetId = currentSheetInstance.getUnitId(), editingRenderController = (_a4 = renderManagerService.getRenderById(currentSheetId)) == null ? void 0 : _a4.with(EditingRenderController);
|
|
68
68
|
if (editingRenderController) {
|
|
69
69
|
const snapshot = Tools.deepClone(editor.getDocumentData());
|
|
70
|
-
editingRenderController.submitCellData(new DocumentDataModel(snapshot));
|
|
70
|
+
snapshot.documentStyle.documentFlavor = DocumentFlavor.UNSPECIFIED, editingRenderController.submitCellData(new DocumentDataModel(snapshot));
|
|
71
71
|
}
|
|
72
72
|
return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()), editorBridgeService.refreshEditCellState(), !0;
|
|
73
73
|
}
|
|
@@ -125,9 +125,11 @@ let ZenEditorController = (_a = class extends RxDisposable {
|
|
|
125
125
|
if (parent == null || docsWidth === Number.POSITIVE_INFINITY || docsHeight === Number.POSITIVE_INFINITY)
|
|
126
126
|
return;
|
|
127
127
|
const { width: engineWidth, height: engineHeight } = parent;
|
|
128
|
-
let docsLeft = 0
|
|
128
|
+
let docsLeft = 0;
|
|
129
|
+
const docsTop = pageMarginTop;
|
|
130
|
+
let sceneWidth = 0, sceneHeight = 0, scrollToX = Number.POSITIVE_INFINITY;
|
|
129
131
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
130
|
-
engineWidth > (docsWidth + pageMarginLeft * 2) * scaleX ? (docsLeft = engineWidth / 2 - docsWidth * scaleX / 2, docsLeft /= scaleX, sceneWidth = (engineWidth - pageMarginLeft * 2) / scaleX, scrollToX = 0) : (docsLeft = pageMarginLeft, sceneWidth = docsWidth + pageMarginLeft * 2, scrollToX = (sceneWidth - engineWidth / scaleX) / 2), engineHeight > docsHeight ?
|
|
132
|
+
engineWidth > (docsWidth + pageMarginLeft * 2) * scaleX ? (docsLeft = engineWidth / 2 - docsWidth * scaleX / 2, docsLeft /= scaleX, sceneWidth = (engineWidth - pageMarginLeft * 2) / scaleX, scrollToX = 0) : (docsLeft = pageMarginLeft, sceneWidth = docsWidth + pageMarginLeft * 2, scrollToX = (sceneWidth - engineWidth / scaleX) / 2), engineHeight > docsHeight ? sceneHeight = (engineHeight - pageMarginTop * 2) / scaleY : sceneHeight = docsHeight + pageMarginTop * 2, scene.resize(sceneWidth, sceneHeight), docsComponent.translate(docsLeft, docsTop), docBackground.translate(docsLeft, docsTop);
|
|
131
133
|
const viewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
|
|
132
134
|
if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) {
|
|
133
135
|
const actualX = viewport.transScroll2ViewportScrollValue(scrollToX, 0).x;
|
|
@@ -278,13 +280,13 @@ const zenEditor = "univer-zen-editor", zenEditorIconWrapper = "univer-zen-editor
|
|
|
278
280
|
documentStyle: {
|
|
279
281
|
pageSize: {
|
|
280
282
|
width: 595,
|
|
281
|
-
height:
|
|
283
|
+
height: Number.POSITIVE_INFINITY
|
|
282
284
|
},
|
|
283
285
|
documentFlavor: DocumentFlavor.MODERN,
|
|
284
|
-
marginTop:
|
|
285
|
-
marginBottom:
|
|
286
|
-
marginRight:
|
|
287
|
-
marginLeft:
|
|
286
|
+
marginTop: 0,
|
|
287
|
+
marginBottom: 0,
|
|
288
|
+
marginRight: 0,
|
|
289
|
+
marginLeft: 0,
|
|
288
290
|
renderConfig: {
|
|
289
291
|
vertexAngle: 0,
|
|
290
292
|
centerAngle: 0
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-zen-editor{position:absolute;top:0;left:0;width:100%;height:100
|
|
1
|
+
.univer-zen-editor{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgb(var(--color-white))}.univer-zen-editor-icon-wrapper{position:absolute;z-index:10;top:0;right:20px;display:flex;align-items:center;justify-content:space-around;width:60px;height:30px}.univer-zen-editor-icon-container{cursor:pointer;display:flex;align-items:center;justify-content:center;width:30px;height:30px}.univer-zen-editor-icon-success{color:rgb(var(--success-color))}.univer-zen-editor-icon-error{color:rgb(var(--error-color))}.univer-zen-editor-canvas-container{position:absolute;top:0;left:0;width:100%;height:100%}
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(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"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsZenEditor={},global.UniverCore,global.UniverDocsUi,global.UniverEngineRender,global.UniverSheetsUi,global.UniverUi,global.rxjs,global.React,global.UniverSheets))})(this,function(exports2,core,docsUi,engineRender,sheetsUi,ui,rxjs,require$$0,sheets){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c;const OpenZenEditorCommand={id:"zen-editor.command.open-zen-editor",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a2;const zenZoneService=accessor.get(ui.IZenZoneService),editorService=accessor.get(docsUi.IEditorService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceService=accessor.get(core.IUniverInstanceService);zenZoneService.open();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const editCellState=editorBridgeService.getLatestEditCellState();if(editCellState==null)return!1;const snapshot=(_a2=editCellState.documentLayoutObject.documentModel)==null?void 0:_a2.getSnapshot();if(snapshot==null)return!1;univerInstanceService.focusUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body,drawings,drawingsOrder,tableSource,settings}=core.Tools.deepClone(snapshot),newSnapshot={...editor.getDocumentData(),body,drawings,drawingsOrder,tableSource,settings},textRanges=[{startOffset:0,endOffset:0,collapsed:!0}];return editor.focus(),editor.setDocumentData(newSnapshot,textRanges),editor.clearUndoRedoHistory(),!0},"handler")},CancelZenEditCommand={id:"zen-editor.command.cancel-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService);zenZoneEditorService.close();const currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);return currentSheetInstance?(univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0):!1},"handler")},ConfirmZenEditCommand={id:"zen-editor.command.confirm-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a2;const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService),editorService=accessor.get(docsUi.IEditorService);zenZoneEditorService.close();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const renderManagerService=accessor.get(engineRender.IRenderManagerService),currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(currentSheetInstance){const currentSheetId=currentSheetInstance.getUnitId(),editingRenderController=(_a2=renderManagerService.getRenderById(currentSheetId))==null?void 0:_a2.with(sheetsUi.EditingRenderController);if(editingRenderController){const snapshot=core.Tools.deepClone(editor.getDocumentData());editingRenderController.submitCellData(new core.DocumentDataModel(snapshot))}return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0}return!1},"handler")},PLUGIN_CONFIG_KEY="sheets-zen-editor.config",defaultPluginConfig={},_ZenEditorManagerService=class _ZenEditorManagerService{constructor(){__publicField(this,"_position",null);__publicField(this,"_position$",new rxjs.BehaviorSubject(null));__publicField(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(param){this._position=param,this._refresh(param)}getPosition(){return this._position}_refresh(param){this._position$.next(param)}};__name(_ZenEditorManagerService,"ZenEditorManagerService");let ZenEditorManagerService=_ZenEditorManagerService;const IZenEditorManagerService=core.createIdentifier("univer.sheet-zen-editor-manager.service");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let ZenEditorController=(_a=class extends core.RxDisposable{constructor(_zenEditorManagerService,_renderManagerService){super(),this._zenEditorManagerService=_zenEditorManagerService,this._renderManagerService=_renderManagerService,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(position=>{if(position==null)return;const{width,height}=position,editorObject=sheetsUi.getEditorObject(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);editorObject!=null&&requestIdleCallback(()=>{editorObject.engine.resizeBySize(width,height),this._calculatePagePosition(editorObject),this._scrollToTop()})})}_calculatePagePosition(currentRender){const{document:docsComponent,scene,docBackground}=currentRender,parent=scene==null?void 0:scene.getParent(),{width:docsWidth,height:docsHeight,pageMarginLeft,pageMarginTop}=docsComponent;if(parent==null||docsWidth===Number.POSITIVE_INFINITY||docsHeight===Number.POSITIVE_INFINITY)return;const{width:engineWidth,height:engineHeight}=parent;let docsLeft=0
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(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"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsZenEditor={},global.UniverCore,global.UniverDocsUi,global.UniverEngineRender,global.UniverSheetsUi,global.UniverUi,global.rxjs,global.React,global.UniverSheets))})(this,function(exports2,core,docsUi,engineRender,sheetsUi,ui,rxjs,require$$0,sheets){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c;const OpenZenEditorCommand={id:"zen-editor.command.open-zen-editor",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a2;const zenZoneService=accessor.get(ui.IZenZoneService),editorService=accessor.get(docsUi.IEditorService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceService=accessor.get(core.IUniverInstanceService);zenZoneService.open();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const editCellState=editorBridgeService.getLatestEditCellState();if(editCellState==null)return!1;const snapshot=(_a2=editCellState.documentLayoutObject.documentModel)==null?void 0:_a2.getSnapshot();if(snapshot==null)return!1;univerInstanceService.focusUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body,drawings,drawingsOrder,tableSource,settings}=core.Tools.deepClone(snapshot),newSnapshot={...editor.getDocumentData(),body,drawings,drawingsOrder,tableSource,settings},textRanges=[{startOffset:0,endOffset:0,collapsed:!0}];return editor.focus(),editor.setDocumentData(newSnapshot,textRanges),editor.clearUndoRedoHistory(),!0},"handler")},CancelZenEditCommand={id:"zen-editor.command.cancel-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService);zenZoneEditorService.close();const currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);return currentSheetInstance?(univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0):!1},"handler")},ConfirmZenEditCommand={id:"zen-editor.command.confirm-zen-edit",type:core.CommandType.COMMAND,handler:__name(async accessor=>{var _a2;const zenZoneEditorService=accessor.get(ui.IZenZoneService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService),univerInstanceManager=accessor.get(core.IUniverInstanceService),editorService=accessor.get(docsUi.IEditorService);zenZoneEditorService.close();const editor=editorService.getEditor(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(editor==null)return!1;const renderManagerService=accessor.get(engineRender.IRenderManagerService),currentSheetInstance=univerInstanceManager.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(currentSheetInstance){const currentSheetId=currentSheetInstance.getUnitId(),editingRenderController=(_a2=renderManagerService.getRenderById(currentSheetId))==null?void 0:_a2.with(sheetsUi.EditingRenderController);if(editingRenderController){const snapshot=core.Tools.deepClone(editor.getDocumentData());snapshot.documentStyle.documentFlavor=core.DocumentFlavor.UNSPECIFIED,editingRenderController.submitCellData(new core.DocumentDataModel(snapshot))}return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()),editorBridgeService.refreshEditCellState(),!0}return!1},"handler")},PLUGIN_CONFIG_KEY="sheets-zen-editor.config",defaultPluginConfig={},_ZenEditorManagerService=class _ZenEditorManagerService{constructor(){__publicField(this,"_position",null);__publicField(this,"_position$",new rxjs.BehaviorSubject(null));__publicField(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(param){this._position=param,this._refresh(param)}getPosition(){return this._position}_refresh(param){this._position$.next(param)}};__name(_ZenEditorManagerService,"ZenEditorManagerService");let ZenEditorManagerService=_ZenEditorManagerService;const IZenEditorManagerService=core.createIdentifier("univer.sheet-zen-editor-manager.service");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");let ZenEditorController=(_a=class extends core.RxDisposable{constructor(_zenEditorManagerService,_renderManagerService){super(),this._zenEditorManagerService=_zenEditorManagerService,this._renderManagerService=_renderManagerService,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(position=>{if(position==null)return;const{width,height}=position,editorObject=sheetsUi.getEditorObject(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);editorObject!=null&&requestIdleCallback(()=>{editorObject.engine.resizeBySize(width,height),this._calculatePagePosition(editorObject),this._scrollToTop()})})}_calculatePagePosition(currentRender){const{document:docsComponent,scene,docBackground}=currentRender,parent=scene==null?void 0:scene.getParent(),{width:docsWidth,height:docsHeight,pageMarginLeft,pageMarginTop}=docsComponent;if(parent==null||docsWidth===Number.POSITIVE_INFINITY||docsHeight===Number.POSITIVE_INFINITY)return;const{width:engineWidth,height:engineHeight}=parent;let docsLeft=0;const docsTop=pageMarginTop;let sceneWidth=0,sceneHeight=0,scrollToX=Number.POSITIVE_INFINITY;const{scaleX,scaleY}=scene.getAncestorScale();engineWidth>(docsWidth+pageMarginLeft*2)*scaleX?(docsLeft=engineWidth/2-docsWidth*scaleX/2,docsLeft/=scaleX,sceneWidth=(engineWidth-pageMarginLeft*2)/scaleX,scrollToX=0):(docsLeft=pageMarginLeft,sceneWidth=docsWidth+pageMarginLeft*2,scrollToX=(sceneWidth-engineWidth/scaleX)/2),engineHeight>docsHeight?sceneHeight=(engineHeight-pageMarginTop*2)/scaleY:sceneHeight=docsHeight+pageMarginTop*2,scene.resize(sceneWidth,sceneHeight),docsComponent.translate(docsLeft,docsTop),docBackground.translate(docsLeft,docsTop);const viewport=scene.getViewport(docsUi.VIEWPORT_KEY.VIEW_MAIN);if(scrollToX!==Number.POSITIVE_INFINITY&&viewport!=null){const actualX=viewport.transScroll2ViewportScrollValue(scrollToX,0).x;viewport.scrollToBarPos({x:actualX})}return this}_scrollToTop(){var _a2;const backScrollController=(_a2=this._renderManagerService.getRenderById(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:_a2.with(docsUi.DocBackScrollRenderController),textRange={startOffset:0,endOffset:0};backScrollController&&backScrollController.scrollToRange(textRange)}},__name(_a,"ZenEditorController"),_a);ZenEditorController=__decorateClass$2([__decorateParam$2(0,IZenEditorManagerService),__decorateParam$2(1,engineRender.IRenderManagerService)],ZenEditorController);var jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/**
|
|
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 f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q"),reactJsxRuntime_production_min.Fragment=l,reactJsxRuntime_production_min.jsx=q,reactJsxRuntime_production_min.jsxs=q,jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,__assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$1={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"}}]},CheckMarkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$1}))});CheckMarkSingle.displayName="CheckMarkSingle";var element={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"}}]},CloseSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"close-single",ref,icon:element}))});CloseSingle.displayName="CloseSingle";function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const styles={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"},ZEN_EDITOR_COMPONENT="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",INITIAL_SNAPSHOT={id:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${core.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:842},documentFlavor:core.DocumentFlavor.MODERN,marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ZenEditor(){const editorRef=require$$0.useRef(null),zenEditorService=core.useDependency(IZenEditorManagerService),editorService=core.useDependency(docsUi.IEditorService),commandService=core.useDependency(core.ICommandService);require$$0.useEffect(()=>{const editorDom=editorRef.current;if(!editorDom)return;const registerSubscription=editorService.register({editorUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:INITIAL_SNAPSHOT,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},editorDom),resizeObserver=new ResizeObserver(()=>{zenEditorService.setPosition(editorDom.getBoundingClientRect())});return resizeObserver.observe(editorDom),()=>{registerSubscription.dispose(),resizeObserver.unobserve(editorDom)}},[]);function handleCloseBtnClick(){commandService.executeCommand(CancelZenEditCommand.id)}__name(handleCloseBtnClick,"handleCloseBtnClick");function handleConfirmBtnClick(){commandService.executeCommand(ConfirmZenEditCommand.id)}return __name(handleConfirmBtnClick,"handleConfirmBtnClick"),jsxRuntimeExports.jsxs("div",{className:styles.zenEditor,children:[jsxRuntimeExports.jsxs("div",{className:styles.zenEditorIconWrapper,children:[jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconError),onClick:handleCloseBtnClick,children:jsxRuntimeExports.jsx(CloseSingle,{style:{fontSize:"22px"}})}),jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconSuccess),onClick:handleConfirmBtnClick,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{fontSize:"22px"}})})]}),jsxRuntimeExports.jsx("div",{className:styles.zenEditorCanvasContainer,ref:editorRef})]})}__name(ZenEditor,"ZenEditor");function ZenEditorMenuItemFactory(accessor){return{id:OpenZenEditorCommand.id,type:ui.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:sheetsUi.getCurrentExclusiveRangeInterest$(accessor),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetSetCellStylePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(ZenEditorMenuItemFactory,"ZenEditorMenuItemFactory");const menuSchema={[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{[OpenZenEditorCommand.id]:{order:2,menuItemFactory:ZenEditorMenuItemFactory}}}},ZenEditorConfirmShortcut={id:ConfirmZenEditCommand.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ENTER|ui.MetaKeys.ALT},ZenEditorCancelShortcut={id:CancelZenEditCommand.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ESC};function whenZenEditorActivated(contextService){return contextService.getContextValue(core.FOCUSING_DOC)&&contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)&&contextService.getContextValue(core.EDITOR_ACTIVATED)&&!contextService.getContextValue(core.FOCUSING_EDITOR_STANDALONE)}__name(whenZenEditorActivated,"whenZenEditorActivated");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let ZenEditorUIController=(_b=class extends core.Disposable{constructor(_zenZoneService,_commandService,_menuManagerService,_shortcutService){super(),this._zenZoneService=_zenZoneService,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT,ZenEditor))}_initCommands(){[OpenZenEditorCommand,CancelZenEditCommand,ConfirmZenEditCommand].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortcuts(){[ZenEditorConfirmShortcut,ZenEditorCancelShortcut].forEach(item=>{this.disposeWithMe(this._shortcutService.registerShortcut(item))})}},__name(_b,"ZenEditorUIController"),_b);ZenEditorUIController=__decorateClass$1([__decorateParam$1(0,ui.IZenZoneService),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],ZenEditorUIController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.UniverSheetsZenEditorPlugin=(_c=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(this._injector)}_initializeDependencies(injector){[[ZenEditorUIController],[ZenEditorController],[IZenEditorManagerService,{useClass:ZenEditorManagerService}]].forEach(dependency=>injector.add(dependency))}onReady(){this._injector.get(ZenEditorUIController)}onSteady(){this._injector.get(ZenEditorController)}},__name(_c,"UniverSheetsZenEditorPlugin"),__publicField(_c,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),__publicField(_c,"type",core.UniverInstanceType.UNIVER_SHEET),_c),exports2.UniverSheetsZenEditorPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports2.UniverSheetsZenEditorPlugin),exports2.CancelZenEditCommand=CancelZenEditCommand,exports2.ConfirmZenEditCommand=ConfirmZenEditCommand,exports2.OpenZenEditorCommand=OpenZenEditorCommand,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
*/var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q"),reactJsxRuntime_production_min.Fragment=l,reactJsxRuntime_production_min.jsx=q,reactJsxRuntime_production_min.jsxs=q,jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,__assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$1={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"}}]},CheckMarkSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$1}))});CheckMarkSingle.displayName="CheckMarkSingle";var element={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"}}]},CloseSingle=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"close-single",ref,icon:element}))});CloseSingle.displayName="CloseSingle";function r(e){var t,f2,n2="";if(typeof e=="string"||typeof e=="number")n2+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f2=r(e[t]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e)e[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx(){for(var e,t,f2=0,n2="",o=arguments.length;f2<o;f2++)(e=arguments[f2])&&(t=r(e))&&(n2&&(n2+=" "),n2+=t);return n2}__name(clsx,"clsx");const styles={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"},ZEN_EDITOR_COMPONENT="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",INITIAL_SNAPSHOT={id:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${core.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:core.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function ZenEditor(){const editorRef=require$$0.useRef(null),zenEditorService=core.useDependency(IZenEditorManagerService),editorService=core.useDependency(docsUi.IEditorService),commandService=core.useDependency(core.ICommandService);require$$0.useEffect(()=>{const editorDom=editorRef.current;if(!editorDom)return;const registerSubscription=editorService.register({editorUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:INITIAL_SNAPSHOT,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},editorDom),resizeObserver=new ResizeObserver(()=>{zenEditorService.setPosition(editorDom.getBoundingClientRect())});return resizeObserver.observe(editorDom),()=>{registerSubscription.dispose(),resizeObserver.unobserve(editorDom)}},[]);function handleCloseBtnClick(){commandService.executeCommand(CancelZenEditCommand.id)}__name(handleCloseBtnClick,"handleCloseBtnClick");function handleConfirmBtnClick(){commandService.executeCommand(ConfirmZenEditCommand.id)}return __name(handleConfirmBtnClick,"handleConfirmBtnClick"),jsxRuntimeExports.jsxs("div",{className:styles.zenEditor,children:[jsxRuntimeExports.jsxs("div",{className:styles.zenEditorIconWrapper,children:[jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconError),onClick:handleCloseBtnClick,children:jsxRuntimeExports.jsx(CloseSingle,{style:{fontSize:"22px"}})}),jsxRuntimeExports.jsx("span",{className:clsx(styles.zenEditorIconContainer,styles.zenEditorIconSuccess),onClick:handleConfirmBtnClick,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{fontSize:"22px"}})})]}),jsxRuntimeExports.jsx("div",{className:styles.zenEditorCanvasContainer,ref:editorRef})]})}__name(ZenEditor,"ZenEditor");function ZenEditorMenuItemFactory(accessor){return{id:OpenZenEditorCommand.id,type:ui.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:sheetsUi.getCurrentExclusiveRangeInterest$(accessor),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetSetCellStylePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(ZenEditorMenuItemFactory,"ZenEditorMenuItemFactory");const menuSchema={[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{[OpenZenEditorCommand.id]:{order:2,menuItemFactory:ZenEditorMenuItemFactory}}}},ZenEditorConfirmShortcut={id:ConfirmZenEditCommand.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ENTER|ui.MetaKeys.ALT},ZenEditorCancelShortcut={id:CancelZenEditCommand.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:__name(contextService=>whenZenEditorActivated(contextService),"preconditions"),binding:ui.KeyCode.ESC};function whenZenEditorActivated(contextService){return contextService.getContextValue(core.FOCUSING_DOC)&&contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)&&contextService.getContextValue(core.EDITOR_ACTIVATED)&&!contextService.getContextValue(core.FOCUSING_EDITOR_STANDALONE)}__name(whenZenEditorActivated,"whenZenEditorActivated");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");let ZenEditorUIController=(_b=class extends core.Disposable{constructor(_zenZoneService,_commandService,_menuManagerService,_shortcutService){super(),this._zenZoneService=_zenZoneService,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT,ZenEditor))}_initCommands(){[OpenZenEditorCommand,CancelZenEditCommand,ConfirmZenEditCommand].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortcuts(){[ZenEditorConfirmShortcut,ZenEditorCancelShortcut].forEach(item=>{this.disposeWithMe(this._shortcutService.registerShortcut(item))})}},__name(_b,"ZenEditorUIController"),_b);ZenEditorUIController=__decorateClass$1([__decorateParam$1(0,ui.IZenZoneService),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuManagerService),__decorateParam$1(3,ui.IShortcutService)],ZenEditorUIController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");exports2.UniverSheetsZenEditorPlugin=(_c=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=this._config;menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(PLUGIN_CONFIG_KEY,rest),this._initializeDependencies(this._injector)}_initializeDependencies(injector){[[ZenEditorUIController],[ZenEditorController],[IZenEditorManagerService,{useClass:ZenEditorManagerService}]].forEach(dependency=>injector.add(dependency))}onReady(){this._injector.get(ZenEditorUIController)}onSteady(){this._injector.get(ZenEditorController)}},__name(_c,"UniverSheetsZenEditorPlugin"),__publicField(_c,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),__publicField(_c,"type",core.UniverInstanceType.UNIVER_SHEET),_c),exports2.UniverSheetsZenEditorPlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports2.UniverSheetsZenEditorPlugin),exports2.CancelZenEditCommand=CancelZenEditCommand,exports2.ConfirmZenEditCommand=ConfirmZenEditCommand,exports2.OpenZenEditorCommand=OpenZenEditorCommand,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-zen-editor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Zen Editor plugin for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
"rxjs": ">=7.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@univerjs/icons": "^0.1.
|
|
54
|
+
"@univerjs/icons": "^0.1.84",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
56
|
-
"@univerjs/
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/docs
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/sheets-ui": "0.4.
|
|
56
|
+
"@univerjs/design": "0.4.2",
|
|
57
|
+
"@univerjs/core": "0.4.2",
|
|
58
|
+
"@univerjs/docs": "0.4.2",
|
|
59
|
+
"@univerjs/docs-ui": "0.4.2",
|
|
60
|
+
"@univerjs/engine-render": "0.4.2",
|
|
61
|
+
"@univerjs/ui": "0.4.2",
|
|
62
|
+
"@univerjs/sheets": "0.4.2",
|
|
63
|
+
"@univerjs/sheets-ui": "0.4.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"less": "^4.2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"typescript": "^5.6.3",
|
|
70
70
|
"vite": "^5.4.8",
|
|
71
71
|
"vitest": "^2.1.2",
|
|
72
|
-
"@univerjs-infra/shared": "0.4.
|
|
72
|
+
"@univerjs-infra/shared": "0.4.2"
|
|
73
73
|
},
|
|
74
74
|
"univerSpace": {
|
|
75
75
|
".": {
|