@univerjs/preset-sheets-note 0.10.10 → 0.10.12

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.
Files changed (2) hide show
  1. package/lib/umd/index.js +1 -1
  2. package/package.json +7 -7
package/lib/umd/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  // @univerjs/sheets-note-ui/index
10
- (function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-note"),require("rxjs"),require("@univerjs/sheets-ui"),require("rxjs/operators"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-note","rxjs","@univerjs/sheets-ui","rxjs/operators","@univerjs/ui","react/jsx-runtime","@univerjs/design","react"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverSheetsNoteUi={},c.UniverCore,c.UniverEngineRender,c.UniverSheets,c.UniverSheetsNote,c.rxjs,c.UniverSheetsUi,c.rxjs.operators,c.UniverUi,c.React,c.UniverDesign,c.React))})(this,(function(c,a,N,I,_,P,w,ee,v,te,Z,f){"use strict";var Ue=Object.defineProperty;var je=(c,a,N)=>a in c?Ue(c,a,{enumerable:!0,configurable:!0,writable:!0,value:N}):c[a]=N;var b=(c,a,N)=>je(c,typeof a!="symbol"?a+"":a,N);var ne=Object.getOwnPropertyDescriptor,ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?ne(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},T=(i,e)=>(t,n)=>e(t,n,i);c.SheetsCellContentController=class extends a.Disposable{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsNoteModel=t,this._renderManagerService=n,this._univerInstanceService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(I.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:u}=t;return this._sheetsNoteModel.getNote(s,u,r,o)&&((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:"#FFBD37",size:6}}),n(e)},priority:100}))}_initSkeletonChange(){const e=()=>{var o;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),r=this._renderManagerService.getRenderById(n);(o=r==null?void 0:r.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsNoteModel.change$.pipe(P.debounceTime(16)).subscribe(()=>{e()}))}},c.SheetsCellContentController=ie([T(0,a.Inject(I.SheetInterceptorService)),T(1,a.Inject(_.SheetsNoteModel)),T(2,N.IRenderManagerService),T(3,a.IUniverInstanceService)],c.SheetsCellContentController);const x="SHEET_NOTE_COMPONENT";var re=Object.getOwnPropertyDescriptor,oe=(i,e,t,n)=>{for(var r=n>1?void 0:n?re(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},B=(i,e)=>(t,n)=>e(t,n,i);c.SheetsNotePopupService=class extends a.Disposable{constructor(t,n){super();b(this,"_lastPopup",null);b(this,"_activePopup");b(this,"_activePopup$",new P.BehaviorSubject(null));b(this,"activePopup$",this._activePopup$.asObservable());this._zenZoneService=t,this._cellPopupManagerService=n,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(t=>{t&&this.hidePopup()}))}showPopup(t,n){var h;const{row:r,col:o,unitId:s,subUnitId:u}=t;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&u===((h=this.activePopup)==null?void 0:h.subUnitId)){this._activePopup=t,this._activePopup$.next(t);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=t,this._activePopup$.next(t);const l=this._cellPopupManagerService.showPopup({unitId:s,subUnitId:u,row:r,col:o},{componentKey:x,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",extraProps:{location:t},priority:3});if(!l)throw new Error("[SheetsNotePopupService]: cannot show popup!");const p=new a.DisposableCollection;p.add(l),p.add({dispose:()=>{n==null||n()}}),this._lastPopup=p}hidePopup(t){this._activePopup&&(!t&&!this._activePopup.temp||(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.SheetsNotePopupService=oe([B(0,v.IZenZoneService),B(1,a.Inject(w.CellPopupManagerService))],c.SheetsNotePopupService);var se=Object.getOwnPropertyDescriptor,ae=(i,e,t,n)=>{for(var r=n>1?void 0:n?se(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},E=(i,e)=>(t,n)=>e(t,n,i);c.SheetsNotePopupController=class extends a.Disposable{constructor(t,n,r,o,s,u){super();b(this,"_isSwitchingSheet",!1);this._sheetsNotePopupService=t,this._sheetsNoteModel=n,this._sheetSelectionService=r,this._editorBridgeService=o,this._renderManagerService=s,this._hoverManagerService=u,this._initSelectionUpdateListener(),this._initEditorBridge(),this._initHoverEvent()}_handleSelectionChange(t,n,r){var S,y,M;const o=(S=t[0])==null?void 0:S.range,s=this._renderManagerService.getRenderById(n),u=(y=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(r))==null?void 0:y.skeleton;if(!u||!o)return;const l=u.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((M=o.rangeType)!=null?M:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((l.isMerged||l.isMergedMainCell)&&a.Rectangle.equals(l.mergeInfo,o))){this._sheetsNotePopupService.hidePopup();return}const h=l.actualRow,d=l.actualColumn,C=this._sheetsNoteModel.getNote(n,r,h,d);C!=null&&C.show||(C?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:r,row:h,col:d}):this._sheetsNotePopupService.hidePopup(!0))}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchingSheet)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsNotePopupService.hidePopup(!0)}))}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ee.debounceTime(100)).subscribe(t=>{if(!(t!=null&&t.location))return;const{unitId:n,subUnitId:r,row:o,col:s}=t.location,u=this._sheetsNoteModel.getNote(n,r,o,s);u!=null&&u.show||(u?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:r,row:o,col:s,temp:!0}):this._sheetsNotePopupService.hidePopup())}))}},c.SheetsNotePopupController=ae([E(0,a.Inject(c.SheetsNotePopupService)),E(1,a.Inject(_.SheetsNoteModel)),E(2,a.Inject(I.SheetsSelectionsService)),E(3,w.IEditorBridgeService),E(4,N.IRenderManagerService),E(5,a.Inject(w.HoverManagerService))],c.SheetsNotePopupController);const A="sheets-note-ui.config",W={};var ce=Object.getOwnPropertyDescriptor,ue=(i,e,t,n)=>{for(var r=n>1?void 0:n?ce(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},U=(i,e)=>(t,n)=>e(t,n,i);let j=class extends a.Disposable{constructor(e,t,n,r){super();b(this,"_noteMatrix",new a.ObjectMatrix);this._sheetsNoteModel=e,this._univerInstanceService=t,this._cellPopupManagerService=n,this._sheetsNotePopupService=r,this._initNoteChangeListener()}_showPopup(e,t,n,r){return this._sheetsNotePopupService.hidePopup(!0),this._cellPopupManagerService.showPopup({unitId:e,subUnitId:t,row:n,col:r},{componentKey:x,direction:"horizontal",extraProps:{location:{unitId:e,subUnitId:t,row:n,col:r}},priority:3})}_initSheet(e,t){var o;this._noteMatrix.forValue((s,u,l)=>{l.dispose()}),this._noteMatrix=new a.ObjectMatrix;const r=(s,u,l,p,h)=>{const d=this._noteMatrix,C=d.getValue(l,p);if(h!=null&&h.show){if(!C){const S=this._showPopup(s,u,l,p);S&&d.setValue(l,p,S)}}else C&&(C.dispose(),d.realDeleteValue(l,p))};return(o=this._sheetsNoteModel.getSheetNotes(e,t))==null||o.forValue((s,u,l)=>{r(e,t,s,u,l)}),this._sheetsNoteModel.change$.subscribe(s=>{if(!(s.unitId!==e||s.sheetId!==t))switch(s.type){case"ref":{const{unitId:u,sheetId:l,row:p,col:h,newPosition:d,note:C}=s,S=this._noteMatrix;if(!C.show)return;const y=S.getValue(p,h);y&&(y.dispose(),S.realDeleteValue(p,h));const M=this._showPopup(u,l,d.row,d.col);M&&S.setValue(d.row,d.col,M);break}case"update":{const{unitId:u,sheetId:l,row:p,col:h,note:d}=s;r(u,l,p,h,d);break}}})}_initNoteChangeListener(){this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).pipe(P.switchMap(e=>{var t;return(t=e==null?void 0:e.activeSheet$)!=null?t:P.of(null)})).subscribe(e=>{if(e){const t=this._initSheet(e.getUnitId(),e.getSheetId());return()=>{t.unsubscribe()}}else this._noteMatrix.forValue((t,n,r)=>{r.dispose()}),this._noteMatrix=new a.ObjectMatrix}))}};j=ue([U(0,a.Inject(_.SheetsNoteModel)),U(1,a.Inject(a.IUniverInstanceService)),U(2,a.Inject(w.CellPopupManagerService)),U(3,a.Inject(c.SheetsNotePopupService))],j);var g=function(){return g=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},g.apply(this,arguments)},le=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},H=f.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=le(i,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),l=f.useRef("_".concat(de()));return F(t,"".concat(n),{defIds:t.defIds,idSuffix:l.current},g({ref:e,className:u},s),o)});function F(i,e,t,n,r){return f.createElement(i.tag,g(g({key:e},pe(i,t,r)),n),(he(i,t).children||[]).map(function(o,s){return F(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function pe(i,e,t){var n=g({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),i.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],u=o[1];s==="mask"&&typeof u=="string"&&(n[s]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],u=o[1];typeof u=="string"&&(n[s]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function he(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?g(g({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.includes(r.attrs.id)?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function de(){return Math.random().toString(36).substring(2,8)}H.displayName="UniverIcon";var ve={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.8813 14.4312V10.2925C10.8813 9.92522 11.1791 9.62745 11.5463 9.62745C11.9136 9.62745 12.2114 9.92522 12.2114 10.2925V14.4312C12.2112 14.7983 11.9135 15.0962 11.5463 15.0962C11.1791 15.0962 10.8814 14.7983 10.8813 14.4312Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.47697 11.6968H11.5463H13.6156C13.9829 11.6968 14.2807 11.9946 14.2807 12.3618C14.2807 12.7291 13.9829 13.0269 13.6156 13.0269H9.47697C9.10981 13.0267 8.81193 12.729 8.81193 12.3618C8.81193 11.9946 9.10981 11.6969 9.47697 11.6968Z"}}]},q=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"add-note-icon",ref:e,icon:ve}))});q.displayName="AddNoteIcon";var fe={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.47489 11.6968H13.6175C13.9847 11.6968 14.2825 11.9946 14.2825 12.3618C14.2825 12.7291 13.9847 13.0269 13.6175 13.0269H9.47489C9.10762 13.0269 8.80985 12.7291 8.80985 12.3618C8.80985 11.9946 9.10762 11.6968 9.47489 11.6968Z"}}]},z=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"delete-note-icon",ref:e,icon:fe}))});z.displayName="DeleteNoteIcon";var Ce={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13.8743 12.6147C13.8742 12.5394 13.7749 12.2553 13.3909 11.9477C13.039 11.6659 12.5573 11.4614 12.0394 11.4614C11.5213 11.4614 11.0398 11.6666 10.6878 11.9487C10.3037 12.2565 10.2045 12.5399 10.2044 12.6147C10.2044 12.6893 10.3034 12.9737 10.6878 13.2817C11.0398 13.5636 11.5215 13.768 12.0394 13.768C12.5574 13.768 13.039 13.5635 13.3909 13.2817C13.7751 12.9739 13.8743 12.6897 13.8743 12.6147ZM15.2044 12.6147C15.2044 13.2772 14.7436 13.9027 14.223 14.3198C13.6701 14.7627 12.9019 15.0981 12.0394 15.0981C11.1768 15.0981 10.4085 14.7627 9.85577 14.3198C9.33533 13.9027 8.87433 13.2769 8.87433 12.6147C8.8744 11.9526 9.33541 11.3276 9.85577 10.9106C10.4086 10.4676 11.1767 10.1313 12.0394 10.1313C12.9018 10.1313 13.6701 10.4668 14.223 10.9096C14.7435 11.3267 15.2043 11.9523 15.2044 12.6147Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.0394 13.299C12.4172 13.299 12.7234 12.9927 12.7234 12.6149C12.7234 12.2371 12.4172 11.9308 12.0394 11.9308C11.6616 11.9308 11.3553 12.2371 11.3553 12.6149C11.3553 12.9927 11.6616 13.299 12.0394 13.299Z"}}]},G=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"hide-note-icon",ref:e,icon:Ce}))});G.displayName="HideNoteIcon";const D={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(i,e)=>{const t=i.get(I.SheetsSelectionsService),n=i.get(c.SheetsNotePopupService),o=i.get(a.IUniverInstanceService).getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return!1;const s=o.getActiveSheet(),u=t.getCurrentLastSelection();if(!(u!=null&&u.primary))return!1;const{primary:l}=u;return n.showPopup({unitId:o.getUnitId(),subUnitId:s.getSheetId(),row:l.actualRow,col:l.actualColumn,temp:!1,trigger:e==null?void 0:e.trigger}),!0}},K=i=>{var M;const{popup:e}=i,t=v.useDependency(_.SheetsNoteModel),n=v.useDependency(a.LocaleService),r=v.useDependency(N.IRenderManagerService),o=v.useConfigValue(A),s=(M=e.extraProps)==null?void 0:M.location;if(!s)return console.error("Popup extraProps or location is undefined."),null;const u=f.useRef(null),l=r.getRenderById(s.unitId),[p,h]=f.useState(null);f.useEffect(()=>{var Q,X;const{unitId:m,subUnitId:O,row:R,col:Ee}=s,{width:Oe=160,height:Te=72}=(Q=o==null?void 0:o.defaultNoteSize)!=null?Q:{},k=(X=t.getNote(m,O,R,Ee))!=null?X:{width:Oe,height:Te,note:""};u.current&&(h(k),u.current.style.width=`${k.width}px`,u.current.style.height=`${k.height}px`)},[s,u]);const d=v.useDependency(a.ICommandService),C=v.useDebounceFn(m=>{s&&(m.note?d.executeCommand(_.SheetUpdateNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col,note:m}):d.executeCommand(_.SheetDeleteNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col}))}),S=f.useCallback(m=>{if(!p)return;const O={...p,note:m};h(O),C(O)},[p]),y=f.useCallback((m,O)=>{if(!p)return;const R={...p,width:m,height:O};h(R),C(R)},[p]);return te.jsx(Z.Textarea,{ref:u,"data-u-comp":"note-textarea",className:Z.clsx("univer-ml-px univer-min-h-1 univer-min-w-1 univer-bg-white !univer-text-sm univer-shadow dark:!univer-bg-gray-800"),value:p==null?void 0:p.note,placeholder:n.t("note.placeholder"),onResize:y,onValueChange:S,onWheel:m=>{document.activeElement!==u.current&&l.engine.getCanvasElement().dispatchEvent(new WheelEvent(m.type,m.nativeEvent))}})};function L(i){const e=i.get(I.SheetsSelectionsService),t=i.get(a.IUniverInstanceService);return e.selectionMoveEnd$.pipe(P.map(()=>{const n=e.getCurrentLastSelection();if(!(n!=null&&n.primary))return!1;const r=I.getSheetCommandTarget(t);if(!r)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!i.get(_.SheetsNoteModel).getNote(r.unitId,r.subUnitId,s,o)}))}function _e(i){return{id:D.id,type:v.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:P.combineLatest([v.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),L(i)]).pipe(P.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(i,{workbookTypes:[I.WorkbookEditablePermission],worksheetTypes:[I.WorksheetEditPermission]}),commandId:D.id}}function ge(i){return{id:_.SheetDeleteNoteCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:L(i).pipe(P.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(i,{workbookTypes:[I.WorkbookEditablePermission],worksheetTypes:[I.WorksheetEditPermission]})}}function Se(i){return{id:_.SheetToggleNotePopupCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:L(i).pipe(P.map(e=>!e))}}const me={[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{order:0,[D.id]:{order:0,menuItemFactory:_e},[_.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:ge},[_.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:Se}}}};var Ie=Object.getOwnPropertyDescriptor,Pe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ie(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},V=(i,e)=>(t,n)=>e(t,n,i);let $=class extends a.Disposable{constructor(i,e,t){super(),this._componentManager=i,this._menuManagerService=e,this._commandService=t,this._initComponents(),this._initMenu(),this._initCommands()}_initComponents(){[[x,K],["AddNoteIcon",q],["DeleteNoteIcon",z],["HideNoteIcon",G]].forEach(([i,e])=>{this.disposeWithMe(this._componentManager.register(i,e))})}_initMenu(){this._menuManagerService.mergeMenu(me)}_initCommands(){this._commandService.registerCommand(D)}};$=Pe([V(0,a.Inject(v.ComponentManager)),V(1,a.Inject(v.IMenuManagerService)),V(2,a.ICommandService)],$);var Ne=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(i,e,t)=>e in i?Ne(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ye=(i,e,t,n)=>{for(var r=n>1?void 0:n?Me(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},Y=(i,e)=>(t,n)=>e(t,n,i),J=(i,e,t)=>we(i,typeof e!="symbol"?e+"":e,t);const be="SHEET_NOTE_UI_PLUGIN";c.UniverSheetsNoteUIPlugin=class extends a.Plugin{constructor(e=W,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{menu:r,...o}=a.merge({},W,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(A,o)}onStarting(){[[c.SheetsNotePopupService],[c.SheetsCellContentController],[c.SheetsNotePopupController],[$],[j]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[$],[c.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[c.SheetsNotePopupController],[j]])}},J(c.UniverSheetsNoteUIPlugin,"pluginName",be),J(c.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsNoteUIPlugin=ye([a.DependentOn(_.UniverSheetsNotePlugin),Y(1,a.Inject(a.Injector)),Y(2,a.IConfigService)],c.UniverSheetsNoteUIPlugin),c.SheetsNote=K,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
10
+ (function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-note"),require("rxjs"),require("@univerjs/sheets-ui"),require("rxjs/operators"),require("@univerjs/ui"),require("react/jsx-runtime"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-note","rxjs","@univerjs/sheets-ui","rxjs/operators","@univerjs/ui","react/jsx-runtime","@univerjs/design","react"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u.UniverSheetsNoteUi={},u.UniverCore,u.UniverEngineRender,u.UniverSheets,u.UniverSheetsNote,u.rxjs,u.UniverSheetsUi,u.rxjs.operators,u.UniverUi,u.React,u.UniverDesign,u.React))})(this,(function(u,a,N,P,_,I,w,ee,v,te,Z,f){"use strict";var Ue=Object.defineProperty;var je=(u,a,N)=>a in u?Ue(u,a,{enumerable:!0,configurable:!0,writable:!0,value:N}):u[a]=N;var b=(u,a,N)=>je(u,typeof a!="symbol"?a+"":a,N);var ne=Object.getOwnPropertyDescriptor,ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?ne(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},T=(i,e)=>(t,n)=>e(t,n,i);u.SheetsCellContentController=class extends a.Disposable{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsNoteModel=t,this._renderManagerService=n,this._univerInstanceService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(P.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t;return this._sheetsNoteModel.getNote(s,c,r,o)&&((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:"#FFBD37",size:6}}),n(e)},priority:100}))}_initSkeletonChange(){const e=()=>{var o;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),r=this._renderManagerService.getRenderById(n);(o=r==null?void 0:r.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsNoteModel.change$.pipe(I.debounceTime(16)).subscribe(()=>{e()}))}},u.SheetsCellContentController=ie([T(0,a.Inject(P.SheetInterceptorService)),T(1,a.Inject(_.SheetsNoteModel)),T(2,N.IRenderManagerService),T(3,a.IUniverInstanceService)],u.SheetsCellContentController);const x="SHEET_NOTE_COMPONENT";var re=Object.getOwnPropertyDescriptor,oe=(i,e,t,n)=>{for(var r=n>1?void 0:n?re(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},B=(i,e)=>(t,n)=>e(t,n,i);u.SheetsNotePopupService=class extends a.Disposable{constructor(t,n){super();b(this,"_lastPopup",null);b(this,"_activePopup");b(this,"_activePopup$",new I.BehaviorSubject(null));b(this,"activePopup$",this._activePopup$.asObservable());this._zenZoneService=t,this._cellPopupManagerService=n,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(t=>{t&&this.hidePopup()}))}dispose(){super.dispose(),this.hidePopup()}showPopup(t,n){var h;const{row:r,col:o,unitId:s,subUnitId:c}=t;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&c===((h=this.activePopup)==null?void 0:h.subUnitId)){this._activePopup=t,this._activePopup$.next(t);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=t,this._activePopup$.next(t);const l=this._cellPopupManagerService.showPopup({unitId:s,subUnitId:c,row:r,col:o},{componentKey:x,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",extraProps:{location:t},priority:3});if(!l)throw new Error("[SheetsNotePopupService]: cannot show popup!");const p=new a.DisposableCollection;p.add(l),p.add({dispose:()=>{n==null||n()}}),this._lastPopup=p}hidePopup(t){this._activePopup&&(!t&&!this._activePopup.temp||(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))}},u.SheetsNotePopupService=oe([B(0,v.IZenZoneService),B(1,a.Inject(w.CellPopupManagerService))],u.SheetsNotePopupService);var se=Object.getOwnPropertyDescriptor,ae=(i,e,t,n)=>{for(var r=n>1?void 0:n?se(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},E=(i,e)=>(t,n)=>e(t,n,i);u.SheetsNotePopupController=class extends a.Disposable{constructor(t,n,r,o,s,c){super();b(this,"_isSwitchingSheet",!1);this._sheetsNotePopupService=t,this._sheetsNoteModel=n,this._sheetSelectionService=r,this._editorBridgeService=o,this._renderManagerService=s,this._hoverManagerService=c,this._initSelectionUpdateListener(),this._initEditorBridge(),this._initHoverEvent()}_handleSelectionChange(t,n,r){var S,y,M;const o=(S=t[0])==null?void 0:S.range,s=this._renderManagerService.getRenderById(n),c=(y=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(r))==null?void 0:y.skeleton;if(!c||!o)return;const l=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((M=o.rangeType)!=null?M:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((l.isMerged||l.isMergedMainCell)&&a.Rectangle.equals(l.mergeInfo,o))){this._sheetsNotePopupService.hidePopup();return}const h=l.actualRow,d=l.actualColumn,C=this._sheetsNoteModel.getNote(n,r,h,d);C!=null&&C.show||(C?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:r,row:h,col:d}):this._sheetsNotePopupService.hidePopup(!0))}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchingSheet)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsNotePopupService.hidePopup(!0)}))}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ee.debounceTime(100)).subscribe(t=>{if(!(t!=null&&t.location))return;const{unitId:n,subUnitId:r,row:o,col:s}=t.location,c=this._sheetsNoteModel.getNote(n,r,o,s);c!=null&&c.show||(c?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:r,row:o,col:s,temp:!0}):this._sheetsNotePopupService.hidePopup())}))}},u.SheetsNotePopupController=ae([E(0,a.Inject(u.SheetsNotePopupService)),E(1,a.Inject(_.SheetsNoteModel)),E(2,a.Inject(P.SheetsSelectionsService)),E(3,w.IEditorBridgeService),E(4,N.IRenderManagerService),E(5,a.Inject(w.HoverManagerService))],u.SheetsNotePopupController);const A="sheets-note-ui.config",W={};var ue=Object.getOwnPropertyDescriptor,ce=(i,e,t,n)=>{for(var r=n>1?void 0:n?ue(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},U=(i,e)=>(t,n)=>e(t,n,i);let j=class extends a.Disposable{constructor(e,t,n,r){super();b(this,"_noteMatrix",new a.ObjectMatrix);this._sheetsNoteModel=e,this._univerInstanceService=t,this._cellPopupManagerService=n,this._sheetsNotePopupService=r,this._initNoteChangeListener()}_showPopup(e,t,n,r){return this._sheetsNotePopupService.hidePopup(!0),this._cellPopupManagerService.showPopup({unitId:e,subUnitId:t,row:n,col:r},{componentKey:x,direction:"horizontal",extraProps:{location:{unitId:e,subUnitId:t,row:n,col:r}},priority:3})}dispose(){super.dispose(),this._noteMatrix.forValue((e,t,n)=>{n.dispose()})}_initSheet(e,t){var o;this._noteMatrix.forValue((s,c,l)=>{l.dispose()}),this._noteMatrix=new a.ObjectMatrix;const r=(s,c,l,p,h)=>{const d=this._noteMatrix,C=d.getValue(l,p);if(h!=null&&h.show){if(!C){const S=this._showPopup(s,c,l,p);S&&d.setValue(l,p,S)}}else C&&(C.dispose(),d.realDeleteValue(l,p))};return(o=this._sheetsNoteModel.getSheetNotes(e,t))==null||o.forValue((s,c,l)=>{r(e,t,s,c,l)}),this._sheetsNoteModel.change$.subscribe(s=>{if(!(s.unitId!==e||s.sheetId!==t))switch(s.type){case"ref":{const{unitId:c,sheetId:l,row:p,col:h,newPosition:d,note:C}=s,S=this._noteMatrix;if(!C.show)return;const y=S.getValue(p,h);y&&(y.dispose(),S.realDeleteValue(p,h));const M=this._showPopup(c,l,d.row,d.col);M&&S.setValue(d.row,d.col,M);break}case"update":{const{unitId:c,sheetId:l,row:p,col:h,note:d}=s;r(c,l,p,h,d);break}}})}_initNoteChangeListener(){this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).pipe(I.switchMap(e=>{var t;return(t=e==null?void 0:e.activeSheet$)!=null?t:I.of(null)})).subscribe(e=>{if(e){const t=this._initSheet(e.getUnitId(),e.getSheetId());return()=>{t.unsubscribe()}}else this._noteMatrix.forValue((t,n,r)=>{r.dispose()}),this._noteMatrix=new a.ObjectMatrix}))}};j=ce([U(0,a.Inject(_.SheetsNoteModel)),U(1,a.Inject(a.IUniverInstanceService)),U(2,a.Inject(w.CellPopupManagerService)),U(3,a.Inject(u.SheetsNotePopupService))],j);var g=function(){return g=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},g.apply(this,arguments)},le=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},H=f.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=le(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),l=f.useRef("_".concat(de()));return F(t,"".concat(n),{defIds:t.defIds,idSuffix:l.current},g({ref:e,className:c},s),o)});function F(i,e,t,n,r){return f.createElement(i.tag,g(g({key:e},pe(i,t,r)),n),(he(i,t).children||[]).map(function(o,s){return F(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function pe(i,e,t){var n=g({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),i.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];s==="mask"&&typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function he(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?g(g({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.includes(r.attrs.id)?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function de(){return Math.random().toString(36).substring(2,8)}H.displayName="UniverIcon";var ve={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.8813 14.4312V10.2925C10.8813 9.92522 11.1791 9.62745 11.5463 9.62745C11.9136 9.62745 12.2114 9.92522 12.2114 10.2925V14.4312C12.2112 14.7983 11.9135 15.0962 11.5463 15.0962C11.1791 15.0962 10.8814 14.7983 10.8813 14.4312Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.47697 11.6968H11.5463H13.6156C13.9829 11.6968 14.2807 11.9946 14.2807 12.3618C14.2807 12.7291 13.9829 13.0269 13.6156 13.0269H9.47697C9.10981 13.0267 8.81193 12.729 8.81193 12.3618C8.81193 11.9946 9.10981 11.6969 9.47697 11.6968Z"}}]},q=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"add-note-icon",ref:e,icon:ve}))});q.displayName="AddNoteIcon";var fe={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M9.47489 11.6968H13.6175C13.9847 11.6968 14.2825 11.9946 14.2825 12.3618C14.2825 12.7291 13.9847 13.0269 13.6175 13.0269H9.47489C9.10762 13.0269 8.80985 12.7291 8.80985 12.3618C8.80985 11.9946 9.10762 11.6968 9.47489 11.6968Z"}}]},z=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"delete-note-icon",ref:e,icon:fe}))});z.displayName="DeleteNoteIcon";var Ce={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:"M12.8481 8.00049V3.87451C12.8481 3.13737 12.2503 2.5398 11.5132 2.53955H4.48682C3.74952 2.53955 3.15186 3.13721 3.15186 3.87451V12.1255C3.15186 12.8628 3.74952 13.4604 4.48682 13.4604H6.99951L7.1333 13.4741C7.43655 13.536 7.66454 13.804 7.66455 14.1255C7.66455 14.447 7.43655 14.715 7.1333 14.7769L6.99951 14.7905H4.48682C3.01498 14.7905 1.82178 13.5973 1.82178 12.1255V3.87451C1.82178 2.40267 3.01498 1.20947 4.48682 1.20947H11.5132C12.9848 1.20972 14.1772 2.40283 14.1772 3.87451V8.00049C14.177 8.36738 13.8801 8.6643 13.5132 8.66455C13.1461 8.66455 12.8484 8.36754 12.8481 8.00049Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.1463 4.53859L10.2801 4.55226C10.5832 4.61419 10.8113 4.8822 10.8113 5.20363C10.8113 5.52506 10.5832 5.79306 10.2801 5.85499L10.1463 5.86867H5.85331C5.48604 5.86867 5.18827 5.5709 5.18827 5.20363C5.18827 4.83636 5.48604 4.53859 5.85331 4.53859H10.1463Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.11307 7.33497L8.24686 7.34865C8.54984 7.41069 8.77811 7.67869 8.77811 8.00001C8.77811 8.32134 8.54984 8.58933 8.24686 8.65138L8.11307 8.66505H5.85331C5.48604 8.66505 5.18827 8.36728 5.18827 8.00001C5.18827 7.63274 5.48604 7.33497 5.85331 7.33497H8.11307Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.98319 10.1314L7.11698 10.145C7.42003 10.207 7.64823 10.475 7.64823 10.7964C7.64823 11.1178 7.42003 11.3858 7.11698 11.4478L6.98319 11.4614H5.85331C5.48604 11.4614 5.18827 11.1637 5.18827 10.7964C5.18827 10.4291 5.48604 10.1314 5.85331 10.1314H6.98319Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13.8743 12.6147C13.8742 12.5394 13.7749 12.2553 13.3909 11.9477C13.039 11.6659 12.5573 11.4614 12.0394 11.4614C11.5213 11.4614 11.0398 11.6666 10.6878 11.9487C10.3037 12.2565 10.2045 12.5399 10.2044 12.6147C10.2044 12.6893 10.3034 12.9737 10.6878 13.2817C11.0398 13.5636 11.5215 13.768 12.0394 13.768C12.5574 13.768 13.039 13.5635 13.3909 13.2817C13.7751 12.9739 13.8743 12.6897 13.8743 12.6147ZM15.2044 12.6147C15.2044 13.2772 14.7436 13.9027 14.223 14.3198C13.6701 14.7627 12.9019 15.0981 12.0394 15.0981C11.1768 15.0981 10.4085 14.7627 9.85577 14.3198C9.33533 13.9027 8.87433 13.2769 8.87433 12.6147C8.8744 11.9526 9.33541 11.3276 9.85577 10.9106C10.4086 10.4676 11.1767 10.1313 12.0394 10.1313C12.9018 10.1313 13.6701 10.4668 14.223 10.9096C14.7435 11.3267 15.2043 11.9523 15.2044 12.6147Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.0394 13.299C12.4172 13.299 12.7234 12.9927 12.7234 12.6149C12.7234 12.2371 12.4172 11.9308 12.0394 11.9308C11.6616 11.9308 11.3553 12.2371 11.3553 12.6149C11.3553 12.9927 11.6616 13.299 12.0394 13.299Z"}}]},G=f.forwardRef(function(i,e){return f.createElement(H,Object.assign({},i,{id:"hide-note-icon",ref:e,icon:Ce}))});G.displayName="HideNoteIcon";const D={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(i,e)=>{const t=i.get(P.SheetsSelectionsService),n=i.get(u.SheetsNotePopupService),o=i.get(a.IUniverInstanceService).getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return!1;const s=o.getActiveSheet(),c=t.getCurrentLastSelection();if(!(c!=null&&c.primary))return!1;const{primary:l}=c;return n.showPopup({unitId:o.getUnitId(),subUnitId:s.getSheetId(),row:l.actualRow,col:l.actualColumn,temp:!1,trigger:e==null?void 0:e.trigger}),!0}},K=i=>{var M;const{popup:e}=i,t=v.useDependency(_.SheetsNoteModel),n=v.useDependency(a.LocaleService),r=v.useDependency(N.IRenderManagerService),o=v.useConfigValue(A),s=(M=e.extraProps)==null?void 0:M.location;if(!s)return console.error("Popup extraProps or location is undefined."),null;const c=f.useRef(null),l=r.getRenderById(s.unitId),[p,h]=f.useState(null);f.useEffect(()=>{var Q,X;const{unitId:m,subUnitId:O,row:R,col:Ee}=s,{width:Oe=160,height:Te=72}=(Q=o==null?void 0:o.defaultNoteSize)!=null?Q:{},k=(X=t.getNote(m,O,R,Ee))!=null?X:{width:Oe,height:Te,note:""};c.current&&(h(k),c.current.style.width=`${k.width}px`,c.current.style.height=`${k.height}px`)},[s,c]);const d=v.useDependency(a.ICommandService),C=v.useDebounceFn(m=>{s&&(m.note?d.executeCommand(_.SheetUpdateNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col,note:m}):d.executeCommand(_.SheetDeleteNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col}))}),S=f.useCallback(m=>{if(!p)return;const O={...p,note:m};h(O),C(O)},[p]),y=f.useCallback((m,O)=>{if(!p)return;const R={...p,width:m,height:O};h(R),C(R)},[p]);return te.jsx(Z.Textarea,{ref:c,"data-u-comp":"note-textarea",className:Z.clsx("univer-ml-px univer-min-h-1 univer-min-w-1 univer-bg-white !univer-text-sm univer-shadow dark:!univer-bg-gray-800"),value:p==null?void 0:p.note,placeholder:n.t("note.placeholder"),onResize:y,onValueChange:S,onWheel:m=>{document.activeElement!==c.current&&l.engine.getCanvasElement().dispatchEvent(new WheelEvent(m.type,m.nativeEvent))}})};function L(i){const e=i.get(P.SheetsSelectionsService),t=i.get(a.IUniverInstanceService);return e.selectionMoveEnd$.pipe(I.map(()=>{const n=e.getCurrentLastSelection();if(!(n!=null&&n.primary))return!1;const r=P.getSheetCommandTarget(t);if(!r)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!i.get(_.SheetsNoteModel).getNote(r.unitId,r.subUnitId,s,o)}))}function _e(i){return{id:D.id,type:v.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:I.combineLatest([v.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),L(i)]).pipe(I.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(i,{workbookTypes:[P.WorkbookEditablePermission],worksheetTypes:[P.WorksheetEditPermission]}),commandId:D.id}}function ge(i){return{id:_.SheetDeleteNoteCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:L(i).pipe(I.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(i,{workbookTypes:[P.WorkbookEditablePermission],worksheetTypes:[P.WorksheetEditPermission]})}}function Se(i){return{id:_.SheetToggleNotePopupCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:L(i).pipe(I.map(e=>!e))}}const me={[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{order:0,[D.id]:{order:0,menuItemFactory:_e},[_.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:ge},[_.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:Se}}}};var Pe=Object.getOwnPropertyDescriptor,Ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?Pe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},V=(i,e)=>(t,n)=>e(t,n,i);let $=class extends a.Disposable{constructor(i,e,t){super(),this._componentManager=i,this._menuManagerService=e,this._commandService=t,this._initComponents(),this._initMenu(),this._initCommands()}_initComponents(){[[x,K],["AddNoteIcon",q],["DeleteNoteIcon",z],["HideNoteIcon",G]].forEach(([i,e])=>{this.disposeWithMe(this._componentManager.register(i,e))})}_initMenu(){this._menuManagerService.mergeMenu(me)}_initCommands(){this._commandService.registerCommand(D)}};$=Ie([V(0,a.Inject(v.ComponentManager)),V(1,a.Inject(v.IMenuManagerService)),V(2,a.ICommandService)],$);var Ne=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(i,e,t)=>e in i?Ne(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ye=(i,e,t,n)=>{for(var r=n>1?void 0:n?Me(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r},Y=(i,e)=>(t,n)=>e(t,n,i),J=(i,e,t)=>we(i,typeof e!="symbol"?e+"":e,t);const be="SHEET_NOTE_UI_PLUGIN";u.UniverSheetsNoteUIPlugin=class extends a.Plugin{constructor(e=W,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{menu:r,...o}=a.merge({},W,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(A,o)}onStarting(){[[u.SheetsNotePopupService],[u.SheetsCellContentController],[u.SheetsNotePopupController],[$],[j]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[$],[u.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[u.SheetsNotePopupController],[j]])}},J(u.UniverSheetsNoteUIPlugin,"pluginName",be),J(u.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),u.UniverSheetsNoteUIPlugin=ye([a.DependentOn(_.UniverSheetsNotePlugin),Y(1,a.Inject(a.Injector)),Y(2,a.IConfigService)],u.UniverSheetsNoteUIPlugin),u.SheetsNote=K,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
11
11
 
12
12
 
13
13
  // index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-note",
3
- "version": "0.10.10",
3
+ "version": "0.10.12",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -58,21 +58,21 @@
58
58
  "rxjs": ">=7.0.0"
59
59
  },
60
60
  "dependencies": {
61
- "@univerjs/sheets-note": "0.10.10",
62
- "@univerjs/sheets-note-ui": "0.10.10"
61
+ "@univerjs/sheets-note": "0.10.12",
62
+ "@univerjs/sheets-note-ui": "0.10.12"
63
63
  },
64
64
  "devDependencies": {
65
- "@univerjs/core": "0.10.10",
65
+ "@univerjs/core": "0.10.12",
66
66
  "react": "18.3.1",
67
67
  "react-dom": "18.3.1",
68
68
  "rxjs": "7.8.2",
69
- "typescript": "^5.9.2",
70
- "@univerjs-infra/shared": "0.10.10"
69
+ "typescript": "^5.9.3",
70
+ "@univerjs-infra/shared": "0.10.12"
71
71
  },
72
72
  "scripts": {
73
73
  "prebuild:preset": "tsx prepare.ts",
74
74
  "build:preset": "tsx build.ts",
75
- "lint:types": "tsc --noEmit"
75
+ "typecheck": "tsc --noEmit"
76
76
  },
77
77
  "module": "./lib/es/index.js"
78
78
  }