@univerjs/sheets-note 0.7.0 → 0.8.0-nightly.202505261607

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/facade.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@univerjs/core/facade"),h=require("@univerjs/sheets-note"),u=require("@univerjs/sheets/facade"),N=require("@univerjs/core");class v{get SheetNoteAdd(){return"SheetNoteAdd"}get SheetNoteDelete(){return"SheetNoteDelete"}get SheetNoteUpdate(){return"SheetNoteUpdate"}get SheetNoteShow(){return"SheetNoteShow"}get SheetNoteHide(){return"SheetNoteHide"}get BeforeSheetNoteAdd(){return"BeforeSheetNoteAdd"}get BeforeSheetNoteDelete(){return"BeforeSheetNoteDelete"}get BeforeSheetNoteUpdate(){return"BeforeSheetNoteUpdate"}get BeforeSheetNoteShow(){return"BeforeSheetNoteShow"}get BeforeSheetNoteHide(){return"BeforeSheetNoteHide"}}f.FEventName.extend(v);class w extends u.FRange{createOrUpdateNote(c){return this._commandService.syncExecuteCommand(h.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:c}),this}deleteNote(){return this._injector.get(h.SheetsNoteModel),this._commandService.syncExecuteCommand(h.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(h.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),this.getRow(),this.getColumn())}}u.FRange.extend(w);class E extends f.FUniver{_initialize(c){this.registerEventHandler(this.Event.SheetNoteAdd,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&!e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteAdd,{workbook:S,worksheet:l,row:o,col:s,note:r})}})),this.registerEventHandler(this.Event.SheetNoteDelete,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&!e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteDelete,{workbook:S,worksheet:l,row:o,col:s,oldNote:i})}})),this.registerEventHandler(this.Event.SheetNoteUpdate,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteUpdate,{workbook:S,worksheet:l,row:o,col:s,note:r,oldNote:i})}})),this.registerEventHandler(this.Event.SheetNoteShow,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&!e.oldNote.show&&e.note.show){const{unitId:d,sheetId:t,row:o,col:s}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:i,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteShow,{workbook:i,worksheet:n,row:o,col:s})}})),this.registerEventHandler(this.Event.SheetNoteHide,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&e.oldNote.show&&!e.note.show){const{unitId:d,sheetId:t,row:o,col:s}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:i,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteHide,{workbook:i,worksheet:n,row:o,col:s})}})),this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>c.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r,note:i}=e.params;if(d.getNote(t,o,s,r))return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:g}=S;if(this.fireEvent(this.Event.BeforeSheetNoteAdd,{workbook:l,worksheet:g,row:s,col:r,note:i}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>c.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetDeleteNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(!i)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteDelete,{workbook:S,worksheet:l,row:s,col:r,oldNote:i}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>c.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r,note:i}=e.params,n=d.getNote(t,o,s,r);if(!n)return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:g}=S;if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,{workbook:l,worksheet:g,row:s,col:r,note:i,oldNote:n}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>c.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(i!=null&&i.show)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteShow,{workbook:S,worksheet:l,row:s,col:r}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>c.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(!(i!=null&&i.show))return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteHide,{workbook:S,worksheet:l,row:s,col:r}))throw new N.CanceledError}}))}}f.FUniver.extend(E);class I extends u.FWorksheet{getNotes(){const a=this._injector.get(h.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId()),e=[];return a==null||a.forValue((d,t,o)=>{e.push({...o,row:d,col:t})}),e}}u.FWorksheet.extend(I);exports.FSheetNoteEvent=v;exports.FSheetsNoteRange=w;exports.FSheetsNoteWorksheet=I;exports.FUniverSheetNoteMixin=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@univerjs/core/facade"),c=require("@univerjs/sheets-note"),u=require("@univerjs/sheets/facade"),N=require("@univerjs/core");class v{get SheetNoteAdd(){return"SheetNoteAdd"}get SheetNoteDelete(){return"SheetNoteDelete"}get SheetNoteUpdate(){return"SheetNoteUpdate"}get SheetNoteShow(){return"SheetNoteShow"}get SheetNoteHide(){return"SheetNoteHide"}get BeforeSheetNoteAdd(){return"BeforeSheetNoteAdd"}get BeforeSheetNoteDelete(){return"BeforeSheetNoteDelete"}get BeforeSheetNoteUpdate(){return"BeforeSheetNoteUpdate"}get BeforeSheetNoteShow(){return"BeforeSheetNoteShow"}get BeforeSheetNoteHide(){return"BeforeSheetNoteHide"}}f.FEventName.extend(v);class w extends u.FRange{createOrUpdateNote(h){return this._commandService.syncExecuteCommand(c.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:h}),this}deleteNote(){return this._commandService.syncExecuteCommand(c.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(c.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),this.getRow(),this.getColumn())}}u.FRange.extend(w);class E extends f.FUniver{_initialize(h){this.registerEventHandler(this.Event.SheetNoteAdd,()=>h.get(c.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&!e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteAdd,{workbook:S,worksheet:l,row:o,col:s,note:r})}})),this.registerEventHandler(this.Event.SheetNoteDelete,()=>h.get(c.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&!e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteDelete,{workbook:S,worksheet:l,row:o,col:s,oldNote:i})}})),this.registerEventHandler(this.Event.SheetNoteUpdate,()=>h.get(c.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:s,note:r,oldNote:i}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteUpdate,{workbook:S,worksheet:l,row:o,col:s,note:r,oldNote:i})}})),this.registerEventHandler(this.Event.SheetNoteShow,()=>h.get(c.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&!e.oldNote.show&&e.note.show){const{unitId:d,sheetId:t,row:o,col:s}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:i,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteShow,{workbook:i,worksheet:n,row:o,col:s})}})),this.registerEventHandler(this.Event.SheetNoteHide,()=>h.get(c.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&e.oldNote.show&&!e.note.show){const{unitId:d,sheetId:t,row:o,col:s}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:i,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteHide,{workbook:i,worksheet:n,row:o,col:s})}})),this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>h.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===c.SheetUpdateNoteCommand.id){const d=h.get(c.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r,note:i}=e.params;if(d.getNote(t,o,s,r))return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:g}=S;if(this.fireEvent(this.Event.BeforeSheetNoteAdd,{workbook:l,worksheet:g,row:s,col:r,note:i}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>h.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===c.SheetDeleteNoteCommand.id){const d=h.get(c.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(!i)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteDelete,{workbook:S,worksheet:l,row:s,col:r,oldNote:i}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>h.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===c.SheetUpdateNoteCommand.id){const d=h.get(c.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r,note:i}=e.params,n=d.getNote(t,o,s,r);if(!n)return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:g}=S;if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,{workbook:l,worksheet:g,row:s,col:r,note:i,oldNote:n}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>h.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===c.SheetToggleNotePopupCommand.id){const d=h.get(c.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(i!=null&&i.show)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteShow,{workbook:S,worksheet:l,row:s,col:r}))throw new N.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>h.get(N.ICommandService).beforeCommandExecuted(e=>{if(e.id===c.SheetToggleNotePopupCommand.id){const d=h.get(c.SheetsNoteModel),{unitId:t,sheetId:o,row:s,col:r}=e.params,i=d.getNote(t,o,s,r);if(!(i!=null&&i.show))return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteHide,{workbook:S,worksheet:l,row:s,col:r}))throw new N.CanceledError}}))}}f.FUniver.extend(E);class I extends u.FWorksheet{getNotes(){const a=this._injector.get(c.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId()),e=[];return a==null||a.forValue((d,t,o)=>{e.push({...o,row:d,col:t})}),e}}u.FWorksheet.extend(I);exports.FSheetNoteEvent=v;exports.FSheetsNoteRange=w;exports.FSheetsNoteWorksheet=I;exports.FUniverSheetNoteMixin=E;
package/lib/es/facade.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FEventName as I, FUniver as v } from "@univerjs/core/facade";
2
- import { UpdateNoteMutation as b, SheetsNoteModel as S, RemoveNoteMutation as B, SheetUpdateNoteCommand as f, SheetDeleteNoteCommand as H, SheetToggleNotePopupCommand as w } from "@univerjs/sheets-note";
2
+ import { UpdateNoteMutation as b, RemoveNoteMutation as B, SheetsNoteModel as S, SheetUpdateNoteCommand as f, SheetDeleteNoteCommand as H, SheetToggleNotePopupCommand as w } from "@univerjs/sheets-note";
3
3
  import { FRange as E, FWorksheet as k } from "@univerjs/sheets/facade";
