@univerjs/sheets-thread-comment-ui 0.5.3 → 0.5.4-experimental.20250114-7c09c35

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/es/index.js CHANGED
@@ -1,20 +1,20 @@
1
- var Le = Object.defineProperty;
2
- var ke = (o, e, n) => e in o ? Le(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
1
+ var Be = Object.defineProperty;
2
+ var ke = (o, e, n) => e in o ? Be(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
3
  var E = (o, e, n) => ke(o, typeof e != "symbol" ? e + "" : e, n);
4
- import { Inject as _, Disposable as $, DisposableCollection as Fe, CommandType as We, IUniverInstanceService as N, InterceptorEffectEnum as Ze, UniverInstanceType as b, Range as ze, ICommandService as ae, RANGE_TYPE as he, Rectangle as qe, useDependency as R, Tools as Ge, DependentOn as Je, Injector as Ye, Plugin as Ke, merge as Qe, IConfigService as Xe } from "@univerjs/core";
5
- import { SheetsSelectionsService as Se, getSheetCommandTarget as et, SheetInterceptorService as ge, INTERCEPTOR_POINT as tt, WorkbookCommentPermission as K, WorksheetViewPermission as Q, RangeProtectionPermissionViewPoint as X, SetWorksheetActiveOperation as nt, RemoveSheetCommand as rt } from "@univerjs/sheets";
4
+ import { Inject as _, Disposable as $, DisposableCollection as Fe, CommandType as We, IUniverInstanceService as N, InterceptorEffectEnum as Ze, UniverInstanceType as b, Range as ze, ICommandService as ce, RANGE_TYPE as he, Rectangle as qe, useDependency as R, Tools as Ge, DependentOn as Je, Injector as Ye, Plugin as Ke, merge as Qe, IConfigService as Xe } from "@univerjs/core";
5
+ import { SheetsSelectionsService as Se, getSheetCommandTarget as et, SheetInterceptorService as ge, INTERCEPTOR_POINT as tt, SheetPermissionCheckController as Ie, WorkbookCommentPermission as K, WorksheetViewPermission as Q, RangeProtectionPermissionViewPoint as X, SetWorksheetActiveOperation as nt, RemoveSheetCommand as rt } from "@univerjs/sheets";
6
6
  import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as ot } from "@univerjs/sheets-thread-comment";
7
- import { ThreadCommentPanelService as ce, SetActiveCommentOperation as te, ThreadCommentTree as it, ThreadCommentPanel as st, ToggleSheetCommentPanelOperation as Ie, THREAD_COMMENT_PANEL as at, UniverThreadCommentUIPlugin as ct } from "@univerjs/thread-comment-ui";
7
+ import { ThreadCommentPanelService as ae, SetActiveCommentOperation as te, ThreadCommentTree as it, ThreadCommentPanel as st, ToggleSheetCommentPanelOperation as Pe, THREAD_COMMENT_PANEL as ct, UniverThreadCommentUIPlugin as at } from "@univerjs/thread-comment-ui";
8
8
  import { UniverThreadCommentUIPlugin as $n } from "@univerjs/thread-comment-ui";
9
- import { SheetCanvasPopManagerService as mt, ISheetClipboardService as ut, COPY_TYPE as dt, HoverManagerService as ht, SheetPermissionInterceptorBaseController as Pe, IMarkSelectionService as Te, IEditorBridgeService as lt, SheetSkeletonManagerService as pt, ScrollToRangeOperation as _t, whenSheetEditorFocused as vt, getCurrentRangeDisable$ as be } from "@univerjs/sheets-ui";
10
- import { IZenZoneService as ft, useObservable as A, KeyCode as Ct, MetaKeys as le, MenuItemType as Me, getMenuHiddenObservable as we, RibbonStartGroup as St, ContextMenuPosition as gt, ContextMenuGroup as It, ComponentManager as Pt, IMenuManagerService as Tt, IShortcutService as bt } from "@univerjs/ui";
11
- import { BehaviorSubject as Mt, debounceTime as me, map as wt } from "rxjs";
9
+ import { SheetCanvasPopManagerService as ut, ISheetClipboardService as dt, COPY_TYPE as mt, HoverManagerService as ht, IMarkSelectionService as Te, IEditorBridgeService as lt, SheetSkeletonManagerService as pt, ScrollToRangeOperation as _t, whenSheetEditorFocused as ft, getCurrentRangeDisable$ as be } from "@univerjs/sheets-ui";
10
+ import { IZenZoneService as vt, useObservable as A, KeyCode as Ct, MetaKeys as le, MenuItemType as Me, getMenuHiddenObservable as we, RibbonStartGroup as St, ContextMenuPosition as gt, ContextMenuGroup as It, ComponentManager as Pt, IMenuManagerService as Tt, IShortcutService as bt } from "@univerjs/ui";
11
+ import { BehaviorSubject as Mt, debounceTime as ue, map as wt } from "rxjs";
12
12
  import { IRenderManagerService as ye } from "@univerjs/engine-render";
13
13
  import { singleReferenceToGrid as V, serializeRange as yt } from "@univerjs/engine-formula";
14
14
  import { IThreadCommentDataSourceService as Ee, DeleteCommentMutation as F, AddCommentMutation as se, ThreadCommentModel as Et } from "@univerjs/thread-comment";
15
- import { AddCommentCommand as xn, DeleteCommentCommand as Dn, DeleteCommentTreeCommand as jn, IThreadCommentDataSourceService as An, ResolveCommentCommand as Vn, UpdateCommentCommand as Bn } from "@univerjs/thread-comment";
15
+ import { AddCommentCommand as xn, DeleteCommentCommand as Dn, DeleteCommentTreeCommand as jn, IThreadCommentDataSourceService as An, ResolveCommentCommand as Vn, UpdateCommentCommand as Hn } from "@univerjs/thread-comment";
16
16
  import Rt, { forwardRef as Re, useRef as Oe, createElement as Ue, useMemo as Ot, useCallback as pe, useEffect as Ut } from "react";
17
- const $e = "univer.sheet.thread-comment-modal", ue = "comment-single", Ne = "SHEET_THREAD_COMMENT";
17
+ const $e = "univer.sheet.thread-comment-modal", de = "comment-single", Ne = "SHEET_THREAD_COMMENT";
18
18
  var $t = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, xt = (o, e, n, t) => {
19
19
  for (var r = t > 1 ? void 0 : t ? Nt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
20
20
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
@@ -40,16 +40,16 @@ let O = class extends $ {
40
40
  }));
41
41
  }
