@univerjs/sheets-thread-comment-ui 0.5.5 → 0.6.0-experimental.20250125-1d060b9

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,31 +1,32 @@
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
- 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 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
- import { SheetsThreadCommentModel as x, UniverSheetsThreadCommentPlugin as ot } from "@univerjs/sheets-thread-comment";
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
- import { UniverThreadCommentUIPlugin as $n } from "@univerjs/thread-comment-ui";
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
- import { IRenderManagerService as ye } from "@univerjs/engine-render";
13
- import { singleReferenceToGrid as V, serializeRange as yt } from "@univerjs/engine-formula";
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 Hn } from "@univerjs/thread-comment";
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", de = "comment-single", Ne = "SHEET_THREAD_COMMENT";
18
- var $t = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, xt = (o, e, n, t) => {
19
- for (var r = t > 1 ? void 0 : t ? Nt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
1
+ var Ae = Object.defineProperty;
2
+ var Ve = (o, e, n) => e in o ? Ae(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
+ var E = (o, e, n) => Ve(o, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Inject as _, Disposable as N, DisposableCollection as He, CommandType as Be, IUniverInstanceService as $, InterceptorEffectEnum as Le, UniverInstanceType as b, Range as ke, ICommandService as ie, RANGE_TYPE as he, Rectangle as Fe, useDependency as O, Tools as We, DependentOn as Ze, Injector as ze, Plugin as Ge, merge as Ke, IConfigService as Ye } from "@univerjs/core";
5
+ import { SheetsSelectionsService as _e, getSheetCommandTarget as qe, SheetInterceptorService as ve, INTERCEPTOR_POINT as Je, SheetPermissionCheckController as fe, WorkbookCommentPermission as q, WorksheetViewPermission as J, RangeProtectionPermissionViewPoint as Q, SetWorksheetActiveOperation as Qe, RemoveSheetCommand as Xe } from "@univerjs/sheets";
6
+ import { SheetsThreadCommentModel as D, UniverSheetsThreadCommentPlugin as et } from "@univerjs/sheets-thread-comment";
7
+ import { ThreadCommentPanelService as se, SetActiveCommentOperation as ee, ThreadCommentTree as tt, ThreadCommentPanel as nt, ToggleSheetCommentPanelOperation as Ce, THREAD_COMMENT_PANEL as rt, UniverThreadCommentUIPlugin as ot } from "@univerjs/thread-comment-ui";
8
+ import { UniverThreadCommentUIPlugin as wn } from "@univerjs/thread-comment-ui";
9
+ import { SheetCanvasPopManagerService as it, ISheetClipboardService as st, COPY_TYPE as ct, HoverManagerService as at, IMarkSelectionService as Se, IEditorBridgeService as dt, SheetSkeletonManagerService as ht, ScrollToRangeOperation as mt, whenSheetEditorFocused as ut, getCurrentRangeDisable$ as ge } from "@univerjs/sheets-ui";
10
+ import { IZenZoneService as lt, useObservable as j, KeyCode as pt, MetaKeys as me, MenuItemType as Ie, getMenuHiddenObservable as Pe, RibbonStartGroup as _t, ContextMenuPosition as vt, ContextMenuGroup as ft, ComponentManager as Ct, IMenuManagerService as St, IShortcutService as gt } from "@univerjs/ui";
11
+ import { BehaviorSubject as It, debounceTime as ce, map as Pt } from "rxjs";
12
+ import { IRenderManagerService as Te } from "@univerjs/engine-render";
13
+ import { singleReferenceToGrid as A, serializeRange as Tt } from "@univerjs/engine-formula";
14
+ import { IThreadCommentDataSourceService as be, DeleteCommentMutation as k, AddCommentMutation as oe, ThreadCommentModel as bt } from "@univerjs/thread-comment";
15
+ import { AddCommentCommand as En, DeleteCommentCommand as On, DeleteCommentTreeCommand as Un, IThreadCommentDataSourceService as Rn, ResolveCommentCommand as Nn, UpdateCommentCommand as $n } from "@univerjs/thread-comment";
16
+ import { jsx as Me } from "react/jsx-runtime";
17
+ import { forwardRef as we, useRef as ye, createElement as Ee, useMemo as Mt, useCallback as ue, useEffect as wt } from "react";
18
+ const Oe = "univer.sheet.thread-comment-modal", ae = "comment-single", Ue = "SHEET_THREAD_COMMENT";
19
+ var yt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Ot = (o, e, n, t) => {
20
+ for (var r = t > 1 ? void 0 : t ? Et(e, n) : e, i = o.length - 1, s; i >= 0; i--)
20
21
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
21
- return t && r && $t(e, n, r), r;
22
- }, _e = (o, e) => (n, t) => e(n, t, o);
23
- let O = class extends $ {
22
+ return t && r && yt(e, n, r), r;
23
+ }, le = (o, e) => (n, t) => e(n, t, o);
24
+ let U = class extends N {
24
25
  constructor(e, n) {
25
26
  super();
26
27
  E(this, "_lastPopup", null);
27
28
  E(this, "_activePopup");
28
- E(this, "_activePopup$", new Mt(null));
29
+ E(this, "_activePopup$", new It(null));
29
30
  E(this, "activePopup$", this._activePopup$.asObservable());
30
31
  this._canvasPopupManagerService = e, this._zenZoneService = n, this._initZenVisible(), this.disposeWithMe(() => {
31
32
  this._activePopup$.complete();
@@ -40,9 +41,9 @@ let O = class extends $ {
40
41
  }));
41
42
  }
42
43
  showPopup(e, n) {
43
- var m;
44
+ var d;
44
45
  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 === ((m = this.activePopup) == null ? void 0 : m.subUnitId)) {
46
+ if (this._activePopup && t === this._activePopup.row && r === this._activePopup.col && i === this._activePopup.unitId && s === ((d = this.activePopup) == null ? void 0 : d.subUnitId)) {
46
47
  this._activePopup = e, this._activePopup$.next(e);
47
48
  return;
48
49
  }
@@ -53,7 +54,7 @@ let O = class extends $ {
53
54
  t,
54
55
  r,
55
56
  {
56
- componentKey: $e,
57
+ componentKey: Oe,
57
58
  onClickOutside: () => {
58
59
  this.hidePopup();
59
60
  },
@@ -66,7 +67,7 @@ let O = class extends $ {
66
67
  );
67
68
  if (!c)
68
69
  throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
69
- const a = new Fe();
70
+ const a = new He();
70
71
  a.add(c), a.add({
71
72
  dispose: () => {
72
73
  n == null || n();
@@ -83,54 +84,54 @@ let O = class extends $ {
83
84
  }, this._activePopup$.next(this._activePopup));
84
85
  }
85
86
  };
86
- O = xt([
87
- _e(0, _(ut)),
88
- _e(1, vt)
89
- ], O);
90
- const H = {
91
- type: We.OPERATION,
87
+ U = Ot([
88
+ le(0, _(it)),
89
+ le(1, lt)
90
+ ], U);
91
+ const V = {
92
+ type: Be.OPERATION,
92
93
  id: "sheets.operation.show-comment-modal",
93
94
  handler(o) {
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);
95
+ var v;
96
+ const e = o.get(_e), n = o.get($), t = o.get(U), r = o.get(se), i = (v = e.getCurrentLastSelection()) == null ? void 0 : v.primary, s = o.get(D);
96
97
  if (!i)
97
98
  return !1;
98
- const c = et(n);
99
+ const c = qe(n);
99
100
  if (!c)
100
101
  return !1;
101
- const { workbook: a, worksheet: m, unitId: u, subUnitId: d } = c, h = {
102
+ const { workbook: a, worksheet: d, unitId: m, subUnitId: h } = c, u = {
102
103
  workbook: a,
103
- worksheet: m,
104
- unitId: u,
105
- subUnitId: d,
104
+ worksheet: d,
105
+ unitId: m,
106
+ subUnitId: h,
106
107
  row: i.startRow,
107
108
  col: i.startColumn
108
109
  };
109
- t.showPopup(h);
110
- const l = s.getByLocation(u, d, i.startRow, i.startColumn);
111
- return l && r.setActiveComment({
112
- unitId: u,
113
- subUnitId: d,
114
- commentId: l,
110
+ t.showPopup(u);
111
+ const p = s.getByLocation(m, h, i.startRow, i.startColumn);
112
+ return p && r.setActiveComment({
113
+ unitId: m,
114
+ subUnitId: h,
115
+ commentId: p,
115
116
  trigger: "context-menu"
116
117
  }), !0;
117
118
  }
118
- }, Dt = "sheets-thread-comment.config", fe = {};
119
- var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Vt = (o, e, n, t) => {
120
- for (var r = t > 1 ? void 0 : t ? At(e, n) : e, i = o.length - 1, s; i >= 0; i--)
119
+ }, Ut = "sheets-thread-comment.config", pe = {};
120
+ var Rt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, $t = (o, e, n, t) => {
121
+ for (var r = t > 1 ? void 0 : t ? Nt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
121
122
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
122
- return t && r && jt(e, n, r), r;
123
- }, L = (o, e) => (n, t) => e(n, t, o);
124
- let W = class extends $ {
123
+ return t && r && Rt(e, n, r), r;
124
+ }, H = (o, e) => (n, t) => e(n, t, o);
125
+ let F = class extends N {
125
126
  constructor(o, e, n, t) {
126
127
  super(), this._sheetInterceptorService = o, this._sheetsThreadCommentModel = e, this._univerInstanceService = n, this._renderManagerService = t, this._initViewModelIntercept(), this._initSkeletonChange();
127
128
  }
128
129
  _initViewModelIntercept() {
129
130
  this.disposeWithMe(
130
131
  this._sheetInterceptorService.intercept(
131
- tt.CELL_CONTENT,
132
+ Je.CELL_CONTENT,
132
133
  {
133
- effect: Ze.Style,
134
+ effect: Le.Style,
134
135
  handler: (o, e, n) => {
135
136
  const { row: t, col: r, unitId: i, subUnitId: s } = e;
136
137
  return this._sheetsThreadCommentModel.showCommentMarker(i, s, t, r) ? n({
@@ -157,32 +158,32 @@ let W = class extends $ {
157
158
  const n = e.getUnitId(), t = this._renderManagerService.getRenderById(n);
158
159
  (r = t == null ? void 0 : t.mainComponent) == null || r.makeForceDirty();
159
160
  };
160
- this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ue(16)).subscribe(() => {
161
+ this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(ce(16)).subscribe(() => {
161
162
  o();
162
163
  }));
163
164
  }
164
165
  };
165
- W = Vt([
166
- L(0, _(ge)),
167
- L(1, _(x)),
168
- L(2, N),
169
- L(3, ye)
170
- ], W);
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--)
166
+ F = $t([
167
+ H(0, _(ve)),
168
+ H(1, _(D)),
169
+ H(2, $),
170
+ H(3, Te)
171
+ ], F);
172
+ var Dt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, jt = (o, e, n, t) => {
173
+ for (var r = t > 1 ? void 0 : t ? xt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
173
174
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
174
- return t && r && Ht(e, n, r), r;
175
- }, ne = (o, e) => (n, t) => e(n, t, o);
176
- const kt = (o, e, n) => {
177
- const t = V(o), r = n.row - e.row, i = n.column - e.column, s = {
175
+ return t && r && Dt(e, n, r), r;
176
+ }, te = (o, e) => (n, t) => e(n, t, o);
177
+ const At = (o, e, n) => {
178
+ const t = A(o), r = n.row - e.row, i = n.column - e.column, s = {
178
179
  startColumn: t.column + i,
179
180
  startRow: t.row + r,
180
181
  endColumn: t.column + i,
181
182
  endRow: t.row + r
182
183
  };
183
- return yt(s);
184
+ return Tt(s);
184
185
  };
185
- let Z = class extends $ {
186
+ let W = class extends N {
186
187
  constructor(e, n, t) {
187
188
  super();
188
189
  E(this, "_copyInfo");
@@ -192,7 +193,7 @@ let Z = class extends $ {
192
193
  _initClipboardHook() {
193
194
  this.disposeWithMe(
194
195
  this._sheetClipboardService.addClipboardHook({
195
- id: Ne,
196
+ id: Ue,
196
197
  onBeforeCopy: (e, n, t) => {
197
198
  this._copyInfo = {
198
199
  unitId: e,
@@ -206,52 +207,52 @@ let Z = class extends $ {
206
207
  row: c.rows[0],
207
208
  column: c.cols[0]
208
209
  };
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
210
+ if (r.copyType === ct.CUT && this._copyInfo) {
211
+ const { range: d, unitId: m, subUnitId: h } = this._copyInfo, u = {
212
+ row: d.startRow,
213
+ column: d.startColumn
213
214
  };
214
- if (!(i === u && s === d)) {
215
- const l = [];
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
- M.parentId || l.push(M);
215
+ if (!(i === m && s === h)) {
216
+ const p = [];
217
+ ke.foreach(d, (g, l) => {
218
+ const I = this._sheetsThreadCommentModel.getAllByLocation(m, h, g, l);
219
+ this._threadCommentDataSourceService.syncUpdateMutationToColla ? I.forEach((f) => {
220
+ p.push(f);
221
+ }) : I.forEach(({ children: f, ...M }) => {
222
+ M.parentId || p.push(M);
222
223
  });
223
224
  });
224
- const f = [], S = [], U = [], D = [], ee = (g) => {
225
- f.unshift({
226
- id: F.id,
225
+ const v = [], S = [], R = [], x = [], X = (g) => {
226
+ v.unshift({
227
+ id: k.id,
227
228
  params: {
228
- unitId: u,
229
- subUnitId: d,
229
+ unitId: m,
230
+ subUnitId: h,
230
231
  commentId: g.id
231
232
  }
232
- }), U.push({
233
- id: se.id,
233
+ }), R.push({
234
+ id: oe.id,
234
235
  params: {
235
236
  unitId: i,
236
237
  subUnitId: s,
237
238
  comment: {
238
239
  ...g,
239
- ref: kt(g.ref, h, a),
240
+ ref: At(g.ref, u, a),
240
241
  unitId: i,
241
242
  subUnitId: s
242
243
  },
243
244
  sync: !0
244
245
  }
245
246
  }), S.push({
246
- id: se.id,
247
+ id: oe.id,
247
248
  params: {
248
- unitId: u,
249
- subUnitId: d,
249
+ unitId: m,
250
+ subUnitId: h,
250
251
  comment: g,
251
252
  sync: !0
252
253
  }
253
- }), D.unshift({
254
- id: F.id,
254
+ }), x.unshift({
255
+ id: k.id,
255
256
  params: {
256
257
  unitId: i,
257
258
  subUnitId: s,
@@ -259,11 +260,11 @@ let Z = class extends $ {
259
260
  }
260
261
  });
261
262
  };
262
- return l.forEach((g) => {
263
- ee(g);
263
+ return p.forEach((g) => {
264
+ X(g);
264
265
  }), {
265
- redos: [...f, ...U],
266
- undos: [...D, ...S]
266
+ redos: [...v, ...R],
267
+ undos: [...x, ...S]
267
268
  };
268
269
  }
269
270
  }
@@ -276,35 +277,35 @@ let Z = class extends $ {
276
277
  );
277
278
  }
278
279
  };
279
- Z = Bt([
280
- ne(0, _(dt)),
281
- ne(1, _(x)),
282
- ne(2, Ee)
283
- ], Z);
284
- var Ft = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (o, e, n, t) => {
285
- for (var r = t > 1 ? void 0 : t ? Wt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
280
+ W = jt([
281
+ te(0, _(st)),
282
+ te(1, _(D)),
283
+ te(2, be)
284
+ ], W);
285
+ var Vt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Bt = (o, e, n, t) => {
286
+ for (var r = t > 1 ? void 0 : t ? Ht(e, n) : e, i = o.length - 1, s; i >= 0; i--)
286
287
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
287
- return t && r && Ft(e, n, r), r;
288
+ return t && r && Vt(e, n, r), r;
288
289
  }, B = (o, e) => (n, t) => e(n, t, o);
289
- let z = class extends $ {
290
+ let Z = class extends N {
290
291
  constructor(o, e, n, t) {
291
292
  super(), this._hoverManagerService = o, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionCheckController = t, this._initHoverEvent();
292
293
  }
293
294
  _initHoverEvent() {
294
295
  this.disposeWithMe(
295
- this._hoverManagerService.currentCell$.pipe(ue(100)).subscribe((o) => {
296
+ this._hoverManagerService.currentCell$.pipe(ce(100)).subscribe((o) => {
296
297
  const e = this._sheetsThreadCommentPopupService.activePopup;
297
298
  if (o && (e && e.temp || !e)) {
298
299
  const { location: n } = o, { unitId: t, subUnitId: r, row: i, col: s } = n, c = this._sheetsThreadCommentModel.getByLocation(t, r, i, s);
299
300
  if (c) {
300
301
  if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
301
- workbookTypes: [K],
302
- worksheetTypes: [Q],
303
- rangeTypes: [X]
302
+ workbookTypes: [q],
303
+ worksheetTypes: [J],
304
+ rangeTypes: [Q]
304
305
  }, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
305
306
  return;
306
- const m = this._sheetsThreadCommentModel.getComment(t, r, c);
307
- m && !m.resolved && this._sheetsThreadCommentPopupService.showPopup({
307
+ const d = this._sheetsThreadCommentModel.getComment(t, r, c);
308
+ d && !d.resolved && this._sheetsThreadCommentPopupService.showPopup({
308
309
  unitId: t,
309
310
  subUnitId: r,
310
311
  row: i,
@@ -319,44 +320,44 @@ let z = class extends $ {
319
320
  );
320
321
  }
321
322
  };
322
- z = Zt([
323
- B(0, _(ht)),
324
- B(1, _(O)),
325
- B(2, _(x)),
326
- B(3, _(Ie))
327
- ], z);
328
- var zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Gt = (o, e, n, t) => {
329
- for (var r = t > 1 ? void 0 : t ? qt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
323
+ Z = Bt([
324
+ B(0, _(at)),
325
+ B(1, _(U)),
326
+ B(2, _(D)),
327
+ B(3, _(fe))
328
+ ], Z);
329
+ var Lt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Ft = (o, e, n, t) => {
330
+ for (var r = t > 1 ? void 0 : t ? kt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
330
331
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
331
- return t && r && zt(e, n, r), r;
332
+ return t && r && Lt(e, n, r), r;
332
333
  }, w = (o, e) => (n, t) => e(n, t, o);
333
- let q = class extends $ {
334
- constructor(e, n, t, r, i, s, c, a, m, u) {
334
+ let z = class extends N {
335
+ constructor(e, n, t, r, i, s, c, a, d, m) {
335
336
  super();
336
337
  E(this, "_isSwitchToCommenting", !1);
337
338
  E(this, "_selectionShapeInfo", null);
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
+ 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 = d, this._renderManagerService = m, this._initCommandListener(), this._initPanelListener(), this._initMarkSelection(), this._initSelectionUpdateListener(), this._initEditorBridge();
339
340
  }
340
341
  _handleSelectionChange(e, n, t) {
341
- var h, l, f;
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;
342
+ var u, p, v;
343
+ const r = (u = e[0]) == null ? void 0 : u.range, i = this._renderManagerService.getRenderById(n), s = (p = i == null ? void 0 : i.with(ht).getWorksheetSkeleton(t)) == null ? void 0 : p.skeleton;
343
344
  if (!s || !r)
344
345
  return;
345
346
  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
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
347
+ if ((((v = r.rangeType) != null ? v : he.NORMAL) !== he.NORMAL || r.endColumn - r.startColumn > 0 || r.endRow - r.startRow > 0) && !((c.isMerged || c.isMergedMainCell) && Fe.equals(c.mergeInfo, r))) {
348
+ this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(ee.id);
348
349
  return;
349
350
  }
350
- const m = c.actualRow, u = c.actualColumn;
351
- if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, m, u)) {
352
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(te.id);
351
+ const d = c.actualRow, m = c.actualColumn;
352
+ if (!this._sheetsThreadCommentModel.showCommentMarker(n, t, d, m)) {
353
+ this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(ee.id);
353
354
  return;
354
355
  }
355
- const d = this._sheetsThreadCommentModel.getByLocation(n, t, m, u);
356
- d && this._commandService.executeCommand(te.id, {
356
+ const h = this._sheetsThreadCommentModel.getByLocation(n, t, d, m);
357
+ h && this._commandService.executeCommand(ee.id, {
357
358
  unitId: n,
358
359
  subUnitId: t,
359
- commentId: d
360
+ commentId: h
360
361
  });
361
362
  }
362
363
  _initSelectionUpdateListener() {
@@ -378,7 +379,7 @@ let q = class extends $ {
378
379
  }
379
380
  _initCommandListener() {
380
381
  this._commandService.onCommandExecuted((e) => {
381
- if (e.id === F.id) {
382
+ if (e.id === k.id) {
382
383
  const n = e.params, t = this._sheetsThreadCommentPopupService.activePopup;
383
384
  if (!t)
384
385
  return;
@@ -397,32 +398,32 @@ let q = class extends $ {
397
398
  const a = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
398
399
  if (!a || a.getUnitId() !== t)
399
400
  return;
400
- this._isSwitchToCommenting = !0, ((n = a.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(nt.id, {
401
+ this._isSwitchToCommenting = !0, ((n = a.getActiveSheet()) == null ? void 0 : n.getSheetId()) !== r && await this._commandService.executeCommand(Qe.id, {
401
402
  unitId: t,
402
403
  subUnitId: r
403
404
  }), this._isSwitchToCommenting = !1;
404
- const d = V(c.ref), { row: h, column: l } = d;
405
+ const h = A(c.ref), { row: u, column: p } = h;
405
406
  if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
406
- workbookTypes: [K],
407
- worksheetTypes: [Q],
408
- rangeTypes: [X]
409
- }, [{ startRow: h, startColumn: l, endRow: h, endColumn: l }]))
407
+ workbookTypes: [q],
408
+ worksheetTypes: [J],
409
+ rangeTypes: [Q]
410
+ }, [{ startRow: u, startColumn: p, endRow: u, endColumn: p }]))
410
411
  return;
411
412
  const S = 1;
412
- if (await this._commandService.executeCommand(_t.id, {
413
+ if (await this._commandService.executeCommand(mt.id, {
413
414
  range: {
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
415
+ startRow: Math.max(h.row - S, 0),
416
+ endRow: h.row + S,
417
+ startColumn: Math.max(h.column - S, 0),
418
+ endColumn: h.column + S
418
419
  }
419
420
  }), this._editorBridgeService.isVisible().visible)
420
421
  return;
421
422
  this._sheetsThreadCommentPopupService.showPopup({
422
423
  unitId: t,
423
424
  subUnitId: r,
424
- row: d.row,
425
- col: d.column,
425
+ row: h.row,
426
+ col: h.column,
426
427
  commentId: c.id,
427
428
  trigger: s
428
429
  });
@@ -431,8 +432,8 @@ let q = class extends $ {
431
432
  }));
432
433
  }
433
434
  _initMarkSelection() {
434
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(ue(100)).subscribe((e) => {
435
- var h, l;
435
+ this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(ce(100)).subscribe((e) => {
436
+ var u, p;
436
437
  if (!e) {
437
438
  this._selectionShapeInfo && (this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId), this._selectionShapeInfo = null);
438
439
  return;
@@ -442,17 +443,17 @@ let q = class extends $ {
442
443
  const i = this._sheetsThreadCommentModel.getComment(n, t, r);
443
444
  if (!i)
444
445
  return;
445
- const s = V(i.ref), { row: c, column: a } = s;
446
+ const s = A(i.ref), { row: c, column: a } = s;
446
447
  if (Number.isNaN(c) || Number.isNaN(a))
447
448
  return null;
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
+ const d = (u = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : u.getSheetBySheetId(t), m = (p = d == null ? void 0 : d.getMergedCell(c, a)) != null ? p : {
449
450
  startColumn: a,
450
451
  endColumn: a,
451
452
  startRow: c,
452
453
  endRow: c
453
- }, d = this._markSelectionService.addShape(
454
+ }, h = this._markSelectionService.addShape(
454
455
  {
455
- range: u,
456
+ range: m,
456
457
  style: {
457
458
  // hasAutoFill: false,
458
459
  fill: "rgb(255, 189, 55, 0.35)",
@@ -465,31 +466,31 @@ let q = class extends $ {
465
466
  [],
466
467
  -1
467
468
  );
468
- d && (this._selectionShapeInfo = {
469
+ h && (this._selectionShapeInfo = {
469
470
  ...e,
470
- shapeId: d
471
+ shapeId: h
471
472
  });
472
473
  }));
473
474
  }
474
475
  };
475
- q = Gt([
476
- w(0, ce),
477
- w(1, _(O)),
478
- w(2, _(x)),
479
- w(3, _(ae)),
480
- w(4, N),
481
- w(5, _(Ie)),
482
- w(6, Te),
483
- w(7, _(Se)),
484
- w(8, lt),
485
- w(9, ye)
486
- ], q);
487
- var Jt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Kt = (o, e, n, t) => {
488
- for (var r = t > 1 ? void 0 : t ? Yt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
476
+ z = Ft([
477
+ w(0, ie),
478
+ w(1, _(U)),
479
+ w(2, _(D)),
480
+ w(3, _(se)),
481
+ w(4, $),
482
+ w(5, _(fe)),
483
+ w(6, Se),
484
+ w(7, _(_e)),
485
+ w(8, dt),
486
+ w(9, Te)
487
+ ], z);
488
+ var Wt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, zt = (o, e, n, t) => {
489
+ for (var r = t > 1 ? void 0 : t ? Zt(e, n) : e, i = o.length - 1, s; i >= 0; i--)
489
490
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
490
- return t && r && Jt(e, n, r), r;
491
- }, k = (o, e) => (n, t) => e(n, t, o);
492
- let G = class extends $ {
491
+ return t && r && Wt(e, n, r), r;
492
+ }, L = (o, e) => (n, t) => e(n, t, o);
493
+ let G = class extends N {
493
494
  constructor(o, e, n, t) {
494
495
  super(), this._sheetInterceptorService = o, this._univerInstanceService = e, this._threadCommentModel = n, this._threadCommentDataSourceService = t, this._initSheetChange();
495
496
  }
@@ -498,33 +499,33 @@ let G = class extends $ {
498
499
  this._sheetInterceptorService.interceptCommand({
499
500
  getMutations: (o) => {
500
501
  var e;
501
- if (o.id === rt.id) {
502
+ if (o.id === Xe.id) {
502
503
  const n = o.params, t = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
503
504
  if (!t)
504
505
  return { redos: [], undos: [] };
505
506
  const r = t.getUnitId(), i = n.subUnitId || ((e = t.getActiveSheet()) == null ? void 0 : e.getSheetId());
506
507
  if (!i)
507
508
  return { redos: [], undos: [] };
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
- id: F.id,
509
+ const s = this._threadCommentModel.ensureMap(r, i), c = Array.from(s.values()).filter((u) => !u.parentId), a = c.map((u) => u.id), d = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = a.map((u) => ({
510
+ id: k.id,
510
511
  params: {
511
512
  unitId: r,
512
513
  subUnitId: i,
513
- commentId: h
514
+ commentId: u
514
515
  }
515
- })), d = c.map(({ children: h, ...l }) => ({
516
- id: se.id,
516
+ })), h = c.map(({ children: u, ...p }) => ({
517
+ id: oe.id,
517
518
  params: {
518
519
  unitId: r,
519
520
  subUnitId: i,
520
521
  comment: {
521
- ...l,
522
- children: m ? h : void 0
522
+ ...p,
523
+ children: d ? u : void 0
523
524
  },
524
- sync: !m
525
+ sync: !d
525
526
  }
526
527
  }));
527
- return { redos: u, undos: d };
528
+ return { redos: m, undos: h };
528
529
  }
529
530
  return { redos: [], undos: [] };
530
531
  }
@@ -532,11 +533,11 @@ let G = class extends $ {
532
533
  );
533
534
  }
534
535
  };
535
- G = Kt([
536
- k(0, _(ge)),
537
- k(1, N),
538
- k(2, _(Et)),
539
- k(3, Ee)
536
+ G = zt([
537
+ L(0, _(ve)),
538
+ L(1, $),
539
+ L(2, _(bt)),
540
+ L(3, be)
540
541
  ], G);
541
542
  var P = function() {
542
543
  return P = Object.assign || function(o) {
@@ -546,23 +547,23 @@ var P = function() {
546
547
  }
547
548
  return o;
548
549
  }, P.apply(this, arguments);
549
- }, Qt = function(o, e) {
550
+ }, Gt = function(o, e) {
550
551
  var n = {};
551
552
  for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && e.indexOf(t) < 0 && (n[t] = o[t]);
552
553
  if (o != null && typeof Object.getOwnPropertySymbols == "function")
553
554
  for (var r = 0, t = Object.getOwnPropertySymbols(o); r < t.length; r++)
554
555
  e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[r]) && (n[t[r]] = o[t[r]]);
555
556
  return n;
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"]), 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);
557
+ }, Re = we(function(o, e) {
558
+ var n = o.icon, t = o.id, r = o.className, i = o.extend, s = Gt(o, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), a = ye("_".concat(qt()));
559
+ return Ne(n, "".concat(t), { defIds: n.defIds, idSuffix: a.current }, P({ ref: e, className: c }, s), i);
559
560
  });
560
- function De(o, e, n, t, r) {
561
- return Ue(o.tag, P(P({ key: e }, Xt(o, n, r)), t), (en(o, n).children || []).map(function(i, s) {
562
- return De(i, "".concat(e, "-").concat(o.tag, "-").concat(s), n, void 0, r);
561
+ function Ne(o, e, n, t, r) {
562
+ return Ee(o.tag, P(P({ key: e }, Kt(o, n, r)), t), (Yt(o, n).children || []).map(function(i, s) {
563
+ return Ne(i, "".concat(e, "-").concat(o.tag, "-").concat(s), n, void 0, r);
563
564
  }));
564
565
  }
565
- function Xt(o, e, n) {
566
+ function Kt(o, e, n) {
566
567
  var t = P({}, o.attrs);
567
568
  n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
568
569
  var r = e.defIds;
@@ -571,106 +572,77 @@ function Xt(o, e, n) {
571
572
  typeof c == "string" && (t[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
572
573
  })), t;
573
574
  }
574
- function en(o, e) {
575
+ function Yt(o, e) {
575
576
  var n, t = e.defIds;
576
577
  return !t || t.length === 0 ? o : o.tag === "defs" && (!((n = o.children) === null || n === void 0) && n.length) ? P(P({}, o), { children: o.children.map(function(r) {
577
578
  return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? P(P({}, r), { attrs: P(P({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
578
579
  }) }) : o;
579
580
  }
580
- function tn() {
581
+ function qt() {
581
582
  return Math.random().toString(36).substring(2, 8);
582
583
  }
583
- xe.displayName = "UniverIcon";
584
- var nn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, je = Re(function(o, e) {
585
- return Ue(xe, Object.assign({}, o, {
584
+ Re.displayName = "UniverIcon";
585
+ var Jt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, $e = we(function(o, e) {
586
+ return Ee(Re, Object.assign({}, o, {
586
587
  id: "comment-single",
587
588
  ref: e,
588
- icon: nn
589
+ icon: Jt
589
590
  }));
590
591
  });
591
- je.displayName = "CommentSingle";
592
- var re = { exports: {} }, j = {};
593
- /**
594
- * @license React
595
- * react-jsx-runtime.production.min.js
596
- *
597
- * Copyright (c) Facebook, Inc. and its affiliates.
598
- *
599
- * This source code is licensed under the MIT license found in the
600
- * LICENSE file in the root directory of this source tree.
601
- */
602
- var ve;
603
- function rn() {
604
- if (ve) return j;
605
- ve = 1;
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(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
- }
614
- return j.Fragment = n, j.jsx = s, j.jsxs = s, j;
615
- }
616
- var Ce;
617
- function on() {
618
- return Ce || (Ce = 1, re.exports = rn()), re.exports;
619
- }
620
- var Ae = on();
621
- const sn = () => {
622
- const o = R(N), e = R(O), n = A(e.activePopup$), t = R(x);
623
- if (A(t.commentUpdate$), !n)
592
+ $e.displayName = "CommentSingle";
593
+ const Qt = () => {
594
+ const o = O($), e = O(U), n = j(e.activePopup$), t = O(D);
595
+ if (j(t.commentUpdate$), !n)
624
596
  return null;
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 = () => {
597
+ const { row: r, col: i, unitId: s, subUnitId: c, trigger: a } = n, d = t.getByLocation(s, c, r, i), m = `${We.chatAtABC(i)}${r + 1}`, h = () => {
626
598
  e.hidePopup();
627
- }, h = (l) => {
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 : "";
599
+ }, u = (p) => {
600
+ var v, S, R;
601
+ return (R = (S = (v = o.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : v.getSheetBySheetId(p)) == null ? void 0 : S.getName()) != null ? R : "";
630
602
  };
631
- return /* @__PURE__ */ Ae.jsx(
632
- it,
603
+ return /* @__PURE__ */ Me(
604
+ tt,
633
605
  {
634
606
  onClick: () => {
635
607
  e.persistPopup();
636
608
  },
637
609
  prefix: "cell",
638
- id: m,
610
+ id: d,
639
611
  unitId: s,
640
612
  subUnitId: c,
641
613
  type: b.UNIVER_SHEET,
642
- refStr: u,
643
- onClose: d,
644
- getSubUnitName: h,
614
+ refStr: m,
615
+ onClose: h,
616
+ getSubUnitName: u,
645
617
  autoFocus: a === "context-menu"
646
618
  }
647
619
  );
648
- }, cn = () => {
620
+ }, Xt = () => {
649
621
  var g;
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 = {};
622
+ const o = O(Se), e = O($), n = O(U), t = e.getCurrentUnitForType(b.UNIVER_SHEET), r = t.getUnitId(), i = O(ie), s = Mt(() => t.activeSheet$.pipe(Pt((l) => l == null ? void 0 : l.getSheetId())), [t.activeSheet$]), c = j(s, (g = t.getActiveSheet()) == null ? void 0 : g.getSheetId()), a = ye(null), d = O(se), m = j(d.activeCommentId$), h = j(d.panelVisible$, d.panelVisible), u = ue((l) => {
623
+ const I = t.getSheets(), f = {};
652
624
  I.forEach((T, C) => {
653
- v[T.getSheetId()] = C;
625
+ f[T.getSheetId()] = C;
654
626
  });
655
627
  const M = (T) => T.map((C) => {
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 };
628
+ var de;
629
+ const y = A(C.ref), je = [(de = f[C.subUnitId]) != null ? de : 0, y.row, y.column];
630
+ return { ...C, p: je };
659
631
  }).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
632
  return [
661
- ...M(p.filter((T) => !T.resolved)),
662
- ...M(p.filter((T) => T.resolved))
633
+ ...M(l.filter((T) => !T.resolved)),
634
+ ...M(l.filter((T) => T.resolved))
663
635
  ];
664
- }, [t]), l = pe((p) => {
636
+ }, [t]), p = ue((l) => {
665
637
  var 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 : {
638
+ if (l.unitId === r && l.subUnitId === c && !l.resolved) {
639
+ const { row: f, column: M } = A(l.ref), T = t.getSheetBySheetId(l.subUnitId), C = (I = T == null ? void 0 : T.getMergedCell(f, M)) != null ? I : {
668
640
  startColumn: M,
669
641
  endColumn: M,
670
- startRow: v,
671
- endRow: v
642
+ startRow: f,
643
+ endRow: f
672
644
  };
673
- if (!Number.isNaN(v) && !Number.isNaN(M))
645
+ if (!Number.isNaN(f) && !Number.isNaN(M))
674
646
  return o.addShape({
675
647
  range: C,
676
648
  style: {
@@ -683,162 +655,163 @@ const sn = () => {
683
655
  primary: null
684
656
  });
685
657
  }
686
- }, [o, c, r]), f = (p) => {
687
- var I, v;
688
- return (v = (I = t.getSheetBySheetId(p)) == null ? void 0 : I.getName()) != null ? v : "";
658
+ return null;
659
+ }, [o, c, r]), v = (l) => {
660
+ var I, f;
661
+ return (f = (I = t.getSheetBySheetId(l)) == null ? void 0 : I.getName()) != null ? f : "";
689
662
  }, S = () => {
690
- i.executeCommand(H.id);
691
- }, U = (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
- }, D = () => {
663
+ i.executeCommand(V.id);
664
+ }, R = (l) => {
665
+ m && m.unitId === l.unitId && m.subUnitId === l.subUnitId && m.commentId === l.id || (a.current && (o.removeShape(a.current), a.current = null), a.current = p(l));
666
+ }, x = () => {
694
667
  a.current && (o.removeShape(a.current), a.current = null);
695
- }, ee = (p, I) => {
668
+ }, X = (l, I) => {
696
669
  I && n.hidePopup();
697
670
  };
698
- return Ut(() => {
699
- !d && a.current && o.removeShape(a.current);
700
- }, [o, d]), /* @__PURE__ */ Ae.jsx(
701
- st,
671
+ return wt(() => {
672
+ !h && a.current && o.removeShape(a.current);
673
+ }, [o, h]), /* @__PURE__ */ Me(
674
+ nt,
702
675
  {
703
676
  unitId: r,
704
677
  subUnitId$: s,
705
678
  type: b.UNIVER_SHEET,
706
679
  onAdd: S,
707
- getSubUnitName: f,
708
- onResolve: ee,
709
- sortComments: h,
710
- onItemEnter: U,
711
- onItemLeave: D,
712
- onDeleteComment: () => (D(), !0)
680
+ getSubUnitName: v,
681
+ onResolve: X,
682
+ sortComments: u,
683
+ onItemEnter: R,
684
+ onItemLeave: x,
685
+ onDeleteComment: () => (x(), !0)
713
686
  }
714
687
  );
715
- }, an = (o) => ({
716
- id: H.id,
717
- type: Me.BUTTON,
718
- icon: de,
688
+ }, en = (o) => ({
689
+ id: V.id,
690
+ type: Ie.BUTTON,
691
+ icon: ae,
719
692
  title: "sheetThreadComment.menu.addComment",
720
- hidden$: we(o, b.UNIVER_SHEET),
721
- disabled$: be(o, {
722
- workbookTypes: [K],
723
- worksheetTypes: [Q],
724
- rangeTypes: [X]
693
+ hidden$: Pe(o, b.UNIVER_SHEET),
694
+ disabled$: ge(o, {
695
+ workbookTypes: [q],
696
+ worksheetTypes: [J],
697
+ rangeTypes: [Q]
725
698
  })
726
- }), un = (o) => ({
727
- id: Pe.id,
728
- type: Me.BUTTON,
729
- icon: de,
699
+ }), tn = (o) => ({
700
+ id: Ce.id,
701
+ type: Ie.BUTTON,
702
+ icon: ae,
730
703
  tooltip: "sheetThreadComment.menu.commentManagement",
731
- disabled$: be(o, {
732
- workbookTypes: [K],
733
- worksheetTypes: [Q],
734
- rangeTypes: [X]
704
+ disabled$: ge(o, {
705
+ workbookTypes: [q],
706
+ worksheetTypes: [J],
707
+ rangeTypes: [Q]
735
708
  }),
736
- hidden$: we(o, b.UNIVER_SHEET)
737
- }), dn = {
738
- id: H.id,
739
- binding: Ct.M | le.CTRL_COMMAND | le.ALT,
740
- preconditions: ft
741
- }, mn = {
742
- [St.OTHERS]: {
743
- [Pe.id]: {
709
+ hidden$: Pe(o, b.UNIVER_SHEET)
710
+ }), nn = {
711
+ id: V.id,
712
+ binding: pt.M | me.CTRL_COMMAND | me.ALT,
713
+ preconditions: ut
714
+ }, rn = {
715
+ [_t.OTHERS]: {
716
+ [Ce.id]: {
744
717
  order: 1,
745
- menuItemFactory: un
718
+ menuItemFactory: tn
746
719
  }
747
720
  },
748
- [gt.MAIN_AREA]: {
749
- [It.OTHERS]: {
750
- [H.id]: {
721
+ [vt.MAIN_AREA]: {
722
+ [ft.OTHERS]: {
723
+ [V.id]: {
751
724
  order: 0,
752
- menuItemFactory: an
725
+ menuItemFactory: en
753
726
  }
754
727
  }
755
728
  }
756
729
  };
757
- var hn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, pn = (o, e, n, t) => {
758
- for (var r = t > 1 ? void 0 : t ? ln(e, n) : e, i = o.length - 1, s; i >= 0; i--)
730
+ var on = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, cn = (o, e, n, t) => {
731
+ for (var r = t > 1 ? void 0 : t ? sn(e, n) : e, i = o.length - 1, s; i >= 0; i--)
759
732
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
760
- return t && r && hn(e, n, r), r;
761
- }, oe = (o, e) => (n, t) => e(n, t, o);
762
- let J = class extends $ {
733
+ return t && r && on(e, n, r), r;
734
+ }, ne = (o, e) => (n, t) => e(n, t, o);
735
+ let K = class extends N {
763
736
  constructor(o, e, n) {
764
737
  super(), this._menuManagerService = o, this._componentManager = e, this._shortcutService = n, this._initMenu(), this._initShortcut(), this._initComponent();
765
738
  }
766
739
  _initShortcut() {
767
- this._shortcutService.registerShortcut(dn);
740
+ this._shortcutService.registerShortcut(nn);
768
741
  }
769
742
  _initMenu() {
770
- this._menuManagerService.mergeMenu(mn);
743
+ this._menuManagerService.mergeMenu(rn);
771
744
  }
772
745
  _initComponent() {
773
746
  [
774
- [$e, sn],
775
- [ct, cn],
776
- [de, je]
747
+ [Oe, Qt],
748
+ [rt, Xt],
749
+ [ae, $e]
777
750
  ].forEach(([o, e]) => {
778
751
  this._componentManager.register(o, e);
779
752
  });
780
753
  }
781
754
  };
782
- J = pn([
783
- oe(0, Tt),
784
- oe(1, _(Pt)),
785
- oe(2, bt)
786
- ], J);
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
- for (var r = t > 1 ? void 0 : t ? _n(e, n) : e, i = o.length - 1, s; i >= 0; i--)
755
+ K = cn([
756
+ ne(0, St),
757
+ ne(1, _(Ct)),
758
+ ne(2, gt)
759
+ ], K);
760
+ var De = Object.defineProperty, an = Object.getOwnPropertyDescriptor, dn = (o, e, n) => e in o ? De(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n, hn = (o, e, n, t) => {
761
+ for (var r = t > 1 ? void 0 : t ? an(e, n) : e, i = o.length - 1, s; i >= 0; i--)
789
762
  (s = o[i]) && (r = (t ? s(e, n, r) : s(r)) || r);
790
- return t && r && Ve(e, n, r), r;
791
- }, ie = (o, e) => (n, t) => e(n, t, o), He = (o, e, n) => fn(o, typeof e != "symbol" ? e + "" : e, n);
792
- let Y = class extends Ke {
793
- constructor(o = fe, e, n, t) {
763
+ return t && r && De(e, n, r), r;
764
+ }, re = (o, e) => (n, t) => e(n, t, o), xe = (o, e, n) => dn(o, typeof e != "symbol" ? e + "" : e, n);
765
+ let Y = class extends Ge {
766
+ constructor(o = pe, e, n, t) {
794
767
  super(), this._config = o, this._injector = e, this._commandService = n, this._configService = t;
795
- const { menu: r, ...i } = Qe(
768
+ const { menu: r, ...i } = Ke(
796
769
  {},
797
- fe,
770
+ pe,
798
771
  this._config
799
772
  );
800
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Dt, i);
773
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Ut, i);
801
774
  }
802
775
  onStarting() {
803
776
  [
804
- [J],
777
+ [K],
778
+ [F],
805
779
  [W],
806
780
  [Z],
807
- [z],
808
781
  [G],
809
- [q],
810
- [O]
782
+ [z],
783
+ [U]
811
784
  ].forEach((o) => {
812
785
  this._injector.add(o);
813
- }), [H].forEach((o) => {
786
+ }), [V].forEach((o) => {
814
787
  this._commandService.registerCommand(o);
815
- }), this._injector.get(J);
788
+ }), this._injector.get(K);
816
789
  }
817
790
  onReady() {
818
- this._injector.get(W), this._injector.get(G);
791
+ this._injector.get(F), this._injector.get(G);
819
792
  }
820
793
  onRendered() {
821
- this._injector.get(Z), this._injector.get(z), this._injector.get(q);
794
+ this._injector.get(W), this._injector.get(Z), this._injector.get(z);
822
795
  }
823
796
  };
824
- He(Y, "pluginName", Ne);
825
- He(Y, "type", b.UNIVER_SHEET);
826
- Y = vn([
827
- Je(at, ot),
828
- ie(1, _(Ye)),
829
- ie(2, _(ce)),
830
- ie(3, Xe)
797
+ xe(Y, "pluginName", Ue);
798
+ xe(Y, "type", b.UNIVER_SHEET);
799
+ Y = hn([
800
+ Ze(ot, et),
801
+ re(1, _(ze)),
802
+ re(2, _(ie)),
803
+ re(3, Ye)
831
804
  ], Y);
832
805
  export {
833
- xn as AddCommentCommand,
834
- Dn as DeleteCommentCommand,
835
- jn as DeleteCommentTreeCommand,
836
- An as IThreadCommentDataSourceService,
837
- Vn as ResolveCommentCommand,
838
- Ne as SHEETS_THREAD_COMMENT,
839
- O as SheetsThreadCommentPopupService,
840
- H as ShowAddSheetCommentModalOperation,
806
+ En as AddCommentCommand,
807
+ On as DeleteCommentCommand,
808
+ Un as DeleteCommentTreeCommand,
809
+ Rn as IThreadCommentDataSourceService,
810
+ Nn as ResolveCommentCommand,
811
+ Ue as SHEETS_THREAD_COMMENT,
812
+ U as SheetsThreadCommentPopupService,
813
+ V as ShowAddSheetCommentModalOperation,
841
814
  Y as UniverSheetsThreadCommentUIPlugin,
842
- $n as UniverThreadCommentUIPlugin,
843
- Hn as UpdateCommentCommand
815
+ wn as UniverThreadCommentUIPlugin,
816
+ $n as UpdateCommentCommand
844
817
  };