@univerjs/sheets-zen-editor 0.4.2 → 0.5.0-alpha.0
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/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +277 -290
- package/lib/{locale/en-US.json → es/locale/en-US.js} +7 -4
- package/lib/{locale/fa-IR.json → es/locale/fa-IR.js} +7 -4
- package/lib/{locale/ru-RU.json → es/locale/ru-RU.js} +7 -4
- package/lib/{locale/vi-VN.json → es/locale/vi-VN.js} +7 -4
- package/lib/{locale/zh-CN.json → es/locale/zh-CN.js} +7 -4
- package/lib/{locale/zh-TW.json → es/locale/zh-TW.js} +7 -4
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +30 -22
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var J=Object.defineProperty;var Q=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var S=(e,t,r)=>Q(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@univerjs/core"),N=require("@univerjs/docs-ui"),B=require("@univerjs/engine-render"),m=require("@univerjs/sheets-ui"),u=require("@univerjs/ui"),k=require("rxjs"),g=require("react"),y=require("@univerjs/sheets"),P={id:"zen-editor.command.open-zen-editor",type:s.CommandType.COMMAND,handler:async e=>{var h;const t=e.get(u.IZenZoneService),r=e.get(N.IEditorService),n=e.get(m.IEditorBridgeService),i=e.get(s.IUniverInstanceService);t.open();const o=r.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const c=n.getLatestEditCellState();if(c==null)return!1;const a=(h=c.documentLayoutObject.documentModel)==null?void 0:h.getSnapshot();if(a==null)return!1;i.focusUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:d,drawings:_,drawingsOrder:v,tableSource:f,settings:T}=s.Tools.deepClone(a),O={...o.getDocumentData(),body:d,drawings:_,drawingsOrder:v,tableSource:f,settings:T},p=[{startOffset:0,endOffset:0,collapsed:!0}];return o.focus(),o.setDocumentData(O,p),o.clearUndoRedoHistory(),!0}},x={id:"zen-editor.command.cancel-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{const t=e.get(u.IZenZoneService),r=e.get(m.IEditorBridgeService),n=e.get(s.IUniverInstanceService);t.close();const i=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return i?(n.focusUnit(i.getUnitId()),r.refreshEditCellState(),!0):!1}},M={id:"zen-editor.command.confirm-zen-edit",type:s.CommandType.COMMAND,handler:async e=>{var d;const t=e.get(u.IZenZoneService),r=e.get(m.IEditorBridgeService),n=e.get(s.IUniverInstanceService),i=e.get(N.IEditorService);t.close();const o=i.getEditor(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(o==null)return!1;const c=e.get(B.IRenderManagerService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(a){const _=a.getUnitId(),v=(d=c.getRenderById(_))==null?void 0:d.with(m.EditingRenderController);if(v){const f=s.Tools.deepClone(o.getDocumentData());f.documentStyle.documentFlavor=s.DocumentFlavor.UNSPECIFIED,v.submitCellData(new s.DocumentDataModel(f))}return n.focusUnit(a.getUnitId()),r.refreshEditCellState(),!0}return!1}},ee="sheets-zen-editor.config",te={};class ne{constructor(){S(this,"_position",null);S(this,"_position$",new k.BehaviorSubject(null));S(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const j=s.createIdentifier("univer.sheet-zen-editor-manager.service");var re=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,oe=(e,t,r,n)=>{for(var i=n>1?void 0:n?ie(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&re(t,r,i),i},L=(e,t)=>(r,n)=>t(r,n,e);let R=class extends s.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(k.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:r}=e,n=m.getEditorObject(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,r),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:r,docBackground:n}=e,i=r==null?void 0:r.getParent(),{width:o,height:c,pageMarginLeft:a,pageMarginTop:d}=t;if(i==null||o===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:_,height:v}=i;let f=0;const T=d;let C=0,O=0,p=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:G}=r.getAncestorScale();_>(o+a*2)*h?(f=_/2-o*h/2,f/=h,C=(_-a*2)/h,p=0):(f=a,C=o+a*2,p=(C-_/h)/2),v>c?O=(v-d*2)/G:O=c+d*2,r.resize(C,O),t.translate(f,T),n.translate(f,T);const Z=r.getViewport(N.VIEWPORT_KEY.VIEW_MAIN);if(p!==Number.POSITIVE_INFINITY&&Z!=null){const X=Z.transScroll2ViewportScrollValue(p,0).x;Z.scrollToBarPos({x:X})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(N.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};R=oe([L(0,j),L(1,B.IRenderManagerService)],R);var F={exports:{}},U={};/**
|
|
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: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;
|
|
9
|
+
*/var se=g,ce=Symbol.for("react.element"),ae=Symbol.for("react.fragment"),de=Object.prototype.hasOwnProperty,le=se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ue={key:!0,ref:!0,__self:!0,__source:!0};function V(e,t,r){var n,i={},o=null,c=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)de.call(t,n)&&!ue.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:ce,type:e,key:o,ref:c,props:i,_owner:le.current}}U.Fragment=ae;U.jsx=V;U.jsxs=V;F.exports=U;var E=F.exports,l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(this,arguments)},fe=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},w=g.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,o=e.extend,c=fe(e,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),d=g.useRef("_".concat(he()));return Y(r,"".concat(n),{defIds:r.defIds,idSuffix:d.current},l({ref:t,className:a},c),o)});function Y(e,t,r,n,i){return g.createElement(e.tag,l(l({key:t},ge(e,r,i)),n),(_e(e,r).children||[]).map(function(o,c){return Y(o,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,i)}))}function ge(e,t,r){var n=l({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var c=o[0],a=o[1];typeof a=="string"&&(n[c]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function _e(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?l(l({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?l(l({},i),{attrs:l(l({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function he(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},W=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ve}))});W.displayName="CheckMarkSingle";var Ee={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},K=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:Ee}))});K.displayName="CloseSingle";function q(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=q(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function A(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=q(e))&&(n&&(n+=" "),n+=t);return n}const Ie="univer-zen-editor",me="univer-zen-editor-icon-wrapper",pe="univer-zen-editor-icon-container",Se="univer-zen-editor-icon-success",Ce="univer-zen-editor-icon-error",Oe="univer-zen-editor-canvas-container",I={zenEditor:Ie,zenEditorIconWrapper:me,zenEditorIconContainer:pe,zenEditorIconSuccess:Se,zenEditorIconError:Ce,zenEditorCanvasContainer:Oe},ye="ZEN_EDITOR_PLUGIN_",Ne=`${ye}ZEN_EDITOR_COMPONENT`,Te={id:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:s.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function De(){const e=g.useRef(null),t=s.useDependency(j),r=s.useDependency(N.IEditorService),n=s.useDependency(s.ICommandService);g.useEffect(()=>{const c=e.current;if(!c)return;const a=r.register({editorUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:Te,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},c),d=new ResizeObserver(()=>{t.setPosition(c.getBoundingClientRect())});return d.observe(c),()=>{a.dispose(),d.unobserve(c)}},[]);function i(){n.executeCommand(x.id)}function o(){n.executeCommand(M.id)}return E.jsxs("div",{className:I.zenEditor,children:[E.jsxs("div",{className:I.zenEditorIconWrapper,children:[E.jsx("span",{className:A(I.zenEditorIconContainer,I.zenEditorIconError),onClick:i,children:E.jsx(K,{style:{fontSize:"22px"}})}),E.jsx("span",{className:A(I.zenEditorIconContainer,I.zenEditorIconSuccess),onClick:o,children:E.jsx(W,{style:{fontSize:"22px"}})})]}),E.jsx("div",{className:I.zenEditorCanvasContainer,ref:e})]})}function be(e){return{id:P.id,type:u.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:m.getCurrentExclusiveRangeInterest$(e),disabled$:m.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const Re={[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.OTHERS]:{[P.id]:{order:2,menuItemFactory:be}}}},ze={id:M.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>H(e),binding:u.KeyCode.ENTER|u.MetaKeys.ALT},Pe={id:x.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>H(e),binding:u.KeyCode.ESC};function H(e){return e.getContextValue(s.FOCUSING_DOC)&&e.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(s.EDITOR_ACTIVATED)&&!e.getContextValue(s.FOCUSING_EDITOR_STANDALONE)}var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ue=(e,t,r,n)=>{for(var i=n>1?void 0:n?Me(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&xe(t,r,i),i},D=(e,t)=>(r,n)=>t(r,n,e);let z=class extends s.Disposable{constructor(e,t,r,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=r,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(Ne,De))}_initCommands(){[P,x,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(Re)}_initShortcuts(){[ze,Pe].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};z=Ue([D(0,u.IZenZoneService),D(1,s.ICommandService),D(2,u.IMenuManagerService),D(3,u.IShortcutService)],z);var Ze=Object.defineProperty,je=Object.getOwnPropertyDescriptor,we=(e,t,r,n)=>{for(var i=n>1?void 0:n?je(t,r):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ze(t,r,i),i},$=(e,t)=>(r,n)=>t(r,n,e),b;exports.UniverSheetsZenEditorPlugin=(b=class extends s.Plugin{constructor(t=te,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...o}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(ee,o),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[z],[R],[j,{useClass:ne}]].forEach(n=>t.add(n))}onReady(){this._injector.get(z)}onSteady(){this._injector.get(R)}},S(b,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),S(b,"type",s.UniverInstanceType.UNIVER_SHEET),b);exports.UniverSheetsZenEditorPlugin=we([$(1,s.Inject(s.Injector)),$(2,s.IConfigService)],exports.UniverSheetsZenEditorPlugin);exports.CancelZenEditCommand=x;exports.ConfirmZenEditCommand=M;exports.OpenZenEditorCommand=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}};module.exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}};module.exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}};module.exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"Hủy chỉnh sửa (trạng thái Zen mode)","zen-edit-confirm":"Bỏ chỉnh sửa (trạng thái Zen mode)"}}};module.exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}};module.exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}};module.exports=e;
|