@univerjs/sheets-note 0.9.1 → 0.9.2
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"),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.
|
|
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.FSheetsNoteRangeMixin=w;exports.FSheetsNoteWorksheet=I;exports.FUniverSheetNoteMixin=E;
|
package/lib/es/facade.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FEventName as I, FUniver as v } from "@univerjs/core/facade";
|
|
|
2
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
|
-
class
|
|
5
|
+
class x {
|
|
6
6
|
get SheetNoteAdd() {
|
|
7
7
|
return "SheetNoteAdd";
|
|
8
8
|
}
|
|
@@ -34,8 +34,8 @@ class U {
|
|
|
34
34
|
return "BeforeSheetNoteHide";
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
I.extend(
|
|
38
|
-
class
|
|
37
|
+
I.extend(x);
|
|
38
|
+
class U extends E {
|
|
39
39
|
createOrUpdateNote(d) {
|
|
40
40
|
return this._commandService.syncExecuteCommand(
|
|
41
41
|
b.id,
|
|
@@ -63,8 +63,9 @@ class x extends E {
|
|
|
63
63
|
return this._injector.get(S).getNote(this.getUnitId(), this.getSheetId(), this.getRow(), this.getColumn());
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
E.extend(
|
|
66
|
+
E.extend(U);
|
|
67
67
|
class C extends v {
|
|
68
|
+
// eslint-disable-next-line max-lines-per-function
|
|
68
69
|
_initialize(d) {
|
|
69
70
|
this.registerEventHandler(
|
|
70
71
|
this.Event.SheetNoteAdd,
|
|
@@ -267,8 +268,8 @@ class T extends k {
|
|
|
267
268
|
}
|
|
268
269
|
k.extend(T);
|
|
269
270
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
x as FSheetNoteEvent,
|
|
272
|
+
U as FSheetsNoteRangeMixin,
|
|
272
273
|
T as FSheetsNoteWorksheet,
|
|
273
274
|
C as FUniverSheetNoteMixin
|
|
274
275
|
};
|
package/lib/facade.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FEventName as I, FUniver as v } from "@univerjs/core/facade";
|
|
|
2
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
|
-
class
|
|
5
|
+
class x {
|
|
6
6
|
get SheetNoteAdd() {
|
|
7
7
|
return "SheetNoteAdd";
|
|
8
8
|
}
|
|
@@ -34,8 +34,8 @@ class U {
|
|
|
34
34
|
return "BeforeSheetNoteHide";
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
I.extend(
|
|
38
|
-
class
|
|
37
|
+
I.extend(x);
|
|
38
|
+
class U extends E {
|
|
39
39
|
createOrUpdateNote(d) {
|
|
40
40
|
return this._commandService.syncExecuteCommand(
|
|
41
41
|
b.id,
|
|
@@ -63,8 +63,9 @@ class x extends E {
|
|
|
63
63
|
return this._injector.get(S).getNote(this.getUnitId(), this.getSheetId(), this.getRow(), this.getColumn());
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
E.extend(
|
|
66
|
+
E.extend(U);
|
|
67
67
|
class C extends v {
|
|
68
|
+
// eslint-disable-next-line max-lines-per-function
|
|
68
69
|
_initialize(d) {
|
|
69
70
|
this.registerEventHandler(
|
|
70
71
|
this.Event.SheetNoteAdd,
|
|
@@ -267,8 +268,8 @@ class T extends k {
|
|
|
267
268
|
}
|
|
268
269
|
k.extend(T);
|
|
269
270
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
x as FSheetNoteEvent,
|
|
272
|
+
U as FSheetsNoteRangeMixin,
|
|
272
273
|
T as FSheetsNoteWorksheet,
|
|
273
274
|
C as FUniverSheetNoteMixin
|
|
274
275
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Nullable } from '@univerjs/core';
|
|
2
2
|
import { ISheetNote } from '@univerjs/sheets-note';
|
|
3
3
|
import { FRange } from '@univerjs/sheets/facade';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
4
7
|
export interface IFSheetsNoteRange {
|
|
5
8
|
/**
|
|
6
9
|
* Get the annotation of the top-left cell in the range
|
|
@@ -52,12 +55,12 @@ export interface IFSheetsNoteRange {
|
|
|
52
55
|
*/
|
|
53
56
|
deleteNote(): FRange;
|
|
54
57
|
}
|
|
55
|
-
export declare class
|
|
58
|
+
export declare class FSheetsNoteRangeMixin extends FRange implements IFSheetsNoteRange {
|
|
56
59
|
createOrUpdateNote(note: ISheetNote): FRange;
|
|
57
60
|
deleteNote(): FRange;
|
|
58
61
|
getNote(): Nullable<ISheetNote>;
|
|
59
62
|
}
|
|
60
63
|
declare module '@univerjs/sheets/facade' {
|
|
61
|
-
interface
|
|
64
|
+
interface FRange extends IFSheetsNoteRange {
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -4,6 +4,9 @@ export interface ISheetNoteInfo extends ISheetNote {
|
|
|
4
4
|
row: number;
|
|
5
5
|
col: number;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
7
10
|
export interface IFSheetsNoteWorksheet {
|
|
8
11
|
/**
|
|
9
12
|
* Get all annotations in the worksheet
|
|
@@ -27,6 +30,6 @@ export declare class FSheetsNoteWorksheet extends FWorksheet implements IFSheets
|
|
|
27
30
|
getNotes(): ISheetNoteInfo[];
|
|
28
31
|
}
|
|
29
32
|
declare module '@univerjs/sheets/facade' {
|
|
30
|
-
interface
|
|
33
|
+
interface FWorksheet extends IFSheetsNoteWorksheet {
|
|
31
34
|
}
|
|
32
35
|
}
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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.
|
|
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.FSheetsNoteRangeMixin=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.9.
|
|
3
|
+
"version": "0.9.2",
|
|
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.9.
|
|
60
|
-
"@univerjs/core": "0.9.
|
|
59
|
+
"@univerjs/sheets": "0.9.2",
|
|
60
|
+
"@univerjs/core": "0.9.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"rxjs": "^7.8.2",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
65
|
"vite": "^6.3.5",
|
|
66
66
|
"vitest": "^3.2.4",
|
|
67
|
-
"@univerjs-infra/shared": "0.9.
|
|
67
|
+
"@univerjs-infra/shared": "0.9.2"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"test": "vitest run",
|