@univerjs/sheets-thread-comment-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 Re = Object.defineProperty;
2
- var Ue = (n, e, r) => e in n ? Re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
3
- var y = (n, e, r) => Ue(n, typeof e != "symbol" ? e + "" : e, r);
4
- import { Inject as p, Disposable as $, DisposableCollection as $e, CommandType as Oe, IUniverInstanceService as x, InterceptorEffectEnum as ke, UniverInstanceType as M, Range as Ne, ICommandService as ne, RANGE_TYPE as se, Rectangle as De, Tools as xe, DependentOn as Ae, Injector as Ve, IConfigService as Be, Plugin as He, merge as Le } from "@univerjs/core";
5
- import { SheetsSelectionsService as de, getSheetCommandTarget as je, SheetInterceptorService as Fe, INTERCEPTOR_POINT as We, SheetPermissionCheckController as ue, RangeProtectionPermissionViewPoint as G, WorksheetViewPermission as z, WorkbookCommentPermission as K, SetWorksheetActiveOperation as Ze } from "@univerjs/sheets";
6
- import { SheetsThreadCommentModel as O, UniverSheetsThreadCommentPlugin as Ge } from "@univerjs/sheets-thread-comment";
7
- import { ThreadCommentPanelService as re, SetActiveCommentOperation as q, ThreadCommentTree as ze, ThreadCommentPanel as Ke, ToggleSheetCommentPanelOperation as le, THREAD_COMMENT_PANEL as Ye, UniverThreadCommentUIPlugin as qe } from "@univerjs/thread-comment-ui";
8
- import { UniverThreadCommentUIPlugin as dn } from "@univerjs/thread-comment-ui";
9
- import { SheetCanvasPopManagerService as Je, CellPopupManagerService as Qe, ISheetClipboardService as Xe, COPY_TYPE as et, HoverManagerService as tt, IMarkSelectionService as pe, IEditorBridgeService as nt, SheetSkeletonManagerService as rt, ScrollToRangeOperation as ot, whenSheetEditorFocused as it, getCurrentRangeDisable$ as Ce } from "@univerjs/sheets-ui";
10
- import { IZenZoneService as st, useDependency as E, useObservable as N, KeyCode as at, MetaKeys as ae, getMenuHiddenObservable as _e, MenuItemType as ve, ContextMenuPosition as ct, ContextMenuGroup as ht, RibbonInsertGroup as mt, IMenuManagerService as dt, ComponentManager as ut, IShortcutService as lt } from "@univerjs/ui";
11
- import { BehaviorSubject as pt, debounceTime as oe, map as Ct } from "rxjs";
12
- import { IRenderManagerService as Se } from "@univerjs/engine-render";
13
- import { singleReferenceToGrid as D, serializeRange as _t } from "@univerjs/engine-formula";
14
- import { IThreadCommentDataSourceService as vt, DeleteCommentMutation as te, AddCommentMutation as ce } from "@univerjs/thread-comment";
15
- import { AddCommentCommand as ln, DeleteCommentCommand as pn, DeleteCommentTreeCommand as Cn, IThreadCommentDataSourceService as _n, ResolveCommentCommand as vn, UpdateCommentCommand as Sn } from "@univerjs/thread-comment";
16
- import { useRef as fe, createElement as ge, forwardRef as St, useMemo as ft, useCallback as he, useEffect as gt } from "react";
17
- import { jsx as Ie } from "react/jsx-runtime";
18
- const Pe = "univer.sheet.thread-comment-modal", Te = "SHEET_THREAD_COMMENT";
19
- var It = Object.getOwnPropertyDescriptor, Pt = (n, e, r, t) => {
20
- for (var o = t > 1 ? void 0 : t ? It(e, r) : e, i = n.length - 1, s; i >= 0; i--)
1
+ var Ue = Object.defineProperty;
2
+ var $e = (n, e, r) => e in n ? Ue(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
3
+ var y = (n, e, r) => $e(n, typeof e != "symbol" ? e + "" : e, r);
4
+ import { Inject as p, Disposable as k, DisposableCollection as ke, CommandType as Oe, IUniverInstanceService as A, InterceptorEffectEnum as Ne, UniverInstanceType as M, Range as De, ICommandService as re, RANGE_TYPE as ae, Rectangle as xe, Tools as Ae, DependentOn as Ve, Injector as Be, IConfigService as He, Plugin as Le, merge as je } from "@univerjs/core";
5
+ import { SheetsSelectionsService as ue, getSheetCommandTarget as Fe, SheetInterceptorService as We, INTERCEPTOR_POINT as Ze, SheetPermissionCheckController as le, RangeProtectionPermissionViewPoint as G, WorksheetViewPermission as z, WorkbookCommentPermission as K, SetWorksheetActiveOperation as Ge } from "@univerjs/sheets";
6
+ import { SheetsThreadCommentModel as O, UniverSheetsThreadCommentPlugin as ze } from "@univerjs/sheets-thread-comment";
7
+ import { ThreadCommentPanelService as oe, SetActiveCommentOperation as J, ToggleSheetCommentPanelOperation as pe, ThreadCommentTree as Ke, ThreadCommentPanel as Ye, THREAD_COMMENT_PANEL as qe, UniverThreadCommentUIPlugin as Je } from "@univerjs/thread-comment-ui";
8
+ import { UniverThreadCommentUIPlugin as pn } from "@univerjs/thread-comment-ui";
9
+ import { SheetCanvasPopManagerService as Qe, CellPopupManagerService as Xe, ISheetClipboardService as et, COPY_TYPE as tt, HoverManagerService as nt, IMarkSelectionService as Ce, IEditorBridgeService as rt, SheetSkeletonManagerService as ot, ScrollToRangeOperation as it, whenSheetEditorFocused as st, getCurrentRangeDisable$ as ve } from "@univerjs/sheets-ui";
10
+ import { IZenZoneService as at, KeyCode as ct, MetaKeys as ce, getMenuHiddenObservable as _e, MenuItemType as Se, ContextMenuPosition as ht, ContextMenuGroup as mt, RibbonInsertGroup as dt, useDependency as E, useObservable as D, IMenuManagerService as ut, ComponentManager as lt, IShortcutService as pt } from "@univerjs/ui";
11
+ import { BehaviorSubject as Ct, debounceTime as ie, map as vt } from "rxjs";
12
+ import { IRenderManagerService as fe } from "@univerjs/engine-render";
13
+ import { singleReferenceToGrid as x, serializeRange as _t } from "@univerjs/engine-formula";
14
+ import { IThreadCommentDataSourceService as St, DeleteCommentMutation as ne, AddCommentMutation as he } from "@univerjs/thread-comment";
15
+ import { AddCommentCommand as vn, DeleteCommentCommand as _n, DeleteCommentTreeCommand as Sn, IThreadCommentDataSourceService as fn, ResolveCommentCommand as gn, UpdateCommentCommand as In } from "@univerjs/thread-comment";
16
+ import { useRef as ge, createElement as Ie, forwardRef as ft, useMemo as gt, useCallback as me, useEffect as It } from "react";
17
+ import { jsx as Pe } from "react/jsx-runtime";
18
+ const Te = "univer.sheet.thread-comment-modal", we = "SHEET_THREAD_COMMENT";
19
+ var Pt = Object.getOwnPropertyDescriptor, Tt = (n, e, r, t) => {
20
+ for (var o = t > 1 ? void 0 : t ? Pt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
21
21
  (s = n[i]) && (o = s(o) || o);
22
22
  return o;
23
- }, J = (n, e) => (r, t) => e(r, t, n);
24
- let R = class extends $ {
23
+ }, Q = (n, e) => (r, t) => e(r, t, n);
24
+ let R = class extends k {
25
25
  constructor(e, r, t) {
26
26
  super();
27
27
  y(this, "_lastPopup", null);
28
28
  y(this, "_activePopup");
29
- y(this, "_activePopup$", new pt(null));
29
+ y(this, "_activePopup$", new Ct(null));
30
30
  y(this, "activePopup$", this._activePopup$.asObservable());
31
31
  this._canvasPopupManagerService = e, this._zenZoneService = r, this._cellPopupManagerService = t, this._initZenVisible(), this.disposeWithMe(() => {
32
32
  this._activePopup$.complete();
@@ -61,7 +61,7 @@ let R = class extends $ {
61
61
  subUnitId: s
62
62
  },
63
63
  {
64
- componentKey: Pe,
64
+ componentKey: Te,
65
65
  onClickOutside: () => {
66
66
  this.hidePopup();
67
67
  },
@@ -75,7 +75,7 @@ let R = class extends $ {
75
75
  );
76
76
  if (!a)
77
77
  throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
78
- const c = new $e();
78
+ const c = new ke();
79
79
  c.add(a), c.add({
80
80
  dispose: () => {
81
81
  r == null || r();
@@ -92,20 +92,20 @@ let R = class extends $ {
92
92
  }, this._activePopup$.next(this._activePopup));
93
93
  }
94
94
  };
95
- R = Pt([
96
- J(0, p(Je)),
97
- J(1, st),
98
- J(2, p(Qe))
95
+ R = Tt([
96
+ Q(0, p(Qe)),
97
+ Q(1, at),
98
+ Q(2, p(Xe))
99
99
  ], R);
100
- const A = {
100
+ const V = {
101
101
  type: Oe.OPERATION,
102
102
  id: "sheets.operation.show-comment-modal",
103
103
  handler(n) {
104
- var _;
105
- const e = n.get(de), r = n.get(x), t = n.get(R), o = n.get(re), i = (_ = e.getCurrentLastSelection()) == null ? void 0 : _.primary, s = n.get(O);
104
+ var v;
105
+ const e = n.get(ue), r = n.get(A), t = n.get(R), o = n.get(oe), i = (v = e.getCurrentLastSelection()) == null ? void 0 : v.primary, s = n.get(O);
106
106
  if (!i)
107
107
  return !1;
108
- const a = je(r);
108
+ const a = Fe(r);
109
109
  if (!a)
110
110
  return !1;
111
111
  const { workbook: c, worksheet: h, unitId: d, subUnitId: m } = a, C = {
@@ -125,22 +125,25 @@ const A = {
125
125
  trigger: "context-menu"
126
126
  }), !0;
127
127
  }
128
- }, Tt = "sheets-thread-comment.config", me = {};
129
- var wt = Object.getOwnPropertyDescriptor, Mt = (n, e, r, t) => {
130
- for (var o = t > 1 ? void 0 : t ? wt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
128
+ }, wt = "@univerjs/sheets-thread-comment-ui", Mt = "0.17.0", Me = {
129
+ name: wt,
130
+ version: Mt
131
+ }, bt = "sheets-thread-comment.config", de = {};
132
+ var yt = Object.getOwnPropertyDescriptor, Et = (n, e, r, t) => {
133
+ for (var o = t > 1 ? void 0 : t ? yt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
131
134
  (s = n[i]) && (o = s(o) || o);
132
135
  return o;
133
- }, V = (n, e) => (r, t) => e(r, t, n);
134
- let H = class extends $ {
136
+ }, B = (n, e) => (r, t) => e(r, t, n);
137
+ let L = class extends k {
135
138
  constructor(n, e, r, t) {
136
139
  super(), this._sheetInterceptorService = n, this._sheetsThreadCommentModel = e, this._univerInstanceService = r, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
137
140
  }
138
141
  _initViewModelIntercept() {
139
142
  this.disposeWithMe(
140
143
  this._sheetInterceptorService.intercept(
141
- We.CELL_CONTENT,
144
+ Ze.CELL_CONTENT,
142
145
  {
143
- effect: ke.Style,
146
+ effect: Ne.Style,
144
147
  handler: (n, e, r) => {
145
148
  const { row: t, col: o, unitId: i, subUnitId: s } = e;
146
149
  return this._sheetsThreadCommentModel.showCommentMarker(i, s, t, o) && ((!n || n === e.rawData) && (n = { ...e.rawData }), n.markers = {
@@ -164,24 +167,24 @@ let H = class extends $ {
164
167
  const r = e.getUnitId(), t = this._renderManagerService.getRenderById(r);
165
168
  (o = t == null ? void 0 : t.mainComponent) == null || o.makeForceDirty();
166
169
  };
167
- this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(oe(16)).subscribe(() => {
170
+ this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ie(16)).subscribe(() => {
168
171
  n();
169
172
  }));
170
173
  }
171
174
  };
172
- H = Mt([
173
- V(0, p(Fe)),
174
- V(1, p(O)),
175
- V(2, x),
176
- V(3, Se)
177
- ], H);
178
- var bt = Object.getOwnPropertyDescriptor, yt = (n, e, r, t) => {
179
- for (var o = t > 1 ? void 0 : t ? bt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
175
+ L = Et([
176
+ B(0, p(We)),
177
+ B(1, p(O)),
178
+ B(2, A),
179
+ B(3, fe)
180
+ ], L);
181
+ var Rt = Object.getOwnPropertyDescriptor, Ut = (n, e, r, t) => {
182
+ for (var o = t > 1 ? void 0 : t ? Rt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
180
183
  (s = n[i]) && (o = s(o) || o);
181
184
  return o;
182
- }, Q = (n, e) => (r, t) => e(r, t, n);
183
- const Et = (n, e, r) => {
184
- const t = D(n), o = r.row - e.row, i = r.column - e.column, s = {
185
+ }, X = (n, e) => (r, t) => e(r, t, n);
186
+ const $t = (n, e, r) => {
187
+ const t = x(n), o = r.row - e.row, i = r.column - e.column, s = {
185
188
  startColumn: t.column + i,
186
189
  startRow: t.row + o,
187
190
  endColumn: t.column + i,
@@ -189,7 +192,7 @@ const Et = (n, e, r) => {
189
192
  };
190
193
  return _t(s);
191
194
  };
192
- let L = class extends $ {
195
+ let j = class extends k {
193
196
  constructor(e, r, t) {
194
197
  super();
195
198
  y(this, "_copyInfo");
@@ -199,7 +202,7 @@ let L = class extends $ {
199
202
  _initClipboardHook() {
200
203
  this.disposeWithMe(
201
204
  this._sheetClipboardService.addClipboardHook({
202
- id: Te,
205
+ id: we,
203
206
  onBeforeCopy: (e, r, t) => {
204
207
  this._copyInfo = {
205
208
  unitId: e,
@@ -213,52 +216,52 @@ let L = class extends $ {
213
216
  row: a.rows[0],
214
217
  column: a.cols[0]
215
218
  };
216
- if (o.copyType === et.CUT && this._copyInfo) {
219
+ if (o.copyType === tt.CUT && this._copyInfo) {
217
220
  const { range: h, unitId: d, subUnitId: m } = this._copyInfo, C = {
218
221
  row: h.startRow,
219
222
  column: h.startColumn
220
223
  };
221
224
  if (!(i === d && s === m)) {
222
225
  const l = [];
223
- Ne.foreach(h, (g, u) => {
226
+ De.foreach(h, (g, u) => {
224
227
  const I = this._sheetsThreadCommentModel.getAllByLocation(d, m, g, u);
225
- this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((v) => {
226
- l.push(v);
227
- }) : I.forEach(({ children: v, ...T }) => {
228
+ this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((_) => {
229
+ l.push(_);
230
+ }) : I.forEach(({ children: _, ...T }) => {
228
231
  T.parentId || l.push(T);
229
232
  });
230
233
  });
231
- const _ = [], f = [], U = [], k = [], Y = (g) => {
232
- _.unshift({
233
- id: te.id,
234
+ const v = [], f = [], U = [], N = [], q = (g) => {
235
+ v.unshift({
236
+ id: ne.id,
234
237
  params: {
235
238
  unitId: d,
236
239
  subUnitId: m,
237
240
  commentId: g.id
238
241
  }
239
242
  }), U.push({
240
- id: ce.id,
243
+ id: he.id,
241
244
  params: {
242
245
  unitId: i,
243
246
  subUnitId: s,
244
247
  comment: {
245
248
  ...g,
246
- ref: Et(g.ref, C, c),
249
+ ref: $t(g.ref, C, c),
247
250
  unitId: i,
248
251
  subUnitId: s
249
252
  },
250
253
  sync: !0
251
254
  }
252
255
  }), f.push({
253
- id: ce.id,
256
+ id: he.id,
254
257
  params: {
255
258
  unitId: d,
256
259
  subUnitId: m,
257
260
  comment: g,
258
261
  sync: !0
259
262
  }
260
- }), k.unshift({
261
- id: te.id,
263
+ }), N.unshift({
264
+ id: ne.id,
262
265
  params: {
263
266
  unitId: i,
264
267
  subUnitId: s,
@@ -267,10 +270,10 @@ let L = class extends $ {
267
270
  });
268
271
  };
269
272
  return l.forEach((g) => {
270
- Y(g);
273
+ q(g);
271
274
  }), {
272
- redos: [..._, ...U],
273
- undos: [...k, ...f]
275
+ redos: [...v, ...U],
276
+ undos: [...N, ...f]
274
277
  };
275
278
  }
276
279
  }
@@ -283,23 +286,23 @@ let L = class extends $ {
283
286
  );
284
287
  }
285
288
  };
286
- L = yt([
287
- Q(0, p(Xe)),
288
- Q(1, p(O)),
289
- Q(2, vt)
290
- ], L);
291
- var Rt = Object.getOwnPropertyDescriptor, Ut = (n, e, r, t) => {
292
- for (var o = t > 1 ? void 0 : t ? Rt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
289
+ j = Ut([
290
+ X(0, p(et)),
291
+ X(1, p(O)),
292
+ X(2, St)
293
+ ], j);
294
+ var kt = Object.getOwnPropertyDescriptor, Ot = (n, e, r, t) => {
295
+ for (var o = t > 1 ? void 0 : t ? kt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
293
296
  (s = n[i]) && (o = s(o) || o);
294
297
  return o;
295
- }, B = (n, e) => (r, t) => e(r, t, n);
296
- let j = class extends $ {
298
+ }, H = (n, e) => (r, t) => e(r, t, n);
299
+ let F = class extends k {
297
300
  constructor(n, e, r, t) {
298
301
  super(), this._hoverManagerService = n, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = r, this._sheetPermissionCheckController = t, this._initHoverEvent();
299
302
  }
300
303
  _initHoverEvent() {
301
304
  this.disposeWithMe(
302
- this._hoverManagerService.currentCell$.pipe(oe(100)).subscribe((n) => {
305
+ this._hoverManagerService.currentCell$.pipe(ie(100)).subscribe((n) => {
303
306
  const e = this._sheetsThreadCommentPopupService.activePopup;
304
307
  if (n && (e && e.temp || !e)) {
305
308
  const { location: r } = n, { unitId: t, subUnitId: o, row: i, col: s } = r, a = this._sheetsThreadCommentModel.getByLocation(t, o, i, s);
@@ -326,18 +329,18 @@ let j = class extends $ {
326
329
  );
327
330
  }
328
331
  };
329
- j = Ut([
330
- B(0, p(tt)),
331
- B(1, p(R)),
332
- B(2, p(O)),
333
- B(3, p(ue))
334
- ], j);
335
- var $t = Object.getOwnPropertyDescriptor, Ot = (n, e, r, t) => {
336
- for (var o = t > 1 ? void 0 : t ? $t(e, r) : e, i = n.length - 1, s; i >= 0; i--)
332
+ F = Ot([
333
+ H(0, p(nt)),
334
+ H(1, p(R)),
335
+ H(2, p(O)),
336
+ H(3, p(le))
337
+ ], F);
338
+ var Nt = Object.getOwnPropertyDescriptor, Dt = (n, e, r, t) => {
339
+ for (var o = t > 1 ? void 0 : t ? Nt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
337
340
  (s = n[i]) && (o = s(o) || o);
338
341
  return o;
339
342
  }, w = (n, e) => (r, t) => e(r, t, n);
340
- let F = class extends $ {
343
+ let W = class extends k {
341
344
  constructor(e, r, t, o, i, s, a, c, h, d) {
342
345
  super();
343
346
  y(this, "_isSwitchToCommenting", !1);
@@ -345,22 +348,22 @@ let F = class extends $ {
345
348
  this._commandService = e, this._sheetsThreadCommentPopupService = r, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = o, this._univerInstanceService = i, this._sheetPermissionCheckController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = h, this._renderManagerService = d, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
346
349
  }
347
350
  _handleSelectionChange(e, r, t) {
348
- var C, l, _;
349
- const o = (C = e[0]) == null ? void 0 : C.range, i = this._renderManagerService.getRenderById(r), s = (l = i == null ? void 0 : i.with(rt).getSkeletonParam(t)) == null ? void 0 : l.skeleton;
351
+ var C, l, v;
352
+ const o = (C = e[0]) == null ? void 0 : C.range, i = this._renderManagerService.getRenderById(r), s = (l = i == null ? void 0 : i.with(ot).getSkeletonParam(t)) == null ? void 0 : l.skeleton;
350
353
  if (!s || !o)
351
354
  return;
352
355
  const a = s.getCellWithCoordByIndex(o.startRow, o.startColumn);
353
- if ((((_ = o.rangeType) != null ? _ : se.NORMAL) !== se.NORMAL || o.endColumn - o.startColumn > 0 || o.endRow - o.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && De.equals(a.mergeInfo, o))) {
354
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(q.id);
356
+ if ((((v = o.rangeType) != null ? v : ae.NORMAL) !== ae.NORMAL || o.endColumn - o.startColumn > 0 || o.endRow - o.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && xe.equals(a.mergeInfo, o))) {
357
+ this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(J.id);
355
358
  return;
356
359
  }
357
360
  const h = a.actualRow, d = a.actualColumn;
358
361
  if (!this._sheetsThreadCommentModel.showCommentMarker(r, t, h, d)) {
359
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(q.id);
362
+ this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(J.id);
360
363
  return;
361
364
  }
362
365
  const m = this._sheetsThreadCommentModel.getByLocation(r, t, h, d);
363
- m && this._commandService.executeCommand(q.id, {
366
+ m && this._commandService.executeCommand(J.id, {
364
367
  unitId: r,
365
368
  subUnitId: t,
366
369
  commentId: m
@@ -385,7 +388,7 @@ let F = class extends $ {
385
388
  }
386
389
  _initCommandListener() {
387
390
  this._commandService.onCommandExecuted((e) => {
388
- if (e.id === te.id) {
391
+ if (e.id === ne.id) {
389
392
  const r = e.params, t = this._sheetsThreadCommentPopupService.activePopup;
390
393
  if (!t)
391
394
  return;
@@ -404,11 +407,11 @@ let F = class extends $ {
404
407
  const c = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SHEET);
405
408
  if (!c || c.getUnitId() !== t)
406
409
  return;
407
- this._isSwitchToCommenting = !0, ((r = c.getActiveSheet()) == null ? void 0 : r.getSheetId()) !== o && await this._commandService.executeCommand(Ze.id, {
410
+ this._isSwitchToCommenting = !0, ((r = c.getActiveSheet()) == null ? void 0 : r.getSheetId()) !== o && await this._commandService.executeCommand(Ge.id, {
408
411
  unitId: t,
409
412
  subUnitId: o
410
413
  }), this._isSwitchToCommenting = !1;
411
- const m = D(a.ref), { row: C, column: l } = m;
414
+ const m = x(a.ref), { row: C, column: l } = m;
412
415
  if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
413
416
  workbookTypes: [K],
414
417
  worksheetTypes: [z],
@@ -416,7 +419,7 @@ let F = class extends $ {
416
419
  }, [{ startRow: C, startColumn: l, endRow: C, endColumn: l }], t, o))
417
420
  return;
418
421
  const f = 1;
419
- if (await this._commandService.executeCommand(ot.id, {
422
+ if (await this._commandService.executeCommand(it.id, {
420
423
  range: {
421
424
  startRow: Math.max(m.row - f, 0),
422
425
  endRow: m.row + f,
@@ -438,7 +441,7 @@ let F = class extends $ {
438
441
  }));
439
442
  }
440
443
  _initMarkSelection() {
441
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(oe(100)).subscribe((e) => {
444
+ this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(ie(100)).subscribe((e) => {
442
445
  var C, l;
443
446
  if (!e) {
444
447
  this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
@@ -449,7 +452,7 @@ let F = class extends $ {
449
452
  const i = this._sheetsThreadCommentModel.getComment(r, t, o);
450
453
  if (!i)
451
454
  return;
452
- const s = D(i.ref), { row: a, column: c } = s;
455
+ const s = x(i.ref), { row: a, column: c } = s;
453
456
  if (Number.isNaN(a) || Number.isNaN(c))
454
457
  return null;
455
458
  const h = (C = this._univerInstanceService.getCurrentUnitForType(M.UNIVER_SHEET)) == null ? void 0 : C.getSheetBySheetId(t), d = (l = h == null ? void 0 : h.getMergedCell(a, c)) != null ? l : {
@@ -479,21 +482,21 @@ let F = class extends $ {
479
482
  }));
480
483
  }
481
484
  };
482
- F = Ot([
483
- w(0, ne),
485
+ W = Dt([
486
+ w(0, re),
484
487
  w(1, p(R)),
485
488
  w(2, p(O)),
486
- w(3, p(re)),
487
- w(4, x),
488
- w(5, p(ue)),
489
- w(6, pe),
490
- w(7, p(de)),
491
- w(8, nt),
492
- w(9, Se)
493
- ], F);
494
- function we({ ref: n, ...e }) {
495
- const { icon: r, id: t, className: o, extend: i, ...s } = e, a = `univerjs-icon univerjs-icon-${t} ${o || ""}`.trim(), c = fe(`_${Dt()}`);
496
- return Me(r, `${t}`, {
489
+ w(3, p(oe)),
490
+ w(4, A),
491
+ w(5, p(le)),
492
+ w(6, Ce),
493
+ w(7, p(ue)),
494
+ w(8, rt),
495
+ w(9, fe)
496
+ ], W);
497
+ function be({ ref: n, ...e }) {
498
+ const { icon: r, id: t, className: o, extend: i, ...s } = e, a = `univerjs-icon univerjs-icon-${t} ${o || ""}`.trim(), c = ge(`_${Vt()}`);
499
+ return ye(r, `${t}`, {
497
500
  defIds: r.defIds,
498
501
  idSuffix: c.current
499
502
  }, {
@@ -502,14 +505,14 @@ function we({ ref: n, ...e }) {
502
505
  ...s
503
506
  }, i);
504
507
  }
505
- function Me(n, e, r, t, o) {
506
- return ge(n.tag, {
508
+ function ye(n, e, r, t, o) {
509
+ return Ie(n.tag, {
507
510
  key: e,
508
- ...kt(n, r, o),
511
+ ...xt(n, r, o),
509
512
  ...t
510
- }, (Nt(n, r).children || []).map((i, s) => Me(i, `${e}-${n.tag}-${s}`, r, void 0, o)));
513
+ }, (At(n, r).children || []).map((i, s) => ye(i, `${e}-${n.tag}-${s}`, r, void 0, o)));
511
514
  }
512
- function kt(n, e, r) {
515
+ function xt(n, e, r) {
513
516
  const t = { ...n.attrs };
514
517
  r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1), n.tag === "mask" && t.id && (t.id = t.id + e.idSuffix), Object.entries(t).forEach(([i, s]) => {
515
518
  i === "mask" && typeof s == "string" && (t[i] = s.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
@@ -519,7 +522,7 @@ function kt(n, e, r) {
519
522
  typeof s == "string" && (t[i] = s.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
520
523
  })), t;
521
524
  }
522
- function Nt(n, e) {
525
+ function At(n, e) {
523
526
  var t;
524
527
  const { defIds: r } = e;
525
528
  return !r || r.length === 0 ? n : n.tag === "defs" && ((t = n.children) != null && t.length) ? {
@@ -533,11 +536,11 @@ function Nt(n, e) {
533
536
  } : o)
534
537
  } : n;
535
538
  }
536
- function Dt() {
539
+ function Vt() {
537
540
  return Math.random().toString(36).substring(2, 8);
538
541
  }
539
- we.displayName = "UniverIcon";
540
- const xt = {
542
+ be.displayName = "UniverIcon";
543
+ const Bt = {
541
544
  tag: "svg",
542
545
  attrs: {
543
546
  xmlns: "http://www.w3.org/2000/svg",
@@ -587,26 +590,67 @@ const xt = {
587
590
  }
588
591
  }
589
592
  ]
590
- }, be = St(function(e, r) {
591
- return ge(we, Object.assign({}, e, {
593
+ }, Ee = ft(function(e, r) {
594
+ return Ie(be, Object.assign({}, e, {
592
595
  id: "comment-icon",
593
596
  ref: r,
594
- icon: xt
597
+ icon: Bt
595
598
  }));
596
599
  });
597
- be.displayName = "CommentIcon";
598
- const At = () => {
599
- const n = E(x), e = E(R), r = N(e.activePopup$), t = E(O);
600
- if (N(t.commentUpdate$), !r)
600
+ Ee.displayName = "CommentIcon";
601
+ const Ht = (n) => ({
602
+ id: V.id,
603
+ type: Se.BUTTON,
604
+ icon: "CommentIcon",
605
+ title: "sheetThreadComment.menu.addComment",
606
+ hidden$: _e(n, M.UNIVER_SHEET),
607
+ disabled$: ve(n, {
608
+ workbookTypes: [K],
609
+ worksheetTypes: [z],
610
+ rangeTypes: [G]
611
+ })
612
+ }), Lt = (n) => ({
613
+ id: pe.id,
614
+ type: Se.BUTTON,
615
+ icon: "CommentIcon",
616
+ tooltip: "sheetThreadComment.menu.commentManagement",
617
+ disabled$: ve(n, {
618
+ workbookTypes: [K],
619
+ worksheetTypes: [z],
620
+ rangeTypes: [G]
621
+ }),
622
+ hidden$: _e(n, M.UNIVER_SHEET)
623
+ }), jt = {
624
+ id: V.id,
625
+ binding: ct.M | ce.CTRL_COMMAND | ce.ALT,
626
+ preconditions: st
627
+ }, Ft = {
628
+ [dt.MEDIA]: {
629
+ [pe.id]: {
630
+ order: 2,
631
+ menuItemFactory: Lt
632
+ }
633
+ },
634
+ [ht.MAIN_AREA]: {
635
+ [mt.OTHERS]: {
636
+ [V.id]: {
637
+ order: 0,
638
+ menuItemFactory: Ht
639
+ }
640
+ }
641
+ }
642
+ }, Wt = () => {
643
+ const n = E(A), e = E(R), r = D(e.activePopup$), t = E(O);
644
+ if (D(t.commentUpdate$), !r)
601
645
  return null;
602
- const { row: o, col: i, unitId: s, subUnitId: a, trigger: c } = r, h = t.getByLocation(s, a, o, i), d = `${xe.chatAtABC(i)}${o + 1}`, m = () => {
646
+ const { row: o, col: i, unitId: s, subUnitId: a, trigger: c } = r, h = t.getByLocation(s, a, o, i), d = `${Ae.chatAtABC(i)}${o + 1}`, m = () => {
603
647
  e.hidePopup();
604
648
  }, C = (l) => {
605
- var _, f, U;
606
- return (U = (f = (_ = n.getCurrentUnitForType(M.UNIVER_SHEET)) == null ? void 0 : _.getSheetBySheetId(l)) == null ? void 0 : f.getName()) != null ? U : "";
649
+ var v, f, U;
650
+ return (U = (f = (v = n.getCurrentUnitForType(M.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(l)) == null ? void 0 : f.getName()) != null ? U : "";
607
651
  };
608
- return /* @__PURE__ */ Ie(
609
- ze,
652
+ return /* @__PURE__ */ Pe(
653
+ Ke,
610
654
  {
611
655
  onClick: () => {
612
656
  e.persistPopup();
@@ -622,32 +666,32 @@ const At = () => {
622
666
  autoFocus: c === "context-menu"
623
667
  }
624
668
  );
625
- }, Vt = () => {
669
+ }, Zt = () => {
626
670
  var g;
627
- const n = E(pe), e = E(x), r = E(R), t = e.getCurrentUnitForType(M.UNIVER_SHEET), o = t.getUnitId(), i = E(ne), s = ft(() => t.activeSheet$.pipe(Ct((u) => u == null ? void 0 : u.getSheetId())), [t.activeSheet$]), a = N(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = fe(null), h = E(re), d = N(h.activeCommentId$), m = N(h.panelVisible$, h.panelVisible), C = he((u) => {
628
- const I = t.getSheets(), v = {};
671
+ const n = E(Ce), e = E(A), r = E(R), t = e.getCurrentUnitForType(M.UNIVER_SHEET), o = t.getUnitId(), i = E(re), s = gt(() => t.activeSheet$.pipe(vt((u) => u == null ? void 0 : u.getSheetId())), [t.activeSheet$]), a = D(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = ge(null), h = E(oe), d = D(h.activeCommentId$), m = D(h.panelVisible$, h.panelVisible), C = me((u) => {
672
+ const I = t.getSheets(), _ = {};
629
673
  I.forEach((P, S) => {
630
- v[P.getSheetId()] = S;
674
+ _[P.getSheetId()] = S;
631
675
  });
632
676
  const T = (P) => P.map((S) => {
633
- var ie;
634
- const b = D(S.ref), Ee = [(ie = v[S.subUnitId]) != null ? ie : 0, b.row, b.column];
635
- return { ...S, p: Ee };
677
+ var se;
678
+ const b = x(S.ref), Re = [(se = _[S.subUnitId]) != null ? se : 0, b.row, b.column];
679
+ return { ...S, p: Re };
636
680
  }).sort((S, b) => S.p[0] === b.p[0] ? S.p[1] === b.p[1] ? S.p[2] - b.p[2] : S.p[1] - b.p[1] : S.p[0] - b.p[0]);
637
681
  return [
638
682
  ...T(u.filter((P) => !P.resolved)),
639
683
  ...T(u.filter((P) => P.resolved))
640
684
  ];
641
- }, [t]), l = he((u) => {
685
+ }, [t]), l = me((u) => {
642
686
  var I;
643
687
  if (u.unitId === o && u.subUnitId === a && !u.resolved) {
644
- const { row: v, column: T } = D(u.ref), P = t.getSheetBySheetId(u.subUnitId), S = (I = P == null ? void 0 : P.getMergedCell(v, T)) != null ? I : {
688
+ const { row: _, column: T } = x(u.ref), P = t.getSheetBySheetId(u.subUnitId), S = (I = P == null ? void 0 : P.getMergedCell(_, T)) != null ? I : {
645
689
  startColumn: T,
646
690
  endColumn: T,
647
- startRow: v,
648
- endRow: v
691
+ startRow: _,
692
+ endRow: _
649
693
  };
650
- if (!Number.isNaN(v) && !Number.isNaN(T))
694
+ if (!Number.isNaN(_) && !Number.isNaN(T))
651
695
  return n.addShape({
652
696
  range: S,
653
697
  style: {
@@ -661,97 +705,56 @@ const At = () => {
661
705
  });
662
706
  }
663
707
  return null;
664
- }, [n, a, o]), _ = (u) => {
665
- var I, v;
666
- return (v = (I = t.getSheetBySheetId(u)) == null ? void 0 : I.getName()) != null ? v : "";
708
+ }, [n, a, o]), v = (u) => {
709
+ var I, _;
710
+ return (_ = (I = t.getSheetBySheetId(u)) == null ? void 0 : I.getName()) != null ? _ : "";
667
711
  }, f = () => {
668
- i.executeCommand(A.id);
712
+ i.executeCommand(V.id);
669
713
  }, U = (u) => {
670
714
  d && d.unitId === u.unitId && d.subUnitId === u.subUnitId && d.commentId === u.id || (c.current && (n.removeShape(c.current), c.current = null), c.current = l(u));
671
- }, k = () => {
715
+ }, N = () => {
672
716
  c.current && (n.removeShape(c.current), c.current = null);
673
- }, Y = (u, I) => {
717
+ }, q = (u, I) => {
674
718
  I && r.hidePopup();
675
719
  };
676
- return gt(() => {
720
+ return It(() => {
677
721
  !m && c.current && n.removeShape(c.current);
678
- }, [n, m]), /* @__PURE__ */ Ie(
679
- Ke,
722
+ }, [n, m]), /* @__PURE__ */ Pe(
723
+ Ye,
680
724
  {
681
725
  unitId: o,
682
726
  subUnitId$: s,
683
727
  type: M.UNIVER_SHEET,
684
728
  onAdd: f,
685
- getSubUnitName: _,
686
- onResolve: Y,
729
+ getSubUnitName: v,
730
+ onResolve: q,
687
731
  sortComments: C,
688
732
  onItemEnter: U,
689
- onItemLeave: k,
690
- onDeleteComment: () => (k(), !0)
733
+ onItemLeave: N,
734
+ onDeleteComment: () => (N(), !0)
691
735
  }
692
736
  );
693
- }, Bt = (n) => ({
694
- id: A.id,
695
- type: ve.BUTTON,
696
- icon: "CommentIcon",
697
- title: "sheetThreadComment.menu.addComment",
698
- hidden$: _e(n, M.UNIVER_SHEET),
699
- disabled$: Ce(n, {
700
- workbookTypes: [K],
701
- worksheetTypes: [z],
702
- rangeTypes: [G]
703
- })
704
- }), Ht = (n) => ({
705
- id: le.id,
706
- type: ve.BUTTON,
707
- icon: "CommentIcon",
708
- tooltip: "sheetThreadComment.menu.commentManagement",
709
- disabled$: Ce(n, {
710
- workbookTypes: [K],
711
- worksheetTypes: [z],
712
- rangeTypes: [G]
713
- }),
714
- hidden$: _e(n, M.UNIVER_SHEET)
715
- }), Lt = {
716
- id: A.id,
717
- binding: at.M | ae.CTRL_COMMAND | ae.ALT,
718
- preconditions: it
719
- }, jt = {
720
- [mt.MEDIA]: {
721
- [le.id]: {
722
- order: 2,
723
- menuItemFactory: Ht
724
- }
725
- },
726
- [ct.MAIN_AREA]: {
727
- [ht.OTHERS]: {
728
- [A.id]: {
729
- order: 0,
730
- menuItemFactory: Bt
731
- }
732
- }
733
- }
734
737
  };
735
- var Ft = Object.getOwnPropertyDescriptor, Wt = (n, e, r, t) => {
736
- for (var o = t > 1 ? void 0 : t ? Ft(e, r) : e, i = n.length - 1, s; i >= 0; i--)
738
+ var Gt = Object.getOwnPropertyDescriptor, zt = (n, e, r, t) => {
739
+ for (var o = t > 1 ? void 0 : t ? Gt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
737
740
  (s = n[i]) && (o = s(o) || o);
738
741
  return o;
739
- }, X = (n, e) => (r, t) => e(r, t, n);
740
- let W = class extends $ {
742
+ }, ee = (n, e) => (r, t) => e(r, t, n);
743
+ let Z = class extends k {
741
744
  constructor(n, e, r) {
742
745
  super(), this._menuManagerService = n, this._componentManager = e, this._shortcutService = r, this._initMenu(), this._initShortcut(), this._initComponent();
743
746
  }
744
747
  _initShortcut() {
745
- this._shortcutService.registerShortcut(Lt);
748
+ this._shortcutService.registerShortcut(jt);
746
749
  }
747
750
  _initMenu() {
748
- this._menuManagerService.mergeMenu(jt);
751
+ this._menuManagerService.mergeMenu(Ft);
749
752
  }
750
753
  _initComponent() {
751
754
  [
752
- [Pe, At],
753
- [Ye, Vt],
754
- ["CommentIcon", be]
755
+ [Te, Wt],
756
+ [qe, Zt],
757
+ ["CommentIcon", Ee]
755
758
  ].forEach(([n, e]) => {
756
759
  this.disposeWithMe(
757
760
  this._componentManager.register(n, e)
@@ -759,65 +762,67 @@ let W = class extends $ {
759
762
  });
760
763
  }
761
764
  };
762
- W = Wt([
763
- X(0, dt),
764
- X(1, p(ut)),
765
- X(2, lt)
766
- ], W);
767
- var Zt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, zt = (n, e, r) => e in n ? Zt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, Kt = (n, e, r, t) => {
768
- for (var o = t > 1 ? void 0 : t ? Gt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
765
+ Z = zt([
766
+ ee(0, ut),
767
+ ee(1, p(lt)),
768
+ ee(2, pt)
769
+ ], Z);
770
+ var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (n, e, r) => e in n ? Kt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, Jt = (n, e, r, t) => {
771
+ for (var o = t > 1 ? void 0 : t ? Yt(e, r) : e, i = n.length - 1, s; i >= 0; i--)
769
772
  (s = n[i]) && (o = s(o) || o);
770
773
  return o;
771
- }, ee = (n, e) => (r, t) => e(r, t, n), ye = (n, e, r) => zt(n, typeof e != "symbol" ? e + "" : e, r);
772
- let Z = class extends He {
773
- constructor(n = me, e, r, t) {
774
+ }, te = (n, e) => (r, t) => e(r, t, n), Y = (n, e, r) => qt(n, typeof e != "symbol" ? e + "" : e, r);
775
+ let $ = class extends Le {
776
+ constructor(n = de, e, r, t) {
774
777
  super(), this._config = n, this._injector = e, this._commandService = r, this._configService = t;
775
- const { menu: o, ...i } = Le(
778
+ const { menu: o, ...i } = je(
776
779
  {},
777
- me,
780
+ de,
778
781
  this._config
779
782
  );
780
- o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Tt, i);
783
+ o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(bt, i);
781
784
  }
782
785
  onStarting() {
783
786
  [
784
- [W],
785
- [H],
787
+ [Z],
786
788
  [L],
787
789
  [j],
788
790
  [F],
791
+ [W],
789
792
  [R]
790
793
  ].forEach((n) => {
791
794
  this._injector.add(n);
792
- }), [A].forEach((n) => {
795
+ }), [V].forEach((n) => {
793
796
  this._commandService.registerCommand(n);
794
- }), this._injector.get(W);
797
+ }), this._injector.get(Z);
795
798
  }
796
799
  onReady() {
797
- this._injector.get(H);
800
+ this._injector.get(L);
798
801
  }
799
802
  onRendered() {
800
- this._injector.get(L), this._injector.get(j), this._injector.get(F);
803
+ this._injector.get(j), this._injector.get(F), this._injector.get(W);
801
804
  }
802
805
  };
803
- ye(Z, "pluginName", Te);
804
- ye(Z, "type", M.UNIVER_SHEET);
805
- Z = Kt([
806
- Ae(qe, Ge),
807
- ee(1, p(Ve)),
808
- ee(2, p(ne)),
809
- ee(3, Be)
810
- ], Z);
806
+ Y($, "pluginName", we);
807
+ Y($, "packageName", Me.name);
808
+ Y($, "version", Me.version);
809
+ Y($, "type", M.UNIVER_SHEET);
810
+ $ = Jt([
811
+ Ve(Je, ze),
812
+ te(1, p(Be)),
813
+ te(2, p(re)),
814
+ te(3, He)
815
+ ], $);
811
816
  export {
812
- ln as AddCommentCommand,
813
- pn as DeleteCommentCommand,
814
- Cn as DeleteCommentTreeCommand,
815
- _n as IThreadCommentDataSourceService,
816
- vn as ResolveCommentCommand,
817
- Te as SHEETS_THREAD_COMMENT,
817
+ vn as AddCommentCommand,
818
+ _n as DeleteCommentCommand,
819
+ Sn as DeleteCommentTreeCommand,
820
+ fn as IThreadCommentDataSourceService,
821
+ gn as ResolveCommentCommand,
822
+ we as SHEETS_THREAD_COMMENT,
818
823
  R as SheetsThreadCommentPopupService,
819
- A as ShowAddSheetCommentModalOperation,
820
- Z as UniverSheetsThreadCommentUIPlugin,
821
- dn as UniverThreadCommentUIPlugin,
822
- Sn as UpdateCommentCommand
824
+ V as ShowAddSheetCommentModalOperation,
825
+ $ as UniverSheetsThreadCommentUIPlugin,
826
+ pn as UniverThreadCommentUIPlugin,
827
+ In as UpdateCommentCommand
823
828
  };