4
4
  import { ICommandService as u, CanceledError as N } from "@univerjs/core";
5
5
  class U {
@@ -49,7 +49,7 @@ class x extends E {
49
49
  ), this;
50
50
  }
51
51
  deleteNote() {
52
- return this._injector.get(S), this._commandService.syncExecuteCommand(
52
+ return this._commandService.syncExecuteCommand(
53
53
  B.id,
54
54
  {
55
55
  unitId: this.getUnitId(),
package/lib/facade.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FEventName as I, FUniver as v } from "@univerjs/core/facade";
2
- import { UpdateNoteMutation as b, SheetsNoteModel as S, RemoveNoteMutation as B, SheetUpdateNoteCommand as f, SheetDeleteNoteCommand as H, SheetToggleNotePopupCommand as w } from "@univerjs/sheets-note";
2
+ import { UpdateNoteMutation as b, RemoveNoteMutation as B, SheetsNoteModel as S, SheetUpdateNoteCommand as f, SheetDeleteNoteCommand as H, SheetToggleNotePopupCommand as w } from "@univerjs/sheets-note";
3
3
  import { FRange as E, FWorksheet as k } from "@univerjs/sheets/facade";
4
4
  import { ICommandService as u, CanceledError as N } from "@univerjs/core";
5
5
  class U {
@@ -49,7 +49,7 @@ class x extends E {
49
49
  ), this;
50
50
  }
51
51
  deleteNote() {
52
- return this._injector.get(S), this._commandService.syncExecuteCommand(
52
+ return this._commandService.syncExecuteCommand(
53
53
  B.id,
54
54
  {
55
55
  unitId: this.getUnitId(),
@@ -1,6 +1,6 @@
1
1
  import { ISheetNote } from '@univerjs/sheets-note';
2
2
  import { FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
3
- export interface ISheetNoteAddEventParmas {
3
+ export interface ISheetNoteAddEventParams {
4
4
  workbook: FWorkbook;
5
5
  worksheet: FWorksheet;
6
6
  row: number;
@@ -8,7 +8,7 @@ export interface ISheetNoteAddEventParmas {
8
8
  note: ISheetNote;
9
9
  cancel?: boolean;
10
10
  }
11
- export interface ISheetNoteDeleteEventParmas {
11
+ export interface ISheetNoteDeleteEventParams {
12
12
  workbook: FWorkbook;
13
13
  worksheet: FWorksheet;
14
14
  row: number;
@@ -16,7 +16,7 @@ export interface ISheetNoteDeleteEventParmas {
16
16
  oldNote: ISheetNote;
17
17
  cancel?: boolean;
18
18
  }
19
- export interface ISheetNoteUpdateEventParmas {
19
+ export interface ISheetNoteUpdateEventParams {
20
20
  workbook: FWorkbook;
21
21
  worksheet: FWorksheet;
22
22
  row: number;
@@ -25,14 +25,14 @@ export interface ISheetNoteUpdateEventParmas {
25
25
  oldNote: ISheetNote;
26
26
  cancel?: boolean;
27
27
  }
28
- export interface ISheetNoteShowEventParmas {
28
+ export interface ISheetNoteShowEventParams {
29
29
  workbook: FWorkbook;
30
30
  worksheet: FWorksheet;
31
31
  row: number;
32
32
  col: number;
33
33
  cancel?: boolean;
34
34
  }
35
- export interface ISheetNoteHideEventParmas {
35
+ export interface ISheetNoteHideEventParams {
36
36
  workbook: FWorkbook;
37
37
  worksheet: FWorksheet;
38
38
  row: number;
@@ -43,16 +43,16 @@ export interface ISheetNoteHideEventParmas {
43
43
  * @ignore
44
44
  */
45
45
  export interface ISheetsNoteEventParamConfig {
46
- SheetNoteAdd: ISheetNoteAddEventParmas;
47
- SheetNoteDelete: ISheetNoteDeleteEventParmas;
48
- SheetNoteUpdate: ISheetNoteUpdateEventParmas;
49
- SheetNoteShow: ISheetNoteShowEventParmas;
50
- SheetNoteHide: ISheetNoteHideEventParmas;
51
- BeforeSheetNoteAdd: ISheetNoteAddEventParmas;
52
- BeforeSheetNoteDelete: ISheetNoteDeleteEventParmas;
53
- BeforeSheetNoteUpdate: ISheetNoteUpdateEventParmas;
54
- BeforeSheetNoteShow: ISheetNoteShowEventParmas;
55
- BeforeSheetNoteHide: ISheetNoteHideEventParmas;
46
+ SheetNoteAdd: ISheetNoteAddEventParams;
47
+ SheetNoteDelete: ISheetNoteDeleteEventParams;
48
+ SheetNoteUpdate: ISheetNoteUpdateEventParams;
49
+ SheetNoteShow: ISheetNoteShowEventParams;
50
+ SheetNoteHide: ISheetNoteHideEventParams;
51
+ BeforeSheetNoteAdd: ISheetNoteAddEventParams;
52
+ BeforeSheetNoteDelete: ISheetNoteDeleteEventParams;
53
+ BeforeSheetNoteUpdate: ISheetNoteUpdateEventParams;
54
+ BeforeSheetNoteShow: ISheetNoteShowEventParams;
55
+ BeforeSheetNoteHide: ISheetNoteHideEventParams;
56
56
  }
57
57
  /**
58
58
  * @ignore
@@ -60,121 +60,156 @@ export interface ISheetsNoteEventParamConfig {
60
60
  interface ISheetNoteEvent {
61
61
  /**
62
62
  * Event fired when a note is added
63
- * @see {@link ISheetNoteAddEventParmas}
63
+ * @see {@link ISheetNoteAddEventParams}
64
64
  * @example
65
65
  * ```ts
66
66
  * const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteAdd, (params) => {
67
67
  * const { workbook, worksheet, row, col, note } = params;
68
68
  * console.log(params);
69
69
  * });
70
+ *
71
+ * // Remove the event listener, use `disposable.dispose()`
70
72
  * ```
71
73
  */
72
74
  SheetNoteAdd: 'SheetNoteAdd';
73
75
  /**
74
76
  * Event fired when a note is deleted
75
- * @see {@link ISheetNoteDeleteEventParmas}
77
+ * @see {@link ISheetNoteDeleteEventParams}
76
78
  * @example
77
79
  * ```ts
78
80
  * const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteDelete, (params) => {
79
81
  * const { workbook, worksheet, row, col, oldNote } = params;
80
82
  * console.log(params);
81
83
  * });
84
+ *
85
+ * // Remove the event listener, use `disposable.dispose()`
82
86
  * ```
83
87
  */
84
88
  SheetNoteDelete: 'SheetNoteDelete';
85
89
  /**
86
90
  * Event fired when a note is updated
87
- * @see {@link ISheetNoteUpdateEventParmas}
91
+ * @see {@link ISheetNoteUpdateEventParams}
88
92
  * @example
89
93
  * ```ts
90
94
  * const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteUpdate, (params) => {
91
95
  * const { workbook, worksheet, row, col, note, oldNote } = params;
92
96
  * console.log(params);
93
97
  * });
98
+ *
99
+ * // Remove the event listener, use `disposable.dispose()`
94
100
  * ```
95
101
  */
96
102
  SheetNoteUpdate: 'SheetNoteUpdate';
97
103
  /**
98
104
  * Event fired when a note is shown
99
- * @see {@link ISheetNoteShowEventParmas}
105
+ * @see {@link ISheetNoteShowEventParams}
100
106
  * @example
101
107
  * ```ts
102
108
  * const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteShow, (params) => {
103
109
  * const { workbook, worksheet, row, col } = params;
104
110
  * console.log(params);
105
111
  * });
112
+ *
113
+ * // Remove the event listener, use `disposable.dispose()`
106
114
  * ```
107
115
  */
108
116
  SheetNoteShow: 'SheetNoteShow';
109
117
  /**
110
118
  * Event fired when a note is hidden
111
- * @see {@link ISheetNoteHideEventParmas}
119
+ * @see {@link ISheetNoteHideEventParams}
112
120
  * @example
113
121
  * ```ts
114
122
  * const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteHide, (params) => {
115
123
  * const { workbook, worksheet, row, col } = params;
116
124
  * console.log(params);
117
125
  * });
126
+ *
127
+ * // Remove the event listener, use `disposable.dispose()`
118
128
  * ```
119
129
  */
120
130
  SheetNoteHide: 'SheetNoteHide';
121
131
  /**
122
132
  * Event fired before a note is added
123
- * @see {@link ISheetNoteAddEventParmas}
133
+ * @see {@link ISheetNoteAddEventParams}
124
134
  * @example
125
135
  * ```ts
126
136
  * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteAdd, (params) => {
127
137
  * const { workbook, worksheet, row, col, note } = params;
128
138
  * console.log(params);
139
+ *
140
+ * // Cancel the note addition operation
141
+ * params.cancel = true;
129
142
  * });
143
+ *
144
+ * // Remove the event listener, use `disposable.dispose()`
130
145
  * ```
131
146
  */
132
147
  BeforeSheetNoteAdd: 'BeforeSheetNoteAdd';
133
148
  /**
134
149
  * Event fired before a note is deleted
135
- * @see {@link ISheetNoteDeleteEventParmas}
150
+ * @see {@link ISheetNoteDeleteEventParams}
136
151
  * @example
137
152
  * ```ts
138
153
  * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteDelete, (params) => {
139
154
  * const { workbook, worksheet, row, col, oldNote } = params;
140
155
  * console.log(params);
156
+ *
157
+ * // Cancel the note deletion operation
158
+ * params.cancel = true;
141
159
  * });
160
+ *
161
+ * // Remove the event listener, use `disposable.dispose()`
142
162
  * ```
143
163
  */
144
164
  BeforeSheetNoteDelete: 'BeforeSheetNoteDelete';
145
165
  /**
146
166
  * Event fired before a note is updated
147
- * @see {@link ISheetNoteUpdateEventParmas}
167
+ * @see {@link ISheetNoteUpdateEventParams}
148
168
  * @example
149
169
  * ```ts
150
170
  * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteUpdate, (params) => {
151
171
  * const { workbook, worksheet, row, col, note, oldNote } = params;
152
172
  * console.log(params);
173
+ *
174
+ * // Cancel the note update operation
175
+ * params.cancel = true;
153
176
  * });
177
+ *
178
+ * // Remove the event listener, use `disposable.dispose()`
154
179
  * ```
155
180
  */
156
181
  BeforeSheetNoteUpdate: 'BeforeSheetNoteUpdate';
157
182
  /**
158
183
  * Event fired before a note is shown
159
- * @see {@link ISheetNoteShowEventParmas}
184
+ * @see {@link ISheetNoteShowEventParams}
160
185
  * @example
161
186
  * ```ts
162
187
  * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteShow, (params) => {
163
188
  * const { workbook, worksheet, row, col } = params;
164
189
  * console.log(params);
190
+ *
191
+ * // Cancel the note show operation
192
+ * params.cancel = true;
165
193
  * });
194
+ *
195
+ * // Remove the event listener, use `disposable.dispose()`
166
196
  * ```
167
197
  */
168
198
  BeforeSheetNoteShow: 'BeforeSheetNoteShow';
169
199
  /**
170
200
  * Event fired before a note is hidden
171
- * @see {@link ISheetNoteHideEventParmas}
201
+ * @see {@link ISheetNoteHideEventParams}
172
202
  * @example
173
203
  * ```ts
174
204
  * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteHide, (params) => {
175
205
  * const { workbook, worksheet, row, col } = params;
176
206
  * console.log(params);
207
+ *
208
+ * // Cancel the note hide operation
209
+ * params.cancel = true;
177
210
  * });
211
+ *
212
+ * // Remove the event listener, use `disposable.dispose()`
178
213
  * ```
179
214
  */
180
215
  BeforeSheetNoteHide: 'BeforeSheetNoteHide';
@@ -198,16 +233,16 @@ export declare class FSheetNoteEvent implements ISheetNoteEvent {
198
233
  * @ignore
199
234
  */
200
235
  export interface ISheetNoteEventConfig {
201
- SheetNoteAdd: ISheetNoteAddEventParmas;
202
- SheetNoteDelete: ISheetNoteDeleteEventParmas;
203
- SheetNoteUpdate: ISheetNoteUpdateEventParmas;
204
- SheetNoteShow: ISheetNoteShowEventParmas;
205
- SheetNoteHide: ISheetNoteHideEventParmas;
206
- BeforeSheetNoteAdd: ISheetNoteAddEventParmas;
207
- BeforeSheetNoteDelete: ISheetNoteDeleteEventParmas;
208
- BeforeSheetNoteUpdate: ISheetNoteUpdateEventParmas;
209
- BeforeSheetNoteShow: ISheetNoteShowEventParmas;
210
- BeforeSheetNoteHide: ISheetNoteHideEventParmas;
236
+ SheetNoteAdd: ISheetNoteAddEventParams;
237
+ SheetNoteDelete: ISheetNoteDeleteEventParams;
238
+ SheetNoteUpdate: ISheetNoteUpdateEventParams;
239
+ SheetNoteShow: ISheetNoteShowEventParams;
240
+ SheetNoteHide: ISheetNoteHideEventParams;
241
+ BeforeSheetNoteAdd: ISheetNoteAddEventParams;
242
+ BeforeSheetNoteDelete: ISheetNoteDeleteEventParams;
243
+ BeforeSheetNoteUpdate: ISheetNoteUpdateEventParams;
244
+ BeforeSheetNoteShow: ISheetNoteShowEventParams;
245
+ BeforeSheetNoteHide: ISheetNoteHideEventParams;
211
246
  }
212
247
  declare module '@univerjs/core/facade' {
213
248
  interface FEventName extends ISheetNoteEvent {
@@ -3,39 +3,51 @@ import { ISheetNote } from '@univerjs/sheets-note';
3
3
  import { FRange } from '@univerjs/sheets/facade';
4
4
  export interface IFSheetsNoteRange {
5
5
  /**
6
- * get the note of the primary cell
7
- * @returns {Nullable<ISheetNote>} the note of the primary cell
6
+ * Get the annotation of the top-left cell in the range
7
+ * @returns {Nullable<ISheetNote>} The annotation of the top-left cell in the range
8
8
  * @example
9
9
  * ```ts
10
- * const fWorkbook = univerAPI.getWorkbook();
11
- * const fWorksheet = fWorkbook.getWorksheet();
12
- * const fRange = fWorksheet.getRange(0, 0, 1, 1);
10
+ * const fWorkbook = univerAPI.getActiveWorkbook();
11
+ * const fWorksheet = fWorkbook.getActiveSheet();
12
+ * const fRange = fWorksheet.getRange('A1:D10');
13
13
  * const note = fRange.getNote();
14
+ * console.log(note);
14
15
  * ```
15
16
  */
16
17
  getNote(): Nullable<ISheetNote>;
17
18
  /**
18
- * create a new note and attach to the primary cell
19
- * @param {ISheetNote} note the note to create
20
- * @returns {FRange} the range
19
+ * Create or update the annotation of the top-left cell in the range
20
+ * @param {ISheetNote} note The annotation to create or update
21
+ * @returns {FRange} This range for method chaining
21
22
  * @example
22
23
  * ```ts
23
- * const fWorkbook = univerAPI.getWorkbook();
24
- * const fWorksheet = fWorkbook.getWorksheet();
25
- * const fRange = fWorksheet.getRange(0, 0, 1, 1);
26
- * const note = fRange.createOrUpdateNote({});
24
+ * const fWorkbook = univerAPI.getActiveWorkbook();
25
+ * const fWorksheet = fWorkbook.getActiveSheet();
26
+ * const fRange = fWorksheet.getRange('A1');
27
+ * fRange.createOrUpdateNote({
28
+ * note: 'This is a note',
29
+ * width: 160,
30
+ * height: 100,
31
+ * show: true,
32
+ * });
27
33
  * ```
28
34
  */
29
35
  createOrUpdateNote(note: ISheetNote): FRange;
30
36
  /**
31
- * delete the note of the primary cell
32
- * @returns {FRange} the range
37
+ * Delete the annotation of the top-left cell in the range
38
+ * @returns {FRange} This range for method chaining
33
39
  * @example
34
40
  * ```ts
35
- * const fWorkbook = univerAPI.getWorkbook();
36
- * const fWorksheet = fWorkbook.getWorksheet();
37
- * const fRange = fWorksheet.getRange(0, 0, 1, 1);
38
- * fRange.deleteNote();
41
+ * const fWorkbook = univerAPI.getActiveWorkbook();
42
+ * const fWorksheet = fWorkbook.getActiveSheet();
43
+ * const notes = fWorksheet.getNotes();
44
+ * console.log(notes);
45
+ *
46
+ * if (notes.length > 0) {
47
+ * // Delete the first note
48
+ * const { row, col } = notes[0];
49
+ * fWorksheet.getRange(row, col).deleteNote();
50
+ * }
39
51
  * ```
40
52
  */
41
53
  deleteNote(): FRange;
@@ -6,7 +6,20 @@ export interface ISheetNoteInfo extends ISheetNote {
6
6
  }
7
7
  export interface IFSheetsNoteWorksheet {
8
8
  /**
9
- * get the note of the primary cell
9
+ * Get all annotations in the worksheet
10
+ * @returns {ISheetNoteInfo[]} An array of all annotations in the worksheet
11
+ * @example
12
+ * ```ts
13
+ * const fWorkbook = univerAPI.getActiveWorkbook();
14
+ * const fWorksheet = fWorkbook.getActiveSheet();
15
+ * const notes = fWorksheet.getNotes();
16
+ * console.log(notes);
17
+ *
18
+ * notes.forEach((item) => {
19
+ * const { row, col, note } = item;
20
+ * console.log(`Cell ${fWorksheet.getRange(row, col).getA1Notation()} has a note: ${note}`);
21
+ * });
22
+ * ```
10
23
  */
11
24
  getNotes(): ISheetNoteInfo[];
12
25
  }
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(a,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@univerjs/core/facade"),require("@univerjs/sheets-note"),require("@univerjs/sheets/facade"),require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core/facade","@univerjs/sheets-note","@univerjs/sheets/facade","@univerjs/core"],m):(a=typeof globalThis<"u"?globalThis:a||self,m(a.UniverSheetsNoteFacade={},a.UniverCoreFacade,a.UniverSheetsNote,a.UniverSheetsFacade,a.UniverCore))})(this,function(a,m,h,f,g){"use strict";class w{get SheetNoteAdd(){return"SheetNoteAdd"}get SheetNoteDelete(){return"SheetNoteDelete"}get SheetNoteUpdate(){return"SheetNoteUpdate"}get SheetNoteShow(){return"SheetNoteShow"}get SheetNoteHide(){return"SheetNoteHide"}get BeforeSheetNoteAdd(){return"BeforeSheetNoteAdd"}get BeforeSheetNoteDelete(){return"BeforeSheetNoteDelete"}get BeforeSheetNoteUpdate(){return"BeforeSheetNoteUpdate"}get BeforeSheetNoteShow(){return"BeforeSheetNoteShow"}get BeforeSheetNoteHide(){return"BeforeSheetNoteHide"}}m.FEventName.extend(w);class E extends f.FRange{createOrUpdateNote(c){return this._commandService.syncExecuteCommand(h.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:c}),this}deleteNote(){return this._injector.get(h.SheetsNoteModel),this._commandService.syncExecuteCommand(h.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(h.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),this.getRow(),this.getColumn())}}f.FRange.extend(E);class I extends m.FUniver{_initialize(c){this.registerEventHandler(this.Event.SheetNoteAdd,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&!e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteAdd,{workbook:S,worksheet:l,row:o,col:i,note:r})}})),this.registerEventHandler(this.Event.SheetNoteDelete,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&!e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteDelete,{workbook:S,worksheet:l,row:o,col:i,oldNote:s})}})),this.registerEventHandler(this.Event.SheetNoteUpdate,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:l}=n;this.fireEvent(this.Event.SheetNoteUpdate,{workbook:S,worksheet:l,row:o,col:i,note:r,oldNote:s})}})),this.registerEventHandler(this.Event.SheetNoteShow,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&!e.oldNote.show&&e.note.show){const{unitId:d,sheetId:t,row:o,col:i}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:s,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteShow,{workbook:s,worksheet:n,row:o,col:i})}})),this.registerEventHandler(this.Event.SheetNoteHide,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&e.oldNote.show&&!e.note.show){const{unitId:d,sheetId:t,row:o,col:i}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:s,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteHide,{workbook:s,worksheet:n,row:o,col:i})}})),this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r,note:s}=e.params;if(d.getNote(t,o,i,r))return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:v}=S;if(this.fireEvent(this.Event.BeforeSheetNoteAdd,{workbook:l,worksheet:v,row:i,col:r,note:s}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetDeleteNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(!s)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteDelete,{workbook:S,worksheet:l,row:i,col:r,oldNote:s}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r,note:s}=e.params,n=d.getNote(t,o,i,r);if(!n)return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:l,worksheet:v}=S;if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,{workbook:l,worksheet:v,row:i,col:r,note:s,oldNote:n}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(s!=null&&s.show)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteShow,{workbook:S,worksheet:l,row:i,col:r}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(!(s!=null&&s.show))return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:l}=n;if(this.fireEvent(this.Event.BeforeSheetNoteHide,{workbook:S,worksheet:l,row:i,col:r}))throw new g.CanceledError}}))}}m.FUniver.extend(I);class k extends f.FWorksheet{getNotes(){const u=this._injector.get(h.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId()),e=[];return u==null||u.forValue((d,t,o)=>{e.push({...o,row:d,col:t})}),e}}f.FWorksheet.extend(k),a.FSheetNoteEvent=w,a.FSheetsNoteRange=E,a.FSheetsNoteWorksheet=k,a.FUniverSheetNoteMixin=I,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@univerjs/core/facade"),require("@univerjs/sheets-note"),require("@univerjs/sheets/facade"),require("@univerjs/core")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core/facade","@univerjs/sheets-note","@univerjs/sheets/facade","@univerjs/core"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.UniverSheetsNoteFacade={},l.UniverCoreFacade,l.UniverSheetsNote,l.UniverSheetsFacade,l.UniverCore))})(this,function(l,m,h,f,g){"use strict";class w{get SheetNoteAdd(){return"SheetNoteAdd"}get SheetNoteDelete(){return"SheetNoteDelete"}get SheetNoteUpdate(){return"SheetNoteUpdate"}get SheetNoteShow(){return"SheetNoteShow"}get SheetNoteHide(){return"SheetNoteHide"}get BeforeSheetNoteAdd(){return"BeforeSheetNoteAdd"}get BeforeSheetNoteDelete(){return"BeforeSheetNoteDelete"}get BeforeSheetNoteUpdate(){return"BeforeSheetNoteUpdate"}get BeforeSheetNoteShow(){return"BeforeSheetNoteShow"}get BeforeSheetNoteHide(){return"BeforeSheetNoteHide"}}m.FEventName.extend(w);class E extends f.FRange{createOrUpdateNote(c){return this._commandService.syncExecuteCommand(h.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:c}),this}deleteNote(){return this._commandService.syncExecuteCommand(h.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(h.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),this.getRow(),this.getColumn())}}f.FRange.extend(E);class I extends m.FUniver{_initialize(c){this.registerEventHandler(this.Event.SheetNoteAdd,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&!e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:a}=n;this.fireEvent(this.Event.SheetNoteAdd,{workbook:S,worksheet:a,row:o,col:i,note:r})}})),this.registerEventHandler(this.Event.SheetNoteDelete,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&!e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:a}=n;this.fireEvent(this.Event.SheetNoteDelete,{workbook:S,worksheet:a,row:o,col:i,oldNote:s})}})),this.registerEventHandler(this.Event.SheetNoteUpdate,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note){const{unitId:d,sheetId:t,row:o,col:i,note:r,oldNote:s}=e,n=this.getSheetTarget(d,t);if(!n)return;const{workbook:S,worksheet:a}=n;this.fireEvent(this.Event.SheetNoteUpdate,{workbook:S,worksheet:a,row:o,col:i,note:r,oldNote:s})}})),this.registerEventHandler(this.Event.SheetNoteShow,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&!e.oldNote.show&&e.note.show){const{unitId:d,sheetId:t,row:o,col:i}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:s,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteShow,{workbook:s,worksheet:n,row:o,col:i})}})),this.registerEventHandler(this.Event.SheetNoteHide,()=>c.get(h.SheetsNoteModel).change$.subscribe(e=>{if(e.type==="update"&&e.oldNote&&e.note&&e.oldNote.show&&!e.note.show){const{unitId:d,sheetId:t,row:o,col:i}=e,r=this.getSheetTarget(d,t);if(!r)return;const{workbook:s,worksheet:n}=r;this.fireEvent(this.Event.SheetNoteHide,{workbook:s,worksheet:n,row:o,col:i})}})),this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r,note:s}=e.params;if(d.getNote(t,o,i,r))return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:a,worksheet:v}=S;if(this.fireEvent(this.Event.BeforeSheetNoteAdd,{workbook:a,worksheet:v,row:i,col:r,note:s}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetDeleteNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(!s)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:a}=n;if(this.fireEvent(this.Event.BeforeSheetNoteDelete,{workbook:S,worksheet:a,row:i,col:r,oldNote:s}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetUpdateNoteCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r,note:s}=e.params,n=d.getNote(t,o,i,r);if(!n)return;const S=this.getSheetTarget(t,o);if(!S)return;const{workbook:a,worksheet:v}=S;if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,{workbook:a,worksheet:v,row:i,col:r,note:s,oldNote:n}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(s!=null&&s.show)return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:a}=n;if(this.fireEvent(this.Event.BeforeSheetNoteShow,{workbook:S,worksheet:a,row:i,col:r}))throw new g.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>c.get(g.ICommandService).beforeCommandExecuted(e=>{if(e.id===h.SheetToggleNotePopupCommand.id){const d=c.get(h.SheetsNoteModel),{unitId:t,sheetId:o,row:i,col:r}=e.params,s=d.getNote(t,o,i,r);if(!(s!=null&&s.show))return;const n=this.getSheetTarget(t,o);if(!n)return;const{workbook:S,worksheet:a}=n;if(this.fireEvent(this.Event.BeforeSheetNoteHide,{workbook:S,worksheet:a,row:i,col:r}))throw new g.CanceledError}}))}}m.FUniver.extend(I);class k extends f.FWorksheet{getNotes(){const u=this._injector.get(h.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId()),e=[];return u==null||u.forValue((d,t,o)=>{e.push({...o,row:d,col:t})}),e}}f.FWorksheet.extend(k),l.FSheetNoteEvent=w,l.FSheetsNoteRange=E,l.FSheetsNoteWorksheet=k,l.FUniverSheetNoteMixin=I,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-note",
3
- "version": "0.7.0",
3
+ "version": "0.8.0-nightly.202505261607",
4
4
  "private": false,
5
5
  "description": "Univer sheets note base plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -56,15 +56,15 @@
56
56
  "rxjs": ">=7.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@univerjs/sheets": "0.7.0",
60
- "@univerjs/core": "0.7.0"
59
+ "@univerjs/core": "0.8.0-nightly.202505261607",
60
+ "@univerjs/sheets": "0.8.0-nightly.202505261607"
61
61
  },
62
62
  "devDependencies": {
63
63
  "rxjs": "^7.8.2",
64
64
  "typescript": "^5.8.3",
65
65
  "vite": "^6.3.5",
66
- "vitest": "^3.1.3",
67
- "@univerjs-infra/shared": "0.7.0"
66
+ "vitest": "^3.1.4",
67
+ "@univerjs-infra/shared": "0.8.0-beta.0"
68
68
  },
69
69
  "scripts": {
70
70
  "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