@univerjs/sheets-thread-comment-ui 0.5.1-nightly.202412261606 → 0.5.1-nightly.202412271606
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 +204 -203
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -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 se;function Fe(){if(se)return B;se=1;var o=R,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,m,u){var d,h={},l=null,p=null;u!==void 0&&(l=""+u),m.key!==void 0&&(l=""+m.key),m.ref!==void 0&&(p=m.ref);for(d in m)e.call(m,d)&&!i.hasOwnProperty(d)&&(h[d]=m[d]);if(c&&c.defaultProps)for(d in m=c.defaultProps,m)h[d]===void 0&&(h[d]=m[d]);return{$$typeof:t,type:c,key:l,ref:p,props:h,_owner:r.current}}return B.Fragment=n,B.jsx=s,B.jsxs=s,B}var ae;function qe(){return ae||(ae=1,Q.exports=Fe()),Q.exports}var le=qe();const Ge=()=>{const o=a.useDependency(a.IUniverInstanceService),t=a.useDependency(exports.SheetsThreadCommentPopupService),n=S.useObservable(t.activePopup$),e=a.useDependency($.SheetsThreadCommentModel);if(S.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:c,trigger:m}=n,u=e.getByLocation(s,c,r,i),d=`${a.Tools.chatAtABC(i)}${r+1}`,h=()=>{t.hidePopup()},l=p=>{var f,b,N;return(N=(b=(f=o.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(p))==null?void 0:b.getName())!=null?N:""};return le.jsx(T.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:u,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:d,onClose:h,getSubUnitName:l,autoFocus:m==="context-menu"})},Ze=()=>{var y;const o=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=a.useDependency(a.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=S.useObservable(s,(y=e.getActiveSheet())==null?void 0:y.getSheetId()),m=R.useRef(),u=a.useDependency(T.ThreadCommentPanelService),d=S.useObservable(u.activeCommentId$),h=S.useObservable(u.panelVisible$,u.panelVisible),l=R.useCallback(v=>{const M=e.getSheets(),g={};M.forEach((U,P)=>{g[U.getSheetId()]=P});const O=U=>U.map(P=>{var re;const j=x.singleReferenceToGrid(P.ref),Ce=[(re=g[P.subUnitId])!=null?re:0,j.row,j.column];return{...P,p:Ce}}).sort((P,j)=>P.p[0]===j.p[0]?P.p[1]===j.p[1]?P.p[2]-j.p[2]:P.p[1]-j.p[1]:P.p[0]-j.p[0]);return[...O(v.filter(U=>!U.resolved)),...O(v.filter(U=>U.resolved))]},[e]),p=R.useCallback(v=>{var M;if(v.unitId===r&&v.subUnitId===c&&!v.resolved){const{row:g,column:O}=x.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),P=(M=U==null?void 0:U.getMergedCell(g,O))!=null?M:{startColumn:O,endColumn:O,startRow:g,endRow:g};if(!Number.isNaN(g)&&!Number.isNaN(O))return o.addShape({range:P,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[o,c,r]),f=v=>{var M,g;return(g=(M=e.getSheetBySheetId(v))==null?void 0:M.getName())!=null?g:""},b=()=>{i.executeCommand(A.id)},N=v=>{d&&d.unitId===v.unitId&&d.subUnitId===v.subUnitId&&d.commentId===v.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=p(v))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},J=(v,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!h&&m.current&&o.removeShape(m.current)},[o,h]),le.jsx(T.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:b,getSubUnitName:f,onResolve:J,sortComments:l,onItemEnter:N,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},ze=o=>({id:A.id,type:S.MenuItemType.BUTTON,icon:te,title:"sheetThreadComment.menu.addComment",hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),Ye=o=>({id:T.ToggleSheetCommentPanelOperation.id,type:S.MenuItemType.BUTTON,icon:te,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET)}),Je={id:A.id,binding:S.KeyCode.M|S.MetaKeys.CTRL_COMMAND|S.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ke={[S.RibbonStartGroup.OTHERS]:{[T.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Ye}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{[A.id]:{order:0,menuItemFactory:ze}}}};var Qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(o,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Qe(t,n,r),r},X=(o,t)=>(n,e)=>t(n,e,o);let Y=class extends a.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Je)}_initMenu(){this._menuManagerService.mergeMenu(Ke)}_initComponent(){[[me,Ge],[T.THREAD_COMMENT_PANEL,Ze],[te,he]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};Y=et([X(0,S.IMenuManagerService),X(1,a.Inject(S.ComponentManager)),X(2,S.IShortcutService)],Y);var pe=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,nt=(o,t,n)=>t in o?pe(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,rt=(o,t,n,e)=>{for(var r=e>1?void 0:e?tt(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&pe(t,n,r),r},ee=(o,t)=>(n,e)=>t(n,e,o),ve=(o,t,n)=>nt(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=ie,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=a.
|
|
9
|
+
*/var se;function Fe(){if(se)return B;se=1;var o=R,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,m,u){var d,h={},l=null,p=null;u!==void 0&&(l=""+u),m.key!==void 0&&(l=""+m.key),m.ref!==void 0&&(p=m.ref);for(d in m)e.call(m,d)&&!i.hasOwnProperty(d)&&(h[d]=m[d]);if(c&&c.defaultProps)for(d in m=c.defaultProps,m)h[d]===void 0&&(h[d]=m[d]);return{$$typeof:t,type:c,key:l,ref:p,props:h,_owner:r.current}}return B.Fragment=n,B.jsx=s,B.jsxs=s,B}var ae;function qe(){return ae||(ae=1,Q.exports=Fe()),Q.exports}var le=qe();const Ge=()=>{const o=a.useDependency(a.IUniverInstanceService),t=a.useDependency(exports.SheetsThreadCommentPopupService),n=S.useObservable(t.activePopup$),e=a.useDependency($.SheetsThreadCommentModel);if(S.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:i,unitId:s,subUnitId:c,trigger:m}=n,u=e.getByLocation(s,c,r,i),d=`${a.Tools.chatAtABC(i)}${r+1}`,h=()=>{t.hidePopup()},l=p=>{var f,b,N;return(N=(b=(f=o.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:f.getSheetBySheetId(p))==null?void 0:b.getName())!=null?N:""};return le.jsx(T.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:u,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:d,onClose:h,getSubUnitName:l,autoFocus:m==="context-menu"})},Ze=()=>{var y;const o=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(exports.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),i=a.useDependency(a.ICommandService),s=R.useMemo(()=>e.activeSheet$.pipe(k.map(v=>v==null?void 0:v.getSheetId())),[e.activeSheet$]),c=S.useObservable(s,(y=e.getActiveSheet())==null?void 0:y.getSheetId()),m=R.useRef(),u=a.useDependency(T.ThreadCommentPanelService),d=S.useObservable(u.activeCommentId$),h=S.useObservable(u.panelVisible$,u.panelVisible),l=R.useCallback(v=>{const M=e.getSheets(),g={};M.forEach((U,P)=>{g[U.getSheetId()]=P});const O=U=>U.map(P=>{var re;const j=x.singleReferenceToGrid(P.ref),Ce=[(re=g[P.subUnitId])!=null?re:0,j.row,j.column];return{...P,p:Ce}}).sort((P,j)=>P.p[0]===j.p[0]?P.p[1]===j.p[1]?P.p[2]-j.p[2]:P.p[1]-j.p[1]:P.p[0]-j.p[0]);return[...O(v.filter(U=>!U.resolved)),...O(v.filter(U=>U.resolved))]},[e]),p=R.useCallback(v=>{var M;if(v.unitId===r&&v.subUnitId===c&&!v.resolved){const{row:g,column:O}=x.singleReferenceToGrid(v.ref),U=e.getSheetBySheetId(v.subUnitId),P=(M=U==null?void 0:U.getMergedCell(g,O))!=null?M:{startColumn:O,endColumn:O,startRow:g,endRow:g};if(!Number.isNaN(g)&&!Number.isNaN(O))return o.addShape({range:P,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[o,c,r]),f=v=>{var M,g;return(g=(M=e.getSheetBySheetId(v))==null?void 0:M.getName())!=null?g:""},b=()=>{i.executeCommand(A.id)},N=v=>{d&&d.unitId===v.unitId&&d.subUnitId===v.subUnitId&&d.commentId===v.id||(m.current&&(o.removeShape(m.current),m.current=null),m.current=p(v))},V=()=>{m.current&&(o.removeShape(m.current),m.current=null)},J=(v,M)=>{M&&n.hidePopup()};return R.useEffect(()=>{!h&&m.current&&o.removeShape(m.current)},[o,h]),le.jsx(T.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:b,getSubUnitName:f,onResolve:J,sortComments:l,onItemEnter:N,onItemLeave:V,onDeleteComment:()=>(V(),!0)})},ze=o=>({id:A.id,type:S.MenuItemType.BUTTON,icon:te,title:"sheetThreadComment.menu.addComment",hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]})}),Ye=o=>({id:T.ToggleSheetCommentPanelOperation.id,type:S.MenuItemType.BUTTON,icon:te,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(o,{workbookTypes:[C.WorkbookCommentPermission],worksheetTypes:[C.WorksheetViewPermission],rangeTypes:[C.RangeProtectionPermissionViewPoint]}),hidden$:S.getMenuHiddenObservable(o,a.UniverInstanceType.UNIVER_SHEET)}),Je={id:A.id,binding:S.KeyCode.M|S.MetaKeys.CTRL_COMMAND|S.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ke={[S.RibbonStartGroup.OTHERS]:{[T.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:Ye}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.OTHERS]:{[A.id]:{order:0,menuItemFactory:ze}}}};var Qe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(o,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Qe(t,n,r),r},X=(o,t)=>(n,e)=>t(n,e,o);let Y=class extends a.Disposable{constructor(o,t,n){super(),this._menuManagerService=o,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Je)}_initMenu(){this._menuManagerService.mergeMenu(Ke)}_initComponent(){[[me,Ge],[T.THREAD_COMMENT_PANEL,Ze],[te,he]].forEach(([o,t])=>{this._componentManager.register(o,t)})}};Y=et([X(0,S.IMenuManagerService),X(1,a.Inject(S.ComponentManager)),X(2,S.IShortcutService)],Y);var pe=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,nt=(o,t,n)=>t in o?pe(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,rt=(o,t,n,e)=>{for(var r=e>1?void 0:e?tt(t,n):t,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&pe(t,n,r),r},ee=(o,t)=>(n,e)=>t(n,e,o),ve=(o,t,n)=>nt(o,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=ie,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:i,...s}=a.merge({},ie,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Pe,s)}onStarting(){[[Y],[F],[q],[G],[z],[Z],[exports.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[A].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(Y)}onReady(){this._injector.get(F),this._injector.get(z)}onRendered(){this._injector.get(q),this._injector.get(G),this._injector.get(Z)}};ve(exports.UniverSheetsThreadCommentUIPlugin,"pluginName",ne);ve(exports.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsThreadCommentUIPlugin=rt([a.DependentOn(T.UniverThreadCommentUIPlugin,$.UniverSheetsThreadCommentPlugin),ee(1,a.Inject(a.Injector)),ee(2,a.Inject(a.ICommandService)),ee(3,a.IConfigService)],exports.UniverSheetsThreadCommentUIPlugin);Object.defineProperty(exports,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>T.UniverThreadCommentUIPlugin});Object.defineProperty(exports,"AddCommentCommand",{enumerable:!0,get:()=>_.AddCommentCommand});Object.defineProperty(exports,"DeleteCommentCommand",{enumerable:!0,get:()=>_.DeleteCommentCommand});Object.defineProperty(exports,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>_.DeleteCommentTreeCommand});Object.defineProperty(exports,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>_.IThreadCommentDataSourceService});Object.defineProperty(exports,"ResolveCommentCommand",{enumerable:!0,get:()=>_.ResolveCommentCommand});Object.defineProperty(exports,"UpdateCommentCommand",{enumerable:!0,get:()=>_.UpdateCommentCommand});exports.SHEETS_THREAD_COMMENT=ne;exports.ShowAddSheetCommentModalOperation=A;
|
package/lib/es/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var E = (o, e, n) =>
|
|
4
|
-
import { Inject as _, Disposable as $, DisposableCollection as
|
|
5
|
-
import { SheetsSelectionsService as
|
|
6
|
-
import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as
|
|
7
|
-
import { ThreadCommentPanelService as ce, SetActiveCommentOperation as te, ThreadCommentTree as
|
|
8
|
-
import { UniverThreadCommentUIPlugin as
|
|
9
|
-
import { SheetCanvasPopManagerService as
|
|
10
|
-
import { IZenZoneService as
|
|
11
|
-
import { BehaviorSubject as
|
|
12
|
-
import { IRenderManagerService as
|
|
13
|
-
import { singleReferenceToGrid as V, serializeRange as
|
|
14
|
-
import { IThreadCommentDataSourceService as
|
|
15
|
-
import { AddCommentCommand as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
18
|
-
var
|
|
19
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var ke = (o, e, n) => e in o ? Le(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
|
+
var E = (o, e, n) => ke(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as _, Disposable as $, DisposableCollection as Fe, CommandType as We, IUniverInstanceService as N, InterceptorEffectEnum as Ze, UniverInstanceType as b, Range as ze, ICommandService as ae, RANGE_TYPE as he, Rectangle as qe, useDependency as R, Tools as Ge, DependentOn as Je, Injector as Ye, Plugin as Ke, merge as Qe, IConfigService as Xe } from "@univerjs/core";
|
|
5
|
+
import { SheetsSelectionsService as Se, getSheetCommandTarget as et, SheetInterceptorService as ge, INTERCEPTOR_POINT as tt, WorkbookCommentPermission as K, WorksheetViewPermission as Q, RangeProtectionPermissionViewPoint as X, SetWorksheetActiveOperation as nt, RemoveSheetCommand as rt } from "@univerjs/sheets";
|
|
6
|
+
import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as ot } from "@univerjs/sheets-thread-comment";
|
|
7
|
+
import { ThreadCommentPanelService as ce, SetActiveCommentOperation as te, ThreadCommentTree as it, ThreadCommentPanel as st, ToggleSheetCommentPanelOperation as Ie, THREAD_COMMENT_PANEL as at, UniverThreadCommentUIPlugin as ct } from "@univerjs/thread-comment-ui";
|
|
8
|
+
import { UniverThreadCommentUIPlugin as $n } from "@univerjs/thread-comment-ui";
|
|
9
|
+
import { SheetCanvasPopManagerService as mt, ISheetClipboardService as ut, COPY_TYPE as dt, HoverManagerService as ht, SheetPermissionInterceptorBaseController as Pe, IMarkSelectionService as Te, IEditorBridgeService as lt, SheetSkeletonManagerService as pt, ScrollToRangeOperation as _t, whenSheetEditorFocused as vt, getCurrentRangeDisable$ as be } from "@univerjs/sheets-ui";
|
|
10
|
+
import { IZenZoneService as ft, useObservable as A, KeyCode as Ct, MetaKeys as le, MenuItemType as Me, getMenuHiddenObservable as we, RibbonStartGroup as St, ContextMenuPosition as gt, ContextMenuGroup as It, ComponentManager as Pt, IMenuManagerService as Tt, IShortcutService as bt } from "@univerjs/ui";
|
|
11
|
+
import { BehaviorSubject as Mt, debounceTime as me, map as wt } from "rxjs";
|
|
12
|
+
import { IRenderManagerService as ye } from "@univerjs/engine-render";
|
|
13
|
+
import { singleReferenceToGrid as V, serializeRange as yt } from "@univerjs/engine-formula";
|
|
14
|
+
import { IThreadCommentDataSourceService as Ee, DeleteCommentMutation as F, AddCommentMutation as se, ThreadCommentModel as Et } from "@univerjs/thread-comment";
|
|
15
|
+
import { AddCommentCommand as xn, DeleteCommentCommand as Dn, DeleteCommentTreeCommand as jn, IThreadCommentDataSourceService as An, ResolveCommentCommand as Vn, UpdateCommentCommand as Bn } from "@univerjs/thread-comment";
|
|
16
|
+
import Rt, { forwardRef as Re, useRef as Oe, createElement as Ue, useMemo as Ot, useCallback as pe, useEffect as Ut } from "react";
|
|
17
|
+
const $e = "univer.sheet.thread-comment-modal", ue = "comment-single", Ne = "SHEET_THREAD_COMMENT";
|
|
18
|
+
var $t = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, xt = (o, e, n, t) => {
|
|
19
|
+
for (var r = t > 1 ? void 0 : t ? Nt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
20
20
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
21
|
-
return t && r &&
|
|
21
|
+
return t && r && $t(e, n, r), r;
|
|
22
22
|
}, _e = (o, e) => (n, t) => e(n, t, o);
|
|
23
23
|
let O = class extends $ {
|
|
24
24
|
constructor(e, n) {
|
|
25
25
|
super();
|
|
26
26
|
E(this, "_lastPopup", null);
|
|
27
27
|
E(this, "_activePopup");
|
|
28
|
-
E(this, "_activePopup$", new
|
|
28
|
+
E(this, "_activePopup$", new Mt(null));
|
|
29
29
|
E(this, "activePopup$", this._activePopup$.asObservable());
|
|
30
30
|
this._canvasPopupManagerService = e, this._zenZoneService = n, this._initZenVisible(), this.disposeWithMe(() => {
|
|
31
31
|
this._activePopup$.complete();
|
|
@@ -53,7 +53,7 @@ let O = class extends $ {
|
|
|
53
53
|
t,
|
|
54
54
|
r,
|
|
55
55
|
{
|
|
56
|
-
componentKey:
|
|
56
|
+
componentKey: $e,
|
|
57
57
|
onClickOutside: () => {
|
|
58
58
|
this.hidePopup();
|
|
59
59
|
},
|
|
@@ -66,7 +66,7 @@ let O = class extends $ {
|
|
|
66
66
|
);
|
|
67
67
|
if (!a)
|
|
68
68
|
throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
|
|
69
|
-
const c = new
|
|
69
|
+
const c = new Fe();
|
|
70
70
|
c.add(a), c.add({
|
|
71
71
|
dispose: () => {
|
|
72
72
|
n == null || n();
|
|
@@ -83,43 +83,43 @@ let O = class extends $ {
|
|
|
83
83
|
}, this._activePopup$.next(this._activePopup));
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
O =
|
|
87
|
-
_e(0, _(
|
|
88
|
-
_e(1,
|
|
86
|
+
O = xt([
|
|
87
|
+
_e(0, _(mt)),
|
|
88
|
+
_e(1, ft)
|
|
89
89
|
], O);
|
|
90
90
|
const B = {
|
|
91
|
-
type:
|
|
91
|
+
type: We.OPERATION,
|
|
92
92
|
id: "sheets.operation.show-comment-modal",
|
|
93
93
|
handler(o) {
|
|
94
94
|
var v;
|
|
95
|
-
const e = o.get(
|
|
95
|
+
const e = o.get(Se), n = o.get(N), t = o.get(O), r = o.get(ce), i = (v = e.getCurrentLastSelection()) == null ? void 0 : v.primary, s = o.get(x);
|
|
96
96
|
if (!i)
|
|
97
97
|
return !1;
|
|
98
|
-
const a =
|
|
98
|
+
const a = et(n);
|
|
99
99
|
if (!a)
|
|
100
100
|
return !1;
|
|
101
|
-
const { workbook: c, worksheet: d, unitId:
|
|
101
|
+
const { workbook: c, worksheet: d, unitId: m, subUnitId: u } = a, h = {
|
|
102
102
|
workbook: c,
|
|
103
103
|
worksheet: d,
|
|
104
|
-
unitId:
|
|
105
|
-
subUnitId:
|
|
104
|
+
unitId: m,
|
|
105
|
+
subUnitId: u,
|
|
106
106
|
row: i.startRow,
|
|
107
107
|
col: i.startColumn
|
|
108
108
|
};
|
|
109
109
|
t.showPopup(h);
|
|
110
|
-
const l = s.getByLocation(
|
|
110
|
+
const l = s.getByLocation(m, u, i.startRow, i.startColumn);
|
|
111
111
|
return l && r.setActiveComment({
|
|
112
|
-
unitId:
|
|
113
|
-
subUnitId:
|
|
112
|
+
unitId: m,
|
|
113
|
+
subUnitId: u,
|
|
114
114
|
commentId: l,
|
|
115
115
|
trigger: "context-menu"
|
|
116
116
|
}), !0;
|
|
117
117
|
}
|
|
118
|
-
},
|
|
119
|
-
var
|
|
120
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
118
|
+
}, Dt = "sheets-thread-comment.config", ve = {};
|
|
119
|
+
var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Vt = (o, e, n, t) => {
|
|
120
|
+
for (var r = t > 1 ? void 0 : t ? At(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
121
121
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
122
|
-
return t && r &&
|
|
122
|
+
return t && r && jt(e, n, r), r;
|
|
123
123
|
}, H = (o, e) => (n, t) => e(n, t, o);
|
|
124
124
|
let W = class extends $ {
|
|
125
125
|
constructor(o, e, n, t) {
|
|
@@ -128,9 +128,9 @@ let W = class extends $ {
|
|
|
128
128
|
_initViewModelIntercept() {
|
|
129
129
|
this.disposeWithMe(
|
|
130
130
|
this._sheetInterceptorService.intercept(
|
|
131
|
-
|
|
131
|
+
tt.CELL_CONTENT,
|
|
132
132
|
{
|
|
133
|
-
effect:
|
|
133
|
+
effect: Ze.Style,
|
|
134
134
|
handler: (o, e, n) => {
|
|
135
135
|
const { row: t, col: r, unitId: i, subUnitId: s } = e;
|
|
136
136
|
return this._sheetsThreadCommentModel.showCommentMarker(i, s, t, r) ? n({
|
|
@@ -157,30 +157,30 @@ let W = class extends $ {
|
|
|
157
157
|
const n = e.getUnitId(), t = this._renderManagerService.getRenderById(n);
|
|
158
158
|
(r = t == null ? void 0 : t.mainComponent) == null || r.makeForceDirty();
|
|
159
159
|
};
|
|
160
|
-
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(
|
|
160
|
+
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(me(16)).subscribe(() => {
|
|
161
161
|
o();
|
|
162
162
|
}));
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
W =
|
|
166
|
-
H(0, _(
|
|
165
|
+
W = Vt([
|
|
166
|
+
H(0, _(ge)),
|
|
167
167
|
H(1, _(x)),
|
|
168
168
|
H(2, N),
|
|
169
|
-
H(3,
|
|
169
|
+
H(3, ye)
|
|
170
170
|
], W);
|
|
171
|
-
var
|
|
172
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
171
|
+
var Bt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Lt = (o, e, n, t) => {
|
|
172
|
+
for (var r = t > 1 ? void 0 : t ? Ht(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
173
173
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
174
|
-
return t && r &&
|
|
174
|
+
return t && r && Bt(e, n, r), r;
|
|
175
175
|
}, ne = (o, e) => (n, t) => e(n, t, o);
|
|
176
|
-
const
|
|
176
|
+
const kt = (o, e, n) => {
|
|
177
177
|
const t = V(o), r = n.row - e.row, i = n.column - e.column, s = {
|
|
178
178
|
startColumn: t.column + i,
|
|
179
179
|
startRow: t.row + r,
|
|
180
180
|
endColumn: t.column + i,
|
|
181
181
|
endRow: t.row + r
|
|
182
182
|
};
|
|
183
|
-
return
|
|
183
|
+
return yt(s);
|
|
184
184
|
};
|
|
185
185
|
let Z = class extends $ {
|
|
186
186
|
constructor(e, n, t) {
|
|
@@ -192,7 +192,7 @@ let Z = class extends $ {
|
|
|
192
192
|
_initClipboardHook() {
|
|
193
193
|
this.disposeWithMe(
|
|
194
194
|
this._sheetClipboardService.addClipboardHook({
|
|
195
|
-
id:
|
|
195
|
+
id: Ne,
|
|
196
196
|
onBeforeCopy: (e, n, t) => {
|
|
197
197
|
this._copyInfo = {
|
|
198
198
|
unitId: e,
|
|
@@ -206,15 +206,15 @@ let Z = class extends $ {
|
|
|
206
206
|
row: a.rows[0],
|
|
207
207
|
column: a.cols[0]
|
|
208
208
|
};
|
|
209
|
-
if (r.copyType ===
|
|
210
|
-
const { range: d, unitId:
|
|
209
|
+
if (r.copyType === dt.CUT && this._copyInfo) {
|
|
210
|
+
const { range: d, unitId: m, subUnitId: u } = this._copyInfo, h = {
|
|
211
211
|
row: d.startRow,
|
|
212
212
|
column: d.startColumn
|
|
213
213
|
};
|
|
214
|
-
if (!(i ===
|
|
214
|
+
if (!(i === m && s === u)) {
|
|
215
215
|
const l = [];
|
|
216
|
-
|
|
217
|
-
const I = this._sheetsThreadCommentModel.getAllByLocation(
|
|
216
|
+
ze.foreach(d, (g, p) => {
|
|
217
|
+
const I = this._sheetsThreadCommentModel.getAllByLocation(m, u, g, p);
|
|
218
218
|
this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((f) => {
|
|
219
219
|
l.push(f);
|
|
220
220
|
}) : I.forEach(({ children: f, ...M }) => {
|
|
@@ -225,8 +225,8 @@ let Z = class extends $ {
|
|
|
225
225
|
v.unshift({
|
|
226
226
|
id: F.id,
|
|
227
227
|
params: {
|
|
228
|
-
unitId:
|
|
229
|
-
subUnitId:
|
|
228
|
+
unitId: m,
|
|
229
|
+
subUnitId: u,
|
|
230
230
|
commentId: g.id
|
|
231
231
|
}
|
|
232
232
|
}), U.push({
|
|
@@ -236,7 +236,7 @@ let Z = class extends $ {
|
|
|
236
236
|
subUnitId: s,
|
|
237
237
|
comment: {
|
|
238
238
|
...g,
|
|
239
|
-
ref:
|
|
239
|
+
ref: kt(g.ref, h, c),
|
|
240
240
|
unitId: i,
|
|
241
241
|
subUnitId: s
|
|
242
242
|
},
|
|
@@ -245,8 +245,8 @@ let Z = class extends $ {
|
|
|
245
245
|
}), S.push({
|
|
246
246
|
id: se.id,
|
|
247
247
|
params: {
|
|
248
|
-
unitId:
|
|
249
|
-
subUnitId:
|
|
248
|
+
unitId: m,
|
|
249
|
+
subUnitId: u,
|
|
250
250
|
comment: g,
|
|
251
251
|
sync: !0
|
|
252
252
|
}
|
|
@@ -276,15 +276,15 @@ let Z = class extends $ {
|
|
|
276
276
|
);
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
Z =
|
|
279
|
+
Z = Lt([
|
|
280
280
|
ne(0, _(ut)),
|
|
281
281
|
ne(1, _(x)),
|
|
282
|
-
ne(2,
|
|
282
|
+
ne(2, Ee)
|
|
283
283
|
], Z);
|
|
284
|
-
var
|
|
285
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
284
|
+
var Ft = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (o, e, n, t) => {
|
|
285
|
+
for (var r = t > 1 ? void 0 : t ? Wt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
286
286
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
287
|
-
return t && r &&
|
|
287
|
+
return t && r && Ft(e, n, r), r;
|
|
288
288
|
}, L = (o, e) => (n, t) => e(n, t, o);
|
|
289
289
|
let z = class extends $ {
|
|
290
290
|
constructor(o, e, n, t) {
|
|
@@ -292,7 +292,7 @@ let z = class extends $ {
|
|
|
292
292
|
}
|
|
293
293
|
_initHoverEvent() {
|
|
294
294
|
this.disposeWithMe(
|
|
295
|
-
this._hoverManagerService.currentCell$.pipe(
|
|
295
|
+
this._hoverManagerService.currentCell$.pipe(me(100)).subscribe((o) => {
|
|
296
296
|
const e = this._sheetsThreadCommentPopupService.activePopup;
|
|
297
297
|
if (o && (e && e.temp || !e)) {
|
|
298
298
|
const { location: n } = o, { unitId: t, subUnitId: r, row: i, col: s } = n, a = this._sheetsThreadCommentModel.getByLocation(t, r, i, s);
|
|
@@ -319,44 +319,44 @@ let z = class extends $ {
|
|
|
319
319
|
);
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
z =
|
|
323
|
-
L(0, _(
|
|
322
|
+
z = Zt([
|
|
323
|
+
L(0, _(ht)),
|
|
324
324
|
L(1, _(O)),
|
|
325
325
|
L(2, _(x)),
|
|
326
|
-
L(3, _(
|
|
326
|
+
L(3, _(Pe))
|
|
327
327
|
], z);
|
|
328
|
-
var
|
|
329
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
328
|
+
var zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Gt = (o, e, n, t) => {
|
|
329
|
+
for (var r = t > 1 ? void 0 : t ? qt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
330
330
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
331
|
-
return t && r &&
|
|
331
|
+
return t && r && zt(e, n, r), r;
|
|
332
332
|
}, w = (o, e) => (n, t) => e(n, t, o);
|
|
333
333
|
let q = class extends $ {
|
|
334
|
-
constructor(e, n, t, r, i, s, a, c, d,
|
|
334
|
+
constructor(e, n, t, r, i, s, a, c, d, m) {
|
|
335
335
|
super();
|
|
336
336
|
E(this, "_isSwitchToCommenting", !1);
|
|
337
337
|
E(this, "_selectionShapeInfo", null);
|
|
338
|
-
this._commandService = e, this._sheetsThreadCommentPopupService = n, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = r, this._univerInstanceService = i, this._sheetPermissionInterceptorBaseController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = d, this._renderManagerService =
|
|
338
|
+
this._commandService = e, this._sheetsThreadCommentPopupService = n, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = r, this._univerInstanceService = i, this._sheetPermissionInterceptorBaseController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = d, this._renderManagerService = m, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
|
|
339
339
|
}
|
|
340
340
|
_handleSelectionChange(e, n, t) {
|
|
341
341
|
var h, l, v;
|
|
342
|
-
const r = (h = e[0]) == null ? void 0 : h.range, i = this._renderManagerService.getRenderById(n), s = (l = i == null ? void 0 : i.with(
|
|
342
|
+
const r = (h = e[0]) == null ? void 0 : h.range, i = this._renderManagerService.getRenderById(n), s = (l = i == null ? void 0 : i.with(pt).getWorksheetSkeleton(t)) == null ? void 0 : l.skeleton;
|
|
343
343
|
if (!s || !r)
|
|
344
344
|
return;
|
|
345
345
|
const a = s.getCellWithCoordByIndex(r.startRow, r.startColumn);
|
|
346
|
-
if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) &&
|
|
346
|
+
if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && qe.equals(a.mergeInfo, r))) {
|
|
347
347
|
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
const d = a.actualRow,
|
|
351
|
-
if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, d,
|
|
350
|
+
const d = a.actualRow, m = a.actualColumn;
|
|
351
|
+
if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, d, m)) {
|
|
352
352
|
this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const u = this._sheetsThreadCommentModel.getByLocation(n, t, d, m);
|
|
356
|
+
u && this._commandService.executeCommand(te.id, {
|
|
357
357
|
unitId: n,
|
|
358
358
|
subUnitId: t,
|
|
359
|
-
commentId:
|
|
359
|
+
commentId: u
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
_initSelectionUpdateListener() {
|
|
@@ -397,11 +397,11 @@ let q = class extends $ {
|
|
|
397
397
|
const c = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
398
398
|
if (!c || c.getUnitId() !== t)
|
|
399
399
|
return;
|
|
400
|
-
this._isSwitchToCommenting = !0, ((n = c.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(
|
|
400
|
+
this._isSwitchToCommenting = !0, ((n = c.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(nt.id, {
|
|
401
401
|
unitId: t,
|
|
402
402
|
subUnitId: r
|
|
403
403
|
}), this._isSwitchToCommenting = !1;
|
|
404
|
-
const
|
|
404
|
+
const u = V(a.ref), { row: h, column: l } = u;
|
|
405
405
|
if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
|
|
406
406
|
workbookTypes: [K],
|
|
407
407
|
worksheetTypes: [Q],
|
|
@@ -409,20 +409,20 @@ let q = class extends $ {
|
|
|
409
409
|
}, [{ startRow: h, startColumn: l, endRow: h, endColumn: l }]))
|
|
410
410
|
return;
|
|
411
411
|
const S = 1;
|
|
412
|
-
if (await this._commandService.executeCommand(
|
|
412
|
+
if (await this._commandService.executeCommand(_t.id, {
|
|
413
413
|
range: {
|
|
414
|
-
startRow: Math.max(
|
|
415
|
-
endRow:
|
|
416
|
-
startColumn: Math.max(
|
|
417
|
-
endColumn:
|
|
414
|
+
startRow: Math.max(u.row - S, 0),
|
|
415
|
+
endRow: u.row + S,
|
|
416
|
+
startColumn: Math.max(u.column - S, 0),
|
|
417
|
+
endColumn: u.column + S
|
|
418
418
|
}
|
|
419
419
|
}), this._editorBridgeService.isVisible().visible)
|
|
420
420
|
return;
|
|
421
421
|
this._sheetsThreadCommentPopupService.showPopup({
|
|
422
422
|
unitId: t,
|
|
423
423
|
subUnitId: r,
|
|
424
|
-
row:
|
|
425
|
-
col:
|
|
424
|
+
row: u.row,
|
|
425
|
+
col: u.column,
|
|
426
426
|
commentId: a.id,
|
|
427
427
|
trigger: s
|
|
428
428
|
});
|
|
@@ -431,7 +431,7 @@ let q = class extends $ {
|
|
|
431
431
|
}));
|
|
432
432
|
}
|
|
433
433
|
_initMarkSelection() {
|
|
434
|
-
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(
|
|
434
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(me(100)).subscribe((e) => {
|
|
435
435
|
var h, l;
|
|
436
436
|
if (!e) {
|
|
437
437
|
this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
|
|
@@ -445,14 +445,14 @@ let q = class extends $ {
|
|
|
445
445
|
const s = V(i.ref), { row: a, column: c } = s;
|
|
446
446
|
if (Number.isNaN(a) || Number.isNaN(c))
|
|
447
447
|
return null;
|
|
448
|
-
const d = (h = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : h.getSheetBySheetId(t),
|
|
448
|
+
const d = (h = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : h.getSheetBySheetId(t), m = (l = d == null ? void 0 : d.getMergedCell(a, c)) != null ? l : {
|
|
449
449
|
startColumn: c,
|
|
450
450
|
endColumn: c,
|
|
451
451
|
startRow: a,
|
|
452
452
|
endRow: a
|
|
453
|
-
},
|
|
453
|
+
}, u = this._markSelectionService.addShape(
|
|
454
454
|
{
|
|
455
|
-
range:
|
|
455
|
+
range: m,
|
|
456
456
|
style: {
|
|
457
457
|
// hasAutoFill: false,
|
|
458
458
|
fill: "rgb(255, 189, 55, 0.35)",
|
|
@@ -465,29 +465,29 @@ let q = class extends $ {
|
|
|
465
465
|
[],
|
|
466
466
|
-1
|
|
467
467
|
);
|
|
468
|
-
|
|
468
|
+
u && (this._selectionShapeInfo = {
|
|
469
469
|
...e,
|
|
470
|
-
shapeId:
|
|
470
|
+
shapeId: u
|
|
471
471
|
});
|
|
472
472
|
}));
|
|
473
473
|
}
|
|
474
474
|
};
|
|
475
|
-
q =
|
|
475
|
+
q = Gt([
|
|
476
476
|
w(0, ae),
|
|
477
477
|
w(1, _(O)),
|
|
478
478
|
w(2, _(x)),
|
|
479
479
|
w(3, _(ce)),
|
|
480
480
|
w(4, N),
|
|
481
|
-
w(5, _(
|
|
482
|
-
w(6,
|
|
483
|
-
w(7, _(
|
|
484
|
-
w(8,
|
|
485
|
-
w(9,
|
|
481
|
+
w(5, _(Pe)),
|
|
482
|
+
w(6, Te),
|
|
483
|
+
w(7, _(Se)),
|
|
484
|
+
w(8, lt),
|
|
485
|
+
w(9, ye)
|
|
486
486
|
], q);
|
|
487
|
-
var
|
|
488
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
487
|
+
var Jt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Kt = (o, e, n, t) => {
|
|
488
|
+
for (var r = t > 1 ? void 0 : t ? Yt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
489
489
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
490
|
-
return t && r &&
|
|
490
|
+
return t && r && Jt(e, n, r), r;
|
|
491
491
|
}, k = (o, e) => (n, t) => e(n, t, o);
|
|
492
492
|
let G = class extends $ {
|
|
493
493
|
constructor(o, e, n, t) {
|
|
@@ -498,21 +498,21 @@ let G = class extends $ {
|
|
|
498
498
|
this._sheetInterceptorService.interceptCommand({
|
|
499
499
|
getMutations: (o) => {
|
|
500
500
|
var e;
|
|
501
|
-
if (o.id ===
|
|
501
|
+
if (o.id === rt.id) {
|
|
502
502
|
const n = o.params, t = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
|
|
503
503
|
if (!t)
|
|
504
504
|
return { redos: [], undos: [] };
|
|
505
505
|
const r = t.getUnitId(), i = n.subUnitId || ((e = t.getActiveSheet()) == null ? void 0 : e.getSheetId());
|
|
506
506
|
if (!i)
|
|
507
507
|
return { redos: [], undos: [] };
|
|
508
|
-
const s = this._threadCommentModel.ensureMap(r, i), a = Array.from(s.values()).filter((h) => !h.parentId), c = a.map((h) => h.id), d = this._threadCommentDataSourceService.syncUpdateMutationToColla,
|
|
508
|
+
const s = this._threadCommentModel.ensureMap(r, i), a = Array.from(s.values()).filter((h) => !h.parentId), c = a.map((h) => h.id), d = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = c.map((h) => ({
|
|
509
509
|
id: F.id,
|
|
510
510
|
params: {
|
|
511
511
|
unitId: r,
|
|
512
512
|
subUnitId: i,
|
|
513
513
|
commentId: h
|
|
514
514
|
}
|
|
515
|
-
})),
|
|
515
|
+
})), u = a.map(({ children: h, ...l }) => ({
|
|
516
516
|
id: se.id,
|
|
517
517
|
params: {
|
|
518
518
|
unitId: r,
|
|
@@ -524,7 +524,7 @@ let G = class extends $ {
|
|
|
524
524
|
sync: !d
|
|
525
525
|
}
|
|
526
526
|
}));
|
|
527
|
-
return { redos:
|
|
527
|
+
return { redos: m, undos: u };
|
|
528
528
|
}
|
|
529
529
|
return { redos: [], undos: [] };
|
|
530
530
|
}
|
|
@@ -532,11 +532,11 @@ let G = class extends $ {
|
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
|
-
G =
|
|
536
|
-
k(0, _(
|
|
535
|
+
G = Kt([
|
|
536
|
+
k(0, _(ge)),
|
|
537
537
|
k(1, N),
|
|
538
|
-
k(2, _(
|
|
539
|
-
k(3,
|
|
538
|
+
k(2, _(Et)),
|
|
539
|
+
k(3, Ee)
|
|
540
540
|
], G);
|
|
541
541
|
var P = function() {
|
|
542
542
|
return P = Object.assign || function(o) {
|
|
@@ -546,23 +546,23 @@ var P = function() {
|
|
|
546
546
|
}
|
|
547
547
|
return o;
|
|
548
548
|
}, P.apply(this, arguments);
|
|
549
|
-
},
|
|
549
|
+
}, Qt = function(o, e) {
|
|
550
550
|
var n = {};
|
|
551
551
|
for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (n[t] = o[t]);
|
|
552
552
|
if (o != null && typeof Object.getOwnPropertySymbols == "function")
|
|
553
553
|
for (var r = 0, t = Object.getOwnPropertySymbols(o); r < t.length; r++)
|
|
554
554
|
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (n[t[r]] = o[t[r]]);
|
|
555
555
|
return n;
|
|
556
|
-
},
|
|
557
|
-
var n = o.icon, t = o.id, r = o.className, i = o.extend, s =
|
|
558
|
-
return
|
|
556
|
+
}, xe = Re(function(o, e) {
|
|
557
|
+
var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Qt(o, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), c = Oe("_".concat(tn()));
|
|
558
|
+
return De(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
|
|
559
559
|
});
|
|
560
|
-
function
|
|
561
|
-
return
|
|
562
|
-
return
|
|
560
|
+
function De(o, e, n, t, r) {
|
|
561
|
+
return Ue(o.tag, P(P({ key: e }, Xt(o, n, r)), t), (en(o, n).children || []).map(function(i, s) {
|
|
562
|
+
return De(i, "".concat(e, "-").concat(o.tag, "-").concat(s), n, void 0, r);
|
|
563
563
|
}));
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function Xt(o, e, n) {
|
|
566
566
|
var t = P({}, o.attrs);
|
|
567
567
|
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
568
568
|
var r = e.defIds;
|
|
@@ -571,24 +571,24 @@ function Qt(o, e, n) {
|
|
|
571
571
|
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
572
572
|
})), t;
|
|
573
573
|
}
|
|
574
|
-
function
|
|
574
|
+
function en(o, e) {
|
|
575
575
|
var n, t = e.defIds;
|
|
576
576
|
return !t || t.length === 0 ? o : o.tag === "defs" && (!((n = o.children) === null || n === void 0) && n.length) ? P(P({}, o), { children: o.children.map(function(r) {
|
|
577
577
|
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? P(P({}, r), { attrs: P(P({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
578
578
|
}) }) : o;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function tn() {
|
|
581
581
|
return Math.random().toString(36).substring(2, 8);
|
|
582
582
|
}
|
|
583
|
-
|
|
584
|
-
var
|
|
585
|
-
return
|
|
583
|
+
xe.displayName = "UniverIcon";
|
|
584
|
+
var nn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, je = Re(function(o, e) {
|
|
585
|
+
return Ue(xe, Object.assign({}, o, {
|
|
586
586
|
id: "comment-single",
|
|
587
587
|
ref: e,
|
|
588
|
-
icon:
|
|
588
|
+
icon: nn
|
|
589
589
|
}));
|
|
590
590
|
});
|
|
591
|
-
|
|
591
|
+
je.displayName = "CommentSingle";
|
|
592
592
|
var re = { exports: {} }, j = {};
|
|
593
593
|
/**
|
|
594
594
|
* @license React
|
|
@@ -600,36 +600,36 @@ var re = { exports: {} }, j = {};
|
|
|
600
600
|
* LICENSE file in the root directory of this source tree.
|
|
601
601
|
*/
|
|
602
602
|
var fe;
|
|
603
|
-
function
|
|
603
|
+
function rn() {
|
|
604
604
|
if (fe) return j;
|
|
605
605
|
fe = 1;
|
|
606
|
-
var o =
|
|
606
|
+
var o = Rt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
607
607
|
function s(a, c, d) {
|
|
608
|
-
var
|
|
608
|
+
var m, u = {}, h = null, l = null;
|
|
609
609
|
d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (l = c.ref);
|
|
610
|
-
for (
|
|
611
|
-
if (a && a.defaultProps) for (
|
|
612
|
-
return { $$typeof: e, type: a, key: h, ref: l, props:
|
|
610
|
+
for (m in c) t.call(c, m) && !i.hasOwnProperty(m) && (u[m] = c[m]);
|
|
611
|
+
if (a && a.defaultProps) for (m in c = a.defaultProps, c) u[m] === void 0 && (u[m] = c[m]);
|
|
612
|
+
return { $$typeof: e, type: a, key: h, ref: l, props: u, _owner: r.current };
|
|
613
613
|
}
|
|
614
614
|
return j.Fragment = n, j.jsx = s, j.jsxs = s, j;
|
|
615
615
|
}
|
|
616
616
|
var Ce;
|
|
617
|
-
function
|
|
618
|
-
return Ce || (Ce = 1, re.exports =
|
|
617
|
+
function on() {
|
|
618
|
+
return Ce || (Ce = 1, re.exports = rn()), re.exports;
|
|
619
619
|
}
|
|
620
|
-
var
|
|
621
|
-
const
|
|
620
|
+
var Ae = on();
|
|
621
|
+
const sn = () => {
|
|
622
622
|
const o = R(N), e = R(O), n = A(e.activePopup$), t = R(x);
|
|
623
623
|
if (A(t.commentUpdate$), !n)
|
|
624
624
|
return null;
|
|
625
|
-
const { row: r, col: i, unitId: s, subUnitId: a, trigger: c } = n, d = t.getByLocation(s, a, r, i),
|
|
625
|
+
const { row: r, col: i, unitId: s, subUnitId: a, trigger: c } = n, d = t.getByLocation(s, a, r, i), m = `${Ge.chatAtABC(i)}${r + 1}`, u = () => {
|
|
626
626
|
e.hidePopup();
|
|
627
627
|
}, h = (l) => {
|
|
628
628
|
var v, S, U;
|
|
629
629
|
return (U = (S = (v = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(l)) == null ? void 0 : S.getName()) != null ? U : "";
|
|
630
630
|
};
|
|
631
|
-
return /* @__PURE__ */
|
|
632
|
-
|
|
631
|
+
return /* @__PURE__ */ Ae.jsx(
|
|
632
|
+
it,
|
|
633
633
|
{
|
|
634
634
|
onClick: () => {
|
|
635
635
|
e.persistPopup();
|
|
@@ -639,23 +639,23 @@ const on = () => {
|
|
|
639
639
|
unitId: s,
|
|
640
640
|
subUnitId: a,
|
|
641
641
|
type: b.UNIVER_SHEET,
|
|
642
|
-
refStr:
|
|
643
|
-
onClose:
|
|
642
|
+
refStr: m,
|
|
643
|
+
onClose: u,
|
|
644
644
|
getSubUnitName: h,
|
|
645
645
|
autoFocus: c === "context-menu"
|
|
646
646
|
}
|
|
647
647
|
);
|
|
648
|
-
},
|
|
648
|
+
}, an = () => {
|
|
649
649
|
var g;
|
|
650
|
-
const o = R(
|
|
650
|
+
const o = R(Te), e = R(N), n = R(O), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = R(ae), s = Ot(() => t.activeSheet$.pipe(wt((p) => p == null ? void 0 : p.getSheetId())), [t.activeSheet$]), a = A(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = Oe(), d = R(ce), m = A(d.activeCommentId$), u = A(d.panelVisible$, d.panelVisible), h = pe((p) => {
|
|
651
651
|
const I = t.getSheets(), f = {};
|
|
652
652
|
I.forEach((T, C) => {
|
|
653
653
|
f[T.getSheetId()] = C;
|
|
654
654
|
});
|
|
655
655
|
const M = (T) => T.map((C) => {
|
|
656
656
|
var de;
|
|
657
|
-
const y = V(C.ref),
|
|
658
|
-
return { ...C, p:
|
|
657
|
+
const y = V(C.ref), He = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
|
|
658
|
+
return { ...C, p: He };
|
|
659
659
|
}).sort((C, y) => C.p[0] === y.p[0] ? C.p[1] === y.p[1] ? C.p[2] - y.p[2] : C.p[1] - y.p[1] : C.p[0] - y.p[0]);
|
|
660
660
|
return [
|
|
661
661
|
...M(p.filter((T) => !T.resolved)),
|
|
@@ -689,16 +689,16 @@ const on = () => {
|
|
|
689
689
|
}, S = () => {
|
|
690
690
|
i.executeCommand(B.id);
|
|
691
691
|
}, U = (p) => {
|
|
692
|
-
|
|
692
|
+
m && m.unitId === p.unitId && m.subUnitId === p.subUnitId && m.commentId === p.id || (c.current && (o.removeShape(c.current), c.current = null), c.current = l(p));
|
|
693
693
|
}, D = () => {
|
|
694
694
|
c.current && (o.removeShape(c.current), c.current = null);
|
|
695
695
|
}, ee = (p, I) => {
|
|
696
696
|
I && n.hidePopup();
|
|
697
697
|
};
|
|
698
|
-
return
|
|
699
|
-
!
|
|
700
|
-
}, [o,
|
|
701
|
-
|
|
698
|
+
return Ut(() => {
|
|
699
|
+
!u && c.current && o.removeShape(c.current);
|
|
700
|
+
}, [o, u]), /* @__PURE__ */ Ae.jsx(
|
|
701
|
+
st,
|
|
702
702
|
{
|
|
703
703
|
unitId: r,
|
|
704
704
|
subUnitId$: s,
|
|
@@ -712,52 +712,52 @@ const on = () => {
|
|
|
712
712
|
onDeleteComment: () => (D(), !0)
|
|
713
713
|
}
|
|
714
714
|
);
|
|
715
|
-
},
|
|
715
|
+
}, cn = (o) => ({
|
|
716
716
|
id: B.id,
|
|
717
|
-
type:
|
|
718
|
-
icon:
|
|
717
|
+
type: Me.BUTTON,
|
|
718
|
+
icon: ue,
|
|
719
719
|
title: "sheetThreadComment.menu.addComment",
|
|
720
|
-
hidden$:
|
|
721
|
-
disabled$:
|
|
720
|
+
hidden$: we(o, b.UNIVER_SHEET),
|
|
721
|
+
disabled$: be(o, {
|
|
722
722
|
workbookTypes: [K],
|
|
723
723
|
worksheetTypes: [Q],
|
|
724
724
|
rangeTypes: [X]
|
|
725
725
|
})
|
|
726
|
-
}),
|
|
727
|
-
id:
|
|
728
|
-
type:
|
|
729
|
-
icon:
|
|
726
|
+
}), mn = (o) => ({
|
|
727
|
+
id: Ie.id,
|
|
728
|
+
type: Me.BUTTON,
|
|
729
|
+
icon: ue,
|
|
730
730
|
tooltip: "sheetThreadComment.menu.commentManagement",
|
|
731
|
-
disabled$:
|
|
731
|
+
disabled$: be(o, {
|
|
732
732
|
workbookTypes: [K],
|
|
733
733
|
worksheetTypes: [Q],
|
|
734
734
|
rangeTypes: [X]
|
|
735
735
|
}),
|
|
736
|
-
hidden$:
|
|
736
|
+
hidden$: we(o, b.UNIVER_SHEET)
|
|
737
737
|
}), un = {
|
|
738
738
|
id: B.id,
|
|
739
|
-
binding:
|
|
740
|
-
preconditions:
|
|
741
|
-
},
|
|
742
|
-
[
|
|
743
|
-
[
|
|
739
|
+
binding: Ct.M | le.CTRL_COMMAND | le.ALT,
|
|
740
|
+
preconditions: vt
|
|
741
|
+
}, dn = {
|
|
742
|
+
[St.OTHERS]: {
|
|
743
|
+
[Ie.id]: {
|
|
744
744
|
order: 1,
|
|
745
|
-
menuItemFactory:
|
|
745
|
+
menuItemFactory: mn
|
|
746
746
|
}
|
|
747
747
|
},
|
|
748
|
-
[
|
|
749
|
-
[
|
|
748
|
+
[gt.MAIN_AREA]: {
|
|
749
|
+
[It.OTHERS]: {
|
|
750
750
|
[B.id]: {
|
|
751
751
|
order: 0,
|
|
752
|
-
menuItemFactory:
|
|
752
|
+
menuItemFactory: cn
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
|
-
var
|
|
758
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
757
|
+
var hn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, pn = (o, e, n, t) => {
|
|
758
|
+
for (var r = t > 1 ? void 0 : t ? ln(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
759
759
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
760
|
-
return t && r &&
|
|
760
|
+
return t && r && hn(e, n, r), r;
|
|
761
761
|
}, oe = (o, e) => (n, t) => e(n, t, o);
|
|
762
762
|
let J = class extends $ {
|
|
763
763
|
constructor(o, e, n) {
|
|
@@ -767,36 +767,37 @@ let J = class extends $ {
|
|
|
767
767
|
this._shortcutService.registerShortcut(un);
|
|
768
768
|
}
|
|
769
769
|
_initMenu() {
|
|
770
|
-
this._menuManagerService.mergeMenu(
|
|
770
|
+
this._menuManagerService.mergeMenu(dn);
|
|
771
771
|
}
|
|
772
772
|
_initComponent() {
|
|
773
773
|
[
|
|
774
|
-
[
|
|
775
|
-
[
|
|
776
|
-
[
|
|
774
|
+
[$e, sn],
|
|
775
|
+
[at, an],
|
|
776
|
+
[ue, je]
|
|
777
777
|
].forEach(([o, e]) => {
|
|
778
778
|
this._componentManager.register(o, e);
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
781
|
};
|
|
782
|
-
J =
|
|
783
|
-
oe(0,
|
|
784
|
-
oe(1, _(
|
|
785
|
-
oe(2,
|
|
782
|
+
J = pn([
|
|
783
|
+
oe(0, Tt),
|
|
784
|
+
oe(1, _(Pt)),
|
|
785
|
+
oe(2, bt)
|
|
786
786
|
], J);
|
|
787
|
-
var
|
|
788
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
787
|
+
var Ve = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, vn = (o, e, n) => e in o ? Ve(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, fn = (o, e, n, t) => {
|
|
788
|
+
for (var r = t > 1 ? void 0 : t ? _n(e, n) : e, i = o.length - 1, s; i >= 0; i--)
|
|
789
789
|
(s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
790
|
-
return t && r &&
|
|
791
|
-
}, ie = (o, e) => (n, t) => e(n, t, o),
|
|
790
|
+
return t && r && Ve(e, n, r), r;
|
|
791
|
+
}, ie = (o, e) => (n, t) => e(n, t, o), Be = (o, e, n) => vn(o, typeof e != "symbol" ? e + "" : e, n);
|
|
792
792
|
let Y = class extends Ke {
|
|
793
793
|
constructor(o = ve, e, n, t) {
|
|
794
794
|
super(), this._config = o, this._injector = e, this._commandService = n, this._configService = t;
|
|
795
|
-
const { menu: r, ...i } =
|
|
795
|
+
const { menu: r, ...i } = Qe(
|
|
796
|
+
{},
|
|
796
797
|
ve,
|
|
797
798
|
this._config
|
|
798
799
|
);
|
|
799
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
800
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Dt, i);
|
|
800
801
|
}
|
|
801
802
|
onStarting() {
|
|
802
803
|
[
|
|
@@ -820,24 +821,24 @@ let Y = class extends Ke {
|
|
|
820
821
|
this._injector.get(Z), this._injector.get(z), this._injector.get(q);
|
|
821
822
|
}
|
|
822
823
|
};
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
Y =
|
|
826
|
-
Je(
|
|
824
|
+
Be(Y, "pluginName", Ne);
|
|
825
|
+
Be(Y, "type", b.UNIVER_SHEET);
|
|
826
|
+
Y = fn([
|
|
827
|
+
Je(ct, ot),
|
|
827
828
|
ie(1, _(Ye)),
|
|
828
829
|
ie(2, _(ae)),
|
|
829
|
-
ie(3,
|
|
830
|
+
ie(3, Xe)
|
|
830
831
|
], Y);
|
|
831
832
|
export {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
833
|
+
xn as AddCommentCommand,
|
|
834
|
+
Dn as DeleteCommentCommand,
|
|
835
|
+
jn as DeleteCommentTreeCommand,
|
|
836
|
+
An as IThreadCommentDataSourceService,
|
|
837
|
+
Vn as ResolveCommentCommand,
|
|
838
|
+
Ne as SHEETS_THREAD_COMMENT,
|
|
838
839
|
O as SheetsThreadCommentPopupService,
|
|
839
840
|
B as ShowAddSheetCommentModalOperation,
|
|
840
841
|
Y as UniverSheetsThreadCommentUIPlugin,
|
|
841
|
-
|
|
842
|
-
|
|
842
|
+
$n as UniverThreadCommentUIPlugin,
|
|
843
|
+
Bn as UpdateCommentCommand
|
|
843
844
|
};
|
package/lib/umd/index.js
CHANGED
|
@@ -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 me;function Le(){if(me)return x;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=a,x.jsxs=a,x}var he;function We(){return he||(he=1,ee.exports=Le()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(I.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var Se;const D=$.singleReferenceToGrid(b.ref),nt=[(Se=T[b.subUnitId])!=null?Se:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.
|
|
9
|
+
*/var me;function Le(){if(me)return x;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=a,x.jsxs=a,x}var he;function We(){return he||(he=1,ee.exports=Le()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(I.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var Se;const D=$.singleReferenceToGrid(b.ref),nt=[(Se=T[b.subUnitId])!=null?Se:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},ae,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},ve(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),ve(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([s.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,s.Inject(s.Injector)),ne(2,s.Inject(s.ICommandService)),ne(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-thread-comment-ui",
|
|
3
|
-
"version": "0.5.1-nightly.
|
|
3
|
+
"version": "0.5.1-nightly.202412271606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer thread comment plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^0.2.8",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
-
"@univerjs/core": "0.5.1-nightly.
|
|
58
|
-
"@univerjs/engine-formula": "0.5.1-nightly.
|
|
59
|
-
"@univerjs/engine-render": "0.5.1-nightly.
|
|
60
|
-
"@univerjs/sheets": "0.5.1-nightly.
|
|
61
|
-
"@univerjs/sheets
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/thread-comment
|
|
65
|
-
"@univerjs/ui": "0.5.1-nightly.
|
|
57
|
+
"@univerjs/core": "0.5.1-nightly.202412271606",
|
|
58
|
+
"@univerjs/engine-formula": "0.5.1-nightly.202412271606",
|
|
59
|
+
"@univerjs/engine-render": "0.5.1-nightly.202412271606",
|
|
60
|
+
"@univerjs/sheets-thread-comment": "0.5.1-nightly.202412271606",
|
|
61
|
+
"@univerjs/sheets": "0.5.1-nightly.202412271606",
|
|
62
|
+
"@univerjs/thread-comment-ui": "0.5.1-nightly.202412271606",
|
|
63
|
+
"@univerjs/sheets-ui": "0.5.1-nightly.202412271606",
|
|
64
|
+
"@univerjs/thread-comment": "0.5.1-nightly.202412271606",
|
|
65
|
+
"@univerjs/ui": "0.5.1-nightly.202412271606"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"postcss": "^8.4.49",
|