@univerjs/sheets-thread-comment-ui 1.0.2 → 1.0.3
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 +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
package/lib/cjs/index.js
CHANGED
|
@@ -359,7 +359,7 @@ const menuSchema = {
|
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region package.json
|
|
361
361
|
var name = "@univerjs/sheets-thread-comment-ui";
|
|
362
|
-
var version = "1.0.
|
|
362
|
+
var version = "1.0.3";
|
|
363
363
|
|
|
364
364
|
//#endregion
|
|
365
365
|
//#region src/services/mobile/mobile-sheet-comment-draft.service.ts
|
package/lib/es/index.js
CHANGED
|
@@ -358,7 +358,7 @@ const menuSchema = {
|
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region package.json
|
|
360
360
|
var name = "@univerjs/sheets-thread-comment-ui";
|
|
361
|
-
var version = "1.0.
|
|
361
|
+
var version = "1.0.3";
|
|
362
362
|
|
|
363
363
|
//#endregion
|
|
364
364
|
//#region src/services/mobile/mobile-sheet-comment-draft.service.ts
|
package/lib/index.js
CHANGED
|
@@ -358,7 +358,7 @@ const menuSchema = {
|
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region package.json
|
|
360
360
|
var name = "@univerjs/sheets-thread-comment-ui";
|
|
361
|
-
var version = "1.0.
|
|
361
|
+
var version = "1.0.3";
|
|
362
362
|
|
|
363
363
|
//#endregion
|
|
364
364
|
//#region src/services/mobile/mobile-sheet-comment-draft.service.ts
|
package/lib/umd/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/drawing`,`@univerjs/sheets`,`@univerjs/sheets-thread-comment`,`@univerjs/thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`@univerjs/engine-render`,`react`,`@univerjs/engine-formula`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentUi={},e.UniverCore,e.UniverDrawing,e.UniverSheets,e.UniverSheetsThreadComment,e.UniverThreadComment,e.UniverThreadCommentUi,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.UniverEngineRender,e.React,e.UniverEngineFormula,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let m=`univer.sheet.thread-comment-modal`,h=`univer.sheet.thread-comment-panel`,g=`sheet.operation.show-comment-modal`,_=`SHEET_THREAD_COMMENT_UI_PLUGIN`;function v(e){"@babel/helpers - typeof";return v=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},v(e)}function y(e,t){if(v(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(v(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ee(e){var t=y(e,`string`);return v(t)==`symbol`?t:t+``}function b(e,t,n){return(t=ee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e,t){return function(n,r){t(n,r,e)}}function S(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let C=class extends t.Disposable{get activePopup(){return this._activePopup}constructor(e,t){super(),this._canvasPopupManagerService=e,this._cellPopupManagerService=t,b(this,`_lastPopup`,null),b(this,`_activePopup`,void 0),b(this,`_activePopup$`,new l.BehaviorSubject(null)),b(this,`activePopup$`,this._activePopup$.asObservable()),this.disposeWithMe(()=>{this._activePopup$.complete()})}dispose(){super.dispose(),this.hidePopup()}showPopup(e,n){var r;let{row:i,col:a,unitId:o,subUnitId:s}=e;if(this._activePopup&&i===this._activePopup.row&&a===this._activePopup.col&&o===this._activePopup.unitId&&s===((r=this.activePopup)==null?void 0:r.subUnitId)){this._activePopup=e,this._activePopup$.next(e);return}this._lastPopup&&this._lastPopup.dispose(),this._activePopup=e,this._activePopup$.next(e);let c=this._cellPopupManagerService.showPopup({row:i,col:a,unitId:o,subUnitId:s},{componentKey:m,onClickOutside:()=>{this.hidePopup()},direction:`horizontal`,excludeOutside:[...Array.from(document.querySelectorAll(`.univer-thread-comment`)),document.getElementById(`thread-comment-add`)].filter(Boolean),priority:2});if(!c)throw Error(`[SheetsThreadCommentPopupService]: cannot show popup!`);let l=new t.DisposableCollection;l.add(c),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){this._activePopup&&this._activePopup.temp&&(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}};C=S([x(0,(0,t.Inject)(c.SheetCanvasPopManagerService)),x(1,(0,t.Inject)(c.CellPopupManagerService))],C);let w={type:t.CommandType.OPERATION,id:g,handler(e){var n;let a=e.get(r.SheetsSelectionsService),s=e.get(t.IUniverInstanceService),c=e.get(C),l=e.get(o.ThreadCommentPanelService),u=(n=a.getCurrentLastSelection())==null?void 0:n.primary,d=e.get(i.SheetsThreadCommentModel);if(!u)return!1;let f=(0,r.getSheetCommandTarget)(s);if(!f)return!1;let{workbook:p,worksheet:m,unitId:h,subUnitId:g}=f,_={workbook:p,worksheet:m,unitId:h,subUnitId:g,row:u.startRow,col:u.startColumn};c.showPopup(_);let v=d.getByLocation(h,g,u.startRow,u.startColumn);return v&&l.setActiveComment({unitId:h,subUnitId:g,commentId:v,trigger:`context-menu`}),!0}},T={id:`sheet.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(s.ISidebarService),n=e.get(o.ThreadCommentPanelService);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):D(t,n),!0}},E={id:`sheet.operation.open-comment-panel`,type:t.CommandType.OPERATION,handler(e){return D(e.get(s.ISidebarService),e.get(o.ThreadCommentPanelService)),!0}};function D(e,t){var n;(!t.panelVisible||((n=e.options.children)==null?void 0:n.label)!==`univer.sheet.thread-comment-panel`)&&e.open({header:{title:`sheets-thread-comment-ui.panel.title`},children:{label:h},width:360,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)}let O={id:`sheet.operation.add-drawing-comment`,type:t.CommandType.OPERATION,handler(e){var r;let i=e.get(n.IDrawingManagerService).getFocusDrawings()[0],c=e.get(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!i||!c||i.unitId!==c.getUnitId()||i.subUnitId!==((r=c.getActiveSheet())==null?void 0:r.getSheetId()))return!1;e.get(o.ThreadCommentDraftService).place({unitId:i.unitId,subUnitId:i.subUnitId,anchor:{kind:a.ThreadCommentAnchorKind.SHEET_DRAWING,pageId:i.subUnitId,elementId:i.drawingId}});let l=e.get(o.ThreadCommentPanelService);return e.get(s.ISidebarService).open({header:{title:`sheets-thread-comment-ui.panel.title`},children:{label:h},width:360,onClose:()=>l.setPanelVisible(!1)}),l.setPanelVisible(!0),!0}};function k(e){let n=e.get(t.IUniverInstanceService),i=e.get(t.IPermissionService);return(0,c.deriveStateFromActiveSheet$)(n,!0,({workbook:e,worksheet:t})=>{let n=e.getUnitId(),a=t.getSheetId();return i.composePermission$([new r.WorkbookCommentPermission(n).id,new r.WorksheetViewPermission(n,a).id]).pipe((0,l.map)(e=>e.some(e=>e.value===!1)))})}let A=e=>({id:O.id,type:s.MenuItemType.BUTTON,icon:`InsertCommentDoubleIcon`,title:`sheets-thread-comment-ui.menu.addComment`,tooltip:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:k(e)}),j=e=>({id:w.id,type:s.MenuItemType.BUTTON,icon:`InsertCommentDoubleIcon`,title:`sheets-thread-comment-ui.menu.addComment`,tooltip:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,c.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]})}),M=e=>({id:T.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`sheets-thread-comment-ui.menu.openComments`,tooltip:`sheets-thread-comment-ui.menu.openComments`,disabled$:(0,c.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]}),hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET)}),N={id:w.id,binding:s.KeyCode.M|s.MetaKeys.CTRL_COMMAND|s.MetaKeys.ALT,preconditions:c.whenSheetEditorFocused},te={[s.RibbonInsertGroup.MEDIA]:{[T.id]:{order:2,gridLayout:{row:1,column:3,showLabel:!0},menuItemFactory:M},[w.id]:{order:2.1,gridLayout:{row:2,column:3,showLabel:!0},menuItemFactory:j}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.OTHERS]:{[w.id]:{order:0,menuItemFactory:j}}},[s.FloatingObjectToolbarPosition.SHEET]:{[O.id]:{order:10,menuItemFactory:A}},[s.ContextMenuPosition.DRAWING]:{[s.ContextMenuGroup.OTHERS]:{[O.id]:{order:0,menuItemFactory:A}}}};var ne=`@univerjs/sheets-thread-comment-ui`,re=`1.0.2`,P=class extends t.Disposable{constructor(){super(),b(this,`_draft$`,new l.BehaviorSubject(null)),b(this,`draft$`,this._draft$.asObservable()),this.disposeWithMe(()=>this._draft$.complete())}get draft(){return this._draft$.getValue()}place(e){this._draft$.next(e)}cancel(){this._draft$.next(null)}};let F={type:t.CommandType.OPERATION,id:g,handler(e){var n;let a=(n=e.get(r.SheetsSelectionsService).getCurrentLastSelection())==null?void 0:n.primary;if(!a)return!1;let c=(0,r.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=a.startRow,f=a.startColumn,p=e.get(o.ThreadCommentPanelService),m=e.get(P),h=e.get(i.SheetsThreadCommentModel).getByLocation(l,u,d,f);return e.get(o.ThreadCommentDraftService).cancel(),h?(m.cancel(),p.setActiveComment({unitId:l,subUnitId:u,commentId:h})):(p.setActiveComment(void 0),m.place({unitId:l,subUnitId:u,row:d,column:f})),D(e.get(s.ISidebarService),p),!0}},I=`sheets-thread-comment.config`,L={};function R({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),l=`_${(0,d.useId)()}`,u=(0,d.useRef)(null);return(0,d.useImperativeHandle)(e,()=>u.current),(0,d.useLayoutEffect)(()=>{if(n&&u.current&&u.current.localName===r.tag)return se(u.current)},[n,r]),ie(r,`${i}`,{defIds:r.defIds,idSuffix:l},{ref:u,className:c,...s},o)}function ie(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...ae(e,n,i),...r},(oe(e,n).children||[]).map((r,a)=>ie(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function ae(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function oe(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function se(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:ce(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(le(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function ce(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function le(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}R.displayName=`UniverIcon`;let ue={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{stroke:`currentColor`,d:`M2.43993 3.31861H15.0381V12.5611H8.65676L5.75498 14.069V12.5611H2.43993V3.31861Z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M5.83725 7.50706V8.41159M8.73904 7.50706V8.41159M11.6408 7.50706V8.41159`,strokeLinecap:`round`,strokeWidth:1.39}}]},z=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(R,Object.assign({},e,{id:`comment-icon`,ref:t,icon:ue}))});z.displayName=`CommentIcon`;let de={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.63636 1.99658C1.28491 1.99658 1 2.28149 1 2.63295V10.2693C1 10.6208 1.28491 10.9057 1.63636 10.9057H2.96368L4.05003 11.992C4.29854 12.2405 4.70146 12.2405 4.94997 11.992L6.03632 10.9057H6.72727V12.4128C6.72727 12.7643 7.01218 13.0492 7.36364 13.0492H10.6001L11.3682 13.8173C11.6167 14.0658 12.0196 14.0658 12.2682 13.8173L13.0363 13.0492H14.3636C14.7151 13.0492 15 12.7643 15 12.4128V7.32192C15 6.97047 14.7151 6.68556 14.3636 6.68556H12.4545V2.63295C12.4545 2.28149 12.1696 1.99658 11.8182 1.99658H1.63636ZM12.4545 7.95829V10.2693C12.4545 10.6208 12.1696 10.9057 11.8182 10.9057H8V11.7765H10.8636C11.0324 11.7765 11.1942 11.8435 11.3136 11.9628L11.8182 12.4674L12.3228 11.9628C12.4421 11.8435 12.604 11.7765 12.7727 11.7765H13.7273V7.95829H12.4545ZM11.1818 3.26931H2.27273V9.63295H3.22727C3.39604 9.63295 3.5579 9.70001 3.67725 9.81936L4.5 10.6421L5.32275 9.81936C5.4421 9.70001 5.60396 9.63295 5.77273 9.63295H11.1818V3.26931Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M5.13617 4.54199C4.78472 4.54199 4.49981 4.8269 4.49981 5.17836C4.49981 5.52981 4.78472 5.81472 5.13617 5.81472H8.95435C9.3058 5.81472 9.59072 5.52981 9.59072 5.17836C9.59072 4.8269 9.3058 4.54199 8.95435 4.54199H5.13617ZM4.49981 7.72381C4.49981 7.37236 4.78472 7.08744 5.13617 7.08744H7.04526C7.39671 7.08744 7.68162 7.37236 7.68162 7.72381C7.68162 8.07526 7.39671 8.36018 7.04526 8.36018H5.13617C4.78472 8.36018 4.49981 8.07526 4.49981 7.72381Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},B=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(R,Object.assign({},e,{id:`insert-comment-double-icon`,ref:t,icon:de}))});B.displayName=`InsertCommentDoubleIcon`;let V=({ThreadCommentPanelComponent:e=o.ThreadCommentPanel}={})=>{var n;let r=(0,s.useDependency)(c.IMarkSelectionService),i=(0,s.useDependency)(t.IUniverInstanceService),u=(0,s.useDependency)(C),m=i.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),h=m.getUnitId(),g=(0,s.useDependency)(t.ICommandService),_=(0,s.useDependency)(o.ThreadCommentDraftService),v=(0,s.useDependency)(t.UserManagerService),y=(0,s.useObservable)(_.draft$,_.draft),ee=(y==null?void 0:y.anchor.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING&&y.unitId===h?{id:``,threadId:``,unitId:y.unitId,subUnitId:y.subUnitId,ref:(0,a.serializeThreadCommentAnchor)(y.anchor),dT:``,personId:v.getCurrentUser().userID,text:{dataStream:`\r
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/drawing"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/engine-render"),require("react"),require("@univerjs/engine-formula"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/drawing`,`@univerjs/sheets`,`@univerjs/sheets-thread-comment`,`@univerjs/thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`@univerjs/engine-render`,`react`,`@univerjs/engine-formula`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentUi={},e.UniverCore,e.UniverDrawing,e.UniverSheets,e.UniverSheetsThreadComment,e.UniverThreadComment,e.UniverThreadCommentUi,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.UniverEngineRender,e.React,e.UniverEngineFormula,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let m=`univer.sheet.thread-comment-modal`,h=`univer.sheet.thread-comment-panel`,g=`sheet.operation.show-comment-modal`,_=`SHEET_THREAD_COMMENT_UI_PLUGIN`;function v(e){"@babel/helpers - typeof";return v=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},v(e)}function y(e,t){if(v(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(v(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ee(e){var t=y(e,`string`);return v(t)==`symbol`?t:t+``}function b(e,t,n){return(t=ee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e,t){return function(n,r){t(n,r,e)}}function S(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let C=class extends t.Disposable{get activePopup(){return this._activePopup}constructor(e,t){super(),this._canvasPopupManagerService=e,this._cellPopupManagerService=t,b(this,`_lastPopup`,null),b(this,`_activePopup`,void 0),b(this,`_activePopup$`,new l.BehaviorSubject(null)),b(this,`activePopup$`,this._activePopup$.asObservable()),this.disposeWithMe(()=>{this._activePopup$.complete()})}dispose(){super.dispose(),this.hidePopup()}showPopup(e,n){var r;let{row:i,col:a,unitId:o,subUnitId:s}=e;if(this._activePopup&&i===this._activePopup.row&&a===this._activePopup.col&&o===this._activePopup.unitId&&s===((r=this.activePopup)==null?void 0:r.subUnitId)){this._activePopup=e,this._activePopup$.next(e);return}this._lastPopup&&this._lastPopup.dispose(),this._activePopup=e,this._activePopup$.next(e);let c=this._cellPopupManagerService.showPopup({row:i,col:a,unitId:o,subUnitId:s},{componentKey:m,onClickOutside:()=>{this.hidePopup()},direction:`horizontal`,excludeOutside:[...Array.from(document.querySelectorAll(`.univer-thread-comment`)),document.getElementById(`thread-comment-add`)].filter(Boolean),priority:2});if(!c)throw Error(`[SheetsThreadCommentPopupService]: cannot show popup!`);let l=new t.DisposableCollection;l.add(c),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){this._activePopup&&this._activePopup.temp&&(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}};C=S([x(0,(0,t.Inject)(c.SheetCanvasPopManagerService)),x(1,(0,t.Inject)(c.CellPopupManagerService))],C);let w={type:t.CommandType.OPERATION,id:g,handler(e){var n;let a=e.get(r.SheetsSelectionsService),s=e.get(t.IUniverInstanceService),c=e.get(C),l=e.get(o.ThreadCommentPanelService),u=(n=a.getCurrentLastSelection())==null?void 0:n.primary,d=e.get(i.SheetsThreadCommentModel);if(!u)return!1;let f=(0,r.getSheetCommandTarget)(s);if(!f)return!1;let{workbook:p,worksheet:m,unitId:h,subUnitId:g}=f,_={workbook:p,worksheet:m,unitId:h,subUnitId:g,row:u.startRow,col:u.startColumn};c.showPopup(_);let v=d.getByLocation(h,g,u.startRow,u.startColumn);return v&&l.setActiveComment({unitId:h,subUnitId:g,commentId:v,trigger:`context-menu`}),!0}},T={id:`sheet.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(s.ISidebarService),n=e.get(o.ThreadCommentPanelService);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):D(t,n),!0}},E={id:`sheet.operation.open-comment-panel`,type:t.CommandType.OPERATION,handler(e){return D(e.get(s.ISidebarService),e.get(o.ThreadCommentPanelService)),!0}};function D(e,t){var n;(!t.panelVisible||((n=e.options.children)==null?void 0:n.label)!==`univer.sheet.thread-comment-panel`)&&e.open({header:{title:`sheets-thread-comment-ui.panel.title`},children:{label:h},width:360,onClose:()=>t.setPanelVisible(!1)}),t.setPanelVisible(!0)}let O={id:`sheet.operation.add-drawing-comment`,type:t.CommandType.OPERATION,handler(e){var r;let i=e.get(n.IDrawingManagerService).getFocusDrawings()[0],c=e.get(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!i||!c||i.unitId!==c.getUnitId()||i.subUnitId!==((r=c.getActiveSheet())==null?void 0:r.getSheetId()))return!1;e.get(o.ThreadCommentDraftService).place({unitId:i.unitId,subUnitId:i.subUnitId,anchor:{kind:a.ThreadCommentAnchorKind.SHEET_DRAWING,pageId:i.subUnitId,elementId:i.drawingId}});let l=e.get(o.ThreadCommentPanelService);return e.get(s.ISidebarService).open({header:{title:`sheets-thread-comment-ui.panel.title`},children:{label:h},width:360,onClose:()=>l.setPanelVisible(!1)}),l.setPanelVisible(!0),!0}};function k(e){let n=e.get(t.IUniverInstanceService),i=e.get(t.IPermissionService);return(0,c.deriveStateFromActiveSheet$)(n,!0,({workbook:e,worksheet:t})=>{let n=e.getUnitId(),a=t.getSheetId();return i.composePermission$([new r.WorkbookCommentPermission(n).id,new r.WorksheetViewPermission(n,a).id]).pipe((0,l.map)(e=>e.some(e=>e.value===!1)))})}let A=e=>({id:O.id,type:s.MenuItemType.BUTTON,icon:`InsertCommentDoubleIcon`,title:`sheets-thread-comment-ui.menu.addComment`,tooltip:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:k(e)}),j=e=>({id:w.id,type:s.MenuItemType.BUTTON,icon:`InsertCommentDoubleIcon`,title:`sheets-thread-comment-ui.menu.addComment`,tooltip:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,c.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]})}),M=e=>({id:T.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`sheets-thread-comment-ui.menu.openComments`,tooltip:`sheets-thread-comment-ui.menu.openComments`,disabled$:(0,c.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]}),hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET)}),N={id:w.id,binding:s.KeyCode.M|s.MetaKeys.CTRL_COMMAND|s.MetaKeys.ALT,preconditions:c.whenSheetEditorFocused},te={[s.RibbonInsertGroup.MEDIA]:{[T.id]:{order:2,gridLayout:{row:1,column:3,showLabel:!0},menuItemFactory:M},[w.id]:{order:2.1,gridLayout:{row:2,column:3,showLabel:!0},menuItemFactory:j}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.OTHERS]:{[w.id]:{order:0,menuItemFactory:j}}},[s.FloatingObjectToolbarPosition.SHEET]:{[O.id]:{order:10,menuItemFactory:A}},[s.ContextMenuPosition.DRAWING]:{[s.ContextMenuGroup.OTHERS]:{[O.id]:{order:0,menuItemFactory:A}}}};var ne=`@univerjs/sheets-thread-comment-ui`,re=`1.0.3`,P=class extends t.Disposable{constructor(){super(),b(this,`_draft$`,new l.BehaviorSubject(null)),b(this,`draft$`,this._draft$.asObservable()),this.disposeWithMe(()=>this._draft$.complete())}get draft(){return this._draft$.getValue()}place(e){this._draft$.next(e)}cancel(){this._draft$.next(null)}};let F={type:t.CommandType.OPERATION,id:g,handler(e){var n;let a=(n=e.get(r.SheetsSelectionsService).getCurrentLastSelection())==null?void 0:n.primary;if(!a)return!1;let c=(0,r.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=a.startRow,f=a.startColumn,p=e.get(o.ThreadCommentPanelService),m=e.get(P),h=e.get(i.SheetsThreadCommentModel).getByLocation(l,u,d,f);return e.get(o.ThreadCommentDraftService).cancel(),h?(m.cancel(),p.setActiveComment({unitId:l,subUnitId:u,commentId:h})):(p.setActiveComment(void 0),m.place({unitId:l,subUnitId:u,row:d,column:f})),D(e.get(s.ISidebarService),p),!0}},I=`sheets-thread-comment.config`,L={};function R({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),l=`_${(0,d.useId)()}`,u=(0,d.useRef)(null);return(0,d.useImperativeHandle)(e,()=>u.current),(0,d.useLayoutEffect)(()=>{if(n&&u.current&&u.current.localName===r.tag)return se(u.current)},[n,r]),ie(r,`${i}`,{defIds:r.defIds,idSuffix:l},{ref:u,className:c,...s},o)}function ie(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...ae(e,n,i),...r},(oe(e,n).children||[]).map((r,a)=>ie(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function ae(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function oe(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function se(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:ce(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(le(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function ce(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function le(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}R.displayName=`UniverIcon`;let ue={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{stroke:`currentColor`,d:`M2.43993 3.31861H15.0381V12.5611H8.65676L5.75498 14.069V12.5611H2.43993V3.31861Z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M5.83725 7.50706V8.41159M8.73904 7.50706V8.41159M11.6408 7.50706V8.41159`,strokeLinecap:`round`,strokeWidth:1.39}}]},z=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(R,Object.assign({},e,{id:`comment-icon`,ref:t,icon:ue}))});z.displayName=`CommentIcon`;let de={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.63636 1.99658C1.28491 1.99658 1 2.28149 1 2.63295V10.2693C1 10.6208 1.28491 10.9057 1.63636 10.9057H2.96368L4.05003 11.992C4.29854 12.2405 4.70146 12.2405 4.94997 11.992L6.03632 10.9057H6.72727V12.4128C6.72727 12.7643 7.01218 13.0492 7.36364 13.0492H10.6001L11.3682 13.8173C11.6167 14.0658 12.0196 14.0658 12.2682 13.8173L13.0363 13.0492H14.3636C14.7151 13.0492 15 12.7643 15 12.4128V7.32192C15 6.97047 14.7151 6.68556 14.3636 6.68556H12.4545V2.63295C12.4545 2.28149 12.1696 1.99658 11.8182 1.99658H1.63636ZM12.4545 7.95829V10.2693C12.4545 10.6208 12.1696 10.9057 11.8182 10.9057H8V11.7765H10.8636C11.0324 11.7765 11.1942 11.8435 11.3136 11.9628L11.8182 12.4674L12.3228 11.9628C12.4421 11.8435 12.604 11.7765 12.7727 11.7765H13.7273V7.95829H12.4545ZM11.1818 3.26931H2.27273V9.63295H3.22727C3.39604 9.63295 3.5579 9.70001 3.67725 9.81936L4.5 10.6421L5.32275 9.81936C5.4421 9.70001 5.60396 9.63295 5.77273 9.63295H11.1818V3.26931Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M5.13617 4.54199C4.78472 4.54199 4.49981 4.8269 4.49981 5.17836C4.49981 5.52981 4.78472 5.81472 5.13617 5.81472H8.95435C9.3058 5.81472 9.59072 5.52981 9.59072 5.17836C9.59072 4.8269 9.3058 4.54199 8.95435 4.54199H5.13617ZM4.49981 7.72381C4.49981 7.37236 4.78472 7.08744 5.13617 7.08744H7.04526C7.39671 7.08744 7.68162 7.37236 7.68162 7.72381C7.68162 8.07526 7.39671 8.36018 7.04526 8.36018H5.13617C4.78472 8.36018 4.49981 8.07526 4.49981 7.72381Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},B=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(R,Object.assign({},e,{id:`insert-comment-double-icon`,ref:t,icon:de}))});B.displayName=`InsertCommentDoubleIcon`;let V=({ThreadCommentPanelComponent:e=o.ThreadCommentPanel}={})=>{var n;let r=(0,s.useDependency)(c.IMarkSelectionService),i=(0,s.useDependency)(t.IUniverInstanceService),u=(0,s.useDependency)(C),m=i.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),h=m.getUnitId(),g=(0,s.useDependency)(t.ICommandService),_=(0,s.useDependency)(o.ThreadCommentDraftService),v=(0,s.useDependency)(t.UserManagerService),y=(0,s.useObservable)(_.draft$,_.draft),ee=(y==null?void 0:y.anchor.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING&&y.unitId===h?{id:``,threadId:``,unitId:y.unitId,subUnitId:y.subUnitId,ref:(0,a.serializeThreadCommentAnchor)(y.anchor),dT:``,personId:v.getCurrentUser().userID,text:{dataStream:`\r
|
|
2
2
|
`}}:null,b=(0,d.useMemo)(()=>m.activeSheet$.pipe((0,l.map)(e=>e==null?void 0:e.getSheetId())),[m.activeSheet$]),x=(0,s.useObservable)(b,(n=m.getActiveSheet())==null?void 0:n.getSheetId()),S=(0,d.useRef)(null),T=(0,s.useDependency)(o.ThreadCommentPanelService),E=(0,s.useObservable)(T.activeCommentId$),D=(0,s.useObservable)(T.panelVisible$,T.panelVisible),O=(0,d.useCallback)(e=>{let t=m.getSheets(),n={};t.forEach((e,t)=>{n[e.getSheetId()]=t});let r=e=>e.map(e=>{let t=(0,a.deserializeThreadCommentAnchor)(e.ref);if((t==null?void 0:t.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING)return{...e,p:[n[e.subUnitId]??0,2**53-1,0]};let r=(0,f.singleReferenceToGrid)(e.ref),i=[n[e.subUnitId]??0,r.row,r.column];return{...e,p:i}}).sort((e,t)=>e.p[0]===t.p[0]?e.p[1]===t.p[1]?e.p[2]-t.p[2]:e.p[1]-t.p[1]:e.p[0]-t.p[0]);return[...r(e.filter(e=>!e.resolved)),...r(e.filter(e=>e.resolved))]},[m]),k=(0,d.useCallback)(e=>{if((0,a.deserializeThreadCommentAnchor)(e.ref))return null;if(e.unitId===h&&e.subUnitId===x&&!e.resolved){let{row:t,column:n}=(0,f.singleReferenceToGrid)(e.ref),i=m.getSheetBySheetId(e.subUnitId),a=(i==null?void 0:i.getMergedCell(t,n))??{startColumn:n,endColumn:n,startRow:t,endRow:t};if(!Number.isNaN(t)&&!Number.isNaN(n))return r.addShape({range:a,style:{fill:`rgb(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null})}return null},[r,x,h]),A=e=>{var t;return((t=m.getSheetBySheetId(e))==null?void 0:t.getName())??``},j=()=>{g.executeCommand(w.id)},M=e=>{S.current&&=(r.removeShape(S.current),null),!(E&&E.unitId===e.unitId&&E.subUnitId===e.subUnitId&&E.commentId===e.id)&&(S.current=k(e))},N=()=>{S.current&&=(r.removeShape(S.current),null)};return(0,d.useEffect)(()=>{!D&&S.current&&(r.removeShape(S.current),S.current=null)},[r,D]),(0,p.jsx)(e,{unitId:h,subUnitId$:b,type:t.UniverInstanceType.UNIVER_SHEET,onAdd:j,getSubUnitName:A,onResolve:(e,t)=>{t&&u.hidePopup()},sortComments:O,onItemEnter:M,onItemLeave:N,onDeleteComment:()=>(N(),!0),tempComment:ee,onTempCommentClose:()=>_.cancel(),formatRef:e=>{let t=(0,a.deserializeThreadCommentAnchor)(e.ref);return(t==null?void 0:t.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING?`#${t.elementId}`:e.ref}})};function fe(e){let n=(0,s.useDependency)(P),r=(0,s.useDependency)(t.UserManagerService),i=(0,s.useObservable)(n.draft$,n.draft),a=(i==null?void 0:i.unitId)===e.unitId?{id:``,threadId:``,unitId:i.unitId,subUnitId:i.subUnitId,ref:`${t.Tools.chatAtABC(i.column)}${i.row+1}`,dT:``,personId:r.getCurrentUser().userID,text:{dataStream:`\r
|
|
3
3
|
`}}:null,c=()=>{var t;n.cancel(),(t=e.onTempCommentClose)==null||t.call(e)};return(0,p.jsx)(o.MobileThreadCommentPanel,{...e,tempComment:e.tempComment??a,onTempCommentClose:c,autoFocusActiveComment:!0})}function pe(){return(0,p.jsx)(V,{ThreadCommentPanelComponent:fe})}let H=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this.disposeWithMe(this._componentManager.register(h,pe)),this.disposeWithMe(this._iconManager.register({CommentIcon:z,InsertCommentDoubleIcon:B}))}};H=S([x(0,(0,t.Inject)(s.ComponentManager)),x(1,(0,t.Inject)(s.IconManager))],H);function me(e){var t;let n=e.get(r.SheetsSelectionsService),a=(t=n.getCurrentLastSelection())==null?void 0:t.primary,o=n.currentSelectionParam;return!a||!o?`sheets-thread-comment-ui.menu.addComment`:e.get(i.SheetsThreadCommentModel).getByLocation(o.unitId,o.sheetId,a.startRow,a.startColumn)?`sheets-thread-comment-ui.menu.openComments`:`sheets-thread-comment-ui.menu.addComment`}let he=e=>({id:F.id,type:s.MenuItemType.BUTTON,icon:`InsertCommentDoubleIcon`,title:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,c.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]})}),ge=e=>({...he(e),title:me(e)}),_e={[s.RibbonInsertGroup.MEDIA]:{[T.id]:{order:2,gridLayout:{row:1,column:3,showLabel:!0},menuItemFactory:M},[F.id]:{order:2.1,gridLayout:{row:2,column:3,showLabel:!0},menuItemFactory:he}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.OTHERS]:{[F.id]:{order:0,menuItemFactory:ge}}},[s.FloatingObjectToolbarPosition.SHEET]:{[O.id]:{order:10,menuItemFactory:A}},[s.ContextMenuPosition.DRAWING]:{[s.ContextMenuGroup.OTHERS]:{[O.id]:{order:0,menuItemFactory:A}}}},U=class extends t.Disposable{constructor(e){super(),e.mergeMenu(_e)}};U=S([x(0,s.IMenuManagerService)],U);let W=class extends t.Disposable{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(r.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t;return this._sheetsThreadCommentModel.showCommentMarker(a,o,r,i)?((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:`#FFBD37`,size:6}},n(e)):n(e)},priority:100}))}_initSkeletonChange(){let e=()=>{var e;let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return;let r=n.getUnitId(),i=this._renderManagerService.getRenderUnitById(r);i==null||(e=i.mainComponent)==null||e.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe((0,l.debounceTime)(16)).subscribe(()=>{e()}))}};W=S([x(0,(0,t.Inject)(r.SheetInterceptorService)),x(1,(0,t.Inject)(i.SheetsThreadCommentModel)),x(2,t.IUniverInstanceService),x(3,u.IRenderManagerService)],W);let ve=(e,t,n)=>{let r=(0,f.singleReferenceToGrid)(e),i=n.row-t.row,a=n.column-t.column,o={startColumn:r.column+a,startRow:r.row+i,endColumn:r.column+a,endRow:r.row+i};return(0,f.serializeRange)(o)},G=class extends t.Disposable{constructor(e,t,n){super(),this._sheetClipboardService=e,this._sheetsThreadCommentModel=t,this._threadCommentDataSourceService=n,b(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:_,onBeforeCopy:(e,t,n)=>{this._copyInfo={unitId:e,subUnitId:t,range:n}},onPasteCells:(e,n,r,i)=>{let{unitId:o,subUnitId:s,range:l}=n,u={row:l.rows[0],column:l.cols[0]};if(i.copyType===c.COPY_TYPE.CUT&&this._copyInfo){let{range:e,unitId:n,subUnitId:r}=this._copyInfo,i={row:e.startRow,column:e.startColumn};if(o!==n||s!==r){let c=[];t.Range.foreach(e,(e,t)=>{let i=this._sheetsThreadCommentModel.getAllByLocation(n,r,e,t);this._threadCommentDataSourceService.syncUpdateMutationToColla?i.forEach(e=>{c.push(e)}):i.forEach(({children:e,...t})=>{t.parentId||c.push(t)})});let l=[],d=[],f=[],p=[],m=e=>{l.unshift({id:a.DeleteCommentMutation.id,params:{unitId:n,subUnitId:r,commentId:e.id}}),f.push({id:a.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...e,ref:ve(e.ref,i,u),unitId:o,subUnitId:s},sync:!0}}),d.push({id:a.AddCommentMutation.id,params:{unitId:n,subUnitId:r,comment:e,sync:!0}}),p.unshift({id:a.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:e.id}})};return c.forEach(e=>{m(e)}),{redos:[...l,...f],undos:[...p,...d]}}}return{redos:[],undos:[]}}}))}};G=S([x(0,(0,t.Inject)(c.ISheetClipboardService)),x(1,(0,t.Inject)(i.SheetsThreadCommentModel)),x(2,a.IThreadCommentDataSourceService)],G);let K=class extends t.Disposable{constructor(e,t,n,r){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._sheetsThreadCommentModel=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{let{id:t}=e;if(t===O.id||t===w.id||t===T.id)this._sheetPermissionCheckController.permissionCheckWithoutRange({workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`));else if(t===a.AddCommentCommand.id){let{unitId:t,subUnitId:n,comment:r}=e.params;this._hasCommentPermission(t,n,r.ref)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}else if(t===a.UpdateCommentCommand.id){let{unitId:t,subUnitId:n,payload:r}=e.params,{commentId:i}=r,a=this._sheetsThreadCommentModel.getComment(t,n,i);a&&!this._hasCommentPermission(t,n,a.ref)&&this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}else if(t===a.ResolveCommentCommand.id||t===a.DeleteCommentCommand.id||t===a.DeleteCommentTreeCommand.id){let{unitId:t,subUnitId:n,commentId:r}=e.params,i=this._sheetsThreadCommentModel.getComment(t,n,r);i&&!this._hasCommentPermission(t,n,i.ref)&&this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}}))}_hasCommentPermission(e,t,n){let i={workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission]},o=(0,a.deserializeThreadCommentAnchor)(n);if((o==null?void 0:o.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING)return this._sheetPermissionCheckController.permissionCheckWithoutRange(i,e,t);let{row:s,column:c}=(0,f.singleReferenceToGrid)(n);return!Number.isFinite(s)||!Number.isFinite(c)?!1:this._sheetPermissionCheckController.permissionCheckWithRanges({...i,rangeTypes:[r.RangeProtectionPermissionViewPoint]},[{startRow:s,startColumn:c,endRow:s,endColumn:c}],e,t)}};K=S([x(0,(0,t.Inject)(t.LocaleService)),x(1,t.ICommandService),x(2,(0,t.Inject)(r.SheetPermissionCheckController)),x(3,(0,t.Inject)(i.SheetsThreadCommentModel))],K);let q=class extends t.Plugin{constructor(e=L,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},L,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(I,o)}onStarting(){[[H],[U],[W],[G],[C],[K],[P]].forEach(e=>this._injector.add(e)),this._injector.get(H),[O,E,F,T].forEach(e=>this._commandService.registerCommand(e)),this._injector.get(U)}onReady(){this._injector.get(W)}onRendered(){this._injector.get(G),this._injector.get(K)}};b(q,`pluginName`,_),b(q,`packageName`,ne),b(q,`version`,re),b(q,`type`,t.UniverInstanceType.UNIVER_SHEET),q=S([(0,t.DependentOn)(u.UniverRenderEnginePlugin,a.UniverThreadCommentPlugin,r.UniverSheetsPlugin,o.UniverThreadCommentMobileUIPlugin,i.UniverSheetsThreadCommentPlugin,s.UniverMobileUIPlugin,c.UniverSheetsMobileUIPlugin),x(1,(0,t.Inject)(t.Injector)),x(2,(0,t.Inject)(t.ICommandService)),x(3,t.IConfigService)],q);let ye=()=>{let e=(0,s.useDependency)(t.IUniverInstanceService),n=(0,s.useDependency)(C),r=(0,s.useObservable)(n.activePopup$),a=(0,s.useDependency)(i.SheetsThreadCommentModel),c=()=>{if(!r)return;let{unitId:e,subUnitId:t,row:n,col:i,commentId:o}=r,s=o?a.getAllByLocation(e,t,n,i).find(e=>e.id===o):void 0;return s&&!s.resolved?s.id:a.getByLocation(e,t,n,i)},u=(0,s.useObservable)(r?()=>a.commentUpdate$.pipe((0,l.map)(()=>c()),(0,l.startWith)(c())):null,void 0,!1,[r,a]);if(!r)return null;let{row:d,col:f,unitId:m,subUnitId:h,trigger:g}=r,_=`${t.Tools.chatAtABC(f)}${d+1}`;return(0,p.jsx)(o.ThreadCommentTree,{onClick:()=>{n.persistPopup()},location:o.ThreadCommentTreeLocation.CELL,id:u,unitId:m,subUnitId:h,type:t.UniverInstanceType.UNIVER_SHEET,refStr:_,onClose:()=>{n.hidePopup()},getSubUnitName:n=>{var r;return((r=e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(r=r.getSheetBySheetId(n))==null?void 0:r.getName())??``},autoFocus:g===`context-menu`})},J=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){[[m,ye],[h,V]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_registerIcons(){this.disposeWithMe(this._iconManager.register({CommentIcon:z,InsertCommentDoubleIcon:B}))}};J=S([x(0,(0,t.Inject)(s.ComponentManager)),x(1,(0,t.Inject)(s.IconManager))],J);let Y=class extends t.RxDisposable{constructor(e,n,r,i,a,s){super(),this._context=e,this._commandService=n,this._drawingManagerService=r,this._commentModel=i,this._panelService=a,this._themeService=s,b(this,`_overlay`,void 0),this._overlay=new o.ThreadCommentCanvasOverlay(`sheet-thread-comment-drawing-overlay`,{...this._getColors(),zoomRatio:1,markers:[],underlines:[]}),this._context.scene.addObject(this._overlay,10100),this.disposeWithMe((0,t.toDisposable)(this._overlay.onPointerDown$.subscribeEvent((e,t)=>this._onOverlayPointerDown(t)))),this.disposeWithMe((0,t.toDisposable)(this._context.engine.onTransformChange$.subscribeEvent(()=>this._syncOverlay()))),this.disposeWithMe(this._context.unit.activeSheet$.subscribe(()=>this._syncOverlay())),this.disposeWithMe(this._commentModel.commentUpdate$.subscribe(e=>{e.unitId===this._context.unitId&&this._syncOverlay()})),[this._panelService.activeCommentId$,this._panelService.hoveredCommentId$].forEach(e=>this.disposeWithMe(e.subscribe(()=>this._syncOverlay()))),[this._drawingManagerService.add$,this._drawingManagerService.update$,this._drawingManagerService.remove$].forEach(e=>this.disposeWithMe(e.subscribe(e=>{e.some(e=>e.unitId===this._context.unitId)&&this._syncOverlay()}))),this.disposeWithMe(this._themeService.currentTheme$.subscribe(()=>this._syncOverlay())),this._syncOverlay()}_onOverlayPointerDown(e){var t;let n=this._overlay.hitCommentId,r=(t=this._context.unit.getActiveSheet())==null?void 0:t.getSheetId();n&&r&&(e.stopPropagation(),this._panelService.setActiveComment({unitId:this._context.unitId,subUnitId:r,commentId:n,trigger:`sheet-canvas`}),this._commandService.executeCommand(E.id).catch(()=>void 0))}_syncOverlay(){let e=this._context.unit.getActiveSheet(),t=e==null?void 0:e.getSheetId();if(!e||!t){this._overlay.updateState({markers:[],underlines:[],focusedCommentIds:[],focusOutlines:[]});return}let n=new Map;this._commentModel.query({unitIds:[this._context.unitId],subUnitIds:[t],anchorKinds:[a.ThreadCommentAnchorKind.SHEET_DRAWING],resolved:!1}).forEach(({root:r})=>{let i=(0,a.deserializeThreadCommentAnchor)(r.ref);if((i==null?void 0:i.kind)!==a.ThreadCommentAnchorKind.SHEET_DRAWING)return;let o=this._getDrawingOutline(t,i.elementId);o&&n.set(i.elementId,{commentId:r.id,left:o.left,top:o.top+o.height+2/e.getZoomRatio(),width:o.width})});let r=[],i=new Map;[this._panelService.activeCommentId,this._panelService.hoveredCommentId].forEach(e=>{if(!e||e.unitId!==this._context.unitId||e.subUnitId!==t)return;let n=this._commentModel.getComment(e.unitId,e.subUnitId,e.commentId),o=n&&(0,a.deserializeThreadCommentAnchor)(n.ref);if((o==null?void 0:o.kind)!==a.ThreadCommentAnchorKind.SHEET_DRAWING)return;r.push(e.commentId);let s=this._getDrawingOutline(t,o.elementId);s&&i.set(o.elementId,s)}),this._overlay.updateState({...this._getColors(),zoomRatio:e.getZoomRatio(),markers:[],underlines:Array.from(n.values()),focusedCommentIds:r,focusOutlines:Array.from(i.values())})}_getDrawingOutline(e,t){var r,i;let a=(0,n.getDrawingShapeKeyByDrawingSearch)({unitId:this._context.unitId,subUnitId:e,drawingId:t}),o=((r=(i=this._context.scene).getObjectIncludeInGroup)==null?void 0:r.call(i,a))??this._context.scene.getObject(a);if(!o)return null;let s=o.getRealBound();return{left:s.left,top:s.top,width:s.width,height:s.height}}_getColors(){return{accentColor:this._themeService.getColorFromTheme(`yellow.400`),foregroundColor:this._themeService.getColorFromTheme(`gray.900`),outlineColor:this._themeService.getColorFromTheme(`white`)}}};Y=S([x(1,t.ICommandService),x(2,n.IDrawingManagerService),x(3,(0,t.Inject)(a.ThreadCommentModel)),x(4,(0,t.Inject)(o.ThreadCommentPanelService)),x(5,(0,t.Inject)(t.ThemeService))],Y);let X=class extends t.Disposable{constructor(e,t,n,r){super(),this._hoverManagerService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=r,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,l.debounceTime)(100)).subscribe(e=>{let t=this._sheetsThreadCommentPopupService.activePopup;if(e&&(t&&t.temp||!t)){let{location:n}=e,{unitId:i,subUnitId:a,row:o,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(i,a,o,s);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}],i,a))return;let e=this._sheetsThreadCommentModel.getComment(i,a,c);e&&!e.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:a,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};X=S([x(0,(0,t.Inject)(c.HoverManagerService)),x(1,(0,t.Inject)(C)),x(2,(0,t.Inject)(i.SheetsThreadCommentModel)),x(3,(0,t.Inject)(r.SheetPermissionCheckController))],X);function be(e,t,n,r){for(let i of[t,e])if(i&&i.unitId===n&&i.subUnitId===r)return i}let Z=class extends t.Disposable{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._commandService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=a,this._markSelectionService=o,this._sheetSelectionService=s,this._editorBridgeService=c,this._renderManagerService=l,b(this,`_isSwitchToCommenting`,!1),b(this,`_selectionShapeInfo`,null),this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(e,n,r){var i,a;let s=(i=e[0])==null?void 0:i.range,l=this._renderManagerService.getRenderUnitById(n),u=l==null||(a=l.with(c.SheetSkeletonManagerService).getSkeletonParam(r))==null?void 0:a.skeleton;if(!u||!s)return;let d=u.getCellWithCoordByIndex(s.startRow,s.startColumn);if(((s.rangeType??t.RANGE_TYPE.NORMAL)!==t.RANGE_TYPE.NORMAL||s.endColumn-s.startColumn>0||s.endRow-s.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&t.Rectangle.equals(d.mergeInfo,s))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(o.SetActiveCommentOperation.id);return}let f=d.actualRow,p=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,r,f,p)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(o.SetActiveCommentOperation.id);return}let m=this._sheetsThreadCommentModel.getByLocation(n,r,f,p);m&&this._commandService.executeCommand(o.SetActiveCommentOperation.id,{unitId:n,subUnitId:r,commentId:m})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(e=>{if(this._isSwitchToCommenting)return;let t=this._sheetSelectionService.currentSelectionParam;t&&this._handleSelectionChange(e,t.unitId,t.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(e=>{if(e.id===a.DeleteCommentMutation.id){let t=e.params,n=this._sheetsThreadCommentPopupService.activePopup;if(!n)return;let{unitId:r,subUnitId:i,commentId:a}=n;t.unitId===r&&t.subUnitId===i&&t.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async e=>{if(e){var n;let{unitId:i,subUnitId:o,commentId:s,trigger:l}=e,u=this._sheetsThreadCommentModel.getComment(i,o,s);if(!u||u.resolved)return;let d=(0,a.deserializeThreadCommentAnchor)(u.ref);if((d==null?void 0:d.kind)===a.ThreadCommentAnchorKind.SHEET_DRAWING)return;let p=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!p||p.getUnitId()!==i)return;this._isSwitchToCommenting=!0,((n=p.getActiveSheet())==null?void 0:n.getSheetId())!==o&&await this._commandService.executeCommand(r.SetWorksheetActiveOperation.id,{unitId:i,subUnitId:o}),this._isSwitchToCommenting=!1;let m=(0,f.singleReferenceToGrid)(u.ref),{row:h,column:g}=m;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookCommentPermission],worksheetTypes:[r.WorksheetViewPermission],rangeTypes:[r.RangeProtectionPermissionViewPoint]},[{startRow:h,startColumn:g,endRow:h,endColumn:g}],i,o)||(await this._commandService.executeCommand(c.ScrollToRangeOperation.id,{range:{startRow:Math.max(m.row-1,0),endRow:m.row+1,startColumn:Math.max(m.column-1,0),endColumn:m.column+1}}),this._editorBridgeService.isVisible().visible))return;this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:o,row:m.row,col:m.column,commentId:u.id,trigger:l})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe((0,l.combineLatest)([this._threadCommentPanelService.activeCommentId$,this._threadCommentPanelService.hoveredCommentId$]).pipe((0,l.debounceTime)(100)).subscribe(([e,n])=>{var r,i;let a=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),o=be(e,n,a==null?void 0:a.getUnitId(),a==null||(r=a.getActiveSheet())==null?void 0:r.getSheetId());if(!o){this._selectionShapeInfo&&=(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),null);return}let{unitId:s,subUnitId:c,commentId:l}=o;this._selectionShapeInfo&&=(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),null);let u=this._sheetsThreadCommentModel.getComment(s,c,l);if(!u)return;let{row:d,column:p}=(0,f.singleReferenceToGrid)(u.ref);if(Number.isNaN(d)||Number.isNaN(p))return null;let m=(i=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:i.getSheetBySheetId(c),h=(m==null?void 0:m.getMergedCell(d,p))??{startColumn:p,endColumn:p,startRow:d,endRow:d},g=this._markSelectionService.addShape({range:h,style:{fill:`rgba(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null},[],-1);g&&(this._selectionShapeInfo={...o,shapeId:g})}))}};Z=S([x(0,t.ICommandService),x(1,(0,t.Inject)(C)),x(2,(0,t.Inject)(i.SheetsThreadCommentModel)),x(3,(0,t.Inject)(o.ThreadCommentPanelService)),x(4,t.IUniverInstanceService),x(5,(0,t.Inject)(r.SheetPermissionCheckController)),x(6,c.IMarkSelectionService),x(7,(0,t.Inject)(r.SheetsSelectionsService)),x(8,c.IEditorBridgeService),x(9,u.IRenderManagerService)],Z);let Q=class extends t.Disposable{constructor(e,t){super(),this._menuManagerService=e,this._shortcutService=t,this._initMenu(),this._initShortcut()}_initShortcut(){this._shortcutService.registerShortcut(N)}_initMenu(){this._menuManagerService.mergeMenu(te)}};Q=S([x(0,s.IMenuManagerService),x(1,s.IShortcutService)],Q);let $=class extends t.Plugin{constructor(e=L,n,r,i,a){super(),this._config=e,this._injector=n,this._commandService=r,this._renderManagerService=i,this._configService=a;let{menu:o,...s}=(0,t.merge)({},L,this._config);o&&this._configService.setConfig(`menu`,o,{merge:!0}),this._configService.setConfig(I,s)}onStarting(){this._injector.add([J]),this._injector.get(J),[[Q],[W],[G],[X],[Z],[C],[K]].forEach(e=>{this._injector.add(e)}),[O,E,w,T].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(Q)}onReady(){this._injector.get(W)}onRendered(){this._renderManagerService.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[Y]),this._injector.get(G),this._injector.get(X),this._injector.get(Z),this._injector.get(K)}};b($,`pluginName`,_),b($,`packageName`,ne),b($,`version`,re),b($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=S([(0,t.DependentOn)(u.UniverRenderEnginePlugin,a.UniverThreadCommentPlugin,n.UniverDrawingPlugin,r.UniverSheetsPlugin,o.UniverThreadCommentUIPlugin,i.UniverSheetsThreadCommentPlugin,c.UniverSheetsUIPlugin),x(1,(0,t.Inject)(t.Injector)),x(2,(0,t.Inject)(t.ICommandService)),x(3,u.IRenderManagerService),x(4,t.IConfigService)],$),Object.defineProperty(e,"SheetsThreadCommentPopupService",{enumerable:!0,get:function(){return C}}),e.SheetsThreadCommentUIMenuSchema=te,e.ShowAddSheetCommentModalOperation=w,e.ToggleSheetCommentPanelOperation=T,Object.defineProperty(e,"UniverSheetsThreadCommentMobileUIPlugin",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UniverSheetsThreadCommentUIPlugin",{enumerable:!0,get:function(){return $}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Thread comment UI integration for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/core": "1.0.
|
|
62
|
-
"@univerjs/drawing": "1.0.
|
|
63
|
-
"@univerjs/engine-formula": "1.0.
|
|
64
|
-
"@univerjs/engine-render": "1.0.
|
|
61
|
+
"@univerjs/core": "1.0.3",
|
|
62
|
+
"@univerjs/drawing": "1.0.3",
|
|
63
|
+
"@univerjs/engine-formula": "1.0.3",
|
|
64
|
+
"@univerjs/engine-render": "1.0.3",
|
|
65
65
|
"@univerjs/icons": "1.43.1",
|
|
66
|
-
"@univerjs/sheets": "1.0.
|
|
67
|
-
"@univerjs/sheets-thread-comment": "1.0.
|
|
68
|
-
"@univerjs/sheets-ui": "1.0.
|
|
69
|
-
"@univerjs/thread-comment": "1.0.
|
|
70
|
-
"@univerjs/thread-comment-ui": "1.0.
|
|
71
|
-
"@univerjs/ui": "1.0.
|
|
66
|
+
"@univerjs/sheets": "1.0.3",
|
|
67
|
+
"@univerjs/sheets-thread-comment": "1.0.3",
|
|
68
|
+
"@univerjs/sheets-ui": "1.0.3",
|
|
69
|
+
"@univerjs/thread-comment": "1.0.3",
|
|
70
|
+
"@univerjs/thread-comment-ui": "1.0.3",
|
|
71
|
+
"@univerjs/ui": "1.0.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@univerjs-infra/shared": "1.0.
|
|
74
|
+
"@univerjs-infra/shared": "1.0.3",
|
|
75
75
|
"postcss": "^8.5.28",
|
|
76
76
|
"react": "18.3.1",
|
|
77
77
|
"rxjs": "^7.8.2",
|