@univerjs/sheets-note-ui 0.8.2 → 0.8.3-nightly.202506271607

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var X=Object.defineProperty;var ee=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var M=(r,e,t)=>ee(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),_=require("@univerjs/sheets-note"),R=require("@univerjs/engine-render"),N=require("@univerjs/sheets"),I=require("rxjs"),w=require("@univerjs/sheets-ui"),v=require("@univerjs/ui"),te=require("rxjs/operators"),ne=require("react/jsx-runtime"),$=require("@univerjs/design"),C=require("react"),q="sheets-note-ui.config",A={};var re=Object.getOwnPropertyDescriptor,ie=(r,e,t,n)=>{for(var i=n>1?void 0:n?re(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},O=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsCellContentController=class extends a.Disposable{constructor(e,t,n,i){super(),this._sheetInterceptorService=e,this._sheetsNoteModel=t,this._renderManagerService=n,this._univerInstanceService=i,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(N.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const{row:i,col:o,unitId:s,subUnitId:c}=t;return this._sheetsNoteModel.getNote(s,c,i,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(),i=this._renderManagerService.getRenderById(n);(o=i==null?void 0:i.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsNoteModel.change$.pipe(I.debounceTime(16)).subscribe(()=>{e()}))}};exports.SheetsCellContentController=ie([O(0,a.Inject(N.SheetInterceptorService)),O(1,a.Inject(_.SheetsNoteModel)),O(2,R.IRenderManagerService),O(3,a.IUniverInstanceService)],exports.SheetsCellContentController);const L="SHEET_NOTE_COMPONENT";var oe=Object.getOwnPropertyDescriptor,se=(r,e,t,n)=>{for(var i=n>1?void 0:n?oe(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},W=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsNotePopupService=class extends a.Disposable{constructor(t,n){super();M(this,"_lastPopup",null);M(this,"_activePopup");M(this,"_activePopup$",new I.BehaviorSubject(null));M(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:i,col:o,unitId:s,subUnitId:c}=t;if(this._activePopup&&i===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 u=this._cellPopupManagerService.showPopup({unitId:s,subUnitId:c,row:i,col:o},{componentKey:L,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",extraProps:{location:t},priority:3});if(!u)throw new Error("[SheetsNotePopupService]: cannot show popup!");const p=new a.DisposableCollection;p.add(u),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))}};exports.SheetsNotePopupService=se([W(0,v.IZenZoneService),W(1,a.Inject(w.CellPopupManagerService))],exports.SheetsNotePopupService);var ae=Object.getOwnPropertyDescriptor,ce=(r,e,t,n)=>{for(var i=n>1?void 0:n?ae(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},x=(r,e)=>(t,n)=>e(t,n,r);let U=class extends a.Disposable{constructor(e,t,n,i){super();M(this,"_noteMatrix",new a.ObjectMatrix);this._sheetsNoteModel=e,this._univerInstanceService=t,this._cellPopupManagerService=n,this._sheetsNotePopupService=i,this._initNoteChangeListener()}_showPopup(e,t,n,i){return this._sheetsNotePopupService.hidePopup(!0),this._cellPopupManagerService.showPopup({unitId:e,subUnitId:t,row:n,col:i},{componentKey:L,direction:"horizontal",extraProps:{location:{unitId:e,subUnitId:t,row:n,col:i}},priority:3})}_initSheet(e,t){var o;this._noteMatrix.forValue((s,c,u)=>{u.dispose()}),this._noteMatrix=new a.ObjectMatrix;const i=(s,c,u,p,h)=>{const d=this._noteMatrix,f=d.getValue(u,p);if(h!=null&&h.show){if(!f){const S=this._showPopup(s,c,u,p);S&&d.setValue(u,p,S)}}else f&&(f.dispose(),d.realDeleteValue(u,p))};return(o=this._sheetsNoteModel.getSheetNotes(e,t))==null||o.forValue((s,c,u)=>{i(e,t,s,c,u)}),this._sheetsNoteModel.change$.subscribe(s=>{if(!(s.unitId!==e||s.sheetId!==t))switch(s.type){case"ref":{const{unitId:c,sheetId:u,row:p,col:h,newPosition:d,note:f}=s,S=this._noteMatrix;if(!f.show)return;const P=S.getValue(p,h);P&&(P.dispose(),S.realDeleteValue(p,h));const l=this._showPopup(c,u,d.row,d.col);l&&S.setValue(d.row,d.col,l);break}case"update":{const{unitId:c,sheetId:u,row:p,col:h,note:d}=s;i(c,u,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,i)=>{i.dispose()}),this._noteMatrix=new a.ObjectMatrix}))}};U=ce([x(0,a.Inject(_.SheetsNoteModel)),x(1,a.Inject(a.IUniverInstanceService)),x(2,a.Inject(w.CellPopupManagerService)),x(3,a.Inject(exports.SheetsNotePopupService))],U);var ue=Object.getOwnPropertyDescriptor,le=(r,e,t,n)=>{for(var i=n>1?void 0:n?ue(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},y=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsNotePopupController=class extends a.Disposable{constructor(t,n,i,o,s,c){super();M(this,"_isSwitchingSheet",!1);this._sheetsNotePopupService=t,this._sheetsNoteModel=n,this._sheetSelectionService=i,this._editorBridgeService=o,this._renderManagerService=s,this._hoverManagerService=c,this._initSelectionUpdateListener(),this._initEditorBridge(),this._initHoverEvent()}_handleSelectionChange(t,n,i){var S,P,l;const o=(S=t[0])==null?void 0:S.range,s=this._renderManagerService.getRenderById(n),c=(P=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(i))==null?void 0:P.skeleton;if(!c||!o)return;const u=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((l=o.rangeType)!=null?l:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((u.isMerged||u.isMergedMainCell)&&a.Rectangle.equals(u.mergeInfo,o))){this._sheetsNotePopupService.hidePopup();return}const h=u.actualRow,d=u.actualColumn,f=this._sheetsNoteModel.getNote(n,i,h,d);f!=null&&f.show||(f?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,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(te.debounceTime(100)).subscribe(t=>{if(!(t!=null&&t.location))return;const{unitId:n,subUnitId:i,row:o,col:s}=t.location,c=this._sheetsNoteModel.getNote(n,i,o,s);c!=null&&c.show||(c?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,row:o,col:s,temp:!0}):this._sheetsNotePopupService.hidePopup())}))}};exports.SheetsNotePopupController=le([y(0,a.Inject(exports.SheetsNotePopupService)),y(1,a.Inject(_.SheetsNoteModel)),y(2,a.Inject(N.SheetsSelectionsService)),y(3,w.IEditorBridgeService),y(4,R.IRenderManagerService),y(5,a.Inject(w.HoverManagerService))],exports.SheetsNotePopupController);var g=function(){return g=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},g.apply(this,arguments)},pe=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},D=C.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,o=r.extend,s=pe(r,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),u=C.useRef("_".concat(ve()));return z(t,"".concat(n),{defIds:t.defIds,idSuffix:u.current},g({ref:e,className:c},s),o)});function z(r,e,t,n,i){return C.createElement(r.tag,g(g({key:e},he(r,t,i)),n),(de(r,t).children||[]).map(function(o,s){return z(o,"".concat(e,"-").concat(r.tag,"-").concat(s),t,void 0,i)}))}function he(r,e,t){var n=g({},r.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.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 i=e.defIds;return!i||i.length===0||(r.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 de(r,e){var t,n=e.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((t=r.children)===null||t===void 0)&&t.length)?g(g({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.includes(i.attrs.id)?g(g({},i),{attrs:g(g({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function ve(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";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:"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"}}]},G=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"add-note-icon",ref:e,icon:Ce}))});G.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"}}]},K=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"delete-note-icon",ref:e,icon:fe}))});K.displayName="DeleteNoteIcon";var ge={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"}}]},Y=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"hide-note-icon",ref:e,icon:ge}))});Y.displayName="HideNoteIcon";const T={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=r.get(N.SheetsSelectionsService),n=r.get(exports.SheetsNotePopupService),o=r.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:u}=c;return n.showPopup({unitId:o.getUnitId(),subUnitId:s.getSheetId(),row:u.actualRow,col:u.actualColumn,temp:!1,trigger:e==null?void 0:e.trigger}),!0}},J=r=>{var P;const e=v.useDependency(_.SheetsNoteModel),t=v.useDependency(a.LocaleService),n=v.useDependency(R.IRenderManagerService),i=v.useConfigValue(q),o=(P=r.popup.extraProps)==null?void 0:P.location;if(!o)return console.error("Popup extraProps or location is undefined."),null;const s=n.getRenderById(o.unitId),[c,u]=C.useState(()=>{var b,E;const l={width:((b=i==null?void 0:i.defaultNoteSize)==null?void 0:b.width)||216,height:((E=i==null?void 0:i.defaultNoteSize)==null?void 0:E.height)||92,note:""};return e.getNote(o.unitId,o.subUnitId,o.row,o.col)||l}),p=C.useRef(null),h=v.useDependency(a.ICommandService),d=C.useMemo(()=>o?e.getCellNoteChange$(o.unitId,o.subUnitId,o.row,o.col):I.of(null),[o]),f=v.useDebounceFn(l=>{o&&(l.note?h.executeCommand(_.SheetUpdateNoteCommand.id,{unitId:o.unitId,sheetId:o.subUnitId,row:o.row,col:o.col,note:l}):h.executeCommand(_.SheetDeleteNoteCommand.id,{unitId:o.unitId,sheetId:o.subUnitId,row:o.row,col:o.col}))});C.useEffect(()=>{var l;o&&(e.getNote(o.unitId,o.subUnitId,o.row,o.col)||(l=p.current)==null||l.focus())},[o,e]),C.useEffect(()=>{const l=d.subscribe(()=>{if(!o)return;const m=e.getNote(o.unitId,o.subUnitId,o.row,o.col);m&&u(m)});return()=>l.unsubscribe()},[d]),C.useEffect(()=>{const l=p.current;if(!l)return;const m=new ResizeObserver(b=>{const E=b[0];if(!E)return;const{width:k,height:Z}=E.contentRect;if(k===0&&Z===0)return;const B={...c,width:k,height:Z};u(B),f(B)});return m.observe(l),()=>{m.unobserve(l),m.disconnect()}},[c.note]);const S=l=>{const m=l.target.value,b={...c,note:m};u(b),f(b)};return ne.jsx("textarea",{onWheel:l=>{document.activeElement!==p.current&&s.engine.getCanvasElement().dispatchEvent(new WheelEvent(l.type,l.nativeEvent))},ref:p,"data-u-comp":"note-textarea",className:$.clsx("univer-resize-both univer-ml-px univer-rounded-md univer-bg-white univer-p-2 univer-text-gray-900 univer-shadow focus:univer-outline-none dark:!univer-bg-gray-800 dark:!univer-text-white",$.borderClassName,$.scrollbarClassName),style:{width:c.width,height:c.height},value:c.note,placeholder:t.t("note.placeholder"),onChange:S})};function V(r){const e=r.get(N.SheetsSelectionsService),t=r.get(a.IUniverInstanceService);return e.selectionMoveEnd$.pipe(I.map(()=>{const n=e.getCurrentLastSelection();if(!(n!=null&&n.primary))return!1;const i=N.getSheetCommandTarget(t);if(!i)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!r.get(_.SheetsNoteModel).getNote(i.unitId,i.subUnitId,s,o)}))}function _e(r){return{id:T.id,type:v.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:I.combineLatest([v.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SHEET),V(r)]).pipe(I.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission]}),commandId:T.id}}function Se(r){return{id:_.SheetDeleteNoteCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:V(r).pipe(I.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission]})}}function me(r){return{id:_.SheetToggleNotePopupCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:V(r).pipe(I.map(e=>!e))}}const Ne={[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{order:0,[T.id]:{order:0,menuItemFactory:_e},[_.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:Se},[_.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:me}}}};var Ie=Object.getOwnPropertyDescriptor,Pe=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ie(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},j=(r,e)=>(t,n)=>e(t,n,r);let H=class extends a.Disposable{constructor(r,e,t){super(),this._componentManager=r,this._menuManagerService=e,this._commandService=t,this._initComponents(),this._initMenu(),this._initCommands()}_initComponents(){[[L,J],["AddNoteIcon",G],["DeleteNoteIcon",K],["HideNoteIcon",Y]].forEach(([r,e])=>{this.disposeWithMe(this._componentManager.register(r,e))})}_initMenu(){this._menuManagerService.mergeMenu(Ne)}_initCommands(){this._commandService.registerCommand(T)}};H=Pe([j(0,a.Inject(v.ComponentManager)),j(1,a.Inject(v.IMenuManagerService)),j(2,a.ICommandService)],H);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(r,e,t)=>e in r?be(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ye=(r,e,t,n)=>{for(var i=n>1?void 0:n?Me(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},F=(r,e)=>(t,n)=>e(t,n,r),Q=(r,e,t)=>we(r,typeof e!="symbol"?e+"":e,t);const Ee="SHEET_NOTE_UI_PLUGIN";exports.UniverSheetsNoteUIPlugin=class extends a.Plugin{constructor(e=A,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{menu:i,...o}=a.merge({},A,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(q,o)}onStarting(){[[exports.SheetsNotePopupService],[exports.SheetsCellContentController],[exports.SheetsNotePopupController],[H],[U]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[H],[exports.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[exports.SheetsNotePopupController],[U]])}};Q(exports.UniverSheetsNoteUIPlugin,"pluginName",Ee);Q(exports.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsNoteUIPlugin=ye([a.DependentOn(_.UniverSheetsNotePlugin),F(1,a.Inject(a.Injector)),F(2,a.IConfigService)],exports.UniverSheetsNoteUIPlugin);exports.SheetsNote=J;
1
+ "use strict";var X=Object.defineProperty;var ee=(r,e,t)=>e in r?X(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var M=(r,e,t)=>ee(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),R=require("@univerjs/engine-render"),N=require("@univerjs/sheets"),_=require("@univerjs/sheets-note"),I=require("rxjs"),w=require("@univerjs/sheets-ui"),te=require("rxjs/operators"),v=require("@univerjs/ui"),ne=require("react/jsx-runtime"),$=require("@univerjs/design"),C=require("react");var re=Object.getOwnPropertyDescriptor,ie=(r,e,t,n)=>{for(var i=n>1?void 0:n?re(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},O=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsCellContentController=class extends a.Disposable{constructor(e,t,n,i){super(),this._sheetInterceptorService=e,this._sheetsNoteModel=t,this._renderManagerService=n,this._univerInstanceService=i,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(N.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const{row:i,col:o,unitId:s,subUnitId:c}=t;return this._sheetsNoteModel.getNote(s,c,i,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(),i=this._renderManagerService.getRenderById(n);(o=i==null?void 0:i.mainComponent)==null||o.makeForceDirty()};this.disposeWithMe(this._sheetsNoteModel.change$.pipe(I.debounceTime(16)).subscribe(()=>{e()}))}};exports.SheetsCellContentController=ie([O(0,a.Inject(N.SheetInterceptorService)),O(1,a.Inject(_.SheetsNoteModel)),O(2,R.IRenderManagerService),O(3,a.IUniverInstanceService)],exports.SheetsCellContentController);const L="SHEET_NOTE_COMPONENT";var oe=Object.getOwnPropertyDescriptor,se=(r,e,t,n)=>{for(var i=n>1?void 0:n?oe(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},A=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsNotePopupService=class extends a.Disposable{constructor(t,n){super();M(this,"_lastPopup",null);M(this,"_activePopup");M(this,"_activePopup$",new I.BehaviorSubject(null));M(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:i,col:o,unitId:s,subUnitId:c}=t;if(this._activePopup&&i===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 u=this._cellPopupManagerService.showPopup({unitId:s,subUnitId:c,row:i,col:o},{componentKey:L,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",extraProps:{location:t},priority:3});if(!u)throw new Error("[SheetsNotePopupService]: cannot show popup!");const p=new a.DisposableCollection;p.add(u),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))}};exports.SheetsNotePopupService=se([A(0,v.IZenZoneService),A(1,a.Inject(w.CellPopupManagerService))],exports.SheetsNotePopupService);var ae=Object.getOwnPropertyDescriptor,ce=(r,e,t,n)=>{for(var i=n>1?void 0:n?ae(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},y=(r,e)=>(t,n)=>e(t,n,r);exports.SheetsNotePopupController=class extends a.Disposable{constructor(t,n,i,o,s,c){super();M(this,"_isSwitchingSheet",!1);this._sheetsNotePopupService=t,this._sheetsNoteModel=n,this._sheetSelectionService=i,this._editorBridgeService=o,this._renderManagerService=s,this._hoverManagerService=c,this._initSelectionUpdateListener(),this._initEditorBridge(),this._initHoverEvent()}_handleSelectionChange(t,n,i){var S,P,l;const o=(S=t[0])==null?void 0:S.range,s=this._renderManagerService.getRenderById(n),c=(P=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(i))==null?void 0:P.skeleton;if(!c||!o)return;const u=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((l=o.rangeType)!=null?l:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||o.endColumn-o.startColumn>0||o.endRow-o.startRow>0)&&!((u.isMerged||u.isMergedMainCell)&&a.Rectangle.equals(u.mergeInfo,o))){this._sheetsNotePopupService.hidePopup();return}const h=u.actualRow,d=u.actualColumn,f=this._sheetsNoteModel.getNote(n,i,h,d);f!=null&&f.show||(f?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,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(te.debounceTime(100)).subscribe(t=>{if(!(t!=null&&t.location))return;const{unitId:n,subUnitId:i,row:o,col:s}=t.location,c=this._sheetsNoteModel.getNote(n,i,o,s);c!=null&&c.show||(c?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,row:o,col:s,temp:!0}):this._sheetsNotePopupService.hidePopup())}))}};exports.SheetsNotePopupController=ce([y(0,a.Inject(exports.SheetsNotePopupService)),y(1,a.Inject(_.SheetsNoteModel)),y(2,a.Inject(N.SheetsSelectionsService)),y(3,w.IEditorBridgeService),y(4,R.IRenderManagerService),y(5,a.Inject(w.HoverManagerService))],exports.SheetsNotePopupController);const q="sheets-note-ui.config",W={};var ue=Object.getOwnPropertyDescriptor,le=(r,e,t,n)=>{for(var i=n>1?void 0:n?ue(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},x=(r,e)=>(t,n)=>e(t,n,r);let U=class extends a.Disposable{constructor(e,t,n,i){super();M(this,"_noteMatrix",new a.ObjectMatrix);this._sheetsNoteModel=e,this._univerInstanceService=t,this._cellPopupManagerService=n,this._sheetsNotePopupService=i,this._initNoteChangeListener()}_showPopup(e,t,n,i){return this._sheetsNotePopupService.hidePopup(!0),this._cellPopupManagerService.showPopup({unitId:e,subUnitId:t,row:n,col:i},{componentKey:L,direction:"horizontal",extraProps:{location:{unitId:e,subUnitId:t,row:n,col:i}},priority:3})}_initSheet(e,t){var o;this._noteMatrix.forValue((s,c,u)=>{u.dispose()}),this._noteMatrix=new a.ObjectMatrix;const i=(s,c,u,p,h)=>{const d=this._noteMatrix,f=d.getValue(u,p);if(h!=null&&h.show){if(!f){const S=this._showPopup(s,c,u,p);S&&d.setValue(u,p,S)}}else f&&(f.dispose(),d.realDeleteValue(u,p))};return(o=this._sheetsNoteModel.getSheetNotes(e,t))==null||o.forValue((s,c,u)=>{i(e,t,s,c,u)}),this._sheetsNoteModel.change$.subscribe(s=>{if(!(s.unitId!==e||s.sheetId!==t))switch(s.type){case"ref":{const{unitId:c,sheetId:u,row:p,col:h,newPosition:d,note:f}=s,S=this._noteMatrix;if(!f.show)return;const P=S.getValue(p,h);P&&(P.dispose(),S.realDeleteValue(p,h));const l=this._showPopup(c,u,d.row,d.col);l&&S.setValue(d.row,d.col,l);break}case"update":{const{unitId:c,sheetId:u,row:p,col:h,note:d}=s;i(c,u,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,i)=>{i.dispose()}),this._noteMatrix=new a.ObjectMatrix}))}};U=le([x(0,a.Inject(_.SheetsNoteModel)),x(1,a.Inject(a.IUniverInstanceService)),x(2,a.Inject(w.CellPopupManagerService)),x(3,a.Inject(exports.SheetsNotePopupService))],U);var g=function(){return g=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},g.apply(this,arguments)},pe=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},D=C.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,o=r.extend,s=pe(r,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),u=C.useRef("_".concat(ve()));return z(t,"".concat(n),{defIds:t.defIds,idSuffix:u.current},g({ref:e,className:c},s),o)});function z(r,e,t,n,i){return C.createElement(r.tag,g(g({key:e},he(r,t,i)),n),(de(r,t).children||[]).map(function(o,s){return z(o,"".concat(e,"-").concat(r.tag,"-").concat(s),t,void 0,i)}))}function he(r,e,t){var n=g({},r.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),r.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 i=e.defIds;return!i||i.length===0||(r.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 de(r,e){var t,n=e.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((t=r.children)===null||t===void 0)&&t.length)?g(g({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.includes(i.attrs.id)?g(g({},i),{attrs:g(g({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function ve(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";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:"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"}}]},G=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"add-note-icon",ref:e,icon:Ce}))});G.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"}}]},K=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"delete-note-icon",ref:e,icon:fe}))});K.displayName="DeleteNoteIcon";var ge={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"}}]},Y=C.forwardRef(function(r,e){return C.createElement(D,Object.assign({},r,{id:"hide-note-icon",ref:e,icon:ge}))});Y.displayName="HideNoteIcon";const T={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=r.get(N.SheetsSelectionsService),n=r.get(exports.SheetsNotePopupService),o=r.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:u}=c;return n.showPopup({unitId:o.getUnitId(),subUnitId:s.getSheetId(),row:u.actualRow,col:u.actualColumn,temp:!1,trigger:e==null?void 0:e.trigger}),!0}},J=r=>{var P;const e=v.useDependency(_.SheetsNoteModel),t=v.useDependency(a.LocaleService),n=v.useDependency(R.IRenderManagerService),i=v.useConfigValue(q),o=(P=r.popup.extraProps)==null?void 0:P.location;if(!o)return console.error("Popup extraProps or location is undefined."),null;const s=n.getRenderById(o.unitId),[c,u]=C.useState(()=>{var b,E;const l={width:((b=i==null?void 0:i.defaultNoteSize)==null?void 0:b.width)||216,height:((E=i==null?void 0:i.defaultNoteSize)==null?void 0:E.height)||92,note:""};return e.getNote(o.unitId,o.subUnitId,o.row,o.col)||l}),p=C.useRef(null),h=v.useDependency(a.ICommandService),d=C.useMemo(()=>o?e.getCellNoteChange$(o.unitId,o.subUnitId,o.row,o.col):I.of(null),[o]),f=v.useDebounceFn(l=>{o&&(l.note?h.executeCommand(_.SheetUpdateNoteCommand.id,{unitId:o.unitId,sheetId:o.subUnitId,row:o.row,col:o.col,note:l}):h.executeCommand(_.SheetDeleteNoteCommand.id,{unitId:o.unitId,sheetId:o.subUnitId,row:o.row,col:o.col}))});C.useEffect(()=>{var l;o&&(e.getNote(o.unitId,o.subUnitId,o.row,o.col)||(l=p.current)==null||l.focus())},[o,e]),C.useEffect(()=>{const l=d.subscribe(()=>{if(!o)return;const m=e.getNote(o.unitId,o.subUnitId,o.row,o.col);m&&u(m)});return()=>l.unsubscribe()},[d]),C.useEffect(()=>{const l=p.current;if(!l)return;const m=new ResizeObserver(b=>{const E=b[0];if(!E)return;const{width:k,height:Z}=E.contentRect;if(k===0&&Z===0)return;const B={...c,width:k,height:Z};u(B),f(B)});return m.observe(l),()=>{m.unobserve(l),m.disconnect()}},[c.note]);const S=l=>{const m=l.target.value,b={...c,note:m};u(b),f(b)};return ne.jsx("textarea",{onWheel:l=>{document.activeElement!==p.current&&s.engine.getCanvasElement().dispatchEvent(new WheelEvent(l.type,l.nativeEvent))},ref:p,"data-u-comp":"note-textarea",className:$.clsx("univer-resize-both univer-ml-px univer-rounded-md univer-bg-white univer-p-2 univer-text-gray-900 univer-shadow focus:univer-outline-none dark:!univer-bg-gray-800 dark:!univer-text-white",$.borderClassName,$.scrollbarClassName),style:{width:c.width,height:c.height},value:c.note,placeholder:t.t("note.placeholder"),onChange:S})};function V(r){const e=r.get(N.SheetsSelectionsService),t=r.get(a.IUniverInstanceService);return e.selectionMoveEnd$.pipe(I.map(()=>{const n=e.getCurrentLastSelection();if(!(n!=null&&n.primary))return!1;const i=N.getSheetCommandTarget(t);if(!i)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!r.get(_.SheetsNoteModel).getNote(i.unitId,i.subUnitId,s,o)}))}function _e(r){return{id:T.id,type:v.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:I.combineLatest([v.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SHEET),V(r)]).pipe(I.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission]}),commandId:T.id}}function Se(r){return{id:_.SheetDeleteNoteCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:V(r).pipe(I.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[N.WorkbookEditablePermission],worksheetTypes:[N.WorksheetEditPermission]})}}function me(r){return{id:_.SheetToggleNotePopupCommand.id,type:v.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:V(r).pipe(I.map(e=>!e))}}const Ne={[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{order:0,[T.id]:{order:0,menuItemFactory:_e},[_.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:Se},[_.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:me}}}};var Ie=Object.getOwnPropertyDescriptor,Pe=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ie(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},j=(r,e)=>(t,n)=>e(t,n,r);let H=class extends a.Disposable{constructor(r,e,t){super(),this._componentManager=r,this._menuManagerService=e,this._commandService=t,this._initComponents(),this._initMenu(),this._initCommands()}_initComponents(){[[L,J],["AddNoteIcon",G],["DeleteNoteIcon",K],["HideNoteIcon",Y]].forEach(([r,e])=>{this.disposeWithMe(this._componentManager.register(r,e))})}_initMenu(){this._menuManagerService.mergeMenu(Ne)}_initCommands(){this._commandService.registerCommand(T)}};H=Pe([j(0,a.Inject(v.ComponentManager)),j(1,a.Inject(v.IMenuManagerService)),j(2,a.ICommandService)],H);var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(r,e,t)=>e in r?be(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ye=(r,e,t,n)=>{for(var i=n>1?void 0:n?Me(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},F=(r,e)=>(t,n)=>e(t,n,r),Q=(r,e,t)=>we(r,typeof e!="symbol"?e+"":e,t);const Ee="SHEET_NOTE_UI_PLUGIN";exports.UniverSheetsNoteUIPlugin=class extends a.Plugin{constructor(e=W,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{menu:i,...o}=a.merge({},W,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(q,o)}onStarting(){[[exports.SheetsNotePopupService],[exports.SheetsCellContentController],[exports.SheetsNotePopupController],[H],[U]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[H],[exports.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[exports.SheetsNotePopupController],[U]])}};Q(exports.UniverSheetsNoteUIPlugin,"pluginName",Ee);Q(exports.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsNoteUIPlugin=ye([a.DependentOn(_.UniverSheetsNotePlugin),F(1,a.Inject(a.Injector)),F(2,a.IConfigService)],exports.UniverSheetsNoteUIPlugin);exports.SheetsNote=J;
@@ -0,0 +1 @@
1
+ "use strict";const e={rightClick:{addNote:"노트 추가",deleteNote:"노트 삭제",toggleNote:"노트 표시/숨기기"},note:{placeholder:"여기에 입력"}};module.exports=e;
package/lib/es/index.js CHANGED
@@ -1,18 +1,17 @@
1
1
  var Ce = Object.defineProperty;
2
2
  var me = (t, e, i) => e in t ? Ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
3
  var S = (t, e, i) => me(t, typeof e != "symbol" ? e + "" : e, i);
4
- import { Inject as d, IUniverInstanceService as D, Disposable as w, InterceptorEffectEnum as Se, UniverInstanceType as b, DisposableCollection as Ne, ObjectMatrix as k, RANGE_TYPE as X, Rectangle as Pe, CommandType as Ie, LocaleService as we, ICommandService as ne, DependentOn as be, Injector as Me, IConfigService as ye, Plugin as Ee, merge as Oe, touchDependencies as ee } from "@univerjs/core";
5
- import { SheetsNoteModel as M, SheetUpdateNoteCommand as xe, SheetDeleteNoteCommand as F, SheetToggleNotePopupCommand as oe, UniverSheetsNotePlugin as He } from "@univerjs/sheets-note";
6
- import { IRenderManagerService as W } from "@univerjs/engine-render";
7
- import { SheetInterceptorService as Te, INTERCEPTOR_POINT as $e, SheetsSelectionsService as z, WorksheetEditPermission as se, WorkbookEditablePermission as ae, getSheetCommandTarget as Ue } from "@univerjs/sheets";
4
+ import { Inject as d, IUniverInstanceService as D, Disposable as w, InterceptorEffectEnum as Se, UniverInstanceType as b, DisposableCollection as Ne, RANGE_TYPE as X, Rectangle as Pe, ObjectMatrix as k, CommandType as Ie, LocaleService as we, ICommandService as ne, DependentOn as be, Injector as Me, IConfigService as ye, Plugin as Ee, merge as Oe, touchDependencies as ee } from "@univerjs/core";
5
+ import { IRenderManagerService as F } from "@univerjs/engine-render";
6
+ import { SheetInterceptorService as xe, INTERCEPTOR_POINT as He, SheetsSelectionsService as W, WorksheetEditPermission as oe, WorkbookEditablePermission as se, getSheetCommandTarget as Te } from "@univerjs/sheets";
7
+ import { SheetsNoteModel as M, SheetUpdateNoteCommand as $e, SheetDeleteNoteCommand as z, SheetToggleNotePopupCommand as ae, UniverSheetsNotePlugin as Ue } from "@univerjs/sheets-note";
8
8
  import { debounceTime as Le, BehaviorSubject as De, switchMap as Re, of as ce, map as R, combineLatest as Ve } from "rxjs";
9
9
  import { CellPopupManagerService as ue, IEditorBridgeService as je, HoverManagerService as Ze, SheetSkeletonManagerService as ke, getCurrentRangeDisable$ as le } from "@univerjs/sheets-ui";
10
- import { IZenZoneService as Be, useDependency as y, useConfigValue as Ae, useDebounceFn as Fe, MenuItemType as G, getMenuHiddenObservable as We, ContextMenuPosition as ze, ContextMenuGroup as Ge, ComponentManager as Ke, IMenuManagerService as Ye } from "@univerjs/ui";
11
- import { debounceTime as qe } from "rxjs/operators";
10
+ import { debounceTime as Be } from "rxjs/operators";
11
+ import { IZenZoneService as Ae, useDependency as y, useConfigValue as Fe, useDebounceFn as We, MenuItemType as G, getMenuHiddenObservable as ze, ContextMenuPosition as Ge, ContextMenuGroup as Ke, ComponentManager as Ye, IMenuManagerService as qe } from "@univerjs/ui";
12
12
  import { jsx as Je } from "react/jsx-runtime";
13
13
  import { clsx as Qe, borderClassName as Xe, scrollbarClassName as et } from "@univerjs/design";
14
14
  import { forwardRef as V, useRef as pe, createElement as j, useState as tt, useMemo as it, useEffect as B } from "react";
15
- const he = "sheets-note-ui.config", te = {};
16
15
  var rt = Object.getOwnPropertyDescriptor, nt = (t, e, i, r) => {
17
16
  for (var n = r > 1 ? void 0 : r ? rt(e, i) : e, o = t.length - 1, s; o >= 0; o--)
18
17
  (s = t[o]) && (n = s(n) || n);
@@ -25,7 +24,7 @@ let x = class extends w {
25
24
  _initViewModelIntercept() {
26
25
  this.disposeWithMe(
27
26
  this._sheetInterceptorService.intercept(
28
- $e.CELL_CONTENT,
27
+ He.CELL_CONTENT,
29
28
  {
30
29
  effect: Se.Style,
31
30
  handler: (t, e, i) => {
@@ -57,9 +56,9 @@ let x = class extends w {
57
56
  }
58
57
  };
59
58
  x = nt([
60
- E(0, d(Te)),
59
+ E(0, d(xe)),
61
60
  E(1, d(M)),
62
- E(2, W),
61
+ E(2, F),
63
62
  E(3, D)
64
63
  ], x);
65
64
  const K = "SHEET_NOTE_COMPONENT";
@@ -67,7 +66,7 @@ var ot = Object.getOwnPropertyDescriptor, st = (t, e, i, r) => {
67
66
  for (var n = r > 1 ? void 0 : r ? ot(e, i) : e, o = t.length - 1, s; o >= 0; o--)
68
67
  (s = t[o]) && (n = s(n) || n);
69
68
  return n;
70
- }, ie = (t, e) => (i, r) => e(i, r, t);
69
+ }, te = (t, e) => (i, r) => e(i, r, t);
71
70
  let P = class extends w {
72
71
  constructor(e, i) {
73
72
  super();
@@ -136,15 +135,86 @@ let P = class extends w {
136
135
  }
137
136
  };
138
137
  P = st([
139
- ie(0, Be),
140
- ie(1, d(ue))
138
+ te(0, Ae),
139
+ te(1, d(ue))
141
140
  ], P);
142
141
  var at = Object.getOwnPropertyDescriptor, ct = (t, e, i, r) => {
143
142
  for (var n = r > 1 ? void 0 : r ? at(e, i) : e, o = t.length - 1, s; o >= 0; o--)
144
143
  (s = t[o]) && (n = s(n) || n);
145
144
  return n;
146
- }, O = (t, e) => (i, r) => e(i, r, t);
145
+ }, N = (t, e) => (i, r) => e(i, r, t);
147
146
  let H = class extends w {
147
+ constructor(e, i, r, n, o, s) {
148
+ super();
149
+ S(this, "_isSwitchingSheet", !1);
150
+ this._sheetsNotePopupService = e, this._sheetsNoteModel = i, this._sheetSelectionService = r, this._editorBridgeService = n, this._renderManagerService = o, this._hoverManagerService = s, this._initSelectionUpdateListener(), this._initEditorBridge(), this._initHoverEvent();
151
+ }
152
+ _handleSelectionChange(e, i, r) {
153
+ var f, g, C;
154
+ const n = (f = e[0]) == null ? void 0 : f.range, o = this._renderManagerService.getRenderById(i), s = (g = o == null ? void 0 : o.with(ke).getSkeletonParam(r)) == null ? void 0 : g.skeleton;
155
+ if (!s || !n)
156
+ return;
157
+ const a = s.getCellWithCoordByIndex(n.startRow, n.startColumn);
158
+ if ((((C = n.rangeType) != null ? C : X.NORMAL) !== X.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && Pe.equals(a.mergeInfo, n))) {
159
+ this._sheetsNotePopupService.hidePopup();
160
+ return;
161
+ }
162
+ const l = a.actualRow, h = a.actualColumn, p = this._sheetsNoteModel.getNote(i, r, l, h);
163
+ p != null && p.show || (p ? this._sheetsNotePopupService.showPopup({
164
+ unitId: i,
165
+ subUnitId: r,
166
+ row: l,
167
+ col: h
168
+ }) : this._sheetsNotePopupService.hidePopup(!0));
169
+ }
170
+ _initSelectionUpdateListener() {
171
+ this.disposeWithMe(
172
+ this._sheetSelectionService.selectionMoveEnd$.subscribe((e) => {
173
+ if (this._isSwitchingSheet)
174
+ return;
175
+ const i = this._sheetSelectionService.currentSelectionParam;
176
+ i && this._handleSelectionChange(e, i.unitId, i.sheetId);
177
+ })
178
+ );
179
+ }
180
+ _initEditorBridge() {
181
+ this.disposeWithMe(
182
+ this._editorBridgeService.visible$.subscribe((e) => {
183
+ e.visible && this._sheetsNotePopupService.hidePopup(!0);
184
+ })
185
+ );
186
+ }
187
+ _initHoverEvent() {
188
+ this.disposeWithMe(
189
+ this._hoverManagerService.currentCell$.pipe(Be(100)).subscribe((e) => {
190
+ if (!(e != null && e.location)) return;
191
+ const { unitId: i, subUnitId: r, row: n, col: o } = e.location, s = this._sheetsNoteModel.getNote(i, r, n, o);
192
+ s != null && s.show || (s ? this._sheetsNotePopupService.showPopup({
193
+ unitId: i,
194
+ subUnitId: r,
195
+ row: n,
196
+ col: o,
197
+ temp: !0
198
+ }) : this._sheetsNotePopupService.hidePopup());
199
+ })
200
+ );
201
+ }
202
+ };
203
+ H = ct([
204
+ N(0, d(P)),
205
+ N(1, d(M)),
206
+ N(2, d(W)),
207
+ N(3, je),
208
+ N(4, F),
209
+ N(5, d(Ze))
210
+ ], H);
211
+ const he = "sheets-note-ui.config", ie = {};
212
+ var ut = Object.getOwnPropertyDescriptor, lt = (t, e, i, r) => {
213
+ for (var n = r > 1 ? void 0 : r ? ut(e, i) : e, o = t.length - 1, s; o >= 0; o--)
214
+ (s = t[o]) && (n = s(n) || n);
215
+ return n;
216
+ }, O = (t, e) => (i, r) => e(i, r, t);
217
+ let T = class extends w {
148
218
  constructor(e, i, r, n) {
149
219
  super();
150
220
  S(this, "_noteMatrix", new k());
@@ -231,81 +301,11 @@ let H = class extends w {
231
301
  );
232
302
  }
233
303
  };
234
- H = ct([
304
+ T = lt([
235
305
  O(0, d(M)),
236
306
  O(1, d(D)),
237
307
  O(2, d(ue)),
238
308
  O(3, d(P))
239
- ], H);
240
- var ut = Object.getOwnPropertyDescriptor, lt = (t, e, i, r) => {
241
- for (var n = r > 1 ? void 0 : r ? ut(e, i) : e, o = t.length - 1, s; o >= 0; o--)
242
- (s = t[o]) && (n = s(n) || n);
243
- return n;
244
- }, N = (t, e) => (i, r) => e(i, r, t);
245
- let T = class extends w {
246
- constructor(e, i, r, n, o, s) {
247
- super();
248
- S(this, "_isSwitchingSheet", !1);
249
- this._sheetsNotePopupService = e, this._sheetsNoteModel = i, this._sheetSelectionService = r, this._editorBridgeService = n, this._renderManagerService = o, this._hoverManagerService = s, this._initSelectionUpdateListener(), this._initEditorBridge(), this._initHoverEvent();
250
- }
251
- _handleSelectionChange(e, i, r) {
252
- var f, g, C;
253
- const n = (f = e[0]) == null ? void 0 : f.range, o = this._renderManagerService.getRenderById(i), s = (g = o == null ? void 0 : o.with(ke).getSkeletonParam(r)) == null ? void 0 : g.skeleton;
254
- if (!s || !n)
255
- return;
256
- const a = s.getCellWithCoordByIndex(n.startRow, n.startColumn);
257
- if ((((C = n.rangeType) != null ? C : X.NORMAL) !== X.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && Pe.equals(a.mergeInfo, n))) {
258
- this._sheetsNotePopupService.hidePopup();
259
- return;
260
- }
261
- const l = a.actualRow, h = a.actualColumn, p = this._sheetsNoteModel.getNote(i, r, l, h);
262
- p != null && p.show || (p ? this._sheetsNotePopupService.showPopup({
263
- unitId: i,
264
- subUnitId: r,
265
- row: l,
266
- col: h
267
- }) : this._sheetsNotePopupService.hidePopup(!0));
268
- }
269
- _initSelectionUpdateListener() {
270
- this.disposeWithMe(
271
- this._sheetSelectionService.selectionMoveEnd$.subscribe((e) => {
272
- if (this._isSwitchingSheet)
273
- return;
274
- const i = this._sheetSelectionService.currentSelectionParam;
275
- i && this._handleSelectionChange(e, i.unitId, i.sheetId);
276
- })
277
- );
278
- }
279
- _initEditorBridge() {
280
- this.disposeWithMe(
281
- this._editorBridgeService.visible$.subscribe((e) => {
282
- e.visible && this._sheetsNotePopupService.hidePopup(!0);
283
- })
284
- );
285
- }
286
- _initHoverEvent() {
287
- this.disposeWithMe(
288
- this._hoverManagerService.currentCell$.pipe(qe(100)).subscribe((e) => {
289
- if (!(e != null && e.location)) return;
290
- const { unitId: i, subUnitId: r, row: n, col: o } = e.location, s = this._sheetsNoteModel.getNote(i, r, n, o);
291
- s != null && s.show || (s ? this._sheetsNotePopupService.showPopup({
292
- unitId: i,
293
- subUnitId: r,
294
- row: n,
295
- col: o,
296
- temp: !0
297
- }) : this._sheetsNotePopupService.hidePopup());
298
- })
299
- );
300
- }
301
- };
302
- T = lt([
303
- N(0, d(P)),
304
- N(1, d(M)),
305
- N(2, d(z)),
306
- N(3, je),
307
- N(4, W),
308
- N(5, d(Ze))
309
309
  ], T);
310
310
  var v = function() {
311
311
  return v = Object.assign || function(t) {
@@ -381,7 +381,7 @@ const $ = {
381
381
  id: "sheet.operation.add-note-popup",
382
382
  type: Ie.OPERATION,
383
383
  handler: async (t, e) => {
384
- const i = t.get(z), r = t.get(P), o = t.get(D).getCurrentUnitForType(b.UNIVER_SHEET);
384
+ const i = t.get(W), r = t.get(P), o = t.get(D).getCurrentUnitForType(b.UNIVER_SHEET);
385
385
  if (!o)
386
386
  return !1;
387
387
  const s = o.getActiveSheet(), a = i.getCurrentLastSelection();
@@ -399,21 +399,21 @@ const $ = {
399
399
  }
400
400
  }, Ct = (t) => {
401
401
  var C;
402
- const e = y(M), i = y(we), r = y(W), n = Ae(he), o = (C = t.popup.extraProps) == null ? void 0 : C.location;
402
+ const e = y(M), i = y(we), r = y(F), n = Fe(he), o = (C = t.popup.extraProps) == null ? void 0 : C.location;
403
403
  if (!o)
404
404
  return console.error("Popup extraProps or location is undefined."), null;
405
405
  const s = r.getRenderById(o.unitId), [a, c] = tt(() => {
406
406
  var m, I;
407
407
  const u = { width: ((m = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : m.width) || 216, height: ((I = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : I.height) || 92, note: "" };
408
408
  return e.getNote(o.unitId, o.subUnitId, o.row, o.col) || u;
409
- }), l = pe(null), h = y(ne), p = it(() => o ? e.getCellNoteChange$(o.unitId, o.subUnitId, o.row, o.col) : ce(null), [o]), f = Fe((u) => {
410
- o && (u.note ? h.executeCommand(xe.id, {
409
+ }), l = pe(null), h = y(ne), p = it(() => o ? e.getCellNoteChange$(o.unitId, o.subUnitId, o.row, o.col) : ce(null), [o]), f = We((u) => {
410
+ o && (u.note ? h.executeCommand($e.id, {
411
411
  unitId: o.unitId,
412
412
  sheetId: o.subUnitId,
413
413
  row: o.row,
414
414
  col: o.col,
415
415
  note: u
416
- }) : h.executeCommand(F.id, {
416
+ }) : h.executeCommand(z.id, {
417
417
  unitId: o.unitId,
418
418
  sheetId: o.subUnitId,
419
419
  row: o.row,
@@ -466,11 +466,11 @@ const $ = {
466
466
  );
467
467
  };
468
468
  function Y(t) {
469
- const e = t.get(z), i = t.get(D);
469
+ const e = t.get(W), i = t.get(D);
470
470
  return e.selectionMoveEnd$.pipe(R(() => {
471
471
  const r = e.getCurrentLastSelection();
472
472
  if (!(r != null && r.primary)) return !1;
473
- const n = Ue(i);
473
+ const n = Te(i);
474
474
  if (!n) return !1;
475
475
  const { actualColumn: o, actualRow: s } = r.primary;
476
476
  return !!t.get(M).getNote(n.unitId, n.subUnitId, s, o);
@@ -482,24 +482,24 @@ function mt(t) {
482
482
  type: G.BUTTON,
483
483
  title: "rightClick.addNote",
484
484
  icon: "AddNoteIcon",
485
- hidden$: Ve([We(t, b.UNIVER_SHEET), Y(t)]).pipe(R(([e, i]) => e || i)),
486
- disabled$: le(t, { workbookTypes: [ae], worksheetTypes: [se] }),
485
+ hidden$: Ve([ze(t, b.UNIVER_SHEET), Y(t)]).pipe(R(([e, i]) => e || i)),
486
+ disabled$: le(t, { workbookTypes: [se], worksheetTypes: [oe] }),
487
487
  commandId: $.id
488
488
  };
489
489
  }
490
490
  function St(t) {
491
491
  return {
492
- id: F.id,
492
+ id: z.id,
493
493
  type: G.BUTTON,
494
494
  title: "rightClick.deleteNote",
495
495
  icon: "DeleteNoteIcon",
496
496
  hidden$: Y(t).pipe(R((e) => !e)),
497
- disabled$: le(t, { workbookTypes: [ae], worksheetTypes: [se] })
497
+ disabled$: le(t, { workbookTypes: [se], worksheetTypes: [oe] })
498
498
  };
499
499
  }
500
500
  function Nt(t) {
501
501
  return {
502
- id: oe.id,
502
+ id: ae.id,
503
503
  type: G.BUTTON,
504
504
  title: "rightClick.toggleNote",
505
505
  icon: "HideNoteIcon",
@@ -507,18 +507,18 @@ function Nt(t) {
507
507
  };
508
508
  }
509
509
  const Pt = {
510
- [ze.MAIN_AREA]: {
511
- [Ge.OTHERS]: {
510
+ [Ge.MAIN_AREA]: {
511
+ [Ke.OTHERS]: {
512
512
  order: 0,
513
513
  [$.id]: {
514
514
  order: 0,
515
515
  menuItemFactory: mt
516
516
  },
517
- [F.id]: {
517
+ [z.id]: {
518
518
  order: 0,
519
519
  menuItemFactory: St
520
520
  },
521
- [oe.id]: {
521
+ [ae.id]: {
522
522
  order: 0,
523
523
  menuItemFactory: Nt
524
524
  }
@@ -554,8 +554,8 @@ let U = class extends w {
554
554
  }
555
555
  };
556
556
  U = wt([
557
- A(0, d(Ke)),
558
- A(1, d(Ye)),
557
+ A(0, d(Ye)),
558
+ A(1, d(qe)),
559
559
  A(2, ne)
560
560
  ], U);
561
561
  var bt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, yt = (t, e, i) => e in t ? bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, Et = (t, e, i, r) => {
@@ -565,11 +565,11 @@ var bt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, yt = (t, e
565
565
  }, re = (t, e) => (i, r) => e(i, r, t), _e = (t, e, i) => yt(t, typeof e != "symbol" ? e + "" : e, i);
566
566
  const Ot = "SHEET_NOTE_UI_PLUGIN";
567
567
  let L = class extends Ee {
568
- constructor(t = te, e, i) {
568
+ constructor(t = ie, e, i) {
569
569
  super(), this._config = t, this._injector = e, this._configService = i;
570
570
  const { menu: r, ...n } = Oe(
571
571
  {},
572
- te,
572
+ ie,
573
573
  this._config
574
574
  );
575
575
  r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(he, n);
@@ -578,9 +578,9 @@ let L = class extends Ee {
578
578
  [
579
579
  [P],
580
580
  [x],
581
- [T],
581
+ [H],
582
582
  [U],
583
- [H]
583
+ [T]
584
584
  ].forEach((t) => {
585
585
  this._injector.add(t);
586
586
  });
@@ -593,22 +593,22 @@ let L = class extends Ee {
593
593
  }
594
594
  onRendered() {
595
595
  ee(this._injector, [
596
- [T],
597
- [H]
596
+ [H],
597
+ [T]
598
598
  ]);
599
599
  }
600
600
  };
601
601
  _e(L, "pluginName", Ot);
602
602
  _e(L, "type", b.UNIVER_SHEET);
603
603
  L = Et([
604
- be(He),
604
+ be(Ue),
605
605
  re(1, d(Me)),
606
606
  re(2, ye)
607
607
  ], L);
608
608
  export {
609
609
  x as SheetsCellContentController,
610
610
  Ct as SheetsNote,
611
- T as SheetsNotePopupController,
611
+ H as SheetsNotePopupController,
612
612
  P as SheetsNotePopupService,
613
613
  L as UniverSheetsNoteUIPlugin
614
614
  };
@@ -0,0 +1,13 @@
1
+ const e = {
2
+ rightClick: {
3
+ addNote: "노트 추가",
4
+ deleteNote: "노트 삭제",
5
+ toggleNote: "노트 표시/숨기기"
6
+ },
7
+ note: {
8
+ placeholder: "여기에 입력"
9
+ }
10
+ };
11
+ export {
12
+ e as default
13
+ };