@univerjs/sheets-note-ui 0.16.1 → 0.17.0

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/index.js CHANGED
@@ -1,32 +1,32 @@
1
- var Ee = Object.defineProperty;
2
- var ye = (i, e, t) => e in i ? Ee(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var P = (i, e, t) => ye(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as g, IUniverInstanceService as Z, Disposable as E, InterceptorEffectEnum as $e, UniverInstanceType as y, DisposableCollection as xe, RANGE_TYPE as ne, Rectangle as He, ObjectMatrix as F, CommandType as Oe, LocaleService as Te, generateRandomId as Le, ICommandService as de, DependentOn as Re, Injector as Ue, IConfigService as De, Plugin as Ve, merge as Ze, touchDependencies as se } from "@univerjs/core";
5
- import { IRenderManagerService as z } from "@univerjs/engine-render";
6
- import { SheetInterceptorService as ke, INTERCEPTOR_POINT as je, SheetsSelectionsService as G, WorksheetEditPermission as _e, WorkbookEditablePermission as fe, getSheetCommandTarget as Be } from "@univerjs/sheets";
7
- import { SheetsNoteModel as $, SheetUpdateNoteCommand as Ae, SheetToggleNotePopupCommand as Ce, SheetDeleteNoteCommand as ge, UniverSheetsNotePlugin as Fe } from "@univerjs/sheets-note";
8
- import { debounceTime as We, BehaviorSubject as ze, switchMap as Ge, of as Ke, map as k, combineLatest as qe } from "rxjs";
9
- import { CellPopupManagerService as ve, IEditorBridgeService as Ye, HoverManagerService as Je, SheetSkeletonManagerService as ce, getCurrentRangeDisable$ as me } from "@univerjs/sheets-ui";
10
- import { debounceTime as Qe } from "rxjs/operators";
11
- import { IZenZoneService as Xe, useDependency as b, useConfigValue as et, useDebounceFn as tt, MenuItemType as K, getMenuHiddenObservable as it, ContextMenuPosition as ot, ContextMenuGroup as rt, ComponentManager as nt, IMenuManagerService as st } from "@univerjs/ui";
12
- import { useRef as Se, createElement as j, forwardRef as q, useState as ct, useEffect as ae, useCallback as ue } from "react";
13
- import { jsx as at } from "react/jsx-runtime";
14
- import { Textarea as ut, clsx as lt } from "@univerjs/design";
15
- var pt = Object.getOwnPropertyDescriptor, ht = (i, e, t, o) => {
16
- for (var r = o > 1 ? void 0 : o ? pt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
1
+ var ye = Object.defineProperty;
2
+ var $e = (i, e, t) => e in i ? ye(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var P = (i, e, t) => $e(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Inject as g, IUniverInstanceService as k, Disposable as y, InterceptorEffectEnum as xe, UniverInstanceType as $, DisposableCollection as He, RANGE_TYPE as se, Rectangle as Oe, ObjectMatrix as W, CommandType as Te, LocaleService as Re, generateRandomId as Le, ICommandService as _e, DependentOn as Ue, Injector as De, IConfigService as Ve, Plugin as ke, merge as Ze, touchDependencies as ae } from "@univerjs/core";
5
+ import { IRenderManagerService as G } from "@univerjs/engine-render";
6
+ import { SheetInterceptorService as je, INTERCEPTOR_POINT as Be, SheetsSelectionsService as K, WorksheetEditPermission as fe, WorkbookEditablePermission as Ce, getSheetCommandTarget as Ae } from "@univerjs/sheets";
7
+ import { SheetsNoteModel as x, SheetToggleNotePopupCommand as ge, SheetDeleteNoteCommand as ve, SheetUpdateNoteCommand as Fe, UniverSheetsNotePlugin as We } from "@univerjs/sheets-note";
8
+ import { debounceTime as ze, BehaviorSubject as Ge, switchMap as Ke, of as qe, map as Z, combineLatest as Ye } from "rxjs";
9
+ import { CellPopupManagerService as me, IEditorBridgeService as Je, HoverManagerService as Qe, SheetSkeletonManagerService as ce, getCurrentRangeDisable$ as Se } from "@univerjs/sheets-ui";
10
+ import { debounceTime as Xe } from "rxjs/operators";
11
+ import { IZenZoneService as et, MenuItemType as q, getMenuHiddenObservable as tt, ContextMenuPosition as it, ContextMenuGroup as ot, useDependency as E, useConfigValue as rt, useDebounceFn as nt, ComponentManager as st, IMenuManagerService as at } from "@univerjs/ui";
12
+ import { useRef as Ne, createElement as j, forwardRef as Y, useState as ct, useEffect as ue, useCallback as le } from "react";
13
+ import { jsx as ut } from "react/jsx-runtime";
14
+ import { Textarea as lt, clsx as pt } from "@univerjs/design";
15
+ var ht = Object.getOwnPropertyDescriptor, dt = (i, e, t, o) => {
16
+ for (var r = o > 1 ? void 0 : o ? ht(e, t) : e, s = i.length - 1, n; s >= 0; s--)
17
17
  (n = i[s]) && (r = n(r) || r);
18
18
  return r;
19
- }, H = (i, e) => (t, o) => e(t, o, i);
20
- let T = class extends E {
19
+ }, O = (i, e) => (t, o) => e(t, o, i);
20
+ let R = class extends y {
21
21
  constructor(i, e, t, o) {
22
22
  super(), this._sheetInterceptorService = i, this._sheetsNoteModel = e, this._renderManagerService = t, this._univerInstanceService = o, this._initViewModelIntercept(), this._initSkeletonChange();
23
23
  }
24
24
  _initViewModelIntercept() {
25
25
  this.disposeWithMe(
26
26
  this._sheetInterceptorService.intercept(
27
- je.CELL_CONTENT,
27
+ Be.CELL_CONTENT,
28
28
  {
29
- effect: $e.Style,
29
+ effect: xe.Style,
30
30
  handler: (i, e, t) => {
31
31
  const { row: o, col: r, unitId: s, subUnitId: n } = e;
32
32
  return this._sheetsNoteModel.getNote(s, n, { row: o, col: r }) && ((!i || i === e.rawData) && (i = { ...e.rawData }), i.markers = {
@@ -45,34 +45,34 @@ let T = class extends E {
45
45
  _initSkeletonChange() {
46
46
  const i = () => {
47
47
  var r;
48
- const e = this._univerInstanceService.getCurrentUnitForType(y.UNIVER_SHEET);
48
+ const e = this._univerInstanceService.getCurrentUnitForType($.UNIVER_SHEET);
49
49
  if (!e) return;
50
50
  const t = e.getUnitId(), o = this._renderManagerService.getRenderById(t);
51
51
  (r = o == null ? void 0 : o.mainComponent) == null || r.makeForceDirty();
52
52
  };
53
- this.disposeWithMe(this._sheetsNoteModel.change$.pipe(We(16)).subscribe(() => {
53
+ this.disposeWithMe(this._sheetsNoteModel.change$.pipe(ze(16)).subscribe(() => {
54
54
  i();
55
55
  }));
56
56
  }
57
57
  };
58
- T = ht([
59
- H(0, g(ke)),
60
- H(1, g($)),
61
- H(2, z),
62
- H(3, Z)
63
- ], T);
64
- const Y = "SHEET_NOTE_COMPONENT";
65
- var dt = Object.getOwnPropertyDescriptor, _t = (i, e, t, o) => {
66
- for (var r = o > 1 ? void 0 : o ? dt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
58
+ R = dt([
59
+ O(0, g(je)),
60
+ O(1, g(x)),
61
+ O(2, G),
62
+ O(3, k)
63
+ ], R);
64
+ const J = "SHEET_NOTE_COMPONENT";
65
+ var _t = Object.getOwnPropertyDescriptor, ft = (i, e, t, o) => {
66
+ for (var r = o > 1 ? void 0 : o ? _t(e, t) : e, s = i.length - 1, n; s >= 0; s--)
67
67
  (n = i[s]) && (r = n(r) || r);
68
68
  return r;
69
- }, le = (i, e) => (t, o) => e(t, o, i);
70
- let I = class extends E {
69
+ }, pe = (i, e) => (t, o) => e(t, o, i);
70
+ let I = class extends y {
71
71
  constructor(e, t) {
72
72
  super();
73
73
  P(this, "_lastPopup", null);
74
74
  P(this, "_activePopup");
75
- P(this, "_activePopup$", new ze(null));
75
+ P(this, "_activePopup$", new Ge(null));
76
76
  P(this, "activePopup$", this._activePopup$.asObservable());
77
77
  this._zenZoneService = e, this._cellPopupManagerService = t, this._initZenVisible(), this.disposeWithMe(() => {
78
78
  this._activePopup$.complete();
@@ -99,7 +99,7 @@ let I = class extends E {
99
99
  if (this._lastPopup && this._lastPopup.dispose(), this._zenZoneService.visible)
100
100
  return;
101
101
  this._activePopup = e, this._activePopup$.next(e);
102
- const c = this._cellPopupManagerService.showPopup(
102
+ const a = this._cellPopupManagerService.showPopup(
103
103
  {
104
104
  unitId: s,
105
105
  subUnitId: n,
@@ -107,7 +107,7 @@ let I = class extends E {
107
107
  col: r
108
108
  },
109
109
  {
110
- componentKey: Y,
110
+ componentKey: J,
111
111
  onClickOutside: () => {
112
112
  this.hidePopup();
113
113
  },
@@ -118,10 +118,10 @@ let I = class extends E {
118
118
  priority: 3
119
119
  }
120
120
  );
121
- if (!c)
121
+ if (!a)
122
122
  throw new Error("[SheetsNotePopupService]: cannot show popup!");
123
- const u = new xe();
124
- u.add(c), u.add({
123
+ const u = new He();
124
+ u.add(a), u.add({
125
125
  dispose: () => {
126
126
  t == null || t();
127
127
  }
@@ -137,16 +137,16 @@ let I = class extends E {
137
137
  }, this._activePopup$.next(this._activePopup));
138
138
  }
139
139
  };
140
- I = _t([
141
- le(0, Xe),
142
- le(1, g(ve))
140
+ I = ft([
141
+ pe(0, et),
142
+ pe(1, g(me))
143
143
  ], I);
144
- var ft = Object.getOwnPropertyDescriptor, Ct = (i, e, t, o) => {
145
- for (var r = o > 1 ? void 0 : o ? ft(e, t) : e, s = i.length - 1, n; s >= 0; s--)
144
+ var Ct = Object.getOwnPropertyDescriptor, gt = (i, e, t, o) => {
145
+ for (var r = o > 1 ? void 0 : o ? Ct(e, t) : e, s = i.length - 1, n; s >= 0; s--)
146
146
  (n = i[s]) && (r = n(r) || r);
147
147
  return r;
148
148
  }, w = (i, e) => (t, o) => e(t, o, i);
149
- let L = class extends E {
149
+ let L = class extends y {
150
150
  constructor(e, t, o, r, s, n) {
151
151
  super();
152
152
  P(this, "_isSwitchingSheet", !1);
@@ -157,18 +157,18 @@ let L = class extends E {
157
157
  const r = (d = e[0]) == null ? void 0 : d.range, s = this._renderManagerService.getRenderById(t), n = (_ = s == null ? void 0 : s.with(ce).getSkeletonParam(o)) == null ? void 0 : _.skeleton;
158
158
  if (!n || !r)
159
159
  return;
160
- const c = n.getCellWithCoordByIndex(r.startRow, r.startColumn);
161
- if ((((m = r.rangeType) != null ? m : ne.NORMAL) !== ne.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((c.isMerged || c.isMergedMainCell) && He.equals(c.mergeInfo, r))) {
160
+ const a = n.getCellWithCoordByIndex(r.startRow, r.startColumn);
161
+ if ((((m = r.rangeType) != null ? m : se.NORMAL) !== se.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && Oe.equals(a.mergeInfo, r))) {
162
162
  this._sheetsNotePopupService.hidePopup();
163
163
  return;
164
164
  }
165
- const l = c.actualRow, a = c.actualColumn, p = this._sheetsNoteModel.getNote(t, o, { row: l, col: a });
165
+ const l = a.actualRow, c = a.actualColumn, p = this._sheetsNoteModel.getNote(t, o, { row: l, col: c });
166
166
  p != null && p.show || (p ? this._sheetsNotePopupService.showPopup({
167
167
  unitId: t,
168
168
  subUnitId: o,
169
169
  noteId: p.id,
170
170
  row: l,
171
- col: a
171
+ col: c
172
172
  }) : this._sheetsNotePopupService.hidePopup(!0));
173
173
  }
174
174
  _initSelectionUpdateListener() {
@@ -190,28 +190,28 @@ let L = class extends E {
190
190
  }
191
191
  _initHoverEvent() {
192
192
  this.disposeWithMe(
193
- this._hoverManagerService.currentCell$.pipe(Qe(100)).subscribe((e) => {
193
+ this._hoverManagerService.currentCell$.pipe(Xe(100)).subscribe((e) => {
194
194
  var p;
195
195
  if (!(e != null && e.location)) return;
196
- const { unitId: t, subUnitId: o, row: r, col: s } = e.location, n = this._renderManagerService.getRenderById(t), c = (p = n == null ? void 0 : n.with(ce).getSkeletonParam(o)) == null ? void 0 : p.skeleton;
197
- let u = r, l = s, a = this._sheetsNoteModel.getNote(t, o, { row: u, col: l });
198
- if (!a && c) {
199
- const d = c.getCellWithCoordByIndex(r, s), { startRow: _, endRow: m, startColumn: N, endColumn: S } = d.mergeInfo;
196
+ const { unitId: t, subUnitId: o, row: r, col: s } = e.location, n = this._renderManagerService.getRenderById(t), a = (p = n == null ? void 0 : n.with(ce).getSkeletonParam(o)) == null ? void 0 : p.skeleton;
197
+ let u = r, l = s, c = this._sheetsNoteModel.getNote(t, o, { row: u, col: l });
198
+ if (!c && a) {
199
+ const d = a.getCellWithCoordByIndex(r, s), { startRow: _, endRow: m, startColumn: N, endColumn: S } = d.mergeInfo;
200
200
  if (_ !== m || N !== S) {
201
201
  const h = this._sheetsNoteModel.getSheetNotes(t, o);
202
202
  if (h) {
203
203
  for (const [C, f] of h)
204
204
  if (f.row >= _ && f.row <= m && f.col >= N && f.col <= S) {
205
- a = f, u = f.row, l = f.col;
205
+ c = f, u = f.row, l = f.col;
206
206
  break;
207
207
  }
208
208
  }
209
209
  }
210
210
  }
211
- a != null && a.show || (a ? this._sheetsNotePopupService.showPopup({
211
+ c != null && c.show || (c ? this._sheetsNotePopupService.showPopup({
212
212
  unitId: t,
213
213
  subUnitId: o,
214
- noteId: a.id,
214
+ noteId: c.id,
215
215
  row: u,
216
216
  col: l,
217
217
  temp: !0
@@ -223,30 +223,33 @@ let L = class extends E {
223
223
  this.disposeWithMe(
224
224
  this._sheetsNoteModel.change$.subscribe((e) => {
225
225
  if (!this._sheetsNotePopupService.activePopup) return;
226
- const { unitId: t, subUnitId: o, noteId: r, row: s, col: n } = this._sheetsNotePopupService.activePopup, { oldNote: c, newNote: u } = e;
227
- u === null && e.unitId === t && e.subUnitId === o && (c != null && c.id && c.id === r || (c == null ? void 0 : c.row) === s && c.col === n) && this._sheetsNotePopupService.hidePopup(!0);
226
+ const { unitId: t, subUnitId: o, noteId: r, row: s, col: n } = this._sheetsNotePopupService.activePopup, { oldNote: a, newNote: u } = e;
227
+ u === null && e.unitId === t && e.subUnitId === o && (a != null && a.id && a.id === r || (a == null ? void 0 : a.row) === s && a.col === n) && this._sheetsNotePopupService.hidePopup(!0);
228
228
  })
229
229
  );
230
230
  }
231
231
  };
232
- L = Ct([
232
+ L = gt([
233
233
  w(0, g(I)),
234
- w(1, g($)),
235
- w(2, g(G)),
236
- w(3, Ye),
237
- w(4, z),
238
- w(5, g(Je))
234
+ w(1, g(x)),
235
+ w(2, g(K)),
236
+ w(3, Je),
237
+ w(4, G),
238
+ w(5, g(Qe))
239
239
  ], L);
240
- const Ne = "sheets-note-ui.config", pe = {};
241
- var gt = Object.getOwnPropertyDescriptor, vt = (i, e, t, o) => {
242
- for (var r = o > 1 ? void 0 : o ? gt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
240
+ const vt = "@univerjs/sheets-note-ui", mt = "0.17.0", Pe = {
241
+ name: vt,
242
+ version: mt
243
+ }, Ie = "sheets-note-ui.config", he = {};
244
+ var St = Object.getOwnPropertyDescriptor, Nt = (i, e, t, o) => {
245
+ for (var r = o > 1 ? void 0 : o ? St(e, t) : e, s = i.length - 1, n; s >= 0; s--)
243
246
  (n = i[s]) && (r = n(r) || r);
244
247
  return r;
245
- }, O = (i, e) => (t, o) => e(t, o, i);
246
- let R = class extends E {
248
+ }, T = (i, e) => (t, o) => e(t, o, i);
249
+ let U = class extends y {
247
250
  constructor(e, t, o, r) {
248
251
  super();
249
- P(this, "_noteMatrix", new F());
252
+ P(this, "_noteMatrix", new W());
250
253
  this._sheetsNoteModel = e, this._univerInstanceService = t, this._cellPopupManagerService = o, this._sheetsNotePopupService = r, this._initNoteChangeListener();
251
254
  }
252
255
  _showPopup(e, t, o, r) {
@@ -258,7 +261,7 @@ let R = class extends E {
258
261
  col: r
259
262
  },
260
263
  {
261
- componentKey: Y,
264
+ componentKey: J,
262
265
  direction: "horizontal",
263
266
  extraProps: {
264
267
  location: {
@@ -279,14 +282,14 @@ let R = class extends E {
279
282
  }
280
283
  _initSheet(e, t) {
281
284
  var s;
282
- this._noteMatrix.forValue((n, c, u) => {
285
+ this._noteMatrix.forValue((n, a, u) => {
283
286
  u.dispose();
284
- }), this._noteMatrix = new F();
285
- const r = (n, c, u, l, a) => {
287
+ }), this._noteMatrix = new W();
288
+ const r = (n, a, u, l, c) => {
286
289
  const p = this._noteMatrix, d = p.getValue(u, l);
287
- if (a != null && a.show) {
290
+ if (c != null && c.show) {
288
291
  if (!d) {
289
- const _ = this._showPopup(n, c, u, l);
292
+ const _ = this._showPopup(n, a, u, l);
290
293
  _ && p.setValue(u, l, _);
291
294
  }
292
295
  } else
@@ -298,17 +301,17 @@ let R = class extends E {
298
301
  if (!(n.unitId !== e || n.subUnitId !== t))
299
302
  switch (n.type) {
300
303
  case "ref": {
301
- const { unitId: c, subUnitId: u, oldNote: l, newNote: a } = n;
302
- if (!a.show) return;
303
- const p = this._noteMatrix, { row: d, col: _ } = l, { row: m, col: N } = a, S = p.getValue(d, _);
304
+ const { unitId: a, subUnitId: u, oldNote: l, newNote: c } = n;
305
+ if (!c.show) return;
306
+ const p = this._noteMatrix, { row: d, col: _ } = l, { row: m, col: N } = c, S = p.getValue(d, _);
304
307
  S && (S.dispose(), p.realDeleteValue(d, _));
305
- const h = this._showPopup(c, u, m, N);
308
+ const h = this._showPopup(a, u, m, N);
306
309
  h && p.setValue(m, N, h);
307
310
  break;
308
311
  }
309
312
  case "update": {
310
- const { unitId: c, subUnitId: u, oldNote: l, newNote: a } = n, p = a ? a.row : l.row, d = a ? a.col : l.col;
311
- r(c, u, p, d, a);
313
+ const { unitId: a, subUnitId: u, oldNote: l, newNote: c } = n, p = c ? c.row : l.row, d = c ? c.col : l.col;
314
+ r(a, u, p, d, c);
312
315
  break;
313
316
  }
314
317
  }
@@ -316,10 +319,10 @@ let R = class extends E {
316
319
  }
317
320
  _initNoteChangeListener() {
318
321
  this.disposeWithMe(
319
- this._univerInstanceService.getCurrentTypeOfUnit$(y.UNIVER_SHEET).pipe(
320
- Ge((e) => {
322
+ this._univerInstanceService.getCurrentTypeOfUnit$($.UNIVER_SHEET).pipe(
323
+ Ke((e) => {
321
324
  var t;
322
- return (t = e == null ? void 0 : e.activeSheet$) != null ? t : Ke(null);
325
+ return (t = e == null ? void 0 : e.activeSheet$) != null ? t : qe(null);
323
326
  })
324
327
  ).subscribe((e) => {
325
328
  if (e) {
@@ -330,36 +333,36 @@ let R = class extends E {
330
333
  } else
331
334
  this._noteMatrix.forValue((t, o, r) => {
332
335
  r.dispose();
333
- }), this._noteMatrix = new F();
336
+ }), this._noteMatrix = new W();
334
337
  })
335
338
  );
336
339
  }
337
340
  };
338
- R = vt([
339
- O(0, g($)),
340
- O(1, g(Z)),
341
- O(2, g(ve)),
342
- O(3, g(I))
343
- ], R);
341
+ U = Nt([
342
+ T(0, g(x)),
343
+ T(1, g(k)),
344
+ T(2, g(me)),
345
+ T(3, g(I))
346
+ ], U);
344
347
  function B({ ref: i, ...e }) {
345
- const { icon: t, id: o, className: r, extend: s, ...n } = e, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), u = Se(`_${Nt()}`);
346
- return Pe(t, `${o}`, {
348
+ const { icon: t, id: o, className: r, extend: s, ...n } = e, a = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), u = Ne(`_${wt()}`);
349
+ return we(t, `${o}`, {
347
350
  defIds: t.defIds,
348
351
  idSuffix: u.current
349
352
  }, {
350
353
  ref: i,
351
- className: c,
354
+ className: a,
352
355
  ...n
353
356
  }, s);
354
357
  }
355
- function Pe(i, e, t, o, r) {
358
+ function we(i, e, t, o, r) {
356
359
  return j(i.tag, {
357
360
  key: e,
358
- ...mt(i, t, r),
361
+ ...Pt(i, t, r),
359
362
  ...o
360
- }, (St(i, t).children || []).map((s, n) => Pe(s, `${e}-${i.tag}-${n}`, t, void 0, r)));
363
+ }, (It(i, t).children || []).map((s, n) => we(s, `${e}-${i.tag}-${n}`, t, void 0, r)));
361
364
  }
362
- function mt(i, e, t) {
365
+ function Pt(i, e, t) {
363
366
  const o = { ...i.attrs };
364
367
  t != null && t.colorChannel1 && o.fill === "colorChannel1" && (o.fill = t.colorChannel1), i.tag === "mask" && o.id && (o.id = o.id + e.idSuffix), Object.entries(o).forEach(([s, n]) => {
365
368
  s === "mask" && typeof n == "string" && (o[s] = n.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
@@ -369,7 +372,7 @@ function mt(i, e, t) {
369
372
  typeof n == "string" && (o[s] = n.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
370
373
  })), o;
371
374
  }
372
- function St(i, e) {
375
+ function It(i, e) {
373
376
  var o;
374
377
  const { defIds: t } = e;
375
378
  return !t || t.length === 0 ? i : i.tag === "defs" && ((o = i.children) != null && o.length) ? {
@@ -383,11 +386,11 @@ function St(i, e) {
383
386
  } : r)
384
387
  } : i;
385
388
  }
386
- function Nt() {
389
+ function wt() {
387
390
  return Math.random().toString(36).substring(2, 8);
388
391
  }
389
392
  B.displayName = "UniverIcon";
390
- const Pt = {
393
+ const Mt = {
391
394
  tag: "svg",
392
395
  attrs: {
393
396
  xmlns: "http://www.w3.org/2000/svg",
@@ -440,15 +443,15 @@ const Pt = {
440
443
  }
441
444
  }
442
445
  ]
443
- }, Ie = q(function(e, t) {
446
+ }, Me = Y(function(e, t) {
444
447
  return j(B, Object.assign({}, e, {
445
448
  id: "add-note-icon",
446
449
  ref: t,
447
- icon: Pt
450
+ icon: Mt
448
451
  }));
449
452
  });
450
- Ie.displayName = "AddNoteIcon";
451
- const It = {
453
+ Me.displayName = "AddNoteIcon";
454
+ const bt = {
452
455
  tag: "svg",
453
456
  attrs: {
454
457
  xmlns: "http://www.w3.org/2000/svg",
@@ -494,15 +497,15 @@ const It = {
494
497
  }
495
498
  }
496
499
  ]
497
- }, we = q(function(e, t) {
500
+ }, be = Y(function(e, t) {
498
501
  return j(B, Object.assign({}, e, {
499
502
  id: "delete-note-icon",
500
503
  ref: t,
501
- icon: It
504
+ icon: bt
502
505
  }));
503
506
  });
504
- we.displayName = "DeleteNoteIcon";
505
- const wt = {
507
+ be.displayName = "DeleteNoteIcon";
508
+ const Et = {
506
509
  tag: "svg",
507
510
  attrs: {
508
511
  xmlns: "http://www.w3.org/2000/svg",
@@ -555,26 +558,26 @@ const wt = {
555
558
  }
556
559
  }
557
560
  ]
558
- }, Me = q(function(e, t) {
561
+ }, Ee = Y(function(e, t) {
559
562
  return j(B, Object.assign({}, e, {
560
563
  id: "hide-note-icon",
561
564
  ref: t,
562
- icon: wt
565
+ icon: Et
563
566
  }));
564
567
  });
565
- Me.displayName = "HideNoteIcon";
566
- const U = {
568
+ Ee.displayName = "HideNoteIcon";
569
+ const D = {
567
570
  id: "sheet.operation.add-note-popup",
568
- type: Oe.OPERATION,
571
+ type: Te.OPERATION,
569
572
  handler: async (i, e) => {
570
573
  var l;
571
- const t = i.get(G), o = i.get(I), s = i.get(Z).getCurrentUnitForType(y.UNIVER_SHEET);
574
+ const t = i.get(K), o = i.get(I), s = i.get(k).getCurrentUnitForType($.UNIVER_SHEET);
572
575
  if (!s)
573
576
  return !1;
574
- const n = s.getActiveSheet(), c = t.getCurrentLastSelection();
575
- if (!(c != null && c.primary))
577
+ const n = s.getActiveSheet(), a = t.getCurrentLastSelection();
578
+ if (!(a != null && a.primary))
576
579
  return !1;
577
- const { primary: u } = c;
580
+ const { primary: u } = a;
578
581
  return o.showPopup({
579
582
  unitId: s.getUnitId(),
580
583
  subUnitId: n.getSheetId(),
@@ -584,64 +587,124 @@ const U = {
584
587
  trigger: (l = e == null ? void 0 : e.trigger) != null ? l : "add-note"
585
588
  }), !0;
586
589
  }
587
- }, Mt = (i) => {
590
+ };
591
+ function Q(i) {
592
+ const e = i.get(K), t = i.get(k);
593
+ return e.selectionMoveEnd$.pipe(Z(() => {
594
+ const o = e.getCurrentLastSelection();
595
+ if (!(o != null && o.primary)) return !1;
596
+ const r = Ae(t);
597
+ if (!r) return !1;
598
+ const { actualColumn: s, actualRow: n } = o.primary;
599
+ return !!i.get(x).getNote(r.unitId, r.subUnitId, { row: n, col: s });
600
+ }));
601
+ }
602
+ function yt(i) {
603
+ return {
604
+ id: D.id,
605
+ type: q.BUTTON,
606
+ title: "rightClick.addNote",
607
+ icon: "AddNoteIcon",
608
+ hidden$: Ye([tt(i, $.UNIVER_SHEET), Q(i)]).pipe(Z(([e, t]) => e || t)),
609
+ disabled$: Se(i, { workbookTypes: [Ce], worksheetTypes: [fe] }),
610
+ commandId: D.id
611
+ };
612
+ }
613
+ function $t(i) {
614
+ return {
615
+ id: ve.id,
616
+ type: q.BUTTON,
617
+ title: "rightClick.deleteNote",
618
+ icon: "DeleteNoteIcon",
619
+ hidden$: Q(i).pipe(Z((e) => !e)),
620
+ disabled$: Se(i, { workbookTypes: [Ce], worksheetTypes: [fe] })
621
+ };
622
+ }
623
+ function xt(i) {
624
+ return {
625
+ id: ge.id,
626
+ type: q.BUTTON,
627
+ title: "rightClick.toggleNote",
628
+ icon: "HideNoteIcon",
629
+ hidden$: Q(i).pipe(Z((e) => !e))
630
+ };
631
+ }
632
+ const Ht = {
633
+ [it.MAIN_AREA]: {
634
+ [ot.OTHERS]: {
635
+ order: 0,
636
+ [D.id]: {
637
+ order: 0,
638
+ menuItemFactory: yt
639
+ },
640
+ [ve.id]: {
641
+ order: 0,
642
+ menuItemFactory: $t
643
+ },
644
+ [ge.id]: {
645
+ order: 0,
646
+ menuItemFactory: xt
647
+ }
648
+ }
649
+ }
650
+ }, Ot = (i) => {
588
651
  var S;
589
- const { popup: e } = i, t = b($), o = b(Te), r = b(z), s = b(I), n = et(Ne), c = (S = e.extraProps) == null ? void 0 : S.location;
590
- if (!c)
652
+ const { popup: e } = i, t = E(x), o = E(Re), r = E(G), s = E(I), n = rt(Ie), a = (S = e.extraProps) == null ? void 0 : S.location;
653
+ if (!a)
591
654
  return console.error("Popup extraProps or location is undefined."), null;
592
- const u = Se(null), l = r.getRenderById(c.unitId), [a, p] = ct(null);
593
- ae(() => {
594
- var Q, X, ee, te, ie, oe;
595
- const { unitId: h, subUnitId: C, row: f, col: x } = c, v = t.getNote(h, C, { row: f, col: x }), A = (ee = (X = v == null ? void 0 : v.width) != null ? X : (Q = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : Q.width) != null ? ee : 160, M = (oe = (ie = v == null ? void 0 : v.height) != null ? ie : (te = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : te.height) != null ? oe : 72;
655
+ const u = Ne(null), l = r.getRenderById(a.unitId), [c, p] = ct(null);
656
+ ue(() => {
657
+ var X, ee, te, ie, oe, re;
658
+ const { unitId: h, subUnitId: C, row: f, col: H } = a, v = t.getNote(h, C, { row: f, col: H }), F = (te = (ee = v == null ? void 0 : v.width) != null ? ee : (X = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : X.width) != null ? te : 160, b = (re = (oe = v == null ? void 0 : v.height) != null ? oe : (ie = n == null ? void 0 : n.defaultNoteSize) == null ? void 0 : ie.height) != null ? re : 72;
596
659
  if (v)
597
660
  p(v);
598
661
  else {
599
- const re = {
662
+ const ne = {
600
663
  id: Le(6),
601
- width: A,
602
- height: M,
664
+ width: F,
665
+ height: b,
603
666
  note: ""
604
667
  };
605
- p(re), _(re);
668
+ p(ne), _(ne);
606
669
  }
607
- u.current && (u.current.style.width = `${A}px`, u.current.style.height = `${M}px`);
608
- }, [c, u]), ae(() => {
609
- if (!c || c.temp || !c.trigger || !u.current) return;
670
+ u.current && (u.current.style.width = `${F}px`, u.current.style.height = `${b}px`);
671
+ }, [a, u]), ue(() => {
672
+ if (!a || a.temp || !a.trigger || !u.current) return;
610
673
  const h = requestAnimationFrame(() => {
611
674
  var C;
612
675
  (C = u.current) == null || C.focus();
613
676
  });
614
677
  return () => cancelAnimationFrame(h);
615
- }, [c]);
616
- const d = b(de), _ = tt((h) => {
617
- if (!c) return;
618
- const { unitId: C, subUnitId: f, row: x, col: v } = c;
619
- if (!d.syncExecuteCommand(Ae.id, {
678
+ }, [a]);
679
+ const d = E(_e), _ = nt((h) => {
680
+ if (!a) return;
681
+ const { unitId: C, subUnitId: f, row: H, col: v } = a;
682
+ if (!d.syncExecuteCommand(Fe.id, {
620
683
  unitId: C,
621
684
  sheetId: f,
622
- row: x,
685
+ row: H,
623
686
  col: v,
624
687
  note: h
625
688
  })) {
626
- const M = t.getNote(C, f, { noteId: h.id, row: x, col: v });
627
- M ? p(M) : s.hidePopup(!0);
689
+ const b = t.getNote(C, f, { noteId: h.id, row: H, col: v });
690
+ b ? p(b) : s.hidePopup(!0);
628
691
  }
629
- }), m = ue((h) => {
630
- if (!a || h === a.note) return;
631
- const C = { ...a, note: h };
692
+ }), m = le((h) => {
693
+ if (!c || h === c.note) return;
694
+ const C = { ...c, note: h };
632
695
  p(C), _(C);
633
- }, [a]), N = ue((h, C) => {
634
- if (!a || h === a.width && C === a.height) return;
635
- const f = { ...a, width: h, height: C };
696
+ }, [c]), N = le((h, C) => {
697
+ if (!c || h === c.width && C === c.height) return;
698
+ const f = { ...c, width: h, height: C };
636
699
  p(f), _(f);
637
- }, [a]);
638
- return /* @__PURE__ */ at(
639
- ut,
700
+ }, [c]);
701
+ return /* @__PURE__ */ ut(
702
+ lt,
640
703
  {
641
704
  ref: u,
642
705
  "data-u-comp": "note-textarea",
643
- className: lt("univer-ml-px univer-min-h-1 univer-min-w-1 univer-bg-white !univer-text-sm univer-shadow dark:!univer-bg-gray-800"),
644
- value: a == null ? void 0 : a.note,
706
+ className: pt("univer-ml-px univer-min-h-1 univer-min-w-1 univer-bg-white !univer-text-sm univer-shadow dark:!univer-bg-gray-800"),
707
+ value: c == null ? void 0 : c.note,
645
708
  placeholder: o.t("note.placeholder"),
646
709
  onResize: N,
647
710
  onValueChange: m,
@@ -651,81 +714,21 @@ const U = {
651
714
  }
652
715
  );
653
716
  };
654
- function J(i) {
655
- const e = i.get(G), t = i.get(Z);
656
- return e.selectionMoveEnd$.pipe(k(() => {
657
- const o = e.getCurrentLastSelection();
658
- if (!(o != null && o.primary)) return !1;
659
- const r = Be(t);
660
- if (!r) return !1;
661
- const { actualColumn: s, actualRow: n } = o.primary;
662
- return !!i.get($).getNote(r.unitId, r.subUnitId, { row: n, col: s });
663
- }));
664
- }
665
- function bt(i) {
666
- return {
667
- id: U.id,
668
- type: K.BUTTON,
669
- title: "rightClick.addNote",
670
- icon: "AddNoteIcon",
671
- hidden$: qe([it(i, y.UNIVER_SHEET), J(i)]).pipe(k(([e, t]) => e || t)),
672
- disabled$: me(i, { workbookTypes: [fe], worksheetTypes: [_e] }),
673
- commandId: U.id
674
- };
675
- }
676
- function Et(i) {
677
- return {
678
- id: ge.id,
679
- type: K.BUTTON,
680
- title: "rightClick.deleteNote",
681
- icon: "DeleteNoteIcon",
682
- hidden$: J(i).pipe(k((e) => !e)),
683
- disabled$: me(i, { workbookTypes: [fe], worksheetTypes: [_e] })
684
- };
685
- }
686
- function yt(i) {
687
- return {
688
- id: Ce.id,
689
- type: K.BUTTON,
690
- title: "rightClick.toggleNote",
691
- icon: "HideNoteIcon",
692
- hidden$: J(i).pipe(k((e) => !e))
693
- };
694
- }
695
- const $t = {
696
- [ot.MAIN_AREA]: {
697
- [rt.OTHERS]: {
698
- order: 0,
699
- [U.id]: {
700
- order: 0,
701
- menuItemFactory: bt
702
- },
703
- [ge.id]: {
704
- order: 0,
705
- menuItemFactory: Et
706
- },
707
- [Ce.id]: {
708
- order: 0,
709
- menuItemFactory: yt
710
- }
711
- }
712
- }
713
- };
714
- var xt = Object.getOwnPropertyDescriptor, Ht = (i, e, t, o) => {
715
- for (var r = o > 1 ? void 0 : o ? xt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
717
+ var Tt = Object.getOwnPropertyDescriptor, Rt = (i, e, t, o) => {
718
+ for (var r = o > 1 ? void 0 : o ? Tt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
716
719
  (n = i[s]) && (r = n(r) || r);
717
720
  return r;
718
- }, W = (i, e) => (t, o) => e(t, o, i);
719
- let D = class extends E {
721
+ }, z = (i, e) => (t, o) => e(t, o, i);
722
+ let V = class extends y {
720
723
  constructor(i, e, t) {
721
724
  super(), this._componentManager = i, this._menuManagerService = e, this._commandService = t, this._initComponents(), this._initMenu(), this._initCommands();
722
725
  }
723
726
  _initComponents() {
724
727
  [
725
- [Y, Mt],
726
- ["AddNoteIcon", Ie],
727
- ["DeleteNoteIcon", we],
728
- ["HideNoteIcon", Me]
728
+ [J, Ot],
729
+ ["AddNoteIcon", Me],
730
+ ["DeleteNoteIcon", be],
731
+ ["HideNoteIcon", Ee]
729
732
  ].forEach(([i, e]) => {
730
733
  this.disposeWithMe(
731
734
  this._componentManager.register(i, e)
@@ -733,68 +736,69 @@ let D = class extends E {
733
736
  });
734
737
  }
735
738
  _initMenu() {
736
- this._menuManagerService.mergeMenu($t);
739
+ this._menuManagerService.mergeMenu(Ht);
737
740
  }
738
741
  _initCommands() {
739
- this._commandService.registerCommand(U);
742
+ this._commandService.registerCommand(D);
740
743
  }
741
744
  };
742
- D = Ht([
743
- W(0, g(nt)),
744
- W(1, g(st)),
745
- W(2, de)
746
- ], D);
747
- var Ot = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, Lt = (i, e, t) => e in i ? Ot(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Rt = (i, e, t, o) => {
748
- for (var r = o > 1 ? void 0 : o ? Tt(e, t) : e, s = i.length - 1, n; s >= 0; s--)
745
+ V = Rt([
746
+ z(0, g(st)),
747
+ z(1, g(at)),
748
+ z(2, _e)
749
+ ], V);
750
+ var Lt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Dt = (i, e, t) => e in i ? Lt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Vt = (i, e, t, o) => {
751
+ for (var r = o > 1 ? void 0 : o ? Ut(e, t) : e, s = i.length - 1, n; s >= 0; s--)
749
752
  (n = i[s]) && (r = n(r) || r);
750
753
  return r;
751
- }, he = (i, e) => (t, o) => e(t, o, i), be = (i, e, t) => Lt(i, typeof e != "symbol" ? e + "" : e, t);
752
- const Ut = "SHEET_NOTE_UI_PLUGIN";
753
- let V = class extends Ve {
754
- constructor(i = pe, e, t) {
754
+ }, de = (i, e) => (t, o) => e(t, o, i), A = (i, e, t) => Dt(i, typeof e != "symbol" ? e + "" : e, t);
755
+ let M = class extends ke {
756
+ constructor(i = he, e, t) {
755
757
  super(), this._config = i, this._injector = e, this._configService = t;
756
758
  const { menu: o, ...r } = Ze(
757
759
  {},
758
- pe,
760
+ he,
759
761
  this._config
760
762
  );
761
- o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Ne, r);
763
+ o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Ie, r);
762
764
  }
763
765
  onStarting() {
764
766
  [
765
767
  [I],
766
- [T],
768
+ [R],
767
769
  [L],
768
- [D],
769
- [R]
770
+ [V],
771
+ [U]
770
772
  ].forEach((i) => {
771
773
  this._injector.add(i);
772
774
  });
773
775
  }
774
776
  onReady() {
775
- se(this._injector, [
776
- [D],
777
- [T]
777
+ ae(this._injector, [
778
+ [V],
779
+ [R]
778
780
  ]);
779
781
  }
780
782
  onRendered() {
781
- se(this._injector, [
783
+ ae(this._injector, [
782
784
  [L],
783
- [R]
785
+ [U]
784
786
  ]);
785
787
  }
786
788
  };
787
- be(V, "pluginName", Ut);
788
- be(V, "type", y.UNIVER_SHEET);
789
- V = Rt([
790
- Re(Fe),
791
- he(1, g(Ue)),
792
- he(2, De)
793
- ], V);
789
+ A(M, "pluginName", "SHEET_NOTE_UI_PLUGIN");
790
+ A(M, "packageName", Pe.name);
791
+ A(M, "version", Pe.version);
792
+ A(M, "type", $.UNIVER_SHEET);
793
+ M = Vt([
794
+ Ue(We),
795
+ de(1, g(De)),
796
+ de(2, Ve)
797
+ ], M);
794
798
  export {
795
- T as SheetsCellContentController,
796
- Mt as SheetsNote,
799
+ R as SheetsCellContentController,
800
+ Ot as SheetsNote,
797
801
  L as SheetsNotePopupController,
798
802
  I as SheetsNotePopupService,
799
- V as UniverSheetsNoteUIPlugin
803
+ M as UniverSheetsNoteUIPlugin
800
804
  };