@univerjs/sheets-note-ui 0.10.10 → 0.10.11-nightly.202510220308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +37 -29
- package/lib/index.js +37 -29
- package/lib/types/controllers/sheets-note-attachment.controller.d.ts +1 -0
- package/lib/types/services/sheets-note-popup.service.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +15 -14
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ne=Object.defineProperty;var re=(r,e,t)=>e in r?ne(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var M=(r,e,t)=>re(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),R=require("@univerjs/engine-render"),m=require("@univerjs/sheets"),g=require("@univerjs/sheets-note"),I=require("rxjs"),w=require("@univerjs/sheets-ui"),ie=require("rxjs/operators"),d=require("@univerjs/ui"),oe=require("react/jsx-runtime"),B=require("@univerjs/design"),v=require("react");var se=Object.getOwnPropertyDescriptor,ae=(r,e,t,n)=>{for(var i=n>1?void 0:n?se(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(m.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=ae([O(0,a.Inject(m.SheetInterceptorService)),O(1,a.Inject(g.SheetsNoteModel)),O(2,R.IRenderManagerService),O(3,a.IUniverInstanceService)],exports.SheetsCellContentController);const L="SHEET_NOTE_COMPONENT";var ce=Object.getOwnPropertyDescriptor,ue=(r,e,t,n)=>{for(var i=n>1?void 0:n?ce(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 p;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===((p=this.activePopup)==null?void 0:p.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 l=new a.DisposableCollection;l.add(u),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}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=ue([A(0,d.IZenZoneService),A(1,a.Inject(w.CellPopupManagerService))],exports.SheetsNotePopupService);var le=Object.getOwnPropertyDescriptor,pe=(r,e,t,n)=>{for(var i=n>1?void 0:n?le(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 _,N,P;const o=(_=t[0])==null?void 0:_.range,s=this._renderManagerService.getRenderById(n),c=(N=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(i))==null?void 0:N.skeleton;if(!c||!o)return;const u=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((P=o.rangeType)!=null?P: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 p=u.actualRow,h=u.actualColumn,C=this._sheetsNoteModel.getNote(n,i,p,h);C!=null&&C.show||(C?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,row:p,col:h}):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(ie.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=pe([y(0,a.Inject(exports.SheetsNotePopupService)),y(1,a.Inject(g.SheetsNoteModel)),y(2,a.Inject(m.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 he=Object.getOwnPropertyDescriptor,de=(r,e,t,n)=>{for(var i=n>1?void 0:n?he(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 T=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,l,p)=>{const h=this._noteMatrix,C=h.getValue(u,l);if(p!=null&&p.show){if(!C){const _=this._showPopup(s,c,u,l);_&&h.setValue(u,l,_)}}else C&&(C.dispose(),h.realDeleteValue(u,l))};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:l,col:p,newPosition:h,note:C}=s,_=this._noteMatrix;if(!C.show)return;const N=_.getValue(l,p);N&&(N.dispose(),_.realDeleteValue(l,p));const P=this._showPopup(c,u,h.row,h.col);P&&_.setValue(h.row,h.col,P);break}case"update":{const{unitId:c,sheetId:u,row:l,col:p,note:h}=s;i(c,u,l,p,h);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}))}};T=de([x(0,a.Inject(g.SheetsNoteModel)),x(1,a.Inject(a.IUniverInstanceService)),x(2,a.Inject(w.CellPopupManagerService)),x(3,a.Inject(exports.SheetsNotePopupService))],T);var f=function(){return f=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},f.apply(this,arguments)},ve=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=v.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,o=r.extend,s=ve(r,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),u=v.useRef("_".concat(ge()));return z(t,"".concat(n),{defIds:t.defIds,idSuffix:u.current},f({ref:e,className:c},s),o)});function z(r,e,t,n,i){return v.createElement(r.tag,f(f({key:e},Ce(r,t,i)),n),(fe(r,t).children||[]).map(function(o,s){return z(o,"".concat(e,"-").concat(r.tag,"-").concat(s),t,void 0,i)}))}function Ce(r,e,t){var n=f({},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 fe(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)?f(f({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.includes(i.attrs.id)?f(f({},i),{attrs:f(f({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function ge(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";var _e={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"add-note-icon",ref:e,icon:_e}))});G.displayName="AddNoteIcon";var Se={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"delete-note-icon",ref:e,icon:Se}))});K.displayName="DeleteNoteIcon";var me={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"hide-note-icon",ref:e,icon:me}))});Y.displayName="HideNoteIcon";const U={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=r.get(m.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{popup:e}=r,t=d.useDependency(g.SheetsNoteModel),n=d.useDependency(a.LocaleService),i=d.useDependency(R.IRenderManagerService),o=d.useConfigValue(q),s=(P=e.extraProps)==null?void 0:P.location;if(!s)return console.error("Popup extraProps or location is undefined."),null;const c=v.useRef(null),u=i.getRenderById(s.unitId),[l,p]=v.useState(null);v.useEffect(()=>{var k,Z;const{unitId:S,subUnitId:b,row:E,col:X}=s,{width:ee=160,height:te=72}=(k=o==null?void 0:o.defaultNoteSize)!=null?k:{},$=(Z=t.getNote(S,b,E,X))!=null?Z:{width:ee,height:te,note:""};c.current&&(p($),c.current.style.width=`${$.width}px`,c.current.style.height=`${$.height}px`)},[s,c]);const h=d.useDependency(a.ICommandService),C=d.useDebounceFn(S=>{s&&(S.note?h.executeCommand(g.SheetUpdateNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col,note:S}):h.executeCommand(g.SheetDeleteNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col}))}),_=v.useCallback(S=>{if(!l)return;const b={...l,note:S};p(b),C(b)},[l]),N=v.useCallback((S,b)=>{if(!l)return;const E={...l,width:S,height:b};p(E),C(E)},[l]);return oe.jsx(B.Textarea,{ref:c,"data-u-comp":"note-textarea",className:B.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:l==null?void 0:l.note,placeholder:n.t("note.placeholder"),onResize:N,onValueChange:_,onWheel:S=>{document.activeElement!==c.current&&u.engine.getCanvasElement().dispatchEvent(new WheelEvent(S.type,S.nativeEvent))}})};function V(r){const e=r.get(m.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=m.getSheetCommandTarget(t);if(!i)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!r.get(g.SheetsNoteModel).getNote(i.unitId,i.subUnitId,s,o)}))}function Ie(r){return{id:U.id,type:d.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:I.combineLatest([d.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SHEET),V(r)]).pipe(I.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetEditPermission]}),commandId:U.id}}function Pe(r){return{id:g.SheetDeleteNoteCommand.id,type:d.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:V(r).pipe(I.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetEditPermission]})}}function Ne(r){return{id:g.SheetToggleNotePopupCommand.id,type:d.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:V(r).pipe(I.map(e=>!e))}}const Me={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{order:0,[U.id]:{order:0,menuItemFactory:Ie},[g.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:Pe},[g.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:Ne}}}};var we=Object.getOwnPropertyDescriptor,be=(r,e,t,n)=>{for(var i=n>1?void 0:n?we(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(Me)}_initCommands(){this._commandService.registerCommand(U)}};H=be([j(0,a.Inject(d.ComponentManager)),j(1,a.Inject(d.IMenuManagerService)),j(2,a.ICommandService)],H);var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(r,e,t)=>e in r?ye(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xe=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ee(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)=>Oe(r,typeof e!="symbol"?e+"":e,t);const Te="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],[T]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[H],[exports.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[exports.SheetsNotePopupController],[T]])}};Q(exports.UniverSheetsNoteUIPlugin,"pluginName",Te);Q(exports.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsNoteUIPlugin=xe([a.DependentOn(g.UniverSheetsNotePlugin),F(1,a.Inject(a.Injector)),F(2,a.IConfigService)],exports.UniverSheetsNoteUIPlugin);exports.SheetsNote=J;
|
|
1
|
+
"use strict";var ne=Object.defineProperty;var re=(r,e,t)=>e in r?ne(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var M=(r,e,t)=>re(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),R=require("@univerjs/engine-render"),m=require("@univerjs/sheets"),g=require("@univerjs/sheets-note"),P=require("rxjs"),w=require("@univerjs/sheets-ui"),ie=require("rxjs/operators"),d=require("@univerjs/ui"),oe=require("react/jsx-runtime"),B=require("@univerjs/design"),v=require("react");var se=Object.getOwnPropertyDescriptor,ae=(r,e,t,n)=>{for(var i=n>1?void 0:n?se(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(m.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(P.debounceTime(16)).subscribe(()=>{e()}))}};exports.SheetsCellContentController=ae([O(0,a.Inject(m.SheetInterceptorService)),O(1,a.Inject(g.SheetsNoteModel)),O(2,R.IRenderManagerService),O(3,a.IUniverInstanceService)],exports.SheetsCellContentController);const L="SHEET_NOTE_COMPONENT";var ce=Object.getOwnPropertyDescriptor,ue=(r,e,t,n)=>{for(var i=n>1?void 0:n?ce(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 P.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()}))}dispose(){super.dispose(),this.hidePopup()}showPopup(t,n){var p;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===((p=this.activePopup)==null?void 0:p.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 l=new a.DisposableCollection;l.add(u),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}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=ue([A(0,d.IZenZoneService),A(1,a.Inject(w.CellPopupManagerService))],exports.SheetsNotePopupService);var le=Object.getOwnPropertyDescriptor,pe=(r,e,t,n)=>{for(var i=n>1?void 0:n?le(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 _,N,I;const o=(_=t[0])==null?void 0:_.range,s=this._renderManagerService.getRenderById(n),c=(N=s==null?void 0:s.with(w.SheetSkeletonManagerService).getSkeletonParam(i))==null?void 0:N.skeleton;if(!c||!o)return;const u=c.getCellWithCoordByIndex(o.startRow,o.startColumn);if((((I=o.rangeType)!=null?I: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 p=u.actualRow,h=u.actualColumn,C=this._sheetsNoteModel.getNote(n,i,p,h);C!=null&&C.show||(C?this._sheetsNotePopupService.showPopup({unitId:n,subUnitId:i,row:p,col:h}):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(ie.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=pe([y(0,a.Inject(exports.SheetsNotePopupService)),y(1,a.Inject(g.SheetsNoteModel)),y(2,a.Inject(m.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 he=Object.getOwnPropertyDescriptor,de=(r,e,t,n)=>{for(var i=n>1?void 0:n?he(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 T=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})}dispose(){super.dispose(),this._noteMatrix.forValue((e,t,n)=>{n.dispose()})}_initSheet(e,t){var o;this._noteMatrix.forValue((s,c,u)=>{u.dispose()}),this._noteMatrix=new a.ObjectMatrix;const i=(s,c,u,l,p)=>{const h=this._noteMatrix,C=h.getValue(u,l);if(p!=null&&p.show){if(!C){const _=this._showPopup(s,c,u,l);_&&h.setValue(u,l,_)}}else C&&(C.dispose(),h.realDeleteValue(u,l))};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:l,col:p,newPosition:h,note:C}=s,_=this._noteMatrix;if(!C.show)return;const N=_.getValue(l,p);N&&(N.dispose(),_.realDeleteValue(l,p));const I=this._showPopup(c,u,h.row,h.col);I&&_.setValue(h.row,h.col,I);break}case"update":{const{unitId:c,sheetId:u,row:l,col:p,note:h}=s;i(c,u,l,p,h);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,i)=>{i.dispose()}),this._noteMatrix=new a.ObjectMatrix}))}};T=de([x(0,a.Inject(g.SheetsNoteModel)),x(1,a.Inject(a.IUniverInstanceService)),x(2,a.Inject(w.CellPopupManagerService)),x(3,a.Inject(exports.SheetsNotePopupService))],T);var f=function(){return f=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},f.apply(this,arguments)},ve=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=v.forwardRef(function(r,e){var t=r.icon,n=r.id,i=r.className,o=r.extend,s=ve(r,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),u=v.useRef("_".concat(ge()));return z(t,"".concat(n),{defIds:t.defIds,idSuffix:u.current},f({ref:e,className:c},s),o)});function z(r,e,t,n,i){return v.createElement(r.tag,f(f({key:e},Ce(r,t,i)),n),(fe(r,t).children||[]).map(function(o,s){return z(o,"".concat(e,"-").concat(r.tag,"-").concat(s),t,void 0,i)}))}function Ce(r,e,t){var n=f({},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 fe(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)?f(f({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.includes(i.attrs.id)?f(f({},i),{attrs:f(f({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):r}function ge(){return Math.random().toString(36).substring(2,8)}D.displayName="UniverIcon";var _e={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"add-note-icon",ref:e,icon:_e}))});G.displayName="AddNoteIcon";var Se={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"delete-note-icon",ref:e,icon:Se}))});K.displayName="DeleteNoteIcon";var me={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=v.forwardRef(function(r,e){return v.createElement(D,Object.assign({},r,{id:"hide-note-icon",ref:e,icon:me}))});Y.displayName="HideNoteIcon";const U={id:"sheet.operation.add-note-popup",type:a.CommandType.OPERATION,handler:async(r,e)=>{const t=r.get(m.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 I;const{popup:e}=r,t=d.useDependency(g.SheetsNoteModel),n=d.useDependency(a.LocaleService),i=d.useDependency(R.IRenderManagerService),o=d.useConfigValue(q),s=(I=e.extraProps)==null?void 0:I.location;if(!s)return console.error("Popup extraProps or location is undefined."),null;const c=v.useRef(null),u=i.getRenderById(s.unitId),[l,p]=v.useState(null);v.useEffect(()=>{var k,Z;const{unitId:S,subUnitId:b,row:E,col:X}=s,{width:ee=160,height:te=72}=(k=o==null?void 0:o.defaultNoteSize)!=null?k:{},$=(Z=t.getNote(S,b,E,X))!=null?Z:{width:ee,height:te,note:""};c.current&&(p($),c.current.style.width=`${$.width}px`,c.current.style.height=`${$.height}px`)},[s,c]);const h=d.useDependency(a.ICommandService),C=d.useDebounceFn(S=>{s&&(S.note?h.executeCommand(g.SheetUpdateNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col,note:S}):h.executeCommand(g.SheetDeleteNoteCommand.id,{unitId:s.unitId,sheetId:s.subUnitId,row:s.row,col:s.col}))}),_=v.useCallback(S=>{if(!l)return;const b={...l,note:S};p(b),C(b)},[l]),N=v.useCallback((S,b)=>{if(!l)return;const E={...l,width:S,height:b};p(E),C(E)},[l]);return oe.jsx(B.Textarea,{ref:c,"data-u-comp":"note-textarea",className:B.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:l==null?void 0:l.note,placeholder:n.t("note.placeholder"),onResize:N,onValueChange:_,onWheel:S=>{document.activeElement!==c.current&&u.engine.getCanvasElement().dispatchEvent(new WheelEvent(S.type,S.nativeEvent))}})};function V(r){const e=r.get(m.SheetsSelectionsService),t=r.get(a.IUniverInstanceService);return e.selectionMoveEnd$.pipe(P.map(()=>{const n=e.getCurrentLastSelection();if(!(n!=null&&n.primary))return!1;const i=m.getSheetCommandTarget(t);if(!i)return!1;const{actualColumn:o,actualRow:s}=n.primary;return!!r.get(g.SheetsNoteModel).getNote(i.unitId,i.subUnitId,s,o)}))}function Pe(r){return{id:U.id,type:d.MenuItemType.BUTTON,title:"rightClick.addNote",icon:"AddNoteIcon",hidden$:P.combineLatest([d.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_SHEET),V(r)]).pipe(P.map(([e,t])=>e||t)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetEditPermission]}),commandId:U.id}}function Ie(r){return{id:g.SheetDeleteNoteCommand.id,type:d.MenuItemType.BUTTON,title:"rightClick.deleteNote",icon:"DeleteNoteIcon",hidden$:V(r).pipe(P.map(e=>!e)),disabled$:w.getCurrentRangeDisable$(r,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetEditPermission]})}}function Ne(r){return{id:g.SheetToggleNotePopupCommand.id,type:d.MenuItemType.BUTTON,title:"rightClick.toggleNote",icon:"HideNoteIcon",hidden$:V(r).pipe(P.map(e=>!e))}}const Me={[d.ContextMenuPosition.MAIN_AREA]:{[d.ContextMenuGroup.OTHERS]:{order:0,[U.id]:{order:0,menuItemFactory:Pe},[g.SheetDeleteNoteCommand.id]:{order:0,menuItemFactory:Ie},[g.SheetToggleNotePopupCommand.id]:{order:0,menuItemFactory:Ne}}}};var we=Object.getOwnPropertyDescriptor,be=(r,e,t,n)=>{for(var i=n>1?void 0:n?we(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(Me)}_initCommands(){this._commandService.registerCommand(U)}};H=be([j(0,a.Inject(d.ComponentManager)),j(1,a.Inject(d.IMenuManagerService)),j(2,a.ICommandService)],H);var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(r,e,t)=>e in r?ye(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xe=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ee(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)=>Oe(r,typeof e!="symbol"?e+"":e,t);const Te="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],[T]].forEach(e=>{this._injector.add(e)})}onReady(){a.touchDependencies(this._injector,[[H],[exports.SheetsCellContentController]])}onRendered(){a.touchDependencies(this._injector,[[exports.SheetsNotePopupController],[T]])}};Q(exports.UniverSheetsNoteUIPlugin,"pluginName",Te);Q(exports.UniverSheetsNoteUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsNoteUIPlugin=xe([a.DependentOn(g.UniverSheetsNotePlugin),F(1,a.Inject(a.Injector)),F(2,a.IConfigService)],exports.UniverSheetsNoteUIPlugin);exports.SheetsNote=J;
|
package/lib/es/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Se = Object.defineProperty;
|
|
2
2
|
var Pe = (t, e, i) => e in t ? Se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var g = (t, e, i) => Pe(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { Inject as h, IUniverInstanceService as D, Disposable as N, InterceptorEffectEnum as Ie, UniverInstanceType as
|
|
4
|
+
import { Inject as h, IUniverInstanceService as D, Disposable as N, InterceptorEffectEnum as Ie, UniverInstanceType as M, DisposableCollection as Ne, RANGE_TYPE as Q, Rectangle as Me, ObjectMatrix as B, CommandType as we, LocaleService as be, ICommandService as ne, DependentOn as ye, Injector as Ee, IConfigService as Oe, Plugin as xe, merge as He, touchDependencies as X } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as F } from "@univerjs/engine-render";
|
|
6
6
|
import { SheetInterceptorService as Te, INTERCEPTOR_POINT as $e, SheetsSelectionsService as W, WorksheetEditPermission as oe, WorkbookEditablePermission as se, getSheetCommandTarget as Le } from "@univerjs/sheets";
|
|
7
|
-
import { SheetsNoteModel as
|
|
8
|
-
import { debounceTime as
|
|
7
|
+
import { SheetsNoteModel as w, SheetUpdateNoteCommand as Ue, SheetDeleteNoteCommand as z, SheetToggleNotePopupCommand as ae, UniverSheetsNotePlugin as De } from "@univerjs/sheets-note";
|
|
8
|
+
import { debounceTime as Ve, BehaviorSubject as Re, switchMap as je, of as Ze, map as V, combineLatest as ke } from "rxjs";
|
|
9
9
|
import { CellPopupManagerService as ce, IEditorBridgeService as Be, HoverManagerService as Ae, SheetSkeletonManagerService as Fe, getCurrentRangeDisable$ as ue } from "@univerjs/sheets-ui";
|
|
10
10
|
import { debounceTime as We } from "rxjs/operators";
|
|
11
11
|
import { IZenZoneService as ze, useDependency as y, useConfigValue as Ge, useDebounceFn as Ke, MenuItemType as G, getMenuHiddenObservable as Ye, ContextMenuPosition as qe, ContextMenuGroup as Je, ComponentManager as Qe, IMenuManagerService as Xe } from "@univerjs/ui";
|
|
12
12
|
import { jsx as et } from "react/jsx-runtime";
|
|
13
13
|
import { Textarea as tt, clsx as it } from "@univerjs/design";
|
|
14
|
-
import { forwardRef as
|
|
14
|
+
import { forwardRef as R, useRef as le, createElement as j, useState as rt, useEffect as nt, useCallback as ee } from "react";
|
|
15
15
|
var ot = Object.getOwnPropertyDescriptor, st = (t, e, i, r) => {
|
|
16
16
|
for (var n = r > 1 ? void 0 : r ? ot(e, i) : e, s = t.length - 1, o; s >= 0; s--)
|
|
17
17
|
(o = t[s]) && (n = o(n) || n);
|
|
@@ -45,19 +45,19 @@ let x = class extends N {
|
|
|
45
45
|
_initSkeletonChange() {
|
|
46
46
|
const t = () => {
|
|
47
47
|
var n;
|
|
48
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
48
|
+
const e = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SHEET);
|
|
49
49
|
if (!e) return;
|
|
50
50
|
const i = e.getUnitId(), r = this._renderManagerService.getRenderById(i);
|
|
51
51
|
(n = r == null ? void 0 : r.mainComponent) == null || n.makeForceDirty();
|
|
52
52
|
};
|
|
53
|
-
this.disposeWithMe(this._sheetsNoteModel.change$.pipe(
|
|
53
|
+
this.disposeWithMe(this._sheetsNoteModel.change$.pipe(Ve(16)).subscribe(() => {
|
|
54
54
|
t();
|
|
55
55
|
}));
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
x = st([
|
|
59
59
|
E(0, h(Te)),
|
|
60
|
-
E(1, h(
|
|
60
|
+
E(1, h(w)),
|
|
61
61
|
E(2, F),
|
|
62
62
|
E(3, D)
|
|
63
63
|
], x);
|
|
@@ -72,7 +72,7 @@ let P = class extends N {
|
|
|
72
72
|
super();
|
|
73
73
|
g(this, "_lastPopup", null);
|
|
74
74
|
g(this, "_activePopup");
|
|
75
|
-
g(this, "_activePopup$", new
|
|
75
|
+
g(this, "_activePopup$", new Re(null));
|
|
76
76
|
g(this, "activePopup$", this._activePopup$.asObservable());
|
|
77
77
|
this._zenZoneService = e, this._cellPopupManagerService = i, this._initZenVisible(), this.disposeWithMe(() => {
|
|
78
78
|
this._activePopup$.complete();
|
|
@@ -86,6 +86,9 @@ let P = class extends N {
|
|
|
86
86
|
e && this.hidePopup();
|
|
87
87
|
}));
|
|
88
88
|
}
|
|
89
|
+
dispose() {
|
|
90
|
+
super.dispose(), this.hidePopup();
|
|
91
|
+
}
|
|
89
92
|
showPopup(e, i) {
|
|
90
93
|
var c;
|
|
91
94
|
const { row: r, col: n, unitId: s, subUnitId: o } = e;
|
|
@@ -155,7 +158,7 @@ let H = class extends N {
|
|
|
155
158
|
if (!o || !n)
|
|
156
159
|
return;
|
|
157
160
|
const a = o.getCellWithCoordByIndex(n.startRow, n.startColumn);
|
|
158
|
-
if ((((C = n.rangeType) != null ? C : Q.NORMAL) !== Q.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) &&
|
|
161
|
+
if ((((C = n.rangeType) != null ? C : Q.NORMAL) !== Q.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && Me.equals(a.mergeInfo, n))) {
|
|
159
162
|
this._sheetsNotePopupService.hidePopup();
|
|
160
163
|
return;
|
|
161
164
|
}
|
|
@@ -202,7 +205,7 @@ let H = class extends N {
|
|
|
202
205
|
};
|
|
203
206
|
H = lt([
|
|
204
207
|
S(0, h(P)),
|
|
205
|
-
S(1, h(
|
|
208
|
+
S(1, h(w)),
|
|
206
209
|
S(2, h(W)),
|
|
207
210
|
S(3, Be),
|
|
208
211
|
S(4, F),
|
|
@@ -243,6 +246,11 @@ let T = class extends N {
|
|
|
243
246
|
}
|
|
244
247
|
);
|
|
245
248
|
}
|
|
249
|
+
dispose() {
|
|
250
|
+
super.dispose(), this._noteMatrix.forValue((e, i, r) => {
|
|
251
|
+
r.dispose();
|
|
252
|
+
});
|
|
253
|
+
}
|
|
246
254
|
_initSheet(e, i) {
|
|
247
255
|
var s;
|
|
248
256
|
this._noteMatrix.forValue((o, a, u) => {
|
|
@@ -282,7 +290,7 @@ let T = class extends N {
|
|
|
282
290
|
}
|
|
283
291
|
_initNoteChangeListener() {
|
|
284
292
|
this.disposeWithMe(
|
|
285
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
293
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(M.UNIVER_SHEET).pipe(
|
|
286
294
|
je((e) => {
|
|
287
295
|
var i;
|
|
288
296
|
return (i = e == null ? void 0 : e.activeSheet$) != null ? i : Ze(null);
|
|
@@ -302,7 +310,7 @@ let T = class extends N {
|
|
|
302
310
|
}
|
|
303
311
|
};
|
|
304
312
|
T = ht([
|
|
305
|
-
O(0, h(
|
|
313
|
+
O(0, h(w)),
|
|
306
314
|
O(1, h(D)),
|
|
307
315
|
O(2, h(ce)),
|
|
308
316
|
O(3, h(P))
|
|
@@ -322,7 +330,7 @@ var d = function() {
|
|
|
322
330
|
for (var n = 0, r = Object.getOwnPropertySymbols(t); n < r.length; n++)
|
|
323
331
|
e.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[n]) && (i[r[n]] = t[r[n]]);
|
|
324
332
|
return i;
|
|
325
|
-
}, Z =
|
|
333
|
+
}, Z = R(function(t, e) {
|
|
326
334
|
var i = t.icon, r = t.id, n = t.className, s = t.extend, o = dt(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(n || "").trim(), u = le("_".concat(_t()));
|
|
327
335
|
return he(i, "".concat(r), { defIds: i.defIds, idSuffix: u.current }, d({ ref: e, className: a }, o), s);
|
|
328
336
|
});
|
|
@@ -353,7 +361,7 @@ function _t() {
|
|
|
353
361
|
return Math.random().toString(36).substring(2, 8);
|
|
354
362
|
}
|
|
355
363
|
Z.displayName = "UniverIcon";
|
|
356
|
-
var Ct = { 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" } }] }, de =
|
|
364
|
+
var Ct = { 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" } }] }, de = R(function(t, e) {
|
|
357
365
|
return j(Z, Object.assign({}, t, {
|
|
358
366
|
id: "add-note-icon",
|
|
359
367
|
ref: e,
|
|
@@ -361,7 +369,7 @@ var Ct = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
361
369
|
}));
|
|
362
370
|
});
|
|
363
371
|
de.displayName = "AddNoteIcon";
|
|
364
|
-
var gt = { 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" } }] }, fe =
|
|
372
|
+
var gt = { 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" } }] }, fe = R(function(t, e) {
|
|
365
373
|
return j(Z, Object.assign({}, t, {
|
|
366
374
|
id: "delete-note-icon",
|
|
367
375
|
ref: e,
|
|
@@ -369,7 +377,7 @@ var gt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
369
377
|
}));
|
|
370
378
|
});
|
|
371
379
|
fe.displayName = "DeleteNoteIcon";
|
|
372
|
-
var mt = { 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" } }] }, ve =
|
|
380
|
+
var mt = { 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" } }] }, ve = R(function(t, e) {
|
|
373
381
|
return j(Z, Object.assign({}, t, {
|
|
374
382
|
id: "hide-note-icon",
|
|
375
383
|
ref: e,
|
|
@@ -379,9 +387,9 @@ var mt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
379
387
|
ve.displayName = "HideNoteIcon";
|
|
380
388
|
const $ = {
|
|
381
389
|
id: "sheet.operation.add-note-popup",
|
|
382
|
-
type:
|
|
390
|
+
type: we.OPERATION,
|
|
383
391
|
handler: async (t, e) => {
|
|
384
|
-
const i = t.get(W), r = t.get(P), s = t.get(D).getCurrentUnitForType(
|
|
392
|
+
const i = t.get(W), r = t.get(P), s = t.get(D).getCurrentUnitForType(M.UNIVER_SHEET);
|
|
385
393
|
if (!s)
|
|
386
394
|
return !1;
|
|
387
395
|
const o = s.getActiveSheet(), a = i.getCurrentLastSelection();
|
|
@@ -399,7 +407,7 @@ const $ = {
|
|
|
399
407
|
}
|
|
400
408
|
}, St = (t) => {
|
|
401
409
|
var I;
|
|
402
|
-
const { popup: e } = t, i = y(
|
|
410
|
+
const { popup: e } = t, i = y(w), r = y(be), n = y(F), s = Ge(pe), o = (I = e.extraProps) == null ? void 0 : I.location;
|
|
403
411
|
if (!o)
|
|
404
412
|
return console.error("Popup extraProps or location is undefined."), null;
|
|
405
413
|
const a = le(null), u = n.getRenderById(o.unitId), [c, p] = rt(null);
|
|
@@ -448,13 +456,13 @@ const $ = {
|
|
|
448
456
|
};
|
|
449
457
|
function Y(t) {
|
|
450
458
|
const e = t.get(W), i = t.get(D);
|
|
451
|
-
return e.selectionMoveEnd$.pipe(
|
|
459
|
+
return e.selectionMoveEnd$.pipe(V(() => {
|
|
452
460
|
const r = e.getCurrentLastSelection();
|
|
453
461
|
if (!(r != null && r.primary)) return !1;
|
|
454
462
|
const n = Le(i);
|
|
455
463
|
if (!n) return !1;
|
|
456
464
|
const { actualColumn: s, actualRow: o } = r.primary;
|
|
457
|
-
return !!t.get(
|
|
465
|
+
return !!t.get(w).getNote(n.unitId, n.subUnitId, o, s);
|
|
458
466
|
}));
|
|
459
467
|
}
|
|
460
468
|
function Pt(t) {
|
|
@@ -463,7 +471,7 @@ function Pt(t) {
|
|
|
463
471
|
type: G.BUTTON,
|
|
464
472
|
title: "rightClick.addNote",
|
|
465
473
|
icon: "AddNoteIcon",
|
|
466
|
-
hidden$: ke([Ye(t,
|
|
474
|
+
hidden$: ke([Ye(t, M.UNIVER_SHEET), Y(t)]).pipe(V(([e, i]) => e || i)),
|
|
467
475
|
disabled$: ue(t, { workbookTypes: [se], worksheetTypes: [oe] }),
|
|
468
476
|
commandId: $.id
|
|
469
477
|
};
|
|
@@ -474,7 +482,7 @@ function It(t) {
|
|
|
474
482
|
type: G.BUTTON,
|
|
475
483
|
title: "rightClick.deleteNote",
|
|
476
484
|
icon: "DeleteNoteIcon",
|
|
477
|
-
hidden$: Y(t).pipe(
|
|
485
|
+
hidden$: Y(t).pipe(V((e) => !e)),
|
|
478
486
|
disabled$: ue(t, { workbookTypes: [se], worksheetTypes: [oe] })
|
|
479
487
|
};
|
|
480
488
|
}
|
|
@@ -484,10 +492,10 @@ function Nt(t) {
|
|
|
484
492
|
type: G.BUTTON,
|
|
485
493
|
title: "rightClick.toggleNote",
|
|
486
494
|
icon: "HideNoteIcon",
|
|
487
|
-
hidden$: Y(t).pipe(
|
|
495
|
+
hidden$: Y(t).pipe(V((e) => !e))
|
|
488
496
|
};
|
|
489
497
|
}
|
|
490
|
-
const
|
|
498
|
+
const Mt = {
|
|
491
499
|
[qe.MAIN_AREA]: {
|
|
492
500
|
[Je.OTHERS]: {
|
|
493
501
|
order: 0,
|
|
@@ -506,8 +514,8 @@ const wt = {
|
|
|
506
514
|
}
|
|
507
515
|
}
|
|
508
516
|
};
|
|
509
|
-
var
|
|
510
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
517
|
+
var wt = Object.getOwnPropertyDescriptor, bt = (t, e, i, r) => {
|
|
518
|
+
for (var n = r > 1 ? void 0 : r ? wt(e, i) : e, s = t.length - 1, o; s >= 0; s--)
|
|
511
519
|
(o = t[s]) && (n = o(n) || n);
|
|
512
520
|
return n;
|
|
513
521
|
}, A = (t, e) => (i, r) => e(i, r, t);
|
|
@@ -528,7 +536,7 @@ let L = class extends N {
|
|
|
528
536
|
});
|
|
529
537
|
}
|
|
530
538
|
_initMenu() {
|
|
531
|
-
this._menuManagerService.mergeMenu(
|
|
539
|
+
this._menuManagerService.mergeMenu(Mt);
|
|
532
540
|
}
|
|
533
541
|
_initCommands() {
|
|
534
542
|
this._commandService.registerCommand($);
|
|
@@ -580,7 +588,7 @@ let U = class extends xe {
|
|
|
580
588
|
}
|
|
581
589
|
};
|
|
582
590
|
_e(U, "pluginName", Ht);
|
|
583
|
-
_e(U, "type",
|
|
591
|
+
_e(U, "type", M.UNIVER_SHEET);
|
|
584
592
|
U = xt([
|
|
585
593
|
ye(De),
|
|
586
594
|
re(1, h(Ee)),
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Se = Object.defineProperty;
|
|
2
2
|
var Pe = (t, e, i) => e in t ? Se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var g = (t, e, i) => Pe(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { Inject as h, IUniverInstanceService as D, Disposable as N, InterceptorEffectEnum as Ie, UniverInstanceType as
|
|
4
|
+
import { Inject as h, IUniverInstanceService as D, Disposable as N, InterceptorEffectEnum as Ie, UniverInstanceType as M, DisposableCollection as Ne, RANGE_TYPE as Q, Rectangle as Me, ObjectMatrix as B, CommandType as we, LocaleService as be, ICommandService as ne, DependentOn as ye, Injector as Ee, IConfigService as Oe, Plugin as xe, merge as He, touchDependencies as X } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as F } from "@univerjs/engine-render";
|
|
6
6
|
import { SheetInterceptorService as Te, INTERCEPTOR_POINT as $e, SheetsSelectionsService as W, WorksheetEditPermission as oe, WorkbookEditablePermission as se, getSheetCommandTarget as Le } from "@univerjs/sheets";
|
|
7
|
-
import { SheetsNoteModel as
|
|
8
|
-
import { debounceTime as
|
|
7
|
+
import { SheetsNoteModel as w, SheetUpdateNoteCommand as Ue, SheetDeleteNoteCommand as z, SheetToggleNotePopupCommand as ae, UniverSheetsNotePlugin as De } from "@univerjs/sheets-note";
|
|
8
|
+
import { debounceTime as Ve, BehaviorSubject as Re, switchMap as je, of as Ze, map as V, combineLatest as ke } from "rxjs";
|
|
9
9
|
import { CellPopupManagerService as ce, IEditorBridgeService as Be, HoverManagerService as Ae, SheetSkeletonManagerService as Fe, getCurrentRangeDisable$ as ue } from "@univerjs/sheets-ui";
|
|
10
10
|
import { debounceTime as We } from "rxjs/operators";
|
|
11
11
|
import { IZenZoneService as ze, useDependency as y, useConfigValue as Ge, useDebounceFn as Ke, MenuItemType as G, getMenuHiddenObservable as Ye, ContextMenuPosition as qe, ContextMenuGroup as Je, ComponentManager as Qe, IMenuManagerService as Xe } from "@univerjs/ui";
|
|
12
12
|
import { jsx as et } from "react/jsx-runtime";
|
|
13
13
|
import { Textarea as tt, clsx as it } from "@univerjs/design";
|
|
14
|
-
import { forwardRef as
|
|
14
|
+
import { forwardRef as R, useRef as le, createElement as j, useState as rt, useEffect as nt, useCallback as ee } from "react";
|
|
15
15
|
var ot = Object.getOwnPropertyDescriptor, st = (t, e, i, r) => {
|
|
16
16
|
for (var n = r > 1 ? void 0 : r ? ot(e, i) : e, s = t.length - 1, o; s >= 0; s--)
|
|
17
17
|
(o = t[s]) && (n = o(n) || n);
|
|
@@ -45,19 +45,19 @@ let x = class extends N {
|
|
|
45
45
|
_initSkeletonChange() {
|
|
46
46
|
const t = () => {
|
|
47
47
|
var n;
|
|
48
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
48
|
+
const e = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SHEET);
|
|
49
49
|
if (!e) return;
|
|
50
50
|
const i = e.getUnitId(), r = this._renderManagerService.getRenderById(i);
|
|
51
51
|
(n = r == null ? void 0 : r.mainComponent) == null || n.makeForceDirty();
|
|
52
52
|
};
|
|
53
|
-
this.disposeWithMe(this._sheetsNoteModel.change$.pipe(
|
|
53
|
+
this.disposeWithMe(this._sheetsNoteModel.change$.pipe(Ve(16)).subscribe(() => {
|
|
54
54
|
t();
|
|
55
55
|
}));
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
x = st([
|
|
59
59
|
E(0, h(Te)),
|
|
60
|
-
E(1, h(
|
|
60
|
+
E(1, h(w)),
|
|
61
61
|
E(2, F),
|
|
62
62
|
E(3, D)
|
|
63
63
|
], x);
|
|
@@ -72,7 +72,7 @@ let P = class extends N {
|
|
|
72
72
|
super();
|
|
73
73
|
g(this, "_lastPopup", null);
|
|
74
74
|
g(this, "_activePopup");
|
|
75
|
-
g(this, "_activePopup$", new
|
|
75
|
+
g(this, "_activePopup$", new Re(null));
|
|
76
76
|
g(this, "activePopup$", this._activePopup$.asObservable());
|
|
77
77
|
this._zenZoneService = e, this._cellPopupManagerService = i, this._initZenVisible(), this.disposeWithMe(() => {
|
|
78
78
|
this._activePopup$.complete();
|
|
@@ -86,6 +86,9 @@ let P = class extends N {
|
|
|
86
86
|
e && this.hidePopup();
|
|
87
87
|
}));
|
|
88
88
|
}
|
|
89
|
+
dispose() {
|
|
90
|
+
super.dispose(), this.hidePopup();
|
|
91
|
+
}
|
|
89
92
|
showPopup(e, i) {
|
|
90
93
|
var c;
|
|
91
94
|
const { row: r, col: n, unitId: s, subUnitId: o } = e;
|
|
@@ -155,7 +158,7 @@ let H = class extends N {
|
|
|
155
158
|
if (!o || !n)
|
|
156
159
|
return;
|
|
157
160
|
const a = o.getCellWithCoordByIndex(n.startRow, n.startColumn);
|
|
158
|
-
if ((((C = n.rangeType) != null ? C : Q.NORMAL) !== Q.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) &&
|
|
161
|
+
if ((((C = n.rangeType) != null ? C : Q.NORMAL) !== Q.NORMAL || n.endColumn - n.startColumn > 0 || n.endRow - n.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && Me.equals(a.mergeInfo, n))) {
|
|
159
162
|
this._sheetsNotePopupService.hidePopup();
|
|
160
163
|
return;
|
|
161
164
|
}
|
|
@@ -202,7 +205,7 @@ let H = class extends N {
|
|
|
202
205
|
};
|
|
203
206
|
H = lt([
|
|
204
207
|
S(0, h(P)),
|
|
205
|
-
S(1, h(
|
|
208
|
+
S(1, h(w)),
|
|
206
209
|
S(2, h(W)),
|
|
207
210
|
S(3, Be),
|
|
208
211
|
S(4, F),
|
|
@@ -243,6 +246,11 @@ let T = class extends N {
|
|
|
243
246
|
}
|
|
244
247
|
);
|
|
245
248
|
}
|
|
249
|
+
dispose() {
|
|
250
|
+
super.dispose(), this._noteMatrix.forValue((e, i, r) => {
|
|
251
|
+
r.dispose();
|
|
252
|
+
});
|
|
253
|
+
}
|
|
246
254
|
_initSheet(e, i) {
|
|
247
255
|
var s;
|
|
248
256
|
this._noteMatrix.forValue((o, a, u) => {
|
|
@@ -282,7 +290,7 @@ let T = class extends N {
|
|
|
282
290
|
}
|
|
283
291
|
_initNoteChangeListener() {
|
|
284
292
|
this.disposeWithMe(
|
|
285
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
293
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(M.UNIVER_SHEET).pipe(
|
|
286
294
|
je((e) => {
|
|
287
295
|
var i;
|
|
288
296
|
return (i = e == null ? void 0 : e.activeSheet$) != null ? i : Ze(null);
|
|
@@ -302,7 +310,7 @@ let T = class extends N {
|
|
|
302
310
|
}
|
|
303
311
|
};
|
|
304
312
|
T = ht([
|
|
305
|
-
O(0, h(
|
|
313
|
+
O(0, h(w)),
|
|
306
314
|
O(1, h(D)),
|
|
307
315
|
O(2, h(ce)),
|
|
308
316
|
O(3, h(P))
|
|
@@ -322,7 +330,7 @@ var d = function() {
|
|
|
322
330
|
for (var n = 0, r = Object.getOwnPropertySymbols(t); n < r.length; n++)
|
|
323
331
|
e.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[n]) && (i[r[n]] = t[r[n]]);
|
|
324
332
|
return i;
|
|
325
|
-
}, Z =
|
|
333
|
+
}, Z = R(function(t, e) {
|
|
326
334
|
var i = t.icon, r = t.id, n = t.className, s = t.extend, o = dt(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(n || "").trim(), u = le("_".concat(_t()));
|
|
327
335
|
return he(i, "".concat(r), { defIds: i.defIds, idSuffix: u.current }, d({ ref: e, className: a }, o), s);
|
|
328
336
|
});
|
|
@@ -353,7 +361,7 @@ function _t() {
|
|
|
353
361
|
return Math.random().toString(36).substring(2, 8);
|
|
354
362
|
}
|
|
355
363
|
Z.displayName = "UniverIcon";
|
|
356
|
-
var Ct = { 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" } }] }, de =
|
|
364
|
+
var Ct = { 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" } }] }, de = R(function(t, e) {
|
|
357
365
|
return j(Z, Object.assign({}, t, {
|
|
358
366
|
id: "add-note-icon",
|
|
359
367
|
ref: e,
|
|
@@ -361,7 +369,7 @@ var Ct = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
361
369
|
}));
|
|
362
370
|
});
|
|
363
371
|
de.displayName = "AddNoteIcon";
|
|
364
|
-
var gt = { 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" } }] }, fe =
|
|
372
|
+
var gt = { 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" } }] }, fe = R(function(t, e) {
|
|
365
373
|
return j(Z, Object.assign({}, t, {
|
|
366
374
|
id: "delete-note-icon",
|
|
367
375
|
ref: e,
|
|
@@ -369,7 +377,7 @@ var gt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
369
377
|
}));
|
|
370
378
|
});
|
|
371
379
|
fe.displayName = "DeleteNoteIcon";
|
|
372
|
-
var mt = { 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" } }] }, ve =
|
|
380
|
+
var mt = { 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" } }] }, ve = R(function(t, e) {
|
|
373
381
|
return j(Z, Object.assign({}, t, {
|
|
374
382
|
id: "hide-note-icon",
|
|
375
383
|
ref: e,
|
|
@@ -379,9 +387,9 @@ var mt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
379
387
|
ve.displayName = "HideNoteIcon";
|
|
380
388
|
const $ = {
|
|
381
389
|
id: "sheet.operation.add-note-popup",
|
|
382
|
-
type:
|
|
390
|
+
type: we.OPERATION,
|
|
383
391
|
handler: async (t, e) => {
|
|
384
|
-
const i = t.get(W), r = t.get(P), s = t.get(D).getCurrentUnitForType(
|
|
392
|
+
const i = t.get(W), r = t.get(P), s = t.get(D).getCurrentUnitForType(M.UNIVER_SHEET);
|
|
385
393
|
if (!s)
|
|
386
394
|
return !1;
|
|
387
395
|
const o = s.getActiveSheet(), a = i.getCurrentLastSelection();
|
|
@@ -399,7 +407,7 @@ const $ = {
|
|
|
399
407
|
}
|
|
400
408
|
}, St = (t) => {
|
|
401
409
|
var I;
|
|
402
|
-
const { popup: e } = t, i = y(
|
|
410
|
+
const { popup: e } = t, i = y(w), r = y(be), n = y(F), s = Ge(pe), o = (I = e.extraProps) == null ? void 0 : I.location;
|
|
403
411
|
if (!o)
|
|
404
412
|
return console.error("Popup extraProps or location is undefined."), null;
|
|
405
413
|
const a = le(null), u = n.getRenderById(o.unitId), [c, p] = rt(null);
|
|
@@ -448,13 +456,13 @@ const $ = {
|
|
|
448
456
|
};
|
|
449
457
|
function Y(t) {
|
|
450
458
|
const e = t.get(W), i = t.get(D);
|
|
451
|
-
return e.selectionMoveEnd$.pipe(
|
|
459
|
+
return e.selectionMoveEnd$.pipe(V(() => {
|
|
452
460
|
const r = e.getCurrentLastSelection();
|
|
453
461
|
if (!(r != null && r.primary)) return !1;
|
|
454
462
|
const n = Le(i);
|
|
455
463
|
if (!n) return !1;
|
|
456
464
|
const { actualColumn: s, actualRow: o } = r.primary;
|
|
457
|
-
return !!t.get(
|
|
465
|
+
return !!t.get(w).getNote(n.unitId, n.subUnitId, o, s);
|
|
458
466
|
}));
|
|
459
467
|
}
|
|
460
468
|
function Pt(t) {
|
|
@@ -463,7 +471,7 @@ function Pt(t) {
|
|
|
463
471
|
type: G.BUTTON,
|
|
464
472
|
title: "rightClick.addNote",
|
|
465
473
|
icon: "AddNoteIcon",
|
|
466
|
-
hidden$: ke([Ye(t,
|
|
474
|
+
hidden$: ke([Ye(t, M.UNIVER_SHEET), Y(t)]).pipe(V(([e, i]) => e || i)),
|
|
467
475
|
disabled$: ue(t, { workbookTypes: [se], worksheetTypes: [oe] }),
|
|
468
476
|
commandId: $.id
|
|
469
477
|
};
|
|
@@ -474,7 +482,7 @@ function It(t) {
|
|
|
474
482
|
type: G.BUTTON,
|
|
475
483
|
title: "rightClick.deleteNote",
|
|
476
484
|
icon: "DeleteNoteIcon",
|
|
477
|
-
hidden$: Y(t).pipe(
|
|
485
|
+
hidden$: Y(t).pipe(V((e) => !e)),
|
|
478
486
|
disabled$: ue(t, { workbookTypes: [se], worksheetTypes: [oe] })
|
|
479
487
|
};
|
|
480
488
|
}
|
|
@@ -484,10 +492,10 @@ function Nt(t) {
|
|
|
484
492
|
type: G.BUTTON,
|
|
485
493
|
title: "rightClick.toggleNote",
|
|
486
494
|
icon: "HideNoteIcon",
|
|
487
|
-
hidden$: Y(t).pipe(
|
|
495
|
+
hidden$: Y(t).pipe(V((e) => !e))
|
|
488
496
|
};
|
|
489
497
|
}
|
|
490
|
-
const
|
|
498
|
+
const Mt = {
|
|
491
499
|
[qe.MAIN_AREA]: {
|
|
492
500
|
[Je.OTHERS]: {
|
|
493
501
|
order: 0,
|
|
@@ -506,8 +514,8 @@ const wt = {
|
|
|
506
514
|
}
|
|
507
515
|
}
|
|
508
516
|
};
|
|
509
|
-
var
|
|
510
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
517
|
+
var wt = Object.getOwnPropertyDescriptor, bt = (t, e, i, r) => {
|
|
518
|
+
for (var n = r > 1 ? void 0 : r ? wt(e, i) : e, s = t.length - 1, o; s >= 0; s--)
|
|
511
519
|
(o = t[s]) && (n = o(n) || n);
|
|
512
520
|
return n;
|
|
513
521
|
}, A = (t, e) => (i, r) => e(i, r, t);
|
|
@@ -528,7 +536,7 @@ let L = class extends N {
|
|
|
528
536
|
});
|
|
529
537
|
}
|
|
530
538
|
_initMenu() {
|
|
531
|
-
this._menuManagerService.mergeMenu(
|
|
539
|
+
this._menuManagerService.mergeMenu(Mt);
|
|
532
540
|
}
|
|
533
541
|
_initCommands() {
|
|
534
542
|
this._commandService.registerCommand($);
|
|
@@ -580,7 +588,7 @@ let U = class extends xe {
|
|
|
580
588
|
}
|
|
581
589
|
};
|
|
582
590
|
_e(U, "pluginName", Ht);
|
|
583
|
-
_e(U, "type",
|
|
591
|
+
_e(U, "type", M.UNIVER_SHEET);
|
|
584
592
|
U = xt([
|
|
585
593
|
ye(De),
|
|
586
594
|
re(1, h(Ee)),
|
|
@@ -10,6 +10,7 @@ export declare class SheetsNoteAttachmentController extends Disposable {
|
|
|
10
10
|
private _noteMatrix;
|
|
11
11
|
constructor(_sheetsNoteModel: SheetsNoteModel, _univerInstanceService: IUniverInstanceService, _cellPopupManagerService: CellPopupManagerService, _sheetsNotePopupService: SheetsNotePopupService);
|
|
12
12
|
private _showPopup;
|
|
13
|
+
dispose(): void;
|
|
13
14
|
private _initSheet;
|
|
14
15
|
private _initNoteChangeListener;
|
|
15
16
|
}
|
|
@@ -17,6 +17,7 @@ export declare class SheetsNotePopupService extends Disposable {
|
|
|
17
17
|
get activePopup(): Nullable<INotePopup>;
|
|
18
18
|
constructor(_zenZoneService: IZenZoneService, _cellPopupManagerService: CellPopupManagerService);
|
|
19
19
|
private _initZenVisible;
|
|
20
|
+
dispose(): void;
|
|
20
21
|
showPopup(location: INotePopup, onHide?: () => void): void;
|
|
21
22
|
hidePopup(force?: boolean): void;
|
|
22
23
|
persistPopup(): void;
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(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"})}));
|
|
1
|
+
(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"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-note-ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.11-nightly.202510220308",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer sheets note UI plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -50,24 +50,25 @@
|
|
|
50
50
|
"rxjs": ">=7.0.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@univerjs/icons": "^0.4.
|
|
53
|
+
"@univerjs/icons": "^0.4.9",
|
|
54
54
|
"rxjs": "^7.8.2",
|
|
55
|
-
"@univerjs/core": "0.10.
|
|
56
|
-
"@univerjs/design": "0.10.
|
|
57
|
-
"@univerjs/engine-render": "0.10.
|
|
58
|
-
"@univerjs/sheets": "0.10.
|
|
59
|
-
"@univerjs/sheets-
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
55
|
+
"@univerjs/core": "0.10.11-nightly.202510220308",
|
|
56
|
+
"@univerjs/design": "0.10.11-nightly.202510220308",
|
|
57
|
+
"@univerjs/engine-render": "0.10.11-nightly.202510220308",
|
|
58
|
+
"@univerjs/sheets": "0.10.11-nightly.202510220308",
|
|
59
|
+
"@univerjs/sheets-ui": "0.10.11-nightly.202510220308",
|
|
60
|
+
"@univerjs/ui": "0.10.11-nightly.202510220308",
|
|
61
|
+
"@univerjs/sheets-note": "0.10.11-nightly.202510220308"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@types/react": "19.1.10",
|
|
65
|
-
"@types/react-dom": "^18.0.6",
|
|
66
64
|
"postcss": "^8.5.6",
|
|
65
|
+
"react": "18.3.1",
|
|
66
|
+
"rxjs": "^7.8.2",
|
|
67
67
|
"tailwindcss": "3.4.17",
|
|
68
|
-
"typescript": "^5.9.
|
|
69
|
-
"vite": "^7.1.
|
|
70
|
-
"vitest": "^3.2.4"
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"vite": "^7.1.10",
|
|
70
|
+
"vitest": "^3.2.4",
|
|
71
|
+
"@univerjs-infra/shared": "0.10.11"
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
73
74
|
"test": "vitest run",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|