42
42
  showPopup(e, n) {
43
- var d;
43
+ var m;
44
44
  const { row: t, col: r, unitId: i, subUnitId: s } = e;
45
- if (this._activePopup && t === this._activePopup.row && r === this._activePopup.col && i === this._activePopup.unitId && s === ((d = this.activePopup) == null ? void 0 : d.subUnitId)) {
45
+ if (this._activePopup && t === this._activePopup.row && r === this._activePopup.col && i === this._activePopup.unitId && s === ((m = this.activePopup) == null ? void 0 : m.subUnitId)) {
46
46
  this._activePopup = e, this._activePopup$.next(e);
47
47
  return;
48
48
  }
49
49
  if (this._lastPopup && this._lastPopup.dispose(), this._zenZoneService.visible)
50
50
  return;
51
51
  this._activePopup = e, this._activePopup$.next(e);
52
- const a = this._canvasPopupManagerService.attachPopupToCell(
52
+ const c = this._canvasPopupManagerService.attachPopupToCell(
53
53
  t,
54
54
  r,
55
55
  {
@@ -64,14 +64,14 @@ let O = class extends $ {
64
64
  ].filter(Boolean)
65
65
  }
66
66
  );
67
- if (!a)
67
+ if (!c)
68
68
  throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
69
- const c = new Fe();
70
- c.add(a), c.add({
69
+ const a = new Fe();
70
+ a.add(c), a.add({
71
71
  dispose: () => {
72
72
  n == null || n();
73
73
  }
74
- }), this._lastPopup = c;
74
+ }), this._lastPopup = a;
75
75
  }
76
76
  hidePopup() {
77
77
  this._activePopup && (this._lastPopup && this._lastPopup.dispose(), this._lastPopup = null, this._activePopup = null, this._activePopup$.next(null));
@@ -84,43 +84,43 @@ let O = class extends $ {
84
84
  }
85
85
  };
86
86
  O = xt([
87
- _e(0, _(mt)),
88
- _e(1, ft)
87
+ _e(0, _(ut)),
88
+ _e(1, vt)
89
89
  ], O);
90
- const B = {
90
+ const H = {
91
91
  type: We.OPERATION,
92
92
  id: "sheets.operation.show-comment-modal",
93
93
  handler(o) {
94
- var v;
95
- const e = o.get(Se), n = o.get(N), t = o.get(O), r = o.get(ce), i = (v = e.getCurrentLastSelection()) == null ? void 0 : v.primary, s = o.get(x);
94
+ var f;
95
+ const e = o.get(Se), n = o.get(N), t = o.get(O), r = o.get(ae), i = (f = e.getCurrentLastSelection()) == null ? void 0 : f.primary, s = o.get(x);
96
96
  if (!i)
97
97
  return !1;
98
- const a = et(n);
99
- if (!a)
98
+ const c = et(n);
99
+ if (!c)
100
100
  return !1;
101
- const { workbook: c, worksheet: d, unitId: m, subUnitId: u } = a, h = {
102
- workbook: c,
103
- worksheet: d,
104
- unitId: m,
105
- subUnitId: u,
101
+ const { workbook: a, worksheet: m, unitId: u, subUnitId: d } = c, h = {
102
+ workbook: a,
103
+ worksheet: m,
104
+ unitId: u,
105
+ subUnitId: d,
106
106
  row: i.startRow,
107
107
  col: i.startColumn
108
108
  };
109
109
  t.showPopup(h);
110
- const l = s.getByLocation(m, u, i.startRow, i.startColumn);
110
+ const l = s.getByLocation(u, d, i.startRow, i.startColumn);
111
111
  return l && r.setActiveComment({
112
- unitId: m,
113
- subUnitId: u,
112
+ unitId: u,
113
+ subUnitId: d,
114
114
  commentId: l,
115
115
  trigger: "context-menu"
116
116
  }), !0;
117
117
  }
118
- }, Dt = "sheets-thread-comment.config", ve = {};
118
+ }, Dt = "sheets-thread-comment.config", fe = {};
119
119
  var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Vt = (o, e, n, t) => {
120
120
  for (var r = t > 1 ? void 0 : t ? At(e, n) : e, i = o.length - 1, s; i >= 0; i--)
121
121
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
122
122
  return t && r && jt(e, n, r), r;
123
- }, H = (o, e) => (n, t) => e(n, t, o);
123
+ }, L = (o, e) => (n, t) => e(n, t, o);
124
124
  let W = class extends $ {
125
125
  constructor(o, e, n, t) {
126
126
  super(), this._sheetInterceptorService = o, this._sheetsThreadCommentModel = e, this._univerInstanceService = n, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
@@ -157,21 +157,21 @@ let W = class extends $ {
157
157
  const n = e.getUnitId(), t = this._renderManagerService.getRenderById(n);
158
158
  (r = t == null ? void 0 : t.mainComponent) == null || r.makeForceDirty();
159
159
  };
160
- this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(me(16)).subscribe(() => {
160
+ this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ue(16)).subscribe(() => {
161
161
  o();
162
162
  }));
163
163
  }
164
164
  };
165
165
  W = Vt([
166
- H(0, _(ge)),
167
- H(1, _(x)),
168
- H(2, N),
169
- H(3, ye)
166
+ L(0, _(ge)),
167
+ L(1, _(x)),
168
+ L(2, N),
169
+ L(3, ye)
170
170
  ], W);
171
- var Bt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Lt = (o, e, n, t) => {
172
- for (var r = t > 1 ? void 0 : t ? Ht(e, n) : e, i = o.length - 1, s; i >= 0; i--)
171
+ var Ht = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Bt = (o, e, n, t) => {
172
+ for (var r = t > 1 ? void 0 : t ? Lt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
173
173
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
174
- return t && r && Bt(e, n, r), r;
174
+ return t && r && Ht(e, n, r), r;
175
175
  }, ne = (o, e) => (n, t) => e(n, t, o);
176
176
  const kt = (o, e, n) => {
177
177
  const t = V(o), r = n.row - e.row, i = n.column - e.column, s = {
@@ -202,31 +202,31 @@ let Z = class extends $ {
202
202
  },
203
203
  // eslint-disable-next-line max-lines-per-function
204
204
  onPasteCells: (e, n, t, r) => {
205
- const { unitId: i, subUnitId: s, range: a } = n, c = {
206
- row: a.rows[0],
207
- column: a.cols[0]
205
+ const { unitId: i, subUnitId: s, range: c } = n, a = {
206
+ row: c.rows[0],
207
+ column: c.cols[0]
208
208
  };
209
- if (r.copyType === dt.CUT && this._copyInfo) {
210
- const { range: d, unitId: m, subUnitId: u } = this._copyInfo, h = {
211
- row: d.startRow,
212
- column: d.startColumn
209
+ if (r.copyType === mt.CUT && this._copyInfo) {
210
+ const { range: m, unitId: u, subUnitId: d } = this._copyInfo, h = {
211
+ row: m.startRow,
212
+ column: m.startColumn
213
213
  };
214
- if (!(i === m && s === u)) {
214
+ if (!(i === u && s === d)) {
215
215
  const l = [];
216
- ze.foreach(d, (g, p) => {
217
- const I = this._sheetsThreadCommentModel.getAllByLocation(m, u, g, p);
218
- this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((f) => {
219
- l.push(f);
220
- }) : I.forEach(({ children: f, ...M }) => {
216
+ ze.foreach(m, (g, p) => {
217
+ const I = this._sheetsThreadCommentModel.getAllByLocation(u, d, g, p);
218
+ this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((v) => {
219
+ l.push(v);
220
+ }) : I.forEach(({ children: v, ...M }) => {
221
221
  M.parentId || l.push(M);
222
222
  });
223
223
  });
224
- const v = [], S = [], U = [], D = [], ee = (g) => {
225
- v.unshift({
224
+ const f = [], S = [], U = [], D = [], ee = (g) => {
225
+ f.unshift({
226
226
  id: F.id,
227
227
  params: {
228
- unitId: m,
229
- subUnitId: u,
228
+ unitId: u,
229
+ subUnitId: d,
230
230
  commentId: g.id
231
231
  }
232
232
  }), U.push({
@@ -236,7 +236,7 @@ let Z = class extends $ {
236
236
  subUnitId: s,
237
237
  comment: {
238
238
  ...g,
239
- ref: kt(g.ref, h, c),
239
+ ref: kt(g.ref, h, a),
240
240
  unitId: i,
241
241
  subUnitId: s
242
242
  },
@@ -245,8 +245,8 @@ let Z = class extends $ {
245
245
  }), S.push({
246
246
  id: se.id,
247
247
  params: {
248
- unitId: m,
249
- subUnitId: u,
248
+ unitId: u,
249
+ subUnitId: d,
250
250
  comment: g,
251
251
  sync: !0
252
252
  }
@@ -262,7 +262,7 @@ let Z = class extends $ {
262
262
  return l.forEach((g) => {
263
263
  ee(g);
264
264
  }), {
265
- redos: [...v, ...U],
265
+ redos: [...f, ...U],
266
266
  undos: [...D, ...S]
267
267
  };
268
268
  }
@@ -276,8 +276,8 @@ let Z = class extends $ {
276
276
  );
277
277
  }
278
278
  };
279
- Z = Lt([
280
- ne(0, _(ut)),
279
+ Z = Bt([
280
+ ne(0, _(dt)),
281
281
  ne(1, _(x)),
282
282
  ne(2, Ee)
283
283
  ], Z);
@@ -285,31 +285,31 @@ var Ft = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (o, e
285
285
  for (var r = t > 1 ? void 0 : t ? Wt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
286
286
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
287
287
  return t && r && Ft(e, n, r), r;
288
- }, L = (o, e) => (n, t) => e(n, t, o);
288
+ }, B = (o, e) => (n, t) => e(n, t, o);
289
289
  let z = class extends $ {
290
290
  constructor(o, e, n, t) {
291
- super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionInterceptorBaseController = t, this._initHoverEvent();
291
+ super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionCheckController = t, this._initHoverEvent();
292
292
  }
293
293
  _initHoverEvent() {
294
294
  this.disposeWithMe(
295
- this._hoverManagerService.currentCell$.pipe(me(100)).subscribe((o) => {
295
+ this._hoverManagerService.currentCell$.pipe(ue(100)).subscribe((o) => {
296
296
  const e = this._sheetsThreadCommentPopupService.activePopup;
297
297
  if (o && (e && e.temp || !e)) {
298
- const { location: n } = o, { unitId: t, subUnitId: r, row: i, col: s } = n, a = this._sheetsThreadCommentModel.getByLocation(t, r, i, s);
299
- if (a) {
300
- if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
298
+ const { location: n } = o, { unitId: t, subUnitId: r, row: i, col: s } = n, c = this._sheetsThreadCommentModel.getByLocation(t, r, i, s);
299
+ if (c) {
300
+ if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
301
301
  workbookTypes: [K],
302
302
  worksheetTypes: [Q],
303
303
  rangeTypes: [X]
304
304
  }, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
305
305
  return;
306
- const d = this._sheetsThreadCommentModel.getComment(t, r, a);
307
- d && !d.resolved && this._sheetsThreadCommentPopupService.showPopup({
306
+ const m = this._sheetsThreadCommentModel.getComment(t, r, c);
307
+ m && !m.resolved && this._sheetsThreadCommentPopupService.showPopup({
308
308
  unitId: t,
309
309
  subUnitId: r,
310
310
  row: i,
311
311
  col: s,
312
- commentId: a,
312
+ commentId: c,
313
313
  temp: !0
314
314
  });
315
315
  } else
@@ -320,10 +320,10 @@ let z = class extends $ {
320
320
  }
321
321
  };
322
322
  z = Zt([
323
- L(0, _(ht)),
324
- L(1, _(O)),
325
- L(2, _(x)),
326
- L(3, _(Pe))
323
+ B(0, _(ht)),
324
+ B(1, _(O)),
325
+ B(2, _(x)),
326
+ B(3, _(Ie))
327
327
  ], z);
328
328
  var zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Gt = (o, e, n, t) => {
329
329
  for (var r = t > 1 ? void 0 : t ? qt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
@@ -331,32 +331,32 @@ var zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Gt = (o, e
331
331
  return t && r && zt(e, n, r), r;
332
332
  }, w = (o, e) => (n, t) => e(n, t, o);
333
333
  let q = class extends $ {
334
- constructor(e, n, t, r, i, s, a, c, d, m) {
334
+ constructor(e, n, t, r, i, s, c, a, m, u) {
335
335
  super();
336
336
  E(this, "_isSwitchToCommenting", !1);
337
337
  E(this, "_selectionShapeInfo", null);
338
- this._commandService = e, this._sheetsThreadCommentPopupService = n, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = r, this._univerInstanceService = i, this._sheetPermissionInterceptorBaseController = s, this._markSelectionService = a, this._sheetSelectionService = c, this._editorBridgeService = d, this._renderManagerService = m, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
338
+ this._commandService = e, this._sheetsThreadCommentPopupService = n, this._sheetsThreadCommentModel = t, this._threadCommentPanelService = r, this._univerInstanceService = i, this._sheetPermissionCheckController = s, this._markSelectionService = c, this._sheetSelectionService = a, this._editorBridgeService = m, this._renderManagerService = u, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
339
339
  }
340
340
  _handleSelectionChange(e, n, t) {
341
- var h, l, v;
341
+ var h, l, f;
342
342
  const r = (h = e[0]) == null ? void 0 : h.range, i = this._renderManagerService.getRenderById(n), s = (l = i == null ? void 0 : i.with(pt).getWorksheetSkeleton(t)) == null ? void 0 : l.skeleton;
343
343
  if (!s || !r)
344
344
  return;
345
- const a = s.getCellWithCoordByIndex(r.startRow, r.startColumn);
346
- if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((a.isMerged || a.isMergedMainCell) && qe.equals(a.mergeInfo, r))) {
345
+ const c = s.getCellWithCoordByIndex(r.startRow, r.startColumn);
346
+ if ((((f = r.rangeType) != null ? f : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((c.isMerged || c.isMergedMainCell) && qe.equals(c.mergeInfo, r))) {
347
347
  this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
348
348
  return;
349
349
  }
350
- const d = a.actualRow, m = a.actualColumn;
351
- if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, d, m)) {
350
+ const m = c.actualRow, u = c.actualColumn;
351
+ if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, m, u)) {
352
352
  this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
353
353
  return;
354
354
  }
355
- const u = this._sheetsThreadCommentModel.getByLocation(n, t, d, m);
356
- u && this._commandService.executeCommand(te.id, {
355
+ const d = this._sheetsThreadCommentModel.getByLocation(n, t, m, u);
356
+ d && this._commandService.executeCommand(te.id, {
357
357
  unitId: n,
358
358
  subUnitId: t,
359
- commentId: u
359
+ commentId: d
360
360
  });
361
361
  }
362
362
  _initSelectionUpdateListener() {
@@ -391,18 +391,18 @@ let q = class extends $ {
391
391
  this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (e) => {
392
392
  var n;
393
393
  if (e) {
394
- const { unitId: t, subUnitId: r, commentId: i, trigger: s } = e, a = this._sheetsThreadCommentModel.getComment(t, r, i);
395
- if (!a || a.resolved)
394
+ const { unitId: t, subUnitId: r, commentId: i, trigger: s } = e, c = this._sheetsThreadCommentModel.getComment(t, r, i);
395
+ if (!c || c.resolved)
396
396
  return;
397
- const c = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
398
- if (!c || c.getUnitId() !== t)
397
+ const a = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
398
+ if (!a || a.getUnitId() !== t)
399
399
  return;
400
- this._isSwitchToCommenting = !0, ((n = c.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(nt.id, {
400
+ this._isSwitchToCommenting = !0, ((n = a.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(nt.id, {
401
401
  unitId: t,
402
402
  subUnitId: r
403
403
  }), this._isSwitchToCommenting = !1;
404
- const u = V(a.ref), { row: h, column: l } = u;
405
- if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
404
+ const d = V(c.ref), { row: h, column: l } = d;
405
+ if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
406
406
  workbookTypes: [K],
407
407
  worksheetTypes: [Q],
408
408
  rangeTypes: [X]
@@ -411,19 +411,19 @@ let q = class extends $ {
411
411
  const S = 1;
412
412
  if (await this._commandService.executeCommand(_t.id, {
413
413
  range: {
414
- startRow: Math.max(u.row - S, 0),
415
- endRow: u.row + S,
416
- startColumn: Math.max(u.column - S, 0),
417
- endColumn: u.column + S
414
+ startRow: Math.max(d.row - S, 0),
415
+ endRow: d.row + S,
416
+ startColumn: Math.max(d.column - S, 0),
417
+ endColumn: d.column + S
418
418
  }
419
419
  }), this._editorBridgeService.isVisible().visible)
420
420
  return;
421
421
  this._sheetsThreadCommentPopupService.showPopup({
422
422
  unitId: t,
423
423
  subUnitId: r,
424
- row: u.row,
425
- col: u.column,
426
- commentId: a.id,
424
+ row: d.row,
425
+ col: d.column,
426
+ commentId: c.id,
427
427
  trigger: s
428
428
  });
429
429
  } else
@@ -431,7 +431,7 @@ let q = class extends $ {
431
431
  }));
432
432
  }
433
433
  _initMarkSelection() {
434
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(me(100)).subscribe((e) => {
434
+ this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(ue(100)).subscribe((e) => {
435
435
  var h, l;
436
436
  if (!e) {
437
437
  this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
@@ -442,17 +442,17 @@ let q = class extends $ {
442
442
  const i = this._sheetsThreadCommentModel.getComment(n, t, r);
443
443
  if (!i)
444
444
  return;
445
- const s = V(i.ref), { row: a, column: c } = s;
446
- if (Number.isNaN(a) || Number.isNaN(c))
445
+ const s = V(i.ref), { row: c, column: a } = s;
446
+ if (Number.isNaN(c) || Number.isNaN(a))
447
447
  return null;
448
- const d = (h = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : h.getSheetBySheetId(t), m = (l = d == null ? void 0 : d.getMergedCell(a, c)) != null ? l : {
449
- startColumn: c,
450
- endColumn: c,
451
- startRow: a,
452
- endRow: a
453
- }, u = this._markSelectionService.addShape(
448
+ const m = (h = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : h.getSheetBySheetId(t), u = (l = m == null ? void 0 : m.getMergedCell(c, a)) != null ? l : {
449
+ startColumn: a,
450
+ endColumn: a,
451
+ startRow: c,
452
+ endRow: c
453
+ }, d = this._markSelectionService.addShape(
454
454
  {
455
- range: m,
455
+ range: u,
456
456
  style: {
457
457
  // hasAutoFill: false,
458
458
  fill: "rgb(255, 189, 55, 0.35)",
@@ -465,20 +465,20 @@ let q = class extends $ {
465
465
  [],
466
466
  -1
467
467
  );
468
- u && (this._selectionShapeInfo = {
468
+ d && (this._selectionShapeInfo = {
469
469
  ...e,
470
- shapeId: u
470
+ shapeId: d
471
471
  });
472
472
  }));
473
473
  }
474
474
  };
475
475
  q = Gt([
476
- w(0, ae),
476
+ w(0, ce),
477
477
  w(1, _(O)),
478
478
  w(2, _(x)),
479
- w(3, _(ce)),
479
+ w(3, _(ae)),
480
480
  w(4, N),
481
- w(5, _(Pe)),
481
+ w(5, _(Ie)),
482
482
  w(6, Te),
483
483
  w(7, _(Se)),
484
484
  w(8, lt),
@@ -505,26 +505,26 @@ let G = class extends $ {
505
505
  const r = t.getUnitId(), i = n.subUnitId || ((e = t.getActiveSheet()) == null ? void 0 : e.getSheetId());
506
506
  if (!i)
507
507
  return { redos: [], undos: [] };
508
- const s = this._threadCommentModel.ensureMap(r, i), a = Array.from(s.values()).filter((h) => !h.parentId), c = a.map((h) => h.id), d = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = c.map((h) => ({
508
+ const s = this._threadCommentModel.ensureMap(r, i), c = Array.from(s.values()).filter((h) => !h.parentId), a = c.map((h) => h.id), m = this._threadCommentDataSourceService.syncUpdateMutationToColla, u = a.map((h) => ({
509
509
  id: F.id,
510
510
  params: {
511
511
  unitId: r,
512
512
  subUnitId: i,
513
513
  commentId: h
514
514
  }
515
- })), u = a.map(({ children: h, ...l }) => ({
515
+ })), d = c.map(({ children: h, ...l }) => ({
516
516
  id: se.id,
517
517
  params: {
518
518
  unitId: r,
519
519
  subUnitId: i,
520
520
  comment: {
521
521
  ...l,
522
- children: d ? h : void 0
522
+ children: m ? h : void 0
523
523
  },
524
- sync: !d
524
+ sync: !m
525
525
  }
526
526
  }));
527
- return { redos: m, undos: u };
527
+ return { redos: u, undos: d };
528
528
  }
529
529
  return { redos: [], undos: [] };
530
530
  }
@@ -554,8 +554,8 @@ var P = function() {
554
554
  e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (n[t[r]] = o[t[r]]);
555
555
  return n;
556
556
  }, xe = Re(function(o, e) {
557
- var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Qt(o, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), c = Oe("_".concat(tn()));
558
- return De(n, "".concat(t), { defIds: n.defIds, idSuffix: c.current }, P({ ref: e, className: a }, s), i);
557
+ var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Qt(o, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), a = Oe("_".concat(tn()));
558
+ return De(n, "".concat(t), { defIds: n.defIds, idSuffix: a.current }, P({ ref: e, className: c }, s), i);
559
559
  });
560
560
  function De(o, e, n, t, r) {
561
561
  return Ue(o.tag, P(P({ key: e }, Xt(o, n, r)), t), (en(o, n).children || []).map(function(i, s) {
@@ -567,8 +567,8 @@ function Xt(o, e, n) {
567
567
  n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
568
568
  var r = e.defIds;
569
569
  return !r || r.length === 0 || (o.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(i) {
570
- var s = i[0], a = i[1];
571
- typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
570
+ var s = i[0], c = i[1];
571
+ typeof c == "string" && (t[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
572
572
  })), t;
573
573
  }
574
574
  function en(o, e) {
@@ -599,17 +599,17 @@ var re = { exports: {} }, j = {};
599
599
  * This source code is licensed under the MIT license found in the
600
600
  * LICENSE file in the root directory of this source tree.
601
601
  */
602
- var fe;
602
+ var ve;
603
603
  function rn() {
604
- if (fe) return j;
605
- fe = 1;
604
+ if (ve) return j;
605
+ ve = 1;
606
606
  var o = Rt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
607
- function s(a, c, d) {
608
- var m, u = {}, h = null, l = null;
609
- d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (l = c.ref);
610
- for (m in c) t.call(c, m) && !i.hasOwnProperty(m) && (u[m] = c[m]);
611
- if (a && a.defaultProps) for (m in c = a.defaultProps, c) u[m] === void 0 && (u[m] = c[m]);
612
- return { $$typeof: e, type: a, key: h, ref: l, props: u, _owner: r.current };
607
+ function s(c, a, m) {
608
+ var u, d = {}, h = null, l = null;
609
+ m !== void 0 && (h = "" + m), a.key !== void 0 && (h = "" + a.key), a.ref !== void 0 && (l = a.ref);
610
+ for (u in a) t.call(a, u) && !i.hasOwnProperty(u) && (d[u] = a[u]);
611
+ if (c && c.defaultProps) for (u in a = c.defaultProps, a) d[u] === void 0 && (d[u] = a[u]);
612
+ return { $$typeof: e, type: c, key: h, ref: l, props: d, _owner: r.current };
613
613
  }
614
614
  return j.Fragment = n, j.jsx = s, j.jsxs = s, j;
615
615
  }
@@ -622,11 +622,11 @@ const sn = () => {
622
622
  const o = R(N), e = R(O), n = A(e.activePopup$), t = R(x);
623
623
  if (A(t.commentUpdate$), !n)
624
624
  return null;
625
- const { row: r, col: i, unitId: s, subUnitId: a, trigger: c } = n, d = t.getByLocation(s, a, r, i), m = `${Ge.chatAtABC(i)}${r + 1}`, u = () => {
625
+ const { row: r, col: i, unitId: s, subUnitId: c, trigger: a } = n, m = t.getByLocation(s, c, r, i), u = `${Ge.chatAtABC(i)}${r + 1}`, d = () => {
626
626
  e.hidePopup();
627
627
  }, h = (l) => {
628
- var v, S, U;
629
- return (U = (S = (v = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(l)) == null ? void 0 : S.getName()) != null ? U : "";
628
+ var f, S, U;
629
+ return (U = (S = (f = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : f.getSheetBySheetId(l)) == null ? void 0 : S.getName()) != null ? U : "";
630
630
  };
631
631
  return /* @__PURE__ */ Ae.jsx(
632
632
  it,
@@ -635,27 +635,27 @@ const sn = () => {
635
635
  e.persistPopup();
636
636
  },
637
637
  prefix: "cell",
638
- id: d,
638
+ id: m,
639
639
  unitId: s,
640
- subUnitId: a,
640
+ subUnitId: c,
641
641
  type: b.UNIVER_SHEET,
642
- refStr: m,
643
- onClose: u,
642
+ refStr: u,
643
+ onClose: d,
644
644
  getSubUnitName: h,
645
- autoFocus: c === "context-menu"
645
+ autoFocus: a === "context-menu"
646
646
  }
647
647
  );
648
- }, an = () => {
648
+ }, cn = () => {
649
649
  var g;
650
- const o = R(Te), e = R(N), n = R(O), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = R(ae), s = Ot(() => t.activeSheet$.pipe(wt((p) => p == null ? void 0 : p.getSheetId())), [t.activeSheet$]), a = A(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), c = Oe(), d = R(ce), m = A(d.activeCommentId$), u = A(d.panelVisible$, d.panelVisible), h = pe((p) => {
651
- const I = t.getSheets(), f = {};
650
+ const o = R(Te), e = R(N), n = R(O), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = R(ce), s = Ot(() => t.activeSheet$.pipe(wt((p) => p == null ? void 0 : p.getSheetId())), [t.activeSheet$]), c = A(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), a = Oe(), m = R(ae), u = A(m.activeCommentId$), d = A(m.panelVisible$, m.panelVisible), h = pe((p) => {
651
+ const I = t.getSheets(), v = {};
652
652
  I.forEach((T, C) => {
653
- f[T.getSheetId()] = C;
653
+ v[T.getSheetId()] = C;
654
654
  });
655
655
  const M = (T) => T.map((C) => {
656
- var de;
657
- const y = V(C.ref), He = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
658
- return { ...C, p: He };
656
+ var me;
657
+ const y = V(C.ref), Le = [(me = v[C.subUnitId]) != null ? me : 0, y.row, y.column];
658
+ return { ...C, p: Le };
659
659
  }).sort((C, y) => C.p[0] === y.p[0] ? C.p[1] === y.p[1] ? C.p[2] - y.p[2] : C.p[1] - y.p[1] : C.p[0] - y.p[0]);
660
660
  return [
661
661
  ...M(p.filter((T) => !T.resolved)),
@@ -663,14 +663,14 @@ const sn = () => {
663
663
  ];
664
664
  }, [t]), l = pe((p) => {
665
665
  var I;
666
- if (p.unitId === r && p.subUnitId === a && !p.resolved) {
667
- const { row: f, column: M } = V(p.ref), T = t.getSheetBySheetId(p.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(f, M)) != null ? I : {
666
+ if (p.unitId === r && p.subUnitId === c && !p.resolved) {
667
+ const { row: v, column: M } = V(p.ref), T = t.getSheetBySheetId(p.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(v, M)) != null ? I : {
668
668
  startColumn: M,
669
669
  endColumn: M,
670
- startRow: f,
671
- endRow: f
670
+ startRow: v,
671
+ endRow: v
672
672
  };
673
- if (!Number.isNaN(f) && !Number.isNaN(M))
673
+ if (!Number.isNaN(v) && !Number.isNaN(M))
674
674
  return o.addShape({
675
675
  range: C,
676
676
  style: {
@@ -683,28 +683,28 @@ const sn = () => {
683
683
  primary: null
684
684
  });
685
685
  }
686
- }, [o, a, r]), v = (p) => {
687
- var I, f;
688
- return (f = (I = t.getSheetBySheetId(p)) == null ? void 0 : I.getName()) != null ? f : "";
686
+ }, [o, c, r]), f = (p) => {
687
+ var I, v;
688
+ return (v = (I = t.getSheetBySheetId(p)) == null ? void 0 : I.getName()) != null ? v : "";
689
689
  }, S = () => {
690
- i.executeCommand(B.id);
690
+ i.executeCommand(H.id);
691
691
  }, U = (p) => {
692
- m && m.unitId === p.unitId && m.subUnitId === p.subUnitId && m.commentId === p.id || (c.current && (o.removeShape(c.current), c.current = null), c.current = l(p));
692
+ u && u.unitId === p.unitId && u.subUnitId === p.subUnitId && u.commentId === p.id || (a.current && (o.removeShape(a.current), a.current = null), a.current = l(p));
693
693
  }, D = () => {
694
- c.current && (o.removeShape(c.current), c.current = null);
694
+ a.current && (o.removeShape(a.current), a.current = null);
695
695
  }, ee = (p, I) => {
696
696
  I && n.hidePopup();
697
697
  };
698
698
  return Ut(() => {
699
- !u && c.current && o.removeShape(c.current);
700
- }, [o, u]), /* @__PURE__ */ Ae.jsx(
699
+ !d && a.current && o.removeShape(a.current);
700
+ }, [o, d]), /* @__PURE__ */ Ae.jsx(
701
701
  st,
702
702
  {
703
703
  unitId: r,
704
704
  subUnitId$: s,
705
705
  type: b.UNIVER_SHEET,
706
706
  onAdd: S,
707
- getSubUnitName: v,
707
+ getSubUnitName: f,
708
708
  onResolve: ee,
709
709
  sortComments: h,
710
710
  onItemEnter: U,
@@ -712,10 +712,10 @@ const sn = () => {
712
712
  onDeleteComment: () => (D(), !0)
713
713
  }
714
714
  );
715
- }, cn = (o) => ({
716
- id: B.id,
715
+ }, an = (o) => ({
716
+ id: H.id,
717
717
  type: Me.BUTTON,
718
- icon: ue,
718
+ icon: de,
719
719
  title: "sheetThreadComment.menu.addComment",
720
720
  hidden$: we(o, b.UNIVER_SHEET),
721
721
  disabled$: be(o, {
@@ -723,10 +723,10 @@ const sn = () => {
723
723
  worksheetTypes: [Q],
724
724
  rangeTypes: [X]
725
725
  })
726
- }), mn = (o) => ({
727
- id: Ie.id,
726
+ }), un = (o) => ({
727
+ id: Pe.id,
728
728
  type: Me.BUTTON,
729
- icon: ue,
729
+ icon: de,
730
730
  tooltip: "sheetThreadComment.menu.commentManagement",
731
731
  disabled$: be(o, {
732
732
  workbookTypes: [K],
@@ -734,22 +734,22 @@ const sn = () => {
734
734
  rangeTypes: [X]
735
735
  }),
736
736
  hidden$: we(o, b.UNIVER_SHEET)
737
- }), un = {
738
- id: B.id,
737
+ }), dn = {
738
+ id: H.id,
739
739
  binding: Ct.M | le.CTRL_COMMAND | le.ALT,
740
- preconditions: vt
741
- }, dn = {
740
+ preconditions: ft
741
+ }, mn = {
742
742
  [St.OTHERS]: {
743
- [Ie.id]: {
743
+ [Pe.id]: {
744
744
  order: 1,
745
- menuItemFactory: mn
745
+ menuItemFactory: un
746
746
  }
747
747
  },
748
748
  [gt.MAIN_AREA]: {
749
749
  [It.OTHERS]: {
750
- [B.id]: {
750
+ [H.id]: {
751
751
  order: 0,
752
- menuItemFactory: cn
752
+ menuItemFactory: an
753
753
  }
754
754
  }
755
755
  }
@@ -764,16 +764,16 @@ let J = class extends $ {
764
764
  super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService = n, this._initMenu(), this._initShortcut(), this._initComponent();
765
765
  }
766
766
  _initShortcut() {
767
- this._shortcutService.registerShortcut(un);
767
+ this._shortcutService.registerShortcut(dn);
768
768
  }
769
769
  _initMenu() {
770
- this._menuManagerService.mergeMenu(dn);
770
+ this._menuManagerService.mergeMenu(mn);
771
771
  }
772
772
  _initComponent() {
773
773
  [
774
774
  [$e, sn],
775
- [at, an],
776
- [ue, je]
775
+ [ct, cn],
776
+ [de, je]
777
777
  ].forEach(([o, e]) => {
778
778
  this._componentManager.register(o, e);
779
779
  });
@@ -784,17 +784,17 @@ J = pn([
784
784
  oe(1, _(Pt)),
785
785
  oe(2, bt)
786
786
  ], J);
787
- var Ve = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, vn = (o, e, n) => e in o ? Ve(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, fn = (o, e, n, t) => {
787
+ var Ve = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, fn = (o, e, n) => e in o ? Ve(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, vn = (o, e, n, t) => {
788
788
  for (var r = t > 1 ? void 0 : t ? _n(e, n) : e, i = o.length - 1, s; i >= 0; i--)
789
789
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
790
790
  return t && r && Ve(e, n, r), r;
791
- }, ie = (o, e) => (n, t) => e(n, t, o), Be = (o, e, n) => vn(o, typeof e != "symbol" ? e + "" : e, n);
791
+ }, ie = (o, e) => (n, t) => e(n, t, o), He = (o, e, n) => fn(o, typeof e != "symbol" ? e + "" : e, n);
792
792
  let Y = class extends Ke {
793
- constructor(o = ve, e, n, t) {
793
+ constructor(o = fe, e, n, t) {
794
794
  super(), this._config = o, this._injector = e, this._commandService = n, this._configService = t;
795
795
  const { menu: r, ...i } = Qe(
796
796
  {},
797
- ve,
797
+ fe,
798
798
  this._config
799
799
  );
800
800
  r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Dt, i);
@@ -810,7 +810,7 @@ let Y = class extends Ke {
810
810
  [O]
811
811
  ].forEach((o) => {
812
812
  this._injector.add(o);
813
- }), [B].forEach((o) => {
813
+ }), [H].forEach((o) => {
814
814
  this._commandService.registerCommand(o);
815
815
  }), this._injector.get(J);
816
816
  }
@@ -821,12 +821,12 @@ let Y = class extends Ke {
821
821
  this._injector.get(Z), this._injector.get(z), this._injector.get(q);
822
822
  }
823
823
  };
824
- Be(Y, "pluginName", Ne);
825
- Be(Y, "type", b.UNIVER_SHEET);
826
- Y = fn([
827
- Je(ct, ot),
824
+ He(Y, "pluginName", Ne);
825
+ He(Y, "type", b.UNIVER_SHEET);
826
+ Y = vn([
827
+ Je(at, ot),
828
828
  ie(1, _(Ye)),
829
- ie(2, _(ae)),
829
+ ie(2, _(ce)),
830
830
  ie(3, Xe)
831
831
  ], Y);
832
832
  export {
@@ -837,8 +837,8 @@ export {
837
837
  Vn as ResolveCommentCommand,
838
838
  Ne as SHEETS_THREAD_COMMENT,
839
839
  O as SheetsThreadCommentPopupService,
840
- B as ShowAddSheetCommentModalOperation,
840
+ H as ShowAddSheetCommentModalOperation,
841
841
  Y as UniverSheetsThreadCommentUIPlugin,
842
842
  $n as UniverThreadCommentUIPlugin,
843
- Bn as UpdateCommentCommand
843
+ Hn as UpdateCommentCommand
844
844
  };