@univerjs/sheets-note 0.24.0 → 0.25.0-insiders.20260608-e4336f7

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
@@ -83,7 +83,10 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
83
83
  return injector.get(_univerjs_sheets_note.SheetsNoteModel).change$.subscribe((change) => {
84
84
  if (change.type === "update" && !change.oldNote && change.newNote) {
85
85
  const { unitId, subUnitId, newNote } = change;
86
- const target = this.getSheetTarget(unitId, subUnitId);
86
+ const target = this.getSheetCommandTarget({
87
+ unitId,
88
+ subUnitId
89
+ });
87
90
  if (!target) return;
88
91
  const { workbook, worksheet } = target;
89
92
  const eventParams = {
@@ -101,7 +104,10 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
101
104
  return injector.get(_univerjs_sheets_note.SheetsNoteModel).change$.subscribe((change) => {
102
105
  if (change.type === "update" && change.oldNote && !change.newNote) {
103
106
  const { unitId, subUnitId, oldNote } = change;
104
- const target = this.getSheetTarget(unitId, subUnitId);
107
+ const target = this.getSheetCommandTarget({
108
+ unitId,
109
+ subUnitId
110
+ });
105
111
  if (!target) return;
106
112
  const { workbook, worksheet } = target;
107
113
  const eventParams = {
@@ -119,7 +125,10 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
119
125
  return injector.get(_univerjs_sheets_note.SheetsNoteModel).change$.subscribe((change) => {
120
126
  if (change.type === "update" && change.oldNote && change.newNote) {
121
127
  const { unitId, subUnitId, oldNote, newNote } = change;
122
- const target = this.getSheetTarget(unitId, subUnitId);
128
+ const target = this.getSheetCommandTarget({
129
+ unitId,
130
+ subUnitId
131
+ });
123
132
  if (!target) return;
124
133
  const { workbook, worksheet } = target;
125
134
  const eventParams = {
@@ -138,7 +147,10 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
138
147
  return injector.get(_univerjs_sheets_note.SheetsNoteModel).change$.subscribe((change) => {
139
148
  if (change.type === "update" && change.oldNote && change.newNote && !change.oldNote.show && change.newNote.show) {
140
149
  const { unitId, subUnitId, newNote } = change;
141
- const target = this.getSheetTarget(unitId, subUnitId);
150
+ const target = this.getSheetCommandTarget({
151
+ unitId,
152
+ subUnitId
153
+ });
142
154
  if (!target) return;
143
155
  const { workbook, worksheet } = target;
144
156
  const eventParams = {
@@ -155,7 +167,10 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
155
167
  return injector.get(_univerjs_sheets_note.SheetsNoteModel).change$.subscribe((change) => {
156
168
  if (change.type === "update" && change.oldNote && change.newNote && change.oldNote.show && !change.newNote.show) {
157
169
  const { unitId, subUnitId, newNote } = change;
158
- const target = this.getSheetTarget(unitId, subUnitId);
170
+ const target = this.getSheetCommandTarget({
171
+ unitId,
172
+ subUnitId
173
+ });
159
174
  if (!target) return;
160
175
  const { workbook, worksheet } = target;
161
176
  const eventParams = {
@@ -170,15 +185,16 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
170
185
  }));
171
186
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteAdd, () => commandService.beforeCommandExecuted((command) => {
172
187
  if (command.id === _univerjs_sheets_note.SheetUpdateNoteCommand.id) {
173
- const { unitId, sheetId, row, col, note } = command.params;
174
- const target = this.getSheetTarget(unitId, sheetId);
188
+ const params = command.params;
189
+ const target = this.getSheetCommandTarget(params);
175
190
  if (!target) return;
176
- if (injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, sheetId, {
191
+ const { workbook, worksheet, unitId, subUnitId } = target;
192
+ const { row, col, note } = params;
193
+ if (injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, subUnitId, {
177
194
  noteId: note.id,
178
195
  row,
179
196
  col
180
197
  })) return;
181
- const { workbook, worksheet } = target;
182
198
  const eventParams = {
183
199
  workbook,
184
200
  worksheet,
@@ -191,16 +207,17 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
191
207
  })));
192
208
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteDelete, () => commandService.beforeCommandExecuted((command) => {
193
209
  if (command.id === _univerjs_sheets_note.SheetDeleteNoteCommand.id) {
194
- const { unitId, sheetId, row, col } = command.params;
195
- const target = this.getSheetTarget(unitId, sheetId);
210
+ const target = this.getSheetCommandTarget();
196
211
  if (!target) return;
197
- if (row === void 0 || col === void 0) return;
198
- const oldNote = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, sheetId, {
212
+ const selection = injector.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
213
+ if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
214
+ const { workbook, worksheet, unitId, subUnitId } = target;
215
+ const { actualRow: row, actualColumn: col } = selection.primary;
216
+ const oldNote = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, subUnitId, {
199
217
  row,
200
218
  col
201
219
  });
202
220
  if (!oldNote) return;
203
- const { workbook, worksheet } = target;
204
221
  const eventParams = {
205
222
  workbook,
206
223
  worksheet,
@@ -213,15 +230,16 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
213
230
  })));
214
231
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteUpdate, () => commandService.beforeCommandExecuted((command) => {
215
232
  if (command.id === _univerjs_sheets_note.SheetUpdateNoteCommand.id) {
216
- const { unitId, sheetId, row, col, note } = command.params;
217
- const target = this.getSheetTarget(unitId, sheetId);
233
+ const params = command.params;
234
+ const target = this.getSheetCommandTarget(params);
218
235
  if (!target) return;
219
- const oldNote = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, sheetId, {
236
+ const { workbook, worksheet, unitId, subUnitId } = target;
237
+ const { row, col, note } = params;
238
+ const oldNote = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, subUnitId, {
220
239
  row,
221
240
  col
222
241
  });
223
242
  if (!oldNote) return;
224
- const { workbook, worksheet } = target;
225
243
  const eventParams = {
226
244
  workbook,
227
245
  worksheet,
@@ -235,54 +253,44 @@ var FUniverSheetsNoteMixin = class extends _univerjs_core_facade.FUniver {
235
253
  })));
236
254
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteShow, () => commandService.beforeCommandExecuted((command) => {
237
255
  if (command.id === _univerjs_sheets_note.SheetToggleNotePopupCommand.id) {
238
- const target = (0, _univerjs_sheets.getSheetCommandTarget)(injector.get(_univerjs_core.IUniverInstanceService));
256
+ const target = this.getSheetCommandTarget();
239
257
  if (!target) return;
240
- const { unitId, subUnitId } = target;
241
- const workbook = this.getUniverSheet(unitId);
242
- if (!workbook) return;
243
- const worksheet = workbook.getSheetBySheetId(subUnitId);
244
- if (!worksheet) return;
245
258
  const selection = injector.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
246
259
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
247
- const sheetsNoteModel = injector.get(_univerjs_sheets_note.SheetsNoteModel);
248
- const { actualColumn, actualRow } = selection.primary;
249
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
250
- row: actualRow,
251
- col: actualColumn
260
+ const { workbook, worksheet, unitId, subUnitId } = target;
261
+ const { actualRow: row, actualColumn: col } = selection.primary;
262
+ const note = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, subUnitId, {
263
+ row,
264
+ col
252
265
  });
253
266
  if (!note || note.show) return;
254
267
  const eventParams = {
255
268
  workbook,
256
269
  worksheet,
257
- row: actualRow,
258
- col: actualColumn
270
+ row,
271
+ col
259
272
  };
260
273
  if (this.fireEvent(this.Event.BeforeSheetNoteShow, eventParams)) throw new _univerjs_core.CanceledError();
261
274
  }
262
275
  })));
263
276
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteHide, () => commandService.beforeCommandExecuted((command) => {
264
277
  if (command.id === _univerjs_sheets_note.SheetToggleNotePopupCommand.id) {
265
- const target = (0, _univerjs_sheets.getSheetCommandTarget)(injector.get(_univerjs_core.IUniverInstanceService));
278
+ const target = this.getSheetCommandTarget();
266
279
  if (!target) return;
267
- const { unitId, subUnitId } = target;
268
- const workbook = this.getUniverSheet(unitId);
269
- if (!workbook) return;
270
- const worksheet = workbook.getSheetBySheetId(subUnitId);
271
- if (!worksheet) return;
272
280
  const selection = injector.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
273
281
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
274
- const sheetsNoteModel = injector.get(_univerjs_sheets_note.SheetsNoteModel);
275
- const { actualColumn, actualRow } = selection.primary;
276
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
277
- row: actualRow,
278
- col: actualColumn
282
+ const { workbook, worksheet, unitId, subUnitId } = target;
283
+ const { actualRow: row, actualColumn: col } = selection.primary;
284
+ const note = injector.get(_univerjs_sheets_note.SheetsNoteModel).getNote(unitId, subUnitId, {
285
+ row,
286
+ col
279
287
  });
280
288
  if (!note || !note.show) return;
281
289
  const eventParams = {
282
290
  workbook,
283
291
  worksheet,
284
- row: actualRow,
285
- col: actualColumn
292
+ row,
293
+ col
286
294
  };
287
295
  if (this.fireEvent(this.Event.BeforeSheetNoteHide, eventParams)) throw new _univerjs_core.CanceledError();
288
296
  }
package/lib/cjs/index.js CHANGED
@@ -3,7 +3,7 @@ let _univerjs_core = require("@univerjs/core");
3
3
  let _univerjs_sheets = require("@univerjs/sheets");
4
4
  let rxjs = require("rxjs");
5
5
 
6
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
6
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
7
7
  function _typeof(o) {
8
8
  "@babel/helpers - typeof";
9
9
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -14,7 +14,7 @@ function _typeof(o) {
14
14
  }
15
15
 
16
16
  //#endregion
17
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
17
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
18
18
  function toPrimitive(t, r) {
19
19
  if ("object" != _typeof(t) || !t) return t;
20
20
  var e = t[Symbol.toPrimitive];
@@ -27,14 +27,14 @@ function toPrimitive(t, r) {
27
27
  }
28
28
 
29
29
  //#endregion
30
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
30
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
31
31
  function toPropertyKey(t) {
32
32
  var i = toPrimitive(t, "string");
33
33
  return "symbol" == _typeof(i) ? i : i + "";
34
34
  }
35
35
 
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
37
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
38
38
  function _defineProperty(e, r, t) {
39
39
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
40
40
  value: t,
@@ -441,7 +441,7 @@ const SheetUpdateNoteCommand = {
441
441
  const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
442
442
 
443
443
  //#endregion
444
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
444
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
445
445
  function __decorateParam(paramIndex, decorator) {
446
446
  return function(target, key) {
447
447
  decorator(target, key, paramIndex);
@@ -449,7 +449,7 @@ function __decorateParam(paramIndex, decorator) {
449
449
  }
450
450
 
451
451
  //#endregion
452
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
452
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
453
453
  function __decorate(decorators, target, key, desc) {
454
454
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
455
455
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -617,7 +617,7 @@ SheetsNoteResourceController = __decorate([
617
617
  //#endregion
618
618
  //#region package.json
619
619
  var name = "@univerjs/sheets-note";
620
- var version = "0.24.0";
620
+ var version = "0.25.0-insiders.20260608-e4336f7";
621
621
 
622
622
  //#endregion
623
623
  //#region src/config/config.ts
package/lib/es/facade.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { FEventName, FUniver } from "@univerjs/core/facade";
2
2
  import { RemoveNoteMutation, SheetDeleteNoteCommand, SheetToggleNotePopupCommand, SheetUpdateNoteCommand, SheetsNoteModel, UpdateNoteMutation } from "@univerjs/sheets-note";
3
3
  import { FRange, FWorksheet } from "@univerjs/sheets/facade";
4
- import { CanceledError, ICommandService, IUniverInstanceService } from "@univerjs/core";
5
- import { SheetsSelectionsService, getSheetCommandTarget } from "@univerjs/sheets";
4
+ import { CanceledError, ICommandService } from "@univerjs/core";
5
+ import { SheetsSelectionsService } from "@univerjs/sheets";
6
6
 
7
7
  //#region src/facade/f-event.ts
8
8
  /**
@@ -82,7 +82,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
82
82
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
83
83
  if (change.type === "update" && !change.oldNote && change.newNote) {
84
84
  const { unitId, subUnitId, newNote } = change;
85
- const target = this.getSheetTarget(unitId, subUnitId);
85
+ const target = this.getSheetCommandTarget({
86
+ unitId,
87
+ subUnitId
88
+ });
86
89
  if (!target) return;
87
90
  const { workbook, worksheet } = target;
88
91
  const eventParams = {
@@ -100,7 +103,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
100
103
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
101
104
  if (change.type === "update" && change.oldNote && !change.newNote) {
102
105
  const { unitId, subUnitId, oldNote } = change;
103
- const target = this.getSheetTarget(unitId, subUnitId);
106
+ const target = this.getSheetCommandTarget({
107
+ unitId,
108
+ subUnitId
109
+ });
104
110
  if (!target) return;
105
111
  const { workbook, worksheet } = target;
106
112
  const eventParams = {
@@ -118,7 +124,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
118
124
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
119
125
  if (change.type === "update" && change.oldNote && change.newNote) {
120
126
  const { unitId, subUnitId, oldNote, newNote } = change;
121
- const target = this.getSheetTarget(unitId, subUnitId);
127
+ const target = this.getSheetCommandTarget({
128
+ unitId,
129
+ subUnitId
130
+ });
122
131
  if (!target) return;
123
132
  const { workbook, worksheet } = target;
124
133
  const eventParams = {
@@ -137,7 +146,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
137
146
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
138
147
  if (change.type === "update" && change.oldNote && change.newNote && !change.oldNote.show && change.newNote.show) {
139
148
  const { unitId, subUnitId, newNote } = change;
140
- const target = this.getSheetTarget(unitId, subUnitId);
149
+ const target = this.getSheetCommandTarget({
150
+ unitId,
151
+ subUnitId
152
+ });
141
153
  if (!target) return;
142
154
  const { workbook, worksheet } = target;
143
155
  const eventParams = {
@@ -154,7 +166,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
154
166
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
155
167
  if (change.type === "update" && change.oldNote && change.newNote && change.oldNote.show && !change.newNote.show) {
156
168
  const { unitId, subUnitId, newNote } = change;
157
- const target = this.getSheetTarget(unitId, subUnitId);
169
+ const target = this.getSheetCommandTarget({
170
+ unitId,
171
+ subUnitId
172
+ });
158
173
  if (!target) return;
159
174
  const { workbook, worksheet } = target;
160
175
  const eventParams = {
@@ -169,15 +184,16 @@ var FUniverSheetsNoteMixin = class extends FUniver {
169
184
  }));
170
185
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteAdd, () => commandService.beforeCommandExecuted((command) => {
171
186
  if (command.id === SheetUpdateNoteCommand.id) {
172
- const { unitId, sheetId, row, col, note } = command.params;
173
- const target = this.getSheetTarget(unitId, sheetId);
187
+ const params = command.params;
188
+ const target = this.getSheetCommandTarget(params);
174
189
  if (!target) return;
175
- if (injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
190
+ const { workbook, worksheet, unitId, subUnitId } = target;
191
+ const { row, col, note } = params;
192
+ if (injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
176
193
  noteId: note.id,
177
194
  row,
178
195
  col
179
196
  })) return;
180
- const { workbook, worksheet } = target;
181
197
  const eventParams = {
182
198
  workbook,
183
199
  worksheet,
@@ -190,16 +206,17 @@ var FUniverSheetsNoteMixin = class extends FUniver {
190
206
  })));
191
207
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteDelete, () => commandService.beforeCommandExecuted((command) => {
192
208
  if (command.id === SheetDeleteNoteCommand.id) {
193
- const { unitId, sheetId, row, col } = command.params;
194
- const target = this.getSheetTarget(unitId, sheetId);
209
+ const target = this.getSheetCommandTarget();
195
210
  if (!target) return;
196
- if (row === void 0 || col === void 0) return;
197
- const oldNote = injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
211
+ const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
212
+ if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
213
+ const { workbook, worksheet, unitId, subUnitId } = target;
214
+ const { actualRow: row, actualColumn: col } = selection.primary;
215
+ const oldNote = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
198
216
  row,
199
217
  col
200
218
  });
201
219
  if (!oldNote) return;
202
- const { workbook, worksheet } = target;
203
220
  const eventParams = {
204
221
  workbook,
205
222
  worksheet,
@@ -212,15 +229,16 @@ var FUniverSheetsNoteMixin = class extends FUniver {
212
229
  })));
213
230
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteUpdate, () => commandService.beforeCommandExecuted((command) => {
214
231
  if (command.id === SheetUpdateNoteCommand.id) {
215
- const { unitId, sheetId, row, col, note } = command.params;
216
- const target = this.getSheetTarget(unitId, sheetId);
232
+ const params = command.params;
233
+ const target = this.getSheetCommandTarget(params);
217
234
  if (!target) return;
218
- const oldNote = injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
235
+ const { workbook, worksheet, unitId, subUnitId } = target;
236
+ const { row, col, note } = params;
237
+ const oldNote = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
219
238
  row,
220
239
  col
221
240
  });
222
241
  if (!oldNote) return;
223
- const { workbook, worksheet } = target;
224
242
  const eventParams = {
225
243
  workbook,
226
244
  worksheet,
@@ -234,54 +252,44 @@ var FUniverSheetsNoteMixin = class extends FUniver {
234
252
  })));
235
253
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteShow, () => commandService.beforeCommandExecuted((command) => {
236
254
  if (command.id === SheetToggleNotePopupCommand.id) {
237
- const target = getSheetCommandTarget(injector.get(IUniverInstanceService));
255
+ const target = this.getSheetCommandTarget();
238
256
  if (!target) return;
239
- const { unitId, subUnitId } = target;
240
- const workbook = this.getUniverSheet(unitId);
241
- if (!workbook) return;
242
- const worksheet = workbook.getSheetBySheetId(subUnitId);
243
- if (!worksheet) return;
244
257
  const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
245
258
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
246
- const sheetsNoteModel = injector.get(SheetsNoteModel);
247
- const { actualColumn, actualRow } = selection.primary;
248
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
249
- row: actualRow,
250
- col: actualColumn
259
+ const { workbook, worksheet, unitId, subUnitId } = target;
260
+ const { actualRow: row, actualColumn: col } = selection.primary;
261
+ const note = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
262
+ row,
263
+ col
251
264
  });
252
265
  if (!note || note.show) return;
253
266
  const eventParams = {
254
267
  workbook,
255
268
  worksheet,
256
- row: actualRow,
257
- col: actualColumn
269
+ row,
270
+ col
258
271
  };
259
272
  if (this.fireEvent(this.Event.BeforeSheetNoteShow, eventParams)) throw new CanceledError();
260
273
  }
261
274
  })));
262
275
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteHide, () => commandService.beforeCommandExecuted((command) => {
263
276
  if (command.id === SheetToggleNotePopupCommand.id) {
264
- const target = getSheetCommandTarget(injector.get(IUniverInstanceService));
277
+ const target = this.getSheetCommandTarget();
265
278
  if (!target) return;
266
- const { unitId, subUnitId } = target;
267
- const workbook = this.getUniverSheet(unitId);
268
- if (!workbook) return;
269
- const worksheet = workbook.getSheetBySheetId(subUnitId);
270
- if (!worksheet) return;
271
279
  const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
272
280
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
273
- const sheetsNoteModel = injector.get(SheetsNoteModel);
274
- const { actualColumn, actualRow } = selection.primary;
275
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
276
- row: actualRow,
277
- col: actualColumn
281
+ const { workbook, worksheet, unitId, subUnitId } = target;
282
+ const { actualRow: row, actualColumn: col } = selection.primary;
283
+ const note = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
284
+ row,
285
+ col
278
286
  });
279
287
  if (!note || !note.show) return;
280
288
  const eventParams = {
281
289
  workbook,
282
290
  worksheet,
283
- row: actualRow,
284
- col: actualColumn
291
+ row,
292
+ col
285
293
  };
286
294
  if (this.fireEvent(this.Event.BeforeSheetNoteHide, eventParams)) throw new CanceledError();
287
295
  }
package/lib/es/index.js CHANGED
@@ -2,7 +2,7 @@ import { CommandType, DependentOn, Disposable, ICommandService, IConfigService,
2
2
  import { CopySheetCommand, RefRangeService, RemoveSheetCommand, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
3
3
  import { Subject, filter, map } from "rxjs";
4
4
 
5
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
5
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
6
6
  function _typeof(o) {
7
7
  "@babel/helpers - typeof";
8
8
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -13,7 +13,7 @@ function _typeof(o) {
13
13
  }
14
14
 
15
15
  //#endregion
16
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
16
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
17
17
  function toPrimitive(t, r) {
18
18
  if ("object" != _typeof(t) || !t) return t;
19
19
  var e = t[Symbol.toPrimitive];
@@ -26,14 +26,14 @@ function toPrimitive(t, r) {
26
26
  }
27
27
 
28
28
  //#endregion
29
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
29
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
30
30
  function toPropertyKey(t) {
31
31
  var i = toPrimitive(t, "string");
32
32
  return "symbol" == _typeof(i) ? i : i + "";
33
33
  }
34
34
 
35
35
  //#endregion
36
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
36
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
37
37
  function _defineProperty(e, r, t) {
38
38
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
39
  value: t,
@@ -440,7 +440,7 @@ const SheetUpdateNoteCommand = {
440
440
  const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
441
441
 
442
442
  //#endregion
443
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
443
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
444
444
  function __decorateParam(paramIndex, decorator) {
445
445
  return function(target, key) {
446
446
  decorator(target, key, paramIndex);
@@ -448,7 +448,7 @@ function __decorateParam(paramIndex, decorator) {
448
448
  }
449
449
 
450
450
  //#endregion
451
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
451
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
452
452
  function __decorate(decorators, target, key, desc) {
453
453
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
454
454
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -616,7 +616,7 @@ SheetsNoteResourceController = __decorate([
616
616
  //#endregion
617
617
  //#region package.json
618
618
  var name = "@univerjs/sheets-note";
619
- var version = "0.24.0";
619
+ var version = "0.25.0-insiders.20260608-e4336f7";
620
620
 
621
621
  //#endregion
622
622
  //#region src/config/config.ts
package/lib/facade.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { FEventName, FUniver } from "@univerjs/core/facade";
2
2
  import { RemoveNoteMutation, SheetDeleteNoteCommand, SheetToggleNotePopupCommand, SheetUpdateNoteCommand, SheetsNoteModel, UpdateNoteMutation } from "@univerjs/sheets-note";
3
3
  import { FRange, FWorksheet } from "@univerjs/sheets/facade";
4
- import { CanceledError, ICommandService, IUniverInstanceService } from "@univerjs/core";
5
- import { SheetsSelectionsService, getSheetCommandTarget } from "@univerjs/sheets";
4
+ import { CanceledError, ICommandService } from "@univerjs/core";
5
+ import { SheetsSelectionsService } from "@univerjs/sheets";
6
6
 
7
7
  //#region src/facade/f-event.ts
8
8
  /**
@@ -82,7 +82,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
82
82
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
83
83
  if (change.type === "update" && !change.oldNote && change.newNote) {
84
84
  const { unitId, subUnitId, newNote } = change;
85
- const target = this.getSheetTarget(unitId, subUnitId);
85
+ const target = this.getSheetCommandTarget({
86
+ unitId,
87
+ subUnitId
88
+ });
86
89
  if (!target) return;
87
90
  const { workbook, worksheet } = target;
88
91
  const eventParams = {
@@ -100,7 +103,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
100
103
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
101
104
  if (change.type === "update" && change.oldNote && !change.newNote) {
102
105
  const { unitId, subUnitId, oldNote } = change;
103
- const target = this.getSheetTarget(unitId, subUnitId);
106
+ const target = this.getSheetCommandTarget({
107
+ unitId,
108
+ subUnitId
109
+ });
104
110
  if (!target) return;
105
111
  const { workbook, worksheet } = target;
106
112
  const eventParams = {
@@ -118,7 +124,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
118
124
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
119
125
  if (change.type === "update" && change.oldNote && change.newNote) {
120
126
  const { unitId, subUnitId, oldNote, newNote } = change;
121
- const target = this.getSheetTarget(unitId, subUnitId);
127
+ const target = this.getSheetCommandTarget({
128
+ unitId,
129
+ subUnitId
130
+ });
122
131
  if (!target) return;
123
132
  const { workbook, worksheet } = target;
124
133
  const eventParams = {
@@ -137,7 +146,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
137
146
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
138
147
  if (change.type === "update" && change.oldNote && change.newNote && !change.oldNote.show && change.newNote.show) {
139
148
  const { unitId, subUnitId, newNote } = change;
140
- const target = this.getSheetTarget(unitId, subUnitId);
149
+ const target = this.getSheetCommandTarget({
150
+ unitId,
151
+ subUnitId
152
+ });
141
153
  if (!target) return;
142
154
  const { workbook, worksheet } = target;
143
155
  const eventParams = {
@@ -154,7 +166,10 @@ var FUniverSheetsNoteMixin = class extends FUniver {
154
166
  return injector.get(SheetsNoteModel).change$.subscribe((change) => {
155
167
  if (change.type === "update" && change.oldNote && change.newNote && change.oldNote.show && !change.newNote.show) {
156
168
  const { unitId, subUnitId, newNote } = change;
157
- const target = this.getSheetTarget(unitId, subUnitId);
169
+ const target = this.getSheetCommandTarget({
170
+ unitId,
171
+ subUnitId
172
+ });
158
173
  if (!target) return;
159
174
  const { workbook, worksheet } = target;
160
175
  const eventParams = {
@@ -169,15 +184,16 @@ var FUniverSheetsNoteMixin = class extends FUniver {
169
184
  }));
170
185
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteAdd, () => commandService.beforeCommandExecuted((command) => {
171
186
  if (command.id === SheetUpdateNoteCommand.id) {
172
- const { unitId, sheetId, row, col, note } = command.params;
173
- const target = this.getSheetTarget(unitId, sheetId);
187
+ const params = command.params;
188
+ const target = this.getSheetCommandTarget(params);
174
189
  if (!target) return;
175
- if (injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
190
+ const { workbook, worksheet, unitId, subUnitId } = target;
191
+ const { row, col, note } = params;
192
+ if (injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
176
193
  noteId: note.id,
177
194
  row,
178
195
  col
179
196
  })) return;
180
- const { workbook, worksheet } = target;
181
197
  const eventParams = {
182
198
  workbook,
183
199
  worksheet,
@@ -190,16 +206,17 @@ var FUniverSheetsNoteMixin = class extends FUniver {
190
206
  })));
191
207
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteDelete, () => commandService.beforeCommandExecuted((command) => {
192
208
  if (command.id === SheetDeleteNoteCommand.id) {
193
- const { unitId, sheetId, row, col } = command.params;
194
- const target = this.getSheetTarget(unitId, sheetId);
209
+ const target = this.getSheetCommandTarget();
195
210
  if (!target) return;
196
- if (row === void 0 || col === void 0) return;
197
- const oldNote = injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
211
+ const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
212
+ if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
213
+ const { workbook, worksheet, unitId, subUnitId } = target;
214
+ const { actualRow: row, actualColumn: col } = selection.primary;
215
+ const oldNote = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
198
216
  row,
199
217
  col
200
218
  });
201
219
  if (!oldNote) return;
202
- const { workbook, worksheet } = target;
203
220
  const eventParams = {
204
221
  workbook,
205
222
  worksheet,
@@ -212,15 +229,16 @@ var FUniverSheetsNoteMixin = class extends FUniver {
212
229
  })));
213
230
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteUpdate, () => commandService.beforeCommandExecuted((command) => {
214
231
  if (command.id === SheetUpdateNoteCommand.id) {
215
- const { unitId, sheetId, row, col, note } = command.params;
216
- const target = this.getSheetTarget(unitId, sheetId);
232
+ const params = command.params;
233
+ const target = this.getSheetCommandTarget(params);
217
234
  if (!target) return;
218
- const oldNote = injector.get(SheetsNoteModel).getNote(unitId, sheetId, {
235
+ const { workbook, worksheet, unitId, subUnitId } = target;
236
+ const { row, col, note } = params;
237
+ const oldNote = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
219
238
  row,
220
239
  col
221
240
  });
222
241
  if (!oldNote) return;
223
- const { workbook, worksheet } = target;
224
242
  const eventParams = {
225
243
  workbook,
226
244
  worksheet,
@@ -234,54 +252,44 @@ var FUniverSheetsNoteMixin = class extends FUniver {
234
252
  })));
235
253
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteShow, () => commandService.beforeCommandExecuted((command) => {
236
254
  if (command.id === SheetToggleNotePopupCommand.id) {
237
- const target = getSheetCommandTarget(injector.get(IUniverInstanceService));
255
+ const target = this.getSheetCommandTarget();
238
256
  if (!target) return;
239
- const { unitId, subUnitId } = target;
240
- const workbook = this.getUniverSheet(unitId);
241
- if (!workbook) return;
242
- const worksheet = workbook.getSheetBySheetId(subUnitId);
243
- if (!worksheet) return;
244
257
  const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
245
258
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
246
- const sheetsNoteModel = injector.get(SheetsNoteModel);
247
- const { actualColumn, actualRow } = selection.primary;
248
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
249
- row: actualRow,
250
- col: actualColumn
259
+ const { workbook, worksheet, unitId, subUnitId } = target;
260
+ const { actualRow: row, actualColumn: col } = selection.primary;
261
+ const note = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
262
+ row,
263
+ col
251
264
  });
252
265
  if (!note || note.show) return;
253
266
  const eventParams = {
254
267
  workbook,
255
268
  worksheet,
256
- row: actualRow,
257
- col: actualColumn
269
+ row,
270
+ col
258
271
  };
259
272
  if (this.fireEvent(this.Event.BeforeSheetNoteShow, eventParams)) throw new CanceledError();
260
273
  }
261
274
  })));
262
275
  this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteHide, () => commandService.beforeCommandExecuted((command) => {
263
276
  if (command.id === SheetToggleNotePopupCommand.id) {
264
- const target = getSheetCommandTarget(injector.get(IUniverInstanceService));
277
+ const target = this.getSheetCommandTarget();
265
278
  if (!target) return;
266
- const { unitId, subUnitId } = target;
267
- const workbook = this.getUniverSheet(unitId);
268
- if (!workbook) return;
269
- const worksheet = workbook.getSheetBySheetId(subUnitId);
270
- if (!worksheet) return;
271
279
  const selection = injector.get(SheetsSelectionsService).getCurrentLastSelection();
272
280
  if (!(selection === null || selection === void 0 ? void 0 : selection.primary)) return;
273
- const sheetsNoteModel = injector.get(SheetsNoteModel);
274
- const { actualColumn, actualRow } = selection.primary;
275
- const note = sheetsNoteModel.getNote(unitId, subUnitId, {
276
- row: actualRow,
277
- col: actualColumn
281
+ const { workbook, worksheet, unitId, subUnitId } = target;
282
+ const { actualRow: row, actualColumn: col } = selection.primary;
283
+ const note = injector.get(SheetsNoteModel).getNote(unitId, subUnitId, {
284
+ row,
285
+ col
278
286
  });
279
287
  if (!note || !note.show) return;
280
288
  const eventParams = {
281
289
  workbook,
282
290
  worksheet,
283
- row: actualRow,
284
- col: actualColumn
291
+ row,
292
+ col
285
293
  };
286
294
  if (this.fireEvent(this.Event.BeforeSheetNoteHide, eventParams)) throw new CanceledError();
287
295
  }
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@ import { CommandType, DependentOn, Disposable, ICommandService, IConfigService,
2
2
  import { CopySheetCommand, RefRangeService, RemoveSheetCommand, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
3
3
  import { Subject, filter, map } from "rxjs";
4
4
 
5
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
5
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
6
6
  function _typeof(o) {
7
7
  "@babel/helpers - typeof";
8
8
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -13,7 +13,7 @@ function _typeof(o) {
13
13
  }
14
14
 
15
15
  //#endregion
16
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
16
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
17
17
  function toPrimitive(t, r) {
18
18
  if ("object" != _typeof(t) || !t) return t;
19
19
  var e = t[Symbol.toPrimitive];
@@ -26,14 +26,14 @@ function toPrimitive(t, r) {
26
26
  }
27
27
 
28
28
  //#endregion
29
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
29
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
30
30
  function toPropertyKey(t) {
31
31
  var i = toPrimitive(t, "string");
32
32
  return "symbol" == _typeof(i) ? i : i + "";
33
33
  }
34
34
 
35
35
  //#endregion
36
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
36
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
37
37
  function _defineProperty(e, r, t) {
38
38
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
39
  value: t,
@@ -440,7 +440,7 @@ const SheetUpdateNoteCommand = {
440
440
  const PLUGIN_NAME = "SHEET_NOTE_PLUGIN";
441
441
 
442
442
  //#endregion
443
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
443
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
444
444
  function __decorateParam(paramIndex, decorator) {
445
445
  return function(target, key) {
446
446
  decorator(target, key, paramIndex);
@@ -448,7 +448,7 @@ function __decorateParam(paramIndex, decorator) {
448
448
  }
449
449
 
450
450
  //#endregion
451
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
451
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
452
452
  function __decorate(decorators, target, key, desc) {
453
453
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
454
454
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -616,7 +616,7 @@ SheetsNoteResourceController = __decorate([
616
616
  //#endregion
617
617
  //#region package.json
618
618
  var name = "@univerjs/sheets-note";
619
- var version = "0.24.0";
619
+ var version = "0.25.0-insiders.20260608-e4336f7";
620
620
 
621
621
  //#endregion
622
622
  //#region src/config/config.ts
@@ -26,7 +26,8 @@ export interface IFRangeSheetsNoteMixin {
26
26
  * @example
27
27
  * ```ts
28
28
  * const fWorkbook = univerAPI.getActiveWorkbook();
29
- * const fWorksheet = fWorkbook.getActiveSheet();
29
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
30
+ * if (!fWorksheet) return;
30
31
  * const fRange = fWorksheet.getRange('A1:D10');
31
32
  * const note = fRange.getNote();
32
33
  * console.log(note);
@@ -40,7 +41,8 @@ export interface IFRangeSheetsNoteMixin {
40
41
  * @example
41
42
  * ```ts
42
43
  * const fWorkbook = univerAPI.getActiveWorkbook();
43
- * const fWorksheet = fWorkbook.getActiveSheet();
44
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
45
+ * if (!fWorksheet) return;
44
46
  * const fRange = fWorksheet.getRange('A1');
45
47
  * fRange.createOrUpdateNote({
46
48
  * note: 'This is a note',
@@ -57,7 +59,8 @@ export interface IFRangeSheetsNoteMixin {
57
59
  * @example
58
60
  * ```ts
59
61
  * const fWorkbook = univerAPI.getActiveWorkbook();
60
- * const fWorksheet = fWorkbook.getActiveSheet();
62
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
63
+ * if (!fWorksheet) return;
61
64
  * const notes = fWorksheet.getNotes();
62
65
  * console.log(notes);
63
66
  *
@@ -25,7 +25,8 @@ export interface IFWorksheetNoteMixin {
25
25
  * @example
26
26
  * ```ts
27
27
  * const fWorkbook = univerAPI.getActiveWorkbook();
28
- * const fWorksheet = fWorkbook.getActiveSheet();
28
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
29
+ * if (!fWorksheet) return;
29
30
  * const notes = fWorksheet.getNotes();
30
31
  * console.log(notes);
31
32
  *
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core/facade`),require(`@univerjs/sheets-note`),require(`@univerjs/sheets/facade`),require(`@univerjs/core`),require(`@univerjs/sheets`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core/facade`,`@univerjs/sheets-note`,`@univerjs/sheets/facade`,`@univerjs/core`,`@univerjs/sheets`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNoteFacade={},e.UniverCoreFacade,e.UniverSheetsNote,e.UniverSheetsFacade,e.UniverCore,e.UniverSheets))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=class extends t.FEventName{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`}};t.FEventName.extend(o);var s=class extends r.FRange{createOrUpdateNote(e){return this._commandService.syncExecuteCommand(n.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:e}),this}deleteNote(){return this._commandService.syncExecuteCommand(n.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(n.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),{row:this.getRow(),col:this.getColumn()})}};r.FRange.extend(s);var c=class extends t.FUniver{_initialize(e){let t=e.get(i.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteAdd,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&!e.oldNote&&e.newNote){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetTarget(t,n);if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col,note:r};this.fireEvent(this.Event.SheetNoteAdd,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteDelete,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&!e.newNote){let{unitId:t,subUnitId:n,oldNote:r}=e,i=this.getSheetTarget(t,n);if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col,oldNote:r};this.fireEvent(this.Event.SheetNoteDelete,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteUpdate,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote){let{unitId:t,subUnitId:n,oldNote:r,newNote:i}=e,a=this.getSheetTarget(t,n);if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:i.row,col:i.col,note:i,oldNote:r};this.fireEvent(this.Event.SheetNoteUpdate,c)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteShow,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote&&!e.oldNote.show&&e.newNote.show){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetTarget(t,n);if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col};this.fireEvent(this.Event.SheetNoteShow,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteHide,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote&&e.oldNote.show&&!e.newNote.show){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetTarget(t,n);if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col};this.fireEvent(this.Event.SheetNoteHide,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetUpdateNoteCommand.id){let{unitId:r,sheetId:a,row:o,col:s,note:c}=t.params,l=this.getSheetTarget(r,a);if(!l||e.get(n.SheetsNoteModel).getNote(r,a,{noteId:c.id,row:o,col:s}))return;let{workbook:u,worksheet:d}=l,f={workbook:u,worksheet:d,row:o,col:s,note:c};if(this.fireEvent(this.Event.BeforeSheetNoteAdd,f))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetDeleteNoteCommand.id){let{unitId:r,sheetId:a,row:o,col:s}=t.params,c=this.getSheetTarget(r,a);if(!c||o===void 0||s===void 0)return;let l=e.get(n.SheetsNoteModel).getNote(r,a,{row:o,col:s});if(!l)return;let{workbook:u,worksheet:d}=c,f={workbook:u,worksheet:d,row:o,col:s,oldNote:l};if(this.fireEvent(this.Event.BeforeSheetNoteDelete,f))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetUpdateNoteCommand.id){let{unitId:r,sheetId:a,row:o,col:s,note:c}=t.params,l=this.getSheetTarget(r,a);if(!l)return;let u=e.get(n.SheetsNoteModel).getNote(r,a,{row:o,col:s});if(!u)return;let{workbook:d,worksheet:f}=l,p={workbook:d,worksheet:f,row:o,col:s,note:c,oldNote:u};if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,p))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetToggleNotePopupCommand.id){let t=(0,a.getSheetCommandTarget)(e.get(i.IUniverInstanceService));if(!t)return;let{unitId:r,subUnitId:o}=t,s=this.getUniverSheet(r);if(!s)return;let c=s.getSheetBySheetId(o);if(!c)return;let l=e.get(a.SheetsSelectionsService).getCurrentLastSelection();if(!(l!=null&&l.primary))return;let u=e.get(n.SheetsNoteModel),{actualColumn:d,actualRow:f}=l.primary,p=u.getNote(r,o,{row:f,col:d});if(!p||p.show)return;let m={workbook:s,worksheet:c,row:f,col:d};if(this.fireEvent(this.Event.BeforeSheetNoteShow,m))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetToggleNotePopupCommand.id){let t=(0,a.getSheetCommandTarget)(e.get(i.IUniverInstanceService));if(!t)return;let{unitId:r,subUnitId:o}=t,s=this.getUniverSheet(r);if(!s)return;let c=s.getSheetBySheetId(o);if(!c)return;let l=e.get(a.SheetsSelectionsService).getCurrentLastSelection();if(!(l!=null&&l.primary))return;let u=e.get(n.SheetsNoteModel),{actualColumn:d,actualRow:f}=l.primary,p=u.getNote(r,o,{row:f,col:d});if(!p||!p.show)return;let m={workbook:s,worksheet:c,row:f,col:d};if(this.fireEvent(this.Event.BeforeSheetNoteHide,m))throw new i.CanceledError}})))}};t.FUniver.extend(c);var l=class extends r.FWorksheet{getNotes(){let e=this._injector.get(n.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId());return e?Array.from(e.values()).map(e=>({...e})):[]}};r.FWorksheet.extend(l),e.FRangeSheetsNoteMixin=s,e.FSheetsNoteEventNameMixin=o,e.FUniverSheetsNoteMixin=c,e.FWorksheetNoteMixin=l});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core/facade"),require("@univerjs/sheets-note"),require("@univerjs/sheets/facade"),require("@univerjs/core"),require("@univerjs/sheets")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core/facade`,`@univerjs/sheets-note`,`@univerjs/sheets/facade`,`@univerjs/core`,`@univerjs/sheets`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNoteFacade={},e.UniverCoreFacade,e.UniverSheetsNote,e.UniverSheetsFacade,e.UniverCore,e.UniverSheets))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=class extends t.FEventName{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`}};t.FEventName.extend(o);var s=class extends r.FRange{createOrUpdateNote(e){return this._commandService.syncExecuteCommand(n.UpdateNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn(),note:e}),this}deleteNote(){return this._commandService.syncExecuteCommand(n.RemoveNoteMutation.id,{unitId:this.getUnitId(),sheetId:this.getSheetId(),row:this.getRow(),col:this.getColumn()}),this}getNote(){return this._injector.get(n.SheetsNoteModel).getNote(this.getUnitId(),this.getSheetId(),{row:this.getRow(),col:this.getColumn()})}};r.FRange.extend(s);var c=class extends t.FUniver{_initialize(e){let t=e.get(i.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteAdd,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&!e.oldNote&&e.newNote){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col,note:r};this.fireEvent(this.Event.SheetNoteAdd,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteDelete,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&!e.newNote){let{unitId:t,subUnitId:n,oldNote:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col,oldNote:r};this.fireEvent(this.Event.SheetNoteDelete,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteUpdate,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote){let{unitId:t,subUnitId:n,oldNote:r,newNote:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:i.row,col:i.col,note:i,oldNote:r};this.fireEvent(this.Event.SheetNoteUpdate,c)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteShow,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote&&!e.oldNote.show&&e.newNote.show){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col};this.fireEvent(this.Event.SheetNoteShow,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetNoteHide,()=>e.get(n.SheetsNoteModel).change$.subscribe(e=>{if(e.type===`update`&&e.oldNote&&e.newNote&&e.oldNote.show&&!e.newNote.show){let{unitId:t,subUnitId:n,newNote:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r.row,col:r.col};this.fireEvent(this.Event.SheetNoteHide,s)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteAdd,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetUpdateNoteCommand.id){let r=t.params,a=this.getSheetCommandTarget(r);if(!a)return;let{workbook:o,worksheet:s,unitId:c,subUnitId:l}=a,{row:u,col:d,note:f}=r;if(e.get(n.SheetsNoteModel).getNote(c,l,{noteId:f.id,row:u,col:d}))return;let p={workbook:o,worksheet:s,row:u,col:d,note:f};if(this.fireEvent(this.Event.BeforeSheetNoteAdd,p))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteDelete,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetDeleteNoteCommand.id){let t=this.getSheetCommandTarget();if(!t)return;let r=e.get(a.SheetsSelectionsService).getCurrentLastSelection();if(!(r!=null&&r.primary))return;let{workbook:o,worksheet:s,unitId:c,subUnitId:l}=t,{actualRow:u,actualColumn:d}=r.primary,f=e.get(n.SheetsNoteModel).getNote(c,l,{row:u,col:d});if(!f)return;let p={workbook:o,worksheet:s,row:u,col:d,oldNote:f};if(this.fireEvent(this.Event.BeforeSheetNoteDelete,p))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteUpdate,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetUpdateNoteCommand.id){let r=t.params,a=this.getSheetCommandTarget(r);if(!a)return;let{workbook:o,worksheet:s,unitId:c,subUnitId:l}=a,{row:u,col:d,note:f}=r,p=e.get(n.SheetsNoteModel).getNote(c,l,{row:u,col:d});if(!p)return;let m={workbook:o,worksheet:s,row:u,col:d,note:f,oldNote:p};if(this.fireEvent(this.Event.BeforeSheetNoteUpdate,m))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteShow,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetToggleNotePopupCommand.id){let t=this.getSheetCommandTarget();if(!t)return;let r=e.get(a.SheetsSelectionsService).getCurrentLastSelection();if(!(r!=null&&r.primary))return;let{workbook:o,worksheet:s,unitId:c,subUnitId:l}=t,{actualRow:u,actualColumn:d}=r.primary,f=e.get(n.SheetsNoteModel).getNote(c,l,{row:u,col:d});if(!f||f.show)return;let p={workbook:o,worksheet:s,row:u,col:d};if(this.fireEvent(this.Event.BeforeSheetNoteShow,p))throw new i.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetNoteHide,()=>t.beforeCommandExecuted(t=>{if(t.id===n.SheetToggleNotePopupCommand.id){let t=this.getSheetCommandTarget();if(!t)return;let r=e.get(a.SheetsSelectionsService).getCurrentLastSelection();if(!(r!=null&&r.primary))return;let{workbook:o,worksheet:s,unitId:c,subUnitId:l}=t,{actualRow:u,actualColumn:d}=r.primary,f=e.get(n.SheetsNoteModel).getNote(c,l,{row:u,col:d});if(!f||!f.show)return;let p={workbook:o,worksheet:s,row:u,col:d};if(this.fireEvent(this.Event.BeforeSheetNoteHide,p))throw new i.CanceledError}})))}};t.FUniver.extend(c);var l=class extends r.FWorksheet{getNotes(){let e=this._injector.get(n.SheetsNoteModel).getSheetNotes(this.getWorkbook().getUnitId(),this.getSheetId());return e?Array.from(e.values()).map(e=>({...e})):[]}};r.FWorksheet.extend(l),e.FRangeSheetsNoteMixin=s,e.FSheetsNoteEventNameMixin=o,e.FUniverSheetsNoteMixin=c,e.FWorksheetNoteMixin=l});
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNote={},e.UniverCore,e.UniverSheets,e.rxjs))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=class extends t.Disposable{constructor(...e){super(...e),s(this,`_notesMap`,new Map),s(this,`_change$`,new r.Subject),s(this,`change$`,this._change$.asObservable())}_ensureNotesMap(e,t){let n=this._notesMap.get(e);n||(n=new Map,this._notesMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_getNoteByPosition(e,t,n,r){let i=this._ensureNotesMap(e,t);for(let[e,t]of i)if(t.row===n&&t.col===r)return t}_getNoteById(e,t,n){return this._ensureNotesMap(e,t).get(n)}_getNoteByParams(e,t,n){let{noteId:r,row:i,col:a}=n;return r?this._getNoteById(e,t,r):i!==void 0&&a!==void 0?this._getNoteByPosition(e,t,i,a):null}getSheetShowNotes$(e,t){return this._change$.pipe((0,r.filter)(({unitId:n,subUnitId:r})=>n===e&&r===t),(0,r.map)(()=>{let n=this._ensureNotesMap(e,t),r=[];for(let[i,a]of n)a.show&&r.push({loc:{row:a.row,col:a.col,unitId:e,subUnitId:t},note:a});return r}))}getCellNoteChange$(e,t,n,i){return this._change$.pipe((0,r.filter)(({unitId:r,subUnitId:a,oldNote:o})=>r!==e||a!==t||!o?!1:o.row===n&&o.col===i),(0,r.map)(e=>e))}updateNote(e,n,r,i,a,o){let s=this._getNoteByParams(e,n,{noteId:a==null?void 0:a.id,row:r,col:i}),c=this._ensureNotesMap(e,n),l={...a,id:(s==null?void 0:s.id)||a.id||(0,t.generateRandomId)(6),row:r,col:i};c.set(l.id,l),this._change$.next({unitId:e,subUnitId:n,oldNote:s,type:`update`,newNote:l,silent:o})}removeNote(e,t,n){let{noteId:r,row:i,col:a,silent:o}=n,s=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});s&&(this._ensureNotesMap(e,t).delete(s.id),this._change$.next({unitId:e,subUnitId:t,oldNote:s,type:`update`,newNote:null,silent:o}))}toggleNotePopup(e,t,n){let{noteId:r,row:i,col:a,silent:o}=n,s=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});if(!s)return;let c=this._ensureNotesMap(e,t),l={...s,show:!s.show};c.set(l.id,l),this._change$.next({unitId:e,subUnitId:t,oldNote:s,type:`update`,newNote:l,silent:o})}updateNotePosition(e,t,n){let{noteId:r,row:i,col:a,newRow:o,newCol:s,silent:c}=n,l=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});if(!l)return;let u=this._ensureNotesMap(e,t),d={...l,row:o,col:s};u.set(d.id,d),this._change$.next({unitId:e,subUnitId:t,oldNote:l,type:`ref`,newNote:d,silent:c})}getNote(e,t,n){return this._getNoteByParams(e,t,n)}getNotes(){return this._notesMap}getUnitNotes(e){return this._notesMap.get(e)}getSheetNotes(e,t){let n=this._notesMap.get(e);if(n)return n.get(t)}deleteUnitNotes(e){this._notesMap.delete(e)}};let l={id:`sheet.mutation.update-note`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,row:i,col:a,note:o,silent:s}=t;return e.get(c).updateNote(n,r,i,a,o,s),!0}},u={id:`sheet.mutation.remove-note`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,silent:s}=t;return e.get(c).removeNote(n,r,{noteId:i,row:a,col:o,silent:s}),!0}},d={id:`sheet.mutation.toggle-note-popup`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,silent:s}=t;return e.get(c).toggleNotePopup(n,r,{noteId:i,row:a,col:o,silent:s}),!0}},f={id:`sheet.mutation.update-note-position`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,newPosition:s,silent:l}=t;return e.get(c).updateNotePosition(n,r,{noteId:i,row:a,col:o,newRow:s.row,newCol:s.col,silent:l}),!0}},p={id:`sheet.command.delete-note`,type:t.CommandType.COMMAND,handler:e=>{let r=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!r)return!1;let i=e.get(n.SheetsSelectionsService).getCurrentLastSelection();if(!(i!=null&&i.primary))return!1;let a=e.get(c),{unitId:o,subUnitId:s}=r,{actualColumn:d,actualRow:f}=i.primary,p=a.getNote(o,s,{row:f,col:d});if(!p)return!1;let m=e.get(t.ICommandService),h=e.get(t.IUndoRedoService),g={id:u.id,params:{unitId:o,sheetId:s,noteId:p.id}},_={id:l.id,params:{unitId:o,sheetId:s,row:f,col:d,note:{...p}}};return m.syncExecuteCommand(g.id,g.params)?(h.pushUndoRedo({unitID:o,redoMutations:[g],undoMutations:[_]}),!0):!1}},m={id:`sheet.command.toggle-note-popup`,type:t.CommandType.COMMAND,handler:e=>{let r=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!r)return!1;let i=e.get(n.SheetsSelectionsService).getCurrentLastSelection();if(!(i!=null&&i.primary))return!1;let a=e.get(c),{unitId:o,subUnitId:s}=r,{actualColumn:l,actualRow:u}=i.primary,f=a.getNote(o,s,{row:u,col:l});if(!f)return!1;let p=e.get(t.ICommandService),m=e.get(t.IUndoRedoService),h={id:d.id,params:{unitId:o,sheetId:s,noteId:f.id}},g={id:d.id,params:{unitId:o,sheetId:s,noteId:f.id}};return p.syncExecuteCommand(h.id,h.params)?(m.pushUndoRedo({unitID:o,redoMutations:[h],undoMutations:[g]}),!0):!1}},h={id:`sheet.command.update-note`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!i)return!1;let a=e.get(t.ICommandService),o=e.get(t.IUndoRedoService),s=e.get(c),{unitId:d,subUnitId:f}=i,{row:p,col:m,note:h}=r,g=s.getNote(d,f,{noteId:h.id,row:p,col:m}),_={id:l.id,params:{unitId:d,sheetId:f,row:p,col:m,note:h}},v=[];if(g){let e={id:l.id,params:{unitId:d,sheetId:f,row:p,col:m,note:{...g}}};v.push(e)}else{let e={id:u.id,params:{unitId:d,sheetId:f,row:p,col:m}};v.push(e)}return a.syncExecuteCommand(_.id,_.params)?(o.pushUndoRedo({unitID:d,redoMutations:[_],undoMutations:v}),!0):!1}},g=`SHEET_NOTE_PLUGIN`;function _(e,t){return function(n,r){t(n,r,e)}}function v(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let y=class extends t.Disposable{constructor(e,t,n,r){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._sheetsNoteModel=r,this._initSnapshot(),this._initSheetChange()}_initSnapshot(){let e=e=>{let t=this._sheetsNoteModel.getUnitNotes(e);if(!t)return``;let n={};return t.forEach((e,t)=>{let r={};e.forEach(e=>{let{row:t,col:n}=e;r[t]||(r[t]={}),r[t][n]=e}),Object.keys(r).length>0&&(n[t]=r)}),JSON.stringify(n)},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:g,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._sheetsNoteModel.deleteUnitNotes(e)},onLoad:(e,t)=>{Object.entries(t).forEach(([t,n])=>{Object.entries(n).forEach(([n,r])=>{Object.entries(r).forEach(([r,i])=>{this._sheetsNoteModel.updateNote(e,t,Number(n),Number(r),i)})})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===n.RemoveSheetCommand.id){var r;let n=e.params,i=n.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=n.subUnitId||((r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId());if(!i||!a)return{redos:[],undos:[]};let o=this._sheetsNoteModel.getSheetNotes(i,a);if(!o)return{redos:[],undos:[]};let s=[],c=[];return o.forEach(e=>{s.push({id:u.id,params:{unitId:i,sheetId:a,noteId:e.id,row:e.row,col:e.col}}),c.push({id:l.id,params:{unitId:i,sheetId:a,row:e.row,col:e.col,note:e}})}),{redos:s,undos:c}}else if(e.id===n.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:i}=e.params;if(!n||!r||!i)return{redos:[],undos:[]};let a=this._sheetsNoteModel.getSheetNotes(n,r);if(!a)return{redos:[],undos:[]};let o=[],s=[];return a.forEach(e=>{let r={...e,id:(0,t.generateRandomId)(6)};o.push({id:l.id,params:{unitId:n,sheetId:i,row:r.row,col:r.col,note:r}}),s.push({id:u.id,params:{unitId:n,sheetId:i,noteId:r.id,row:r.row,col:r.col}})}),{redos:o,undos:s}}return{redos:[],undos:[]}}}))}};y=v([_(0,t.IResourceManagerService),_(1,t.IUniverInstanceService),_(2,(0,t.Inject)(n.SheetInterceptorService)),_(3,(0,t.Inject)(c))],y);var b=`@univerjs/sheets-note`,x=`0.24.0`;let S=`sheets-note.config`;Symbol(S);let C={},w=class extends t.Disposable{constructor(e,t,n,r){super(),this._refRangeService=e,this._sheetsNoteModel=t,this._selectionManagerService=n,this._commandService=r,s(this,`_disposableMap`,new Map),s(this,`_watcherMap`,new Map),s(this,`_handleRangeChange`,(e,t,n,r,i,a,o)=>a?{redos:[{id:f.id,params:{unitId:e,sheetId:t,noteId:n.id,newPosition:{row:a.startRow,col:a.startColumn},silent:o}}],undos:[{id:f.id,params:{unitId:e,sheetId:t,noteId:n.id,newPosition:{row:r,col:i},note:n,silent:o}}]}:{redos:[{id:u.id,params:{unitId:e,sheetId:t,noteId:n.id}}],undos:[{id:l.id,params:{unitId:e,sheetId:t,row:r,col:i,note:n}}]}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n,r){return`${e}-${t}-${n}-${r}`}_register(e,t,r,i,a){let o={startColumn:a,endColumn:a,startRow:i,endRow:i};this._disposableMap.set(this._getIdWithUnitId(e,t,i,a),this._refRangeService.registerRefRange(o,s=>{let c=(0,n.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(o,s,{selectionManagerService:this._selectionManagerService}),l=Array.isArray(c)?c[0]:c;return l&&l.startColumn===o.startColumn&&l.startRow===o.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,r,i,a,l,!1)},e,t))}_watch(e,n,r,i,a){let o={startColumn:a,endColumn:a,startRow:i,endRow:i};this._watcherMap.set(this._getIdWithUnitId(e,n,i,a),this._refRangeService.watchRange(e,n,o,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,i.startRow,i.startColumn,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n,r){var i;let a=this._getIdWithUnitId(e,t,n,r);(i=this._watcherMap.get(a))==null||i.dispose(),this._watcherMap.delete(a)}_unregister(e,t,n,r){var i;let a=this._getIdWithUnitId(e,t,n,r);(i=this._disposableMap.get(a))==null||i.dispose(),this._disposableMap.delete(a)}_initData(){let e=this._sheetsNoteModel.getNotes();for(let[t,n]of e)for(let[e,r]of n)r.forEach(n=>{this._register(t,e,n,n.row,n.col),this._watch(t,e,n,n.row,n.col)})}_initRefRange(){this.disposeWithMe(this._sheetsNoteModel.change$.subscribe(e=>{switch(e.type){case`update`:{let{unitId:t,subUnitId:n,oldNote:r,newNote:i}=e,a=i?i.row:r.row,o=i?i.col:r.col,s=this._getIdWithUnitId(t,n,a,o);i?this._disposableMap.has(s)||(this._register(t,n,i,a,o),this._watch(t,n,i,a,o)):(this._unregister(t,n,a,o),this._unwatch(t,n,a,o));break}case`ref`:{let{unitId:t,subUnitId:n,oldNote:r,newNote:i,silent:a}=e,{row:o,col:s}=r,{row:c,col:l}=i;this._unregister(t,n,o,s),a||(this._unwatch(t,n,o,s),this._watch(t,n,i,c,l)),this._register(t,n,i,c,l);break}}}))}};w=v([_(0,(0,t.Inject)(n.RefRangeService)),_(1,(0,t.Inject)(c)),_(2,(0,t.Inject)(n.SheetsSelectionsService)),_(3,t.ICommandService)],w);let T=class extends t.Disposable{constructor(e){super(),this._commandService=e,this._initialize()}_initialize(){[f,d,l,u,p,m,h].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}};T=v([_(0,t.ICommandService)],T);let E=class extends t.Plugin{constructor(e=C,n,r){super(),this._config=e,this._configService=n,this._injector=r;let{...i}=(0,t.merge)({},C,this._config);this._configService.setConfig(S,i)}onStarting(){[[c],[T],[y],[w]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[c],[T],[y]])}onReady(){(0,t.touchDependencies)(this._injector,[[w]])}};s(E,`pluginName`,g),s(E,`packageName`,b),s(E,`version`,x),s(E,`type`,t.UniverInstanceType.UNIVER_SHEET),E=v([(0,t.DependentOn)(n.UniverSheetsPlugin),_(1,t.IConfigService),_(2,(0,t.Inject)(t.Injector))],E),e.RemoveNoteMutation=u,e.SheetDeleteNoteCommand=p,e.SheetToggleNotePopupCommand=m,e.SheetUpdateNoteCommand=h,e.SheetsNoteModel=c,Object.defineProperty(e,`SheetsNoteResourceController`,{enumerable:!0,get:function(){return y}}),e.ToggleNotePopupMutation=d,Object.defineProperty(e,`UniverSheetsNotePlugin`,{enumerable:!0,get:function(){return E}}),e.UpdateNoteMutation=l,e.UpdateNotePositionMutation=f});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNote={},e.UniverCore,e.UniverSheets,e.rxjs))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=class extends t.Disposable{constructor(...e){super(...e),s(this,`_notesMap`,new Map),s(this,`_change$`,new r.Subject),s(this,`change$`,this._change$.asObservable())}_ensureNotesMap(e,t){let n=this._notesMap.get(e);n||(n=new Map,this._notesMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_getNoteByPosition(e,t,n,r){let i=this._ensureNotesMap(e,t);for(let[e,t]of i)if(t.row===n&&t.col===r)return t}_getNoteById(e,t,n){return this._ensureNotesMap(e,t).get(n)}_getNoteByParams(e,t,n){let{noteId:r,row:i,col:a}=n;return r?this._getNoteById(e,t,r):i!==void 0&&a!==void 0?this._getNoteByPosition(e,t,i,a):null}getSheetShowNotes$(e,t){return this._change$.pipe((0,r.filter)(({unitId:n,subUnitId:r})=>n===e&&r===t),(0,r.map)(()=>{let n=this._ensureNotesMap(e,t),r=[];for(let[i,a]of n)a.show&&r.push({loc:{row:a.row,col:a.col,unitId:e,subUnitId:t},note:a});return r}))}getCellNoteChange$(e,t,n,i){return this._change$.pipe((0,r.filter)(({unitId:r,subUnitId:a,oldNote:o})=>r!==e||a!==t||!o?!1:o.row===n&&o.col===i),(0,r.map)(e=>e))}updateNote(e,n,r,i,a,o){let s=this._getNoteByParams(e,n,{noteId:a==null?void 0:a.id,row:r,col:i}),c=this._ensureNotesMap(e,n),l={...a,id:(s==null?void 0:s.id)||a.id||(0,t.generateRandomId)(6),row:r,col:i};c.set(l.id,l),this._change$.next({unitId:e,subUnitId:n,oldNote:s,type:`update`,newNote:l,silent:o})}removeNote(e,t,n){let{noteId:r,row:i,col:a,silent:o}=n,s=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});s&&(this._ensureNotesMap(e,t).delete(s.id),this._change$.next({unitId:e,subUnitId:t,oldNote:s,type:`update`,newNote:null,silent:o}))}toggleNotePopup(e,t,n){let{noteId:r,row:i,col:a,silent:o}=n,s=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});if(!s)return;let c=this._ensureNotesMap(e,t),l={...s,show:!s.show};c.set(l.id,l),this._change$.next({unitId:e,subUnitId:t,oldNote:s,type:`update`,newNote:l,silent:o})}updateNotePosition(e,t,n){let{noteId:r,row:i,col:a,newRow:o,newCol:s,silent:c}=n,l=this._getNoteByParams(e,t,{noteId:r,row:i,col:a});if(!l)return;let u=this._ensureNotesMap(e,t),d={...l,row:o,col:s};u.set(d.id,d),this._change$.next({unitId:e,subUnitId:t,oldNote:l,type:`ref`,newNote:d,silent:c})}getNote(e,t,n){return this._getNoteByParams(e,t,n)}getNotes(){return this._notesMap}getUnitNotes(e){return this._notesMap.get(e)}getSheetNotes(e,t){let n=this._notesMap.get(e);if(n)return n.get(t)}deleteUnitNotes(e){this._notesMap.delete(e)}};let l={id:`sheet.mutation.update-note`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,row:i,col:a,note:o,silent:s}=t;return e.get(c).updateNote(n,r,i,a,o,s),!0}},u={id:`sheet.mutation.remove-note`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,silent:s}=t;return e.get(c).removeNote(n,r,{noteId:i,row:a,col:o,silent:s}),!0}},d={id:`sheet.mutation.toggle-note-popup`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,silent:s}=t;return e.get(c).toggleNotePopup(n,r,{noteId:i,row:a,col:o,silent:s}),!0}},f={id:`sheet.mutation.update-note-position`,type:t.CommandType.MUTATION,handler:(e,t)=>{let{unitId:n,sheetId:r,noteId:i,row:a,col:o,newPosition:s,silent:l}=t;return e.get(c).updateNotePosition(n,r,{noteId:i,row:a,col:o,newRow:s.row,newCol:s.col,silent:l}),!0}},p={id:`sheet.command.delete-note`,type:t.CommandType.COMMAND,handler:e=>{let r=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!r)return!1;let i=e.get(n.SheetsSelectionsService).getCurrentLastSelection();if(!(i!=null&&i.primary))return!1;let a=e.get(c),{unitId:o,subUnitId:s}=r,{actualColumn:d,actualRow:f}=i.primary,p=a.getNote(o,s,{row:f,col:d});if(!p)return!1;let m=e.get(t.ICommandService),h=e.get(t.IUndoRedoService),g={id:u.id,params:{unitId:o,sheetId:s,noteId:p.id}},_={id:l.id,params:{unitId:o,sheetId:s,row:f,col:d,note:{...p}}};return m.syncExecuteCommand(g.id,g.params)?(h.pushUndoRedo({unitID:o,redoMutations:[g],undoMutations:[_]}),!0):!1}},m={id:`sheet.command.toggle-note-popup`,type:t.CommandType.COMMAND,handler:e=>{let r=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!r)return!1;let i=e.get(n.SheetsSelectionsService).getCurrentLastSelection();if(!(i!=null&&i.primary))return!1;let a=e.get(c),{unitId:o,subUnitId:s}=r,{actualColumn:l,actualRow:u}=i.primary,f=a.getNote(o,s,{row:u,col:l});if(!f)return!1;let p=e.get(t.ICommandService),m=e.get(t.IUndoRedoService),h={id:d.id,params:{unitId:o,sheetId:s,noteId:f.id}},g={id:d.id,params:{unitId:o,sheetId:s,noteId:f.id}};return p.syncExecuteCommand(h.id,h.params)?(m.pushUndoRedo({unitID:o,redoMutations:[h],undoMutations:[g]}),!0):!1}},h={id:`sheet.command.update-note`,type:t.CommandType.COMMAND,handler:(e,r)=>{let i=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!i)return!1;let a=e.get(t.ICommandService),o=e.get(t.IUndoRedoService),s=e.get(c),{unitId:d,subUnitId:f}=i,{row:p,col:m,note:h}=r,g=s.getNote(d,f,{noteId:h.id,row:p,col:m}),_={id:l.id,params:{unitId:d,sheetId:f,row:p,col:m,note:h}},v=[];if(g){let e={id:l.id,params:{unitId:d,sheetId:f,row:p,col:m,note:{...g}}};v.push(e)}else{let e={id:u.id,params:{unitId:d,sheetId:f,row:p,col:m}};v.push(e)}return a.syncExecuteCommand(_.id,_.params)?(o.pushUndoRedo({unitID:d,redoMutations:[_],undoMutations:v}),!0):!1}},g=`SHEET_NOTE_PLUGIN`;function _(e,t){return function(n,r){t(n,r,e)}}function v(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let y=class extends t.Disposable{constructor(e,t,n,r){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._sheetsNoteModel=r,this._initSnapshot(),this._initSheetChange()}_initSnapshot(){let e=e=>{let t=this._sheetsNoteModel.getUnitNotes(e);if(!t)return``;let n={};return t.forEach((e,t)=>{let r={};e.forEach(e=>{let{row:t,col:n}=e;r[t]||(r[t]={}),r[t][n]=e}),Object.keys(r).length>0&&(n[t]=r)}),JSON.stringify(n)},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:g,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._sheetsNoteModel.deleteUnitNotes(e)},onLoad:(e,t)=>{Object.entries(t).forEach(([t,n])=>{Object.entries(n).forEach(([n,r])=>{Object.entries(r).forEach(([r,i])=>{this._sheetsNoteModel.updateNote(e,t,Number(n),Number(r),i)})})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===n.RemoveSheetCommand.id){var r;let n=e.params,i=n.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=n.subUnitId||((r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId());if(!i||!a)return{redos:[],undos:[]};let o=this._sheetsNoteModel.getSheetNotes(i,a);if(!o)return{redos:[],undos:[]};let s=[],c=[];return o.forEach(e=>{s.push({id:u.id,params:{unitId:i,sheetId:a,noteId:e.id,row:e.row,col:e.col}}),c.push({id:l.id,params:{unitId:i,sheetId:a,row:e.row,col:e.col,note:e}})}),{redos:s,undos:c}}else if(e.id===n.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:i}=e.params;if(!n||!r||!i)return{redos:[],undos:[]};let a=this._sheetsNoteModel.getSheetNotes(n,r);if(!a)return{redos:[],undos:[]};let o=[],s=[];return a.forEach(e=>{let r={...e,id:(0,t.generateRandomId)(6)};o.push({id:l.id,params:{unitId:n,sheetId:i,row:r.row,col:r.col,note:r}}),s.push({id:u.id,params:{unitId:n,sheetId:i,noteId:r.id,row:r.row,col:r.col}})}),{redos:o,undos:s}}return{redos:[],undos:[]}}}))}};y=v([_(0,t.IResourceManagerService),_(1,t.IUniverInstanceService),_(2,(0,t.Inject)(n.SheetInterceptorService)),_(3,(0,t.Inject)(c))],y);var b=`@univerjs/sheets-note`,x=`0.25.0-insiders.20260608-e4336f7`;let S={},C=class extends t.Disposable{constructor(e,t,n,r){super(),this._refRangeService=e,this._sheetsNoteModel=t,this._selectionManagerService=n,this._commandService=r,s(this,`_disposableMap`,new Map),s(this,`_watcherMap`,new Map),s(this,`_handleRangeChange`,(e,t,n,r,i,a,o)=>a?{redos:[{id:f.id,params:{unitId:e,sheetId:t,noteId:n.id,newPosition:{row:a.startRow,col:a.startColumn},silent:o}}],undos:[{id:f.id,params:{unitId:e,sheetId:t,noteId:n.id,newPosition:{row:r,col:i},note:n,silent:o}}]}:{redos:[{id:u.id,params:{unitId:e,sheetId:t,noteId:n.id}}],undos:[{id:l.id,params:{unitId:e,sheetId:t,row:r,col:i,note:n}}]}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n,r){return`${e}-${t}-${n}-${r}`}_register(e,t,r,i,a){let o={startColumn:a,endColumn:a,startRow:i,endRow:i};this._disposableMap.set(this._getIdWithUnitId(e,t,i,a),this._refRangeService.registerRefRange(o,s=>{let c=(0,n.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(o,s,{selectionManagerService:this._selectionManagerService}),l=Array.isArray(c)?c[0]:c;return l&&l.startColumn===o.startColumn&&l.startRow===o.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,r,i,a,l,!1)},e,t))}_watch(e,n,r,i,a){let o={startColumn:a,endColumn:a,startRow:i,endRow:i};this._watcherMap.set(this._getIdWithUnitId(e,n,i,a),this._refRangeService.watchRange(e,n,o,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,i.startRow,i.startColumn,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n,r){var i;let a=this._getIdWithUnitId(e,t,n,r);(i=this._watcherMap.get(a))==null||i.dispose(),this._watcherMap.delete(a)}_unregister(e,t,n,r){var i;let a=this._getIdWithUnitId(e,t,n,r);(i=this._disposableMap.get(a))==null||i.dispose(),this._disposableMap.delete(a)}_initData(){let e=this._sheetsNoteModel.getNotes();for(let[t,n]of e)for(let[e,r]of n)r.forEach(n=>{this._register(t,e,n,n.row,n.col),this._watch(t,e,n,n.row,n.col)})}_initRefRange(){this.disposeWithMe(this._sheetsNoteModel.change$.subscribe(e=>{switch(e.type){case`update`:{let{unitId:t,subUnitId:n,oldNote:r,newNote:i}=e,a=i?i.row:r.row,o=i?i.col:r.col,s=this._getIdWithUnitId(t,n,a,o);i?this._disposableMap.has(s)||(this._register(t,n,i,a,o),this._watch(t,n,i,a,o)):(this._unregister(t,n,a,o),this._unwatch(t,n,a,o));break}case`ref`:{let{unitId:t,subUnitId:n,oldNote:r,newNote:i,silent:a}=e,{row:o,col:s}=r,{row:c,col:l}=i;this._unregister(t,n,o,s),a||(this._unwatch(t,n,o,s),this._watch(t,n,i,c,l)),this._register(t,n,i,c,l);break}}}))}};C=v([_(0,(0,t.Inject)(n.RefRangeService)),_(1,(0,t.Inject)(c)),_(2,(0,t.Inject)(n.SheetsSelectionsService)),_(3,t.ICommandService)],C);let w=class extends t.Disposable{constructor(e){super(),this._commandService=e,this._initialize()}_initialize(){[f,d,l,u,p,m,h].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}};w=v([_(0,t.ICommandService)],w);let T=class extends t.Plugin{constructor(e=S,n,r){super(),this._config=e,this._configService=n,this._injector=r;let{...i}=(0,t.merge)({},S,this._config);this._configService.setConfig(`sheets-note.config`,i)}onStarting(){[[c],[w],[y],[C]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[c],[w],[y]])}onReady(){(0,t.touchDependencies)(this._injector,[[C]])}};s(T,`pluginName`,g),s(T,`packageName`,b),s(T,`version`,x),s(T,`type`,t.UniverInstanceType.UNIVER_SHEET),T=v([(0,t.DependentOn)(n.UniverSheetsPlugin),_(1,t.IConfigService),_(2,(0,t.Inject)(t.Injector))],T),e.RemoveNoteMutation=u,e.SheetDeleteNoteCommand=p,e.SheetToggleNotePopupCommand=m,e.SheetUpdateNoteCommand=h,e.SheetsNoteModel=c,Object.defineProperty(e,"SheetsNoteResourceController",{enumerable:!0,get:function(){return y}}),e.ToggleNotePopupMutation=d,Object.defineProperty(e,"UniverSheetsNotePlugin",{enumerable:!0,get:function(){return T}}),e.UpdateNoteMutation=l,e.UpdateNotePositionMutation=f});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-note",
3
- "version": "0.24.0",
3
+ "version": "0.25.0-insiders.20260608-e4336f7",
4
4
  "private": false,
5
5
  "description": "Cell note model and commands for Univer Sheets.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -62,17 +62,17 @@
62
62
  "rxjs": ">=7.0.0"
63
63
  },
64
64
  "dependencies": {
65
- "@univerjs/sheets": "0.24.0",
66
- "@univerjs/core": "0.24.0"
65
+ "@univerjs/core": "0.25.0-insiders.20260608-e4336f7",
66
+ "@univerjs/sheets": "0.25.0-insiders.20260608-e4336f7"
67
67
  },
68
68
  "devDependencies": {
69
69
  "rxjs": "^7.8.2",
70
70
  "typescript": "^6.0.3",
71
- "vitest": "^4.1.5",
72
- "@univerjs-infra/shared": "0.24.0",
73
- "@univerjs/engine-render": "0.24.0",
74
- "@univerjs/engine-formula": "0.24.0",
75
- "@univerjs/network": "0.24.0"
71
+ "vitest": "^4.1.8",
72
+ "@univerjs-infra/shared": "0.25.0",
73
+ "@univerjs/engine-formula": "0.25.0-insiders.20260608-e4336f7",
74
+ "@univerjs/engine-render": "0.25.0-insiders.20260608-e4336f7",
75
+ "@univerjs/network": "0.25.0-insiders.20260608-e4336f7"
76
76
  },
77
77
  "scripts": {
78
78
  "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