@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/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(a,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-ui","@univerjs/engine-render","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets"],o):(a=typeof globalThis<"u"?globalThis:a||self,o(a.UniverSheetsZenEditor={},a.UniverCore,a.UniverDocsUi,a.UniverEngineRender,a.UniverSheetsUi,a.UniverUi,a.rxjs,a.React,a.UniverSheets))})(this,function(a,o,v,A,I,u,B,g,y){"use strict";var Pe=Object.defineProperty;var be=(a,o,v)=>o in a?Pe(a,o,{enumerable:!0,configurable:!0,writable:!0,value:v}):a[o]=v;var O=(a,o,v)=>be(a,typeof o!="symbol"?o+"":o,v);var x;const D={id:"zen-editor.command.open-zen-editor",type:o.CommandType.COMMAND,handler:async e=>{var h;const t=e.get(u.IZenZoneService),r=e.get(v.IEditorService),n=e.get(I.IEditorBridgeService),i=e.get(o.IUniverInstanceService);t.open();const s=r.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const c=n.getLatestEditCellState();if(c==null)return!1;const d=(h=c.documentLayoutObject.documentModel)==null?void 0:h.getSnapshot();if(d==null)return!1;i.focusUnit(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const{body:l,drawings:E,drawingsOrder:S,tableSource:_,settings:U}=o.Tools.deepClone(d),T={...s.getDocumentData(),body:l,drawings:E,drawingsOrder:S,tableSource:_,settings:U},C=[{startOffset:0,endOffset:0,collapsed:!0}];return s.focus(),s.setDocumentData(T,C),s.clearUndoRedoHistory(),!0}},z={id:"zen-editor.command.cancel-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{const t=e.get(u.IZenZoneService),r=e.get(I.IEditorBridgeService),n=e.get(o.IUniverInstanceService);t.close();const i=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);return i?(n.focusUnit(i.getUnitId()),r.refreshEditCellState(),!0):!1}},R={id:"zen-editor.command.confirm-zen-edit",type:o.CommandType.COMMAND,handler:async e=>{var l;const t=e.get(u.IZenZoneService),r=e.get(I.IEditorBridgeService),n=e.get(o.IUniverInstanceService),i=e.get(v.IEditorService);t.close();const s=i.getEditor(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY);if(s==null)return!1;const c=e.get(A.IRenderManagerService),d=n.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(d){const E=d.getUnitId(),S=(l=c.getRenderById(E))==null?void 0:l.with(I.EditingRenderController);if(S){const _=o.Tools.deepClone(s.getDocumentData());_.documentStyle.documentFlavor=o.DocumentFlavor.UNSPECIFIED,S.submitCellData(new o.DocumentDataModel(_))}return n.focusUnit(d.getUnitId()),r.refreshEditCellState(),!0}return!1}},q="sheets-zen-editor.config",J={};class Q{constructor(){O(this,"_position",null);O(this,"_position$",new B.BehaviorSubject(null));O(this,"position$",this._position$.asObservable())}dispose(){this._position$.complete(),this._position=null}setPosition(t){this._position=t,this._refresh(t)}getPosition(){return this._position}_refresh(t){this._position$.next(t)}}const Z=o.createIdentifier("univer.sheet-zen-editor-manager.service");var ee=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,te=(e,t,r,n)=>{for(var i=n>1?void 0:n?ne(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&ee(t,r,i),i},F=(e,t)=>(r,n)=>t(r,n,e);let P=class extends o.RxDisposable{constructor(e,t){super(),this._zenEditorManagerService=e,this._renderManagerService=t,this._initialize()}_initialize(){this._syncZenEditorSize()}_syncZenEditorSize(){this._zenEditorManagerService.position$.pipe(B.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const{width:t,height:r}=e,n=I.getEditorObject(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,this._renderManagerService);n!=null&&requestIdleCallback(()=>{n.engine.resizeBySize(t,r),this._calculatePagePosition(n),this._scrollToTop()})})}_calculatePagePosition(e){const{document:t,scene:r,docBackground:n}=e,i=r==null?void 0:r.getParent(),{width:s,height:c,pageMarginLeft:d,pageMarginTop:l}=t;if(i==null||s===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:E,height:S}=i;let _=0;const U=l;let N=0,T=0,C=Number.POSITIVE_INFINITY;const{scaleX:h,scaleY:ze}=r.getAncestorScale();E>(s+d*2)*h?(_=E/2-s*h/2,_/=h,N=(E-d*2)/h,C=0):(_=d,N=s+d*2,C=(N-E/h)/2),S>c?T=(S-l*2)/ze:T=c+l*2,r.resize(N,T),t.translate(_,U),n.translate(_,U);const L=r.getViewport(v.VIEWPORT_KEY.VIEW_MAIN);if(C!==Number.POSITIVE_INFINITY&&L!=null){const Re=L.transScroll2ViewportScrollValue(C,0).x;L.scrollToBarPos({x:Re})}return this}_scrollToTop(){var r;const e=(r=this._renderManagerService.getRenderById(o.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:r.with(v.DocBackScrollRenderController),t={startOffset:0,endOffset:0};e&&e.scrollToRange(t)}};P=te([F(0,Z),F(1,A.IRenderManagerService)],P);var k={exports:{}},b={};/**
|
|
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: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"})});
|
|
9
|
+
*/var re=g,ie=Symbol.for("react.element"),oe=Symbol.for("react.fragment"),se=Object.prototype.hasOwnProperty,ce=re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ae={key:!0,ref:!0,__self:!0,__source:!0};function V(e,t,r){var n,i={},s=null,c=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)se.call(t,n)&&!ae.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:ie,type:e,key:s,ref:c,props:i,_owner:ce.current}}b.Fragment=oe,b.jsx=V,b.jsxs=V,k.exports=b;var m=k.exports,f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},f.apply(this,arguments)},de=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},w=g.forwardRef(function(e,t){var r=e.icon,n=e.id,i=e.className,s=e.extend,c=de(e,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=g.useRef("_".concat(fe()));return W(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},f({ref:t,className:d},c),s)});function W(e,t,r,n,i){return g.createElement(e.tag,f(f({key:t},le(e,r,i)),n),(ue(e,r).children||[]).map(function(s,c){return W(s,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,i)}))}function le(e,t,r){var n=f({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var i=t.defIds;return!i||i.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var c=s[0],d=s[1];typeof d=="string"&&(n[c]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function ue(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?f(f({},e),{children:e.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?f(f({},i),{attrs:f(f({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):e}function fe(){return Math.random().toString(36).substring(2,8)}w.displayName="UniverIcon";var ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Y=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ve}))});Y.displayName="CheckMarkSingle";var ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"}}]},K=g.forwardRef(function(e,t){return g.createElement(w,Object.assign({},e,{id:"close-single",ref:t,icon:ge}))});K.displayName="CloseSingle";function H(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=H(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function G(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=H(e))&&(n&&(n+=" "),n+=t);return n}const p={zenEditor:"univer-zen-editor",zenEditorIconWrapper:"univer-zen-editor-icon-wrapper",zenEditorIconContainer:"univer-zen-editor-icon-container",zenEditorIconSuccess:"univer-zen-editor-icon-success",zenEditorIconError:"univer-zen-editor-icon-error",zenEditorCanvasContainer:"univer-zen-editor-canvas-container"},_e="ZEN_EDITOR_PLUGIN_ZEN_EDITOR_COMPONENT",Ee={id:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,body:{dataStream:`${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],tables:[],customBlocks:[],paragraphs:[{startIndex:0}],sectionBreaks:[{startIndex:1}]},tableSource:{},documentStyle:{pageSize:{width:595,height:Number.POSITIVE_INFINITY},documentFlavor:o.DocumentFlavor.MODERN,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,renderConfig:{vertexAngle:0,centerAngle:0}},drawings:{},drawingsOrder:[]};function he(){const e=g.useRef(null),t=o.useDependency(Z),r=o.useDependency(v.IEditorService),n=o.useDependency(o.ICommandService);g.useEffect(()=>{const c=e.current;if(!c)return;const d=r.register({editorUnitId:o.DOCS_ZEN_EDITOR_UNIT_ID_KEY,initialSnapshot:Ee,scrollBar:!0,noNeedVerticalAlign:!0,backScrollOffset:100},c),l=new ResizeObserver(()=>{t.setPosition(c.getBoundingClientRect())});return l.observe(c),()=>{d.dispose(),l.unobserve(c)}},[]);function i(){n.executeCommand(z.id)}function s(){n.executeCommand(R.id)}return m.jsxs("div",{className:p.zenEditor,children:[m.jsxs("div",{className:p.zenEditorIconWrapper,children:[m.jsx("span",{className:G(p.zenEditorIconContainer,p.zenEditorIconError),onClick:i,children:m.jsx(K,{style:{fontSize:"22px"}})}),m.jsx("span",{className:G(p.zenEditorIconContainer,p.zenEditorIconSuccess),onClick:s,children:m.jsx(Y,{style:{fontSize:"22px"}})})]}),m.jsx("div",{className:p.zenEditorCanvasContainer,ref:e})]})}function Ie(e){return{id:D.id,type:u.MenuItemType.BUTTON,title:"rightClick.zenEditor",icon:"AmplifySingle",hidden$:I.getCurrentExclusiveRangeInterest$(e),disabled$:I.getCurrentRangeDisable$(e,{workbookTypes:[y.WorkbookEditablePermission],worksheetTypes:[y.WorksheetEditPermission,y.WorksheetSetCellValuePermission,y.WorksheetSetCellStylePermission],rangeTypes:[y.RangeProtectionPermissionEditPoint]})}}const me={[u.ContextMenuPosition.MAIN_AREA]:{[u.ContextMenuGroup.OTHERS]:{[D.id]:{order:2,menuItemFactory:Ie}}}},pe={id:R.id,description:"shortcut.sheet.zen-edit-confirm",group:"4_sheet-edit",preconditions:e=>$(e),binding:u.KeyCode.ENTER|u.MetaKeys.ALT},Se={id:z.id,description:"shortcut.sheet.zen-edit-cancel",group:"4_sheet-edit",preconditions:e=>$(e),binding:u.KeyCode.ESC};function $(e){return e.getContextValue(o.FOCUSING_DOC)&&e.getContextValue(o.FOCUSING_UNIVER_EDITOR)&&e.getContextValue(o.EDITOR_ACTIVATED)&&!e.getContextValue(o.FOCUSING_EDITOR_STANDALONE)}var Ce=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ye=(e,t,r,n)=>{for(var i=n>1?void 0:n?Oe(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ce(t,r,i),i},j=(e,t)=>(r,n)=>t(r,n,e);let M=class extends o.Disposable{constructor(e,t,r,n){super(),this._zenZoneService=e,this._commandService=t,this._menuManagerService=r,this._shortcutService=n,this._initialize()}_initialize(){this._initCustomComponents(),this._initCommands(),this._initMenus(),this._initShortcuts()}_initCustomComponents(){this.disposeWithMe(this._zenZoneService.set(_e,he))}_initCommands(){[D,z,R].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.mergeMenu(me)}_initShortcuts(){[pe,Se].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}};M=ye([j(0,u.IZenZoneService),j(1,o.ICommandService),j(2,u.IMenuManagerService),j(3,u.IShortcutService)],M);var Ne=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,De=(e,t,r,n)=>{for(var i=n>1?void 0:n?Te(t,r):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(n?c(t,r,i):c(i))||i);return n&&i&&Ne(t,r,i),i},X=(e,t)=>(r,n)=>t(r,n,e);a.UniverSheetsZenEditorPlugin=(x=class extends o.Plugin{constructor(t=J,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{menu:i,...s}=this._config;i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(q,s),this._initializeDependencies(this._injector)}_initializeDependencies(t){[[M],[P],[Z,{useClass:Q}]].forEach(n=>t.add(n))}onReady(){this._injector.get(M)}onSteady(){this._injector.get(P)}},O(x,"pluginName","SHEET_ZEN_EDITOR_PLUGIN"),O(x,"type",o.UniverInstanceType.UNIVER_SHEET),x),a.UniverSheetsZenEditorPlugin=De([X(1,o.Inject(o.Injector)),X(2,o.IConfigService)],a.UniverSheetsZenEditorPlugin),a.CancelZenEditCommand=z,a.ConfirmZenEditCommand=R,a.OpenZenEditorCommand=D,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorEnUS=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Cancel Zen Edit","zen-edit-confirm":"Confirm Zen Edit"}}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorFaIR=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"لغو ویرایش Zen","zen-edit-confirm":"تایید ویرایش Zen"}}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorRuRU=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"Отменить Zen редактирование","zen-edit-confirm":"Подтвердить Zen редактирование"}}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorViVN=n())})(this,function(){"use strict";return{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)"}}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhCN=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"取消编辑(禅模式状态)","zen-edit-confirm":"放弃编辑(禅模式状态)"}}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsZenEditorZhTW=n())})(this,function(){"use strict";return{shortcut:{sheet:{"zen-edit-cancel":"取消編輯(禪模式狀態)","zen-edit-confirm":"放棄編輯(禪模式狀態)"}}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-zen-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Zen Editor plugin for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -31,11 +31,14 @@
|
|
|
31
31
|
"require": "./lib/cjs/*",
|
|
32
32
|
"types": "./lib/types/index.d.ts"
|
|
33
33
|
},
|
|
34
|
-
"./
|
|
35
|
-
|
|
34
|
+
"./locale/*": {
|
|
35
|
+
"import": "./lib/es/locale/*.js",
|
|
36
|
+
"require": "./lib/cjs/locale/*.js",
|
|
37
|
+
"types": "./lib/types/locale/*.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./lib/*": "./lib/*"
|
|
36
40
|
},
|
|
37
|
-
"main": "./lib/
|
|
38
|
-
"module": "./lib/es/index.js",
|
|
41
|
+
"main": "./lib/es/index.js",
|
|
39
42
|
"types": "./lib/types/index.d.ts",
|
|
40
43
|
"publishConfig": {
|
|
41
44
|
"access": "public"
|
|
@@ -51,27 +54,27 @@
|
|
|
51
54
|
"rxjs": ">=7.0.0"
|
|
52
55
|
},
|
|
53
56
|
"dependencies": {
|
|
54
|
-
"@univerjs/icons": "^0.
|
|
57
|
+
"@univerjs/icons": "^0.2.5",
|
|
55
58
|
"clsx": "^2.1.1",
|
|
56
|
-
"@univerjs/
|
|
57
|
-
"@univerjs/core": "0.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/sheets-ui": "0.
|
|
59
|
+
"@univerjs/docs": "0.5.0-alpha.0",
|
|
60
|
+
"@univerjs/core": "0.5.0-alpha.0",
|
|
61
|
+
"@univerjs/engine-render": "0.5.0-alpha.0",
|
|
62
|
+
"@univerjs/design": "0.5.0-alpha.0",
|
|
63
|
+
"@univerjs/docs-ui": "0.5.0-alpha.0",
|
|
64
|
+
"@univerjs/sheets": "0.5.0-alpha.0",
|
|
65
|
+
"@univerjs/ui": "0.5.0-alpha.0",
|
|
66
|
+
"@univerjs/sheets-ui": "0.5.0-alpha.0"
|
|
64
67
|
},
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"less": "^4.2.0",
|
|
67
70
|
"react": "18.3.1",
|
|
68
71
|
"rxjs": "^7.8.1",
|
|
69
72
|
"typescript": "^5.6.3",
|
|
70
|
-
"vite": "^5.4.
|
|
71
|
-
"vitest": "^2.1.
|
|
72
|
-
"@univerjs-infra/shared": "0.
|
|
73
|
+
"vite": "^5.4.10",
|
|
74
|
+
"vitest": "^2.1.4",
|
|
75
|
+
"@univerjs-infra/shared": "0.5.0-alpha.0"
|
|
73
76
|
},
|
|
74
|
-
"
|
|
77
|
+
"space": {
|
|
75
78
|
".": {
|
|
76
79
|
"import": "./lib/es/index.js",
|
|
77
80
|
"require": "./lib/cjs/index.js",
|
|
@@ -82,14 +85,19 @@
|
|
|
82
85
|
"require": "./lib/cjs/*",
|
|
83
86
|
"types": "./lib/types/index.d.ts"
|
|
84
87
|
},
|
|
85
|
-
"./
|
|
86
|
-
|
|
88
|
+
"./locale/*": {
|
|
89
|
+
"import": "./lib/es/locale/*.js",
|
|
90
|
+
"require": "./lib/cjs/locale/*.js",
|
|
91
|
+
"types": "./lib/types/locale/*.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./lib/*": "./lib/*"
|
|
87
94
|
},
|
|
88
95
|
"scripts": {
|
|
89
96
|
"test": "vitest run",
|
|
90
97
|
"test:watch": "vitest",
|
|
91
98
|
"coverage": "vitest run --coverage",
|
|
92
99
|
"lint:types": "tsc --noEmit",
|
|
93
|
-
"build": "
|
|
94
|
-
}
|
|
100
|
+
"build": "tsx build.ts"
|
|
101
|
+
},
|
|
102
|
+
"module": "./lib/es/index.js"
|
|
95
103
|
}
|