@univerjs/sheets-thread-comment 0.1.16 → 0.2.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/es/index.js CHANGED
@@ -1,50 +1,50 @@
1
- var Re = Object.defineProperty;
2
- var $e = (t, e, n) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var E = (t, e, n) => $e(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { Inject as p, Injector as de } from "@wendellhu/redi";
5
- import { Inject as vn, Injector as _n } from "@wendellhu/redi";
6
- import { Disposable as U, DisposableCollection as Ne, IUniverInstanceService as R, Tools as me, UniverInstanceType as b, CommandType as xe, ICommandService as ee, OnLifecycle as x, LifecycleStages as D, LocaleService as De, Range as je, DependentOn as Ae, Plugin as Ve } from "@univerjs/core";
7
- import { ICommandService as Cn, Plugin as Sn, UniverInstanceType as In } from "@univerjs/core";
8
- import { ThreadCommentTree as He, ThreadCommentPanelService as te, ThreadCommentPanel as Le, ToggleSheetCommentPanelOperation as Be, SetActiveCommentOperation as oe, THREAD_COMMENT_PANEL as Fe, UniverThreadCommentUIPlugin as ke } from "@univerjs/thread-comment-ui";
9
- import { IThreadCommentMentionDataService as Pn, UniverThreadCommentUIPlugin as Tn } from "@univerjs/thread-comment-ui";
10
- import { IZenZoneService as We, useObservable as W, KeyCode as Ze, MetaKeys as ie, MenuItemType as he, MenuPosition as pe, getMenuHiddenObservable as le, MenuGroup as ze, ComponentManager as Ge, IMenuService as Ke, IShortcutService as Ye } from "@univerjs/ui";
11
- import { SelectionManagerService as qe, getSheetCommandTarget as Xe, WorkbookCommentPermission as K, WorksheetViewPermission as Y, RangeProtectionPermissionViewPoint as q, SetSelectionsOperation as Je, SelectionMoveType as Qe, SetWorksheetActiveOperation as et, SheetInterceptorService as ve, INTERCEPTOR_POINT as tt, RemoveSheetCommand as nt } from "@univerjs/sheets";
12
- import { singleReferenceToGrid as Z, serializeRange as rt } from "@univerjs/engine-formula";
13
- import { ThreadCommentModel as _e, DeleteCommentMutation as z, AddCommentMutation as Q } from "@univerjs/thread-comment";
14
- import { IThreadCommentDataSourceService as wn } from "@univerjs/thread-comment";
15
- import { SheetCanvasPopManagerService as ot, IMarkSelectionService as it, whenSheetEditorFocused as st, getCurrentRangeDisable$ as fe, SheetPermissionInterceptorBaseController as Ce, ScrollToRangeOperation as at, SheetSkeletonManagerService as ct, ISheetClipboardService as ut, COPY_TYPE as dt, HoverManagerService as mt } from "@univerjs/sheets-ui";
16
- import { SheetsThreadCommentModel as $, UniverSheetsThreadCommentBasePlugin as ht } from "@univerjs/sheets-thread-comment-base";
17
- import { SheetsThreadCommentModel as yn } from "@univerjs/sheets-thread-comment-base";
1
+ var De = Object.defineProperty;
2
+ var xe = (t, e, n) => e in t ? De(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var U = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Inject as p, Injector as he } from "@wendellhu/redi";
5
+ import { Inject as Cn, Injector as fn } from "@wendellhu/redi";
6
+ import { Disposable as R, DisposableCollection as Ae, IUniverInstanceService as $, Tools as pe, UniverInstanceType as b, CommandType as je, ICommandService as re, OnLifecycle as j, LifecycleStages as V, Range as Ve, DependentOn as He, Plugin as Be } from "@univerjs/core";
7
+ import { ICommandService as In, Plugin as gn, UniverInstanceType as Pn } from "@univerjs/core";
8
+ import { ThreadCommentTree as Le, ThreadCommentPanelService as oe, ThreadCommentPanel as Fe, ToggleSheetCommentPanelOperation as ke, SetActiveCommentOperation as ae, THREAD_COMMENT_PANEL as We, UniverThreadCommentUIPlugin as Ze } from "@univerjs/thread-comment-ui";
9
+ import { IThreadCommentMentionDataService as bn, UniverThreadCommentUIPlugin as Mn } from "@univerjs/thread-comment-ui";
10
+ import { IZenZoneService as ze, useObservable as z, KeyCode as Ge, MetaKeys as ce, MenuItemType as le, MenuPosition as ve, getMenuHiddenObservable as _e, MenuGroup as Ke, ComponentManager as Ye, IMenuService as qe, IShortcutService as Xe } from "@univerjs/ui";
11
+ import { SelectionManagerService as Je, getSheetCommandTarget as Qe, WorkbookCommentPermission as q, WorksheetViewPermission as X, RangeProtectionPermissionViewPoint as J, SetSelectionsOperation as et, SelectionMoveType as tt, SetWorksheetActiveOperation as nt, SheetInterceptorService as Ce, INTERCEPTOR_POINT as rt, RemoveSheetCommand as ot } from "@univerjs/sheets";
12
+ import { singleReferenceToGrid as G, serializeRange as it } from "@univerjs/engine-formula";
13
+ import { ThreadCommentModel as fe, DeleteCommentMutation as K, IThreadCommentDataSourceService as Se, AddCommentMutation as ne } from "@univerjs/thread-comment";
14
+ import { IThreadCommentDataSourceService as yn } from "@univerjs/thread-comment";
15
+ import { SheetCanvasPopManagerService as st, IMarkSelectionService as at, whenSheetEditorFocused as ct, getCurrentRangeDisable$ as Ie, SheetPermissionInterceptorBaseController as ge, ScrollToRangeOperation as ut, SheetSkeletonManagerService as dt, ISheetClipboardService as mt, COPY_TYPE as ht, HoverManagerService as pt } from "@univerjs/sheets-ui";
16
+ import { SheetsThreadCommentModel as N, UniverSheetsThreadCommentBasePlugin as lt } from "@univerjs/sheets-thread-comment-base";
17
+ import { SheetsThreadCommentModel as En } from "@univerjs/sheets-thread-comment-base";
18
18
  import { useDependency as M } from "@wendellhu/redi/react-bindings";
19
- import Se, { forwardRef as Ie, useRef as ge, createElement as Pe, useMemo as pt, useCallback as se, useEffect as lt } from "react";
20
- import { BehaviorSubject as vt, map as _t, debounceTime as ft } from "rxjs";
21
- import { IRenderManagerService as Ct } from "@univerjs/engine-render";
22
- var f = function() {
23
- return f = Object.assign || function(t) {
19
+ import Pe, { forwardRef as Te, useRef as be, createElement as Me, useMemo as vt, useCallback as ue, useEffect as _t } from "react";
20
+ import { BehaviorSubject as Ct, map as ft, debounceTime as St } from "rxjs";
21
+ import { IRenderManagerService as It } from "@univerjs/engine-render";
22
+ var I = function() {
23
+ return I = Object.assign || function(t) {
24
24
  for (var e, n = 1, r = arguments.length; n < r; n++) {
25
25
  e = arguments[n];
26
26
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
27
27
  }
28
28
  return t;
29
- }, f.apply(this, arguments);
30
- }, St = function(t, e) {
29
+ }, I.apply(this, arguments);
30
+ }, gt = function(t, e) {
31
31
  var n = {};
32
32
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
33
33
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
34
34
  for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
35
35
  e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
36
36
  return n;
37
- }, Te = Ie(function(t, e) {
38
- var n = t.icon, r = t.id, o = t.className, i = t.extend, s = St(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), d = ge("_".concat(Pt()));
39
- return be(n, "".concat(r), { defIds: n.defIds, idSuffix: d.current }, f({ ref: e, className: a }, s), i);
37
+ }, we = Te(function(t, e) {
38
+ var n = t.icon, r = t.id, o = t.className, i = t.extend, s = gt(t, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), u = be("_".concat(bt()));
39
+ return ye(n, "".concat(r), { defIds: n.defIds, idSuffix: u.current }, I({ ref: e, className: a }, s), i);
40
40
  });
41
- function be(t, e, n, r, o) {
42
- return Pe(t.tag, f(f({ key: e }, It(t, n, o)), r), (gt(t, n).children || []).map(function(i, s) {
43
- return be(i, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, o);
41
+ function ye(t, e, n, r, o) {
42
+ return Me(t.tag, I(I({ key: e }, Pt(t, n, o)), r), (Tt(t, n).children || []).map(function(i, s) {
43
+ return ye(i, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, o);
44
44
  }));
45
45
  }
46
- function It(t, e, n) {
47
- var r = f({}, t.attrs);
46
+ function Pt(t, e, n) {
47
+ var r = I({}, t.attrs);
48
48
  n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
49
49
  var o = e.defIds;
50
50
  return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
@@ -52,37 +52,37 @@ function It(t, e, n) {
52
52
  typeof a == "string" && (r[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
53
53
  })), r;
54
54
  }
55
- function gt(t, e) {
55
+ function Tt(t, e) {
56
56
  var n, r = e.defIds;
57
- return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? f(f({}, t), { children: t.children.map(function(o) {
58
- return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? f(f({}, o), { attrs: f(f({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
57
+ return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? I(I({}, t), { children: t.children.map(function(o) {
58
+ return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? I(I({}, o), { attrs: I(I({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
59
59
  }) }) : t;
60
60
  }
61
- function Pt() {
61
+ function bt() {
62
62
  return Math.random().toString(36).substring(2, 8);
63
63
  }
64
- Te.displayName = "UniverIcon";
65
- var Tt = { 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" } }] }, we = Ie(function(t, e) {
66
- return Pe(Te, Object.assign({}, t, {
64
+ we.displayName = "UniverIcon";
65
+ var Mt = { 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" } }] }, Oe = Te(function(t, e) {
66
+ return Me(we, Object.assign({}, t, {
67
67
  id: "comment-single",
68
68
  ref: e,
69
- icon: Tt
69
+ icon: Mt
70
70
  }));
71
71
  });
72
- we.displayName = "CommentSingle";
73
- const Me = "univer.sheet.thread-comment-modal", ne = "comment-single", ye = "SHEET_THREAD_COMMENT";
74
- var bt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Mt = (t, e, n, r) => {
75
- for (var o = r > 1 ? void 0 : r ? wt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
72
+ Oe.displayName = "CommentSingle";
73
+ const Ee = "univer.sheet.thread-comment-modal", ie = "comment-single", Ue = "SHEET_THREAD_COMMENT";
74
+ var wt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, Ot = (t, e, n, r) => {
75
+ for (var o = r > 1 ? void 0 : r ? yt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
76
76
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
77
- return r && o && bt(e, n, o), o;
78
- }, ae = (t, e) => (n, r) => e(n, r, t);
79
- let y = class extends U {
77
+ return r && o && wt(e, n, o), o;
78
+ }, de = (t, e) => (n, r) => e(n, r, t);
79
+ let y = class extends R {
80
80
  constructor(e, n) {
81
81
  super();
82
- E(this, "_lastPopup", null);
83
- E(this, "_activePopup");
84
- E(this, "_activePopup$", new vt(null));
85
- E(this, "activePopup$", this._activePopup$.asObservable());
82
+ U(this, "_lastPopup", null);
83
+ U(this, "_activePopup");
84
+ U(this, "_activePopup$", new Ct(null));
85
+ U(this, "activePopup$", this._activePopup$.asObservable());
86
86
  this._canvasPopupManagerService = e, this._zenZoneService = n, this._initZenVisible();
87
87
  }
88
88
  get activePopup() {
@@ -107,7 +107,7 @@ let y = class extends U {
107
107
  r,
108
108
  o,
109
109
  {
110
- componentKey: Me,
110
+ componentKey: Ee,
111
111
  onClickOutside: () => {
112
112
  this.hidePopup();
113
113
  },
@@ -120,12 +120,12 @@ let y = class extends U {
120
120
  );
121
121
  if (!a)
122
122
  throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");
123
- const d = new Ne();
124
- d.add(a), d.add({
123
+ const u = new Ae();
124
+ u.add(a), u.add({
125
125
  dispose: () => {
126
126
  n == null || n();
127
127
  }
128
- }), this._lastPopup = d;
128
+ }), this._lastPopup = u;
129
129
  }
130
130
  hidePopup() {
131
131
  this._activePopup && (this._lastPopup && this._lastPopup.dispose(), this._lastPopup = null, this._activePopup = null, this._activePopup$.next(null));
@@ -137,22 +137,22 @@ let y = class extends U {
137
137
  }, this._activePopup$.next(this._activePopup));
138
138
  }
139
139
  };
140
- y = Mt([
141
- ae(0, p(ot)),
142
- ae(1, We)
140
+ y = Ot([
141
+ de(0, p(st)),
142
+ de(1, ze)
143
143
  ], y);
144
- const yt = () => {
145
- const t = M(R), e = M(y), n = W(e.activePopup$), r = M($);
146
- if (W(r.commentUpdate$), !n)
144
+ const Et = () => {
145
+ const t = M($), e = M(y), n = z(e.activePopup$), r = M(N);
146
+ if (z(r.commentUpdate$), !n)
147
147
  return null;
148
- const { row: o, col: i, unitId: s, subUnitId: a, trigger: d } = n, c = r.getByLocation(s, a, o, i), h = `${me.chatAtABC(i)}${o + 1}`, u = () => {
148
+ const { row: o, col: i, unitId: s, subUnitId: a, trigger: u } = n, c = r.getByLocation(s, a, o, i), m = `${pe.chatAtABC(i)}${o + 1}`, h = () => {
149
149
  e.hidePopup();
150
- }, g = (C) => {
151
- var l, P, O;
152
- return (O = (P = (l = t.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : l.getSheetBySheetId(C)) == null ? void 0 : P.getName()) != null ? O : "";
150
+ }, l = (C) => {
151
+ var _, P, O;
152
+ return (O = (P = (_ = t.getCurrentUnitForType(b.UNIVER_SHEET)) == null ? void 0 : _.getSheetBySheetId(C)) == null ? void 0 : P.getName()) != null ? O : "";
153
153
  };
154
- return /* @__PURE__ */ Se.createElement(
155
- He,
154
+ return /* @__PURE__ */ Pe.createElement(
155
+ Le,
156
156
  {
157
157
  onClick: () => {
158
158
  e.persistPopup();
@@ -162,62 +162,67 @@ const yt = () => {
162
162
  unitId: s,
163
163
  subUnitId: a,
164
164
  type: b.UNIVER_SHEET,
165
- refStr: h,
166
- onClose: u,
167
- getSubUnitName: g,
168
- autoFocus: d === "context-menu"
165
+ refStr: m,
166
+ onClose: h,
167
+ getSubUnitName: l,
168
+ autoFocus: u === "context-menu"
169
169
  }
170
170
  );
171
- }, X = {
172
- type: xe.OPERATION,
171
+ }, Q = {
172
+ type: je.OPERATION,
173
173
  id: "sheets.operation.show-comment-modal",
174
174
  handler(t) {
175
175
  var P;
176
- const e = t.get(qe), n = t.get(R), r = t.get(y), o = t.get(te), i = (P = e.getFirst()) == null ? void 0 : P.primary, s = e.getCurrent(), a = t.get($);
176
+ const e = t.get(Je), n = t.get($), r = t.get(y), o = t.get(oe), i = (P = e.getFirst()) == null ? void 0 : P.primary, s = e.getCurrent(), a = t.get(N);
177
177
  if (!s || !i)
178
178
  return !1;
179
- const { unitId: d, sheetId: c } = s, h = Xe(n, { unitId: d, subUnitId: c });
180
- if (!h)
179
+ const { unitId: u, sheetId: c } = s, m = Qe(n, { unitId: u, subUnitId: c });
180
+ if (!m)
181
181
  return !1;
182
- const { workbook: u, worksheet: g } = h, C = {
183
- workbook: u,
184
- worksheet: g,
185
- unitId: d,
182
+ const { workbook: h, worksheet: l } = m, C = {
183
+ workbook: h,
184
+ worksheet: l,
185
+ unitId: u,
186
186
  subUnitId: c,
187
187
  row: i.startRow,
188
188
  col: i.startColumn
189
189
  };
190
190
  r.showPopup(C);
191
- const l = a.getByLocation(d, c, i.startRow, i.startColumn);
192
- return l && o.setActiveComment({
193
- unitId: d,
191
+ const _ = a.getByLocation(u, c, i.startRow, i.startColumn);
192
+ return _ && o.setActiveComment({
193
+ unitId: u,
194
194
  subUnitId: c,
195
- commentId: l,
195
+ commentId: _,
196
196
  trigger: "context-menu"
197
197
  }), !0;
198
198
  }
199
- }, Ot = () => {
200
- var _;
201
- const t = M(it), e = M(R), n = M(_e), r = M(y), o = e.getCurrentUnitForType(b.UNIVER_SHEET);
199
+ }, Ut = () => {
200
+ var f;
201
+ const t = M(at), e = M($), n = M(fe), r = M(y), o = e.getCurrentUnitForType(b.UNIVER_SHEET);
202
202
  if (!o)
203
203
  return null;
204
- const i = o.getUnitId(), s = M(ee), a = pt(() => o.activeSheet$.pipe(_t((m) => m == null ? void 0 : m.getSheetId())), [o.activeSheet$]), d = W(a, (_ = o.getActiveSheet()) == null ? void 0 : _.getSheetId()), c = ge(), h = M(te), u = W(h.activeCommentId$), g = se((m) => {
205
- const v = o.getSheets(), w = {};
206
- return v.forEach((S, T) => {
207
- w[S.getSheetId()] = T;
208
- }), m.map((S) => {
209
- var re;
210
- const T = Z(S.ref), Ue = [(re = w[S.subUnitId]) != null ? re : 0, T.row, T.column];
211
- return { ...S, p: Ue };
212
- }).sort((S, T) => S.p[0] === T.p[0] ? S.p[1] === T.p[1] ? S.p[2] - T.p[2] : S.p[1] - T.p[1] : S.p[0] - T.p[0]);
213
- }, [o]), C = se((m) => {
214
- if (m.unitId === i && m.subUnitId === d && !m.resolved) {
215
- const { row: v, column: w } = Z(m.ref);
216
- if (!Number.isNaN(v) && !Number.isNaN(w))
204
+ const i = o.getUnitId(), s = M(re), a = vt(() => o.activeSheet$.pipe(ft((d) => d == null ? void 0 : d.getSheetId())), [o.activeSheet$]), u = z(a, (f = o.getActiveSheet()) == null ? void 0 : f.getSheetId()), c = be(), m = M(oe), h = z(m.activeCommentId$), l = ue((d) => {
205
+ const v = o.getSheets(), S = {};
206
+ v.forEach((E, g) => {
207
+ S[E.getSheetId()] = g;
208
+ });
209
+ const x = (E) => E.map((g) => {
210
+ var se;
211
+ const w = G(g.ref), Ne = [(se = S[g.subUnitId]) != null ? se : 0, w.row, w.column];
212
+ return { ...g, p: Ne };
213
+ }).sort((g, w) => g.p[0] === w.p[0] ? g.p[1] === w.p[1] ? g.p[2] - w.p[2] : g.p[1] - w.p[1] : g.p[0] - w.p[0]);
214
+ return [
215
+ ...x(d.filter((E) => !E.resolved)),
216
+ ...x(d.filter((E) => E.resolved))
217
+ ];
218
+ }, [o]), C = ue((d) => {
219
+ if (d.unitId === i && d.subUnitId === u && !d.resolved) {
220
+ const { row: v, column: S } = G(d.ref);
221
+ if (!Number.isNaN(v) && !Number.isNaN(S))
217
222
  return t.addShape({
218
223
  range: {
219
- startColumn: w,
220
- endColumn: w,
224
+ startColumn: S,
225
+ endColumn: S,
221
226
  startRow: v,
222
227
  endRow: v
223
228
  },
@@ -231,104 +236,105 @@ const yt = () => {
231
236
  primary: null
232
237
  });
233
238
  }
234
- }, [t, d, i]), l = (m) => {
235
- var v, w;
236
- return (w = (v = o.getSheetBySheetId(m)) == null ? void 0 : v.getName()) != null ? w : "";
239
+ }, [t, u, i]), _ = (d) => {
240
+ var v, S;
241
+ return (S = (v = o.getSheetBySheetId(d)) == null ? void 0 : v.getName()) != null ? S : "";
237
242
  }, P = () => {
238
- s.executeCommand(X.id);
239
- }, O = () => {
240
- r.hidePopup();
241
- }, j = (m) => {
242
- u && u.unitId === m.unitId && u.subUnitId === m.subUnitId && u.commentId === m.id || (c.current && (t.removeShape(c.current), c.current = null), c.current = C(m));
243
- }, A = () => {
243
+ s.executeCommand(Q.id);
244
+ }, O = (d) => {
245
+ h && h.unitId === d.unitId && h.subUnitId === d.subUnitId && h.commentId === d.id || (c.current && (t.removeShape(c.current), c.current = null), c.current = C(d));
246
+ }, D = () => {
244
247
  c.current && (t.removeShape(c.current), c.current = null);
248
+ }, ee = (d, v) => {
249
+ v && r.hidePopup();
245
250
  };
246
- return lt(() => {
247
- if (!u)
251
+ return _t(() => {
252
+ if (!h)
248
253
  return;
249
- const m = n.getComment(u.unitId, u.subUnitId, u.commentId);
250
- if (!m)
254
+ const d = n.getComment(h.unitId, h.subUnitId, h.commentId);
255
+ if (!d)
251
256
  return;
252
- const v = C(m);
257
+ const v = C(d);
253
258
  return () => {
254
259
  v && t.removeShape(v);
255
260
  };
256
- }, [C, u, n, t]), /* @__PURE__ */ Se.createElement(
257
- Le,
261
+ }, [C, h, n, t]), /* @__PURE__ */ Pe.createElement(
262
+ Fe,
258
263
  {
259
264
  unitId: i,
260
265
  subUnitId$: a,
261
266
  type: b.UNIVER_SHEET,
262
267
  onAdd: P,
263
- getSubUnitName: l,
264
- onResolve: O,
265
- sortComments: g,
266
- onItemEnter: j,
267
- onItemLeave: A
268
+ getSubUnitName: _,
269
+ onResolve: ee,
270
+ sortComments: l,
271
+ onItemEnter: O,
272
+ onItemLeave: D,
273
+ onDeleteComment: () => (D(), !0)
268
274
  }
269
275
  );
270
- }, Et = (t) => ({
271
- id: X.id,
272
- type: he.BUTTON,
273
- positions: [pe.CONTEXT_MENU],
274
- icon: ne,
276
+ }, Rt = (t) => ({
277
+ id: Q.id,
278
+ type: le.BUTTON,
279
+ positions: [ve.CONTEXT_MENU],
280
+ icon: ie,
275
281
  title: "sheetThreadComment.menu.addComment",
276
- hidden$: le(t, b.UNIVER_SHEET),
277
- disabled$: fe(t, {
278
- workbookTypes: [K],
279
- worksheetTypes: [Y],
280
- rangeTypes: [q]
282
+ hidden$: _e(t, b.UNIVER_SHEET),
283
+ disabled$: Ie(t, {
284
+ workbookTypes: [q],
285
+ worksheetTypes: [X],
286
+ rangeTypes: [J]
281
287
  })
282
- }), Ut = (t) => ({
283
- id: Be.id,
284
- type: he.BUTTON,
285
- icon: ne,
288
+ }), $t = (t) => ({
289
+ id: ke.id,
290
+ type: le.BUTTON,
291
+ icon: ie,
286
292
  tooltip: "sheetThreadComment.menu.commentManagement",
287
- positions: pe.TOOLBAR_START,
288
- group: ze.TOOLBAR_OTHERS,
289
- disabled$: fe(t, {
290
- workbookTypes: [K],
291
- worksheetTypes: [Y],
292
- rangeTypes: [q]
293
+ positions: ve.TOOLBAR_START,
294
+ group: Ke.TOOLBAR_OTHERS,
295
+ disabled$: Ie(t, {
296
+ workbookTypes: [q],
297
+ worksheetTypes: [X],
298
+ rangeTypes: [J]
293
299
  }),
294
- hidden$: le(t, b.UNIVER_SHEET)
295
- }), Rt = {
296
- id: X.id,
297
- binding: Ze.M | ie.CTRL_COMMAND | ie.ALT,
298
- preconditions: st
300
+ hidden$: _e(t, b.UNIVER_SHEET)
301
+ }), Nt = {
302
+ id: Q.id,
303
+ binding: Ge.M | ce.CTRL_COMMAND | ce.ALT,
304
+ preconditions: ct
299
305
  };
300
- var $t = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, xt = (t, e, n, r) => {
301
- for (var o = r > 1 ? void 0 : r ? Nt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
306
+ var Dt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, At = (t, e, n, r) => {
307
+ for (var o = r > 1 ? void 0 : r ? xt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
302
308
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
303
- return r && o && $t(e, n, o), o;
304
- }, I = (t, e) => (n, r) => e(n, r, t);
305
- const Dt = {};
306
- let N = class extends U {
307
- constructor(t, e, n, r, o, i, s, a, d, c, h, u) {
308
- super(), this._config = t, this._menuService = e, this._injector = n, this._componentManager = r, this._localeService = o, this._commandService = i, this._sheetsThreadCommentPopupService = s, this._sheetsThreadCommentModel = a, this._threadCommentPanelService = d, this._shortcutService = c, this._univerInstanceService = h, this._sheetPermissionInterceptorBaseController = u, this._initMenu(), this._initShortcut(), this._initComponent(), this._initCommandListener(), this._initPanelListener();
309
+ return r && o && Dt(e, n, o), o;
310
+ }, T = (t, e) => (n, r) => e(n, r, t);
311
+ const jt = {};
312
+ let A = class extends R {
313
+ constructor(t, e, n, r, o, i, s, a, u, c, m) {
314
+ super(), this._config = t, this._menuService = e, this._injector = n, this._componentManager = r, this._commandService = o, this._sheetsThreadCommentPopupService = i, this._sheetsThreadCommentModel = s, this._threadCommentPanelService = a, this._shortcutService = u, this._univerInstanceService = c, this._sheetPermissionInterceptorBaseController = m, this._initMenu(), this._initShortcut(), this._initComponent(), this._initCommandListener(), this._initPanelListener();
309
315
  }
310
316
  _initShortcut() {
311
- this._shortcutService.registerShortcut(Rt);
317
+ this._shortcutService.registerShortcut(Nt);
312
318
  }
313
319
  _initCommandListener() {
314
320
  this._commandService.onCommandExecuted((t) => {
315
- if (t.id === Je.id) {
321
+ if (t.id === et.id) {
316
322
  const e = t.params, { unitId: n, subUnitId: r, selections: o, type: i } = e;
317
- if ((i === Qe.MOVE_END || i === void 0) && o[0].primary) {
323
+ if ((i === tt.MOVE_END || i === void 0) && o[0].primary) {
318
324
  const s = o[0].primary.actualRow, a = o[0].primary.actualColumn;
319
325
  if (!this._sheetsThreadCommentModel.showCommentMarker(n, r, s, a)) {
320
- this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(oe.id);
326
+ this._threadCommentPanelService.activeCommentId && this._commandService.executeCommand(ae.id);
321
327
  return;
322
328
  }
323
- const d = this._sheetsThreadCommentModel.getByLocation(n, r, s, a);
324
- d && this._commandService.executeCommand(oe.id, {
329
+ const u = this._sheetsThreadCommentModel.getByLocation(n, r, s, a);
330
+ u && this._commandService.executeCommand(ae.id, {
325
331
  unitId: n,
326
332
  subUnitId: r,
327
- commentId: d
333
+ commentId: u
328
334
  });
329
335
  }
330
336
  }
331
- if (t.id === z.id) {
337
+ if (t.id === K.id) {
332
338
  const e = t.params, n = this._sheetsThreadCommentPopupService.activePopup;
333
339
  if (!n)
334
340
  return;
@@ -340,17 +346,17 @@ let N = class extends U {
340
346
  _initMenu() {
341
347
  const { menu: t = {} } = this._config;
342
348
  [
343
- Et,
344
- Ut
349
+ Rt,
350
+ $t
345
351
  ].forEach((e) => {
346
352
  this._menuService.addMenuItem(e(this._injector), t);
347
353
  });
348
354
  }
349
355
  _initComponent() {
350
356
  [
351
- [Me, yt],
352
- [Fe, Ot],
353
- [ne, we]
357
+ [Ee, Et],
358
+ [We, Ut],
359
+ [ie, Oe]
354
360
  ].forEach(([t, e]) => {
355
361
  this._componentManager.register(t, e);
356
362
  });
@@ -365,30 +371,30 @@ let N = class extends U {
365
371
  const a = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
366
372
  if (!a || a.getUnitId() !== n)
367
373
  return;
368
- ((e = a.getActiveSheet()) == null ? void 0 : e.getSheetId()) !== r && await this._commandService.executeCommand(et.id, {
374
+ ((e = a.getActiveSheet()) == null ? void 0 : e.getSheetId()) !== r && await this._commandService.executeCommand(nt.id, {
369
375
  unitId: n,
370
376
  subUnitId: r
371
377
  });
372
- const h = Z(s.ref), { row: u, column: g } = h;
378
+ const m = G(s.ref), { row: h, column: l } = m;
373
379
  if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
374
- workbookTypes: [K],
375
- worksheetTypes: [Y],
376
- rangeTypes: [q]
377
- }, [{ startRow: u, startColumn: g, endRow: u, endColumn: g }]))
380
+ workbookTypes: [q],
381
+ worksheetTypes: [X],
382
+ rangeTypes: [J]
383
+ }, [{ startRow: h, startColumn: l, endRow: h, endColumn: l }]))
378
384
  return;
379
- const l = 5;
380
- await this._commandService.executeCommand(at.id, {
385
+ const _ = 1;
386
+ await this._commandService.executeCommand(ut.id, {
381
387
  range: {
382
- startRow: Math.max(h.row - l, 0),
383
- endRow: h.row + l,
384
- startColumn: Math.max(h.column - l, 0),
385
- endColumn: h.column + l
388
+ startRow: Math.max(m.row - _, 0),
389
+ endRow: m.row + _,
390
+ startColumn: Math.max(m.column - _, 0),
391
+ endColumn: m.column + _
386
392
  }
387
393
  }), this._sheetsThreadCommentPopupService.showPopup({
388
394
  unitId: n,
389
395
  subUnitId: r,
390
- row: h.row,
391
- col: h.column,
396
+ row: m.row,
397
+ col: m.column,
392
398
  commentId: s.id,
393
399
  trigger: i
394
400
  });
@@ -397,33 +403,32 @@ let N = class extends U {
397
403
  }));
398
404
  }
399
405
  };
400
- N = xt([
401
- x(D.Starting, N),
402
- I(1, Ke),
403
- I(2, p(de)),
404
- I(3, p(Ge)),
405
- I(4, p(De)),
406
- I(5, ee),
407
- I(6, p(y)),
408
- I(7, p($)),
409
- I(8, p(te)),
410
- I(9, Ye),
411
- I(10, R),
412
- I(11, p(Ce))
413
- ], N);
414
- var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Vt = (t, e, n, r) => {
415
- for (var o = r > 1 ? void 0 : r ? At(e, n) : e, i = t.length - 1, s; i >= 0; i--)
406
+ A = At([
407
+ j(V.Starting, A),
408
+ T(1, qe),
409
+ T(2, p(he)),
410
+ T(3, p(Ye)),
411
+ T(4, re),
412
+ T(5, p(y)),
413
+ T(6, p(N)),
414
+ T(7, p(oe)),
415
+ T(8, Xe),
416
+ T(9, $),
417
+ T(10, p(ge))
418
+ ], A);
419
+ var Vt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Bt = (t, e, n, r) => {
420
+ for (var o = r > 1 ? void 0 : r ? Ht(e, n) : e, i = t.length - 1, s; i >= 0; i--)
416
421
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
417
- return r && o && jt(e, n, o), o;
418
- }, V = (t, e) => (n, r) => e(n, r, t);
419
- let L = class extends U {
422
+ return r && o && Vt(e, n, o), o;
423
+ }, H = (t, e) => (n, r) => e(n, r, t);
424
+ let F = class extends R {
420
425
  constructor(t, e, n, r) {
421
426
  super(), this._sheetInterceptorService = t, this._sheetsThreadCommentModel = e, this._univerInstanceService = n, this._renderManagerService = r, this._initViewModelIntercept(), this._initSkeletonChange();
422
427
  }
423
428
  _initViewModelIntercept() {
424
429
  this.disposeWithMe(
425
430
  this._sheetInterceptorService.intercept(
426
- tt.CELL_CONTENT,
431
+ rt.CELL_CONTENT,
427
432
  {
428
433
  handler: (t, e, n) => {
429
434
  const { row: r, col: o, unitId: i, subUnitId: s } = e;
@@ -453,46 +458,46 @@ let L = class extends U {
453
458
  console.warn("No active sheet found");
454
459
  return;
455
460
  }
456
- const o = this._renderManagerService.getRenderById(n), i = o == null ? void 0 : o.with(ct).getOrCreateSkeleton({ sheetId: r });
461
+ const o = this._renderManagerService.getRenderById(n), i = o == null ? void 0 : o.with(dt).getOrCreateSkeleton({ sheetId: r });
457
462
  i == null || i.makeDirty(!0), i == null || i.calculate(), o && o.mainComponent.makeForceDirty();
458
463
  };
459
- this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(() => {
464
+ this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe((e) => {
460
465
  t();
461
466
  }));
462
467
  }
463
468
  };
464
- L = Vt([
465
- x(D.Ready, L),
466
- V(0, p(ve)),
467
- V(1, p($)),
468
- V(2, R),
469
- V(3, Ct)
470
- ], L);
471
- var Ht = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Bt = (t, e, n, r) => {
472
- for (var o = r > 1 ? void 0 : r ? Lt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
469
+ F = Bt([
470
+ j(V.Ready, F),
471
+ H(0, p(Ce)),
472
+ H(1, p(N)),
473
+ H(2, $),
474
+ H(3, It)
475
+ ], F);
476
+ var Lt = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, kt = (t, e, n, r) => {
477
+ for (var o = r > 1 ? void 0 : r ? Ft(e, n) : e, i = t.length - 1, s; i >= 0; i--)
473
478
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
474
- return r && o && Ht(e, n, o), o;
475
- }, ce = (t, e) => (n, r) => e(n, r, t);
476
- const Ft = (t, e, n) => {
477
- const r = Z(t), o = n.row - e.row, i = n.column - e.column, s = {
479
+ return r && o && Lt(e, n, o), o;
480
+ }, te = (t, e) => (n, r) => e(n, r, t);
481
+ const Wt = (t, e, n) => {
482
+ const r = G(t), o = n.row - e.row, i = n.column - e.column, s = {
478
483
  startColumn: r.column + i,
479
484
  startRow: r.row + o,
480
485
  endColumn: r.column + i,
481
486
  endRow: r.row + o
482
487
  };
483
- return rt(s);
488
+ return it(s);
484
489
  };
485
- let B = class extends U {
486
- constructor(e, n) {
490
+ let k = class extends R {
491
+ constructor(e, n, r) {
487
492
  super();
488
- E(this, "_copyInfo");
489
- this._sheetClipboardService = e, this._sheetsThreadCommentModel = n, this._initClipboardHook();
493
+ U(this, "_copyInfo");
494
+ this._sheetClipboardService = e, this._sheetsThreadCommentModel = n, this._threadCommentDataSourceService = r, this._initClipboardHook();
490
495
  }
491
496
  // eslint-disable-next-line max-lines-per-function
492
497
  _initClipboardHook() {
493
498
  this.disposeWithMe(
494
499
  this._sheetClipboardService.addClipboardHook({
495
- id: ye,
500
+ id: Ue,
496
501
  onBeforeCopy: (e, n, r) => {
497
502
  this._copyInfo = {
498
503
  unitId: e,
@@ -502,64 +507,68 @@ let B = class extends U {
502
507
  },
503
508
  // eslint-disable-next-line max-lines-per-function
504
509
  onPasteCells: (e, n, r, o) => {
505
- const { unitId: i, subUnitId: s, range: a } = n, d = {
510
+ const { unitId: i, subUnitId: s, range: a } = n, u = {
506
511
  row: a.rows[0],
507
512
  column: a.cols[0]
508
513
  };
509
- if (o.copyType === dt.CUT && this._copyInfo) {
510
- const { range: c, unitId: h, subUnitId: u } = this._copyInfo, g = {
514
+ if (o.copyType === ht.CUT && this._copyInfo) {
515
+ const { range: c, unitId: m, subUnitId: h } = this._copyInfo, l = {
511
516
  row: c.startRow,
512
517
  column: c.startColumn
513
518
  };
514
- if (!(i === h && s === u)) {
519
+ if (!(i === m && s === h)) {
515
520
  const C = [];
516
- je.foreach(c, (_, m) => {
517
- const v = this._sheetsThreadCommentModel.getCommentWithChildren(h, u, _, m);
518
- v && C.push(v);
521
+ Ve.foreach(c, (f, d) => {
522
+ const v = this._sheetsThreadCommentModel.getAllByLocation(m, h, f, d);
523
+ this._threadCommentDataSourceService.syncUpdateMutationToColla ? v.forEach((S) => {
524
+ C.push(S);
525
+ }) : v.forEach(({ children: S, ...x }) => {
526
+ x.parentId || C.push(x);
527
+ });
519
528
  });
520
- const l = [], P = [], O = [], j = [], A = (_) => {
521
- l.unshift({
522
- id: z.id,
529
+ const _ = [], P = [], O = [], D = [], ee = (f) => {
530
+ _.unshift({
531
+ id: K.id,
523
532
  params: {
524
- unitId: h,
525
- subUnitId: u,
526
- commentId: _.id
533
+ unitId: m,
534
+ subUnitId: h,
535
+ commentId: f.id
527
536
  }
528
537
  }), O.push({
529
- id: Q.id,
538
+ id: ne.id,
530
539
  params: {
531
540
  unitId: i,
532
541
  subUnitId: s,
533
542
  comment: {
534
- ..._,
535
- ref: Ft(_.ref, g, d),
543
+ ...f,
544
+ ref: Wt(f.ref, l, u),
536
545
  unitId: i,
537
546
  subUnitId: s
538
- }
547
+ },
548
+ sync: !0
539
549
  }
540
550
  }), P.push({
541
- id: Q.id,
551
+ id: ne.id,
542
552
  params: {
543
- unitId: h,
544
- subUnitId: u,
545
- comment: _
553
+ unitId: m,
554
+ subUnitId: h,
555
+ comment: f,
556
+ sync: !0
546
557
  }
547
- }), j.unshift({
548
- id: z.id,
558
+ }), D.unshift({
559
+ id: K.id,
549
560
  params: {
550
561
  unitId: i,
551
562
  subUnitId: s,
552
- commentId: _.id
563
+ commentId: f.id
553
564
  }
554
565
  });
555
566
  };
556
- return C.forEach((_) => {
557
- A(_.root), _.children.forEach((m) => {
558
- A(m);
559
- });
567
+ return C.forEach((f) => {
568
+ ee(f);
560
569
  }), {
561
- redos: [...l, ...O],
562
- undos: [...j, ...P]
570
+ redos: [..._, ...O],
571
+ undos: [...D, ...P]
563
572
  };
564
573
  }
565
574
  }
@@ -572,31 +581,32 @@ let B = class extends U {
572
581
  );
573
582
  }
574
583
  };
575
- B = Bt([
576
- x(D.Rendered, B),
577
- ce(0, p(ut)),
578
- ce(1, p($))
579
- ], B);
580
- var kt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (t, e, n, r) => {
581
- for (var o = r > 1 ? void 0 : r ? Wt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
584
+ k = kt([
585
+ j(V.Rendered, k),
586
+ te(0, p(mt)),
587
+ te(1, p(N)),
588
+ te(2, Se)
589
+ ], k);
590
+ var Zt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Gt = (t, e, n, r) => {
591
+ for (var o = r > 1 ? void 0 : r ? zt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
582
592
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
583
- return r && o && kt(e, n, o), o;
584
- }, H = (t, e) => (n, r) => e(n, r, t);
585
- let F = class extends U {
593
+ return r && o && Zt(e, n, o), o;
594
+ }, B = (t, e) => (n, r) => e(n, r, t);
595
+ let W = class extends R {
586
596
  constructor(t, e, n, r) {
587
597
  super(), this._hoverManagerService = t, this._sheetsThreadCommentPopupService = e, this._sheetsThreadCommentModel = n, this._sheetPermissionInterceptorBaseController = r, this._initHoverEvent();
588
598
  }
589
599
  _initHoverEvent() {
590
600
  this.disposeWithMe(
591
- this._hoverManagerService.currentCell$.pipe(ft(100)).subscribe((t) => {
601
+ this._hoverManagerService.currentCell$.pipe(St(100)).subscribe((t) => {
592
602
  const e = this._sheetsThreadCommentPopupService.activePopup;
593
603
  if (t && (e && e.temp || !e)) {
594
604
  const { location: n } = t, { unitId: r, subUnitId: o, row: i, col: s } = n, a = this._sheetsThreadCommentModel.getByLocation(r, o, i, s);
595
605
  if (a) {
596
606
  if (!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
597
- workbookTypes: [K],
598
- worksheetTypes: [Y],
599
- rangeTypes: [q]
607
+ workbookTypes: [q],
608
+ worksheetTypes: [X],
609
+ rangeTypes: [J]
600
610
  }, [{ startRow: i, startColumn: s, endRow: i, endColumn: s }]))
601
611
  return;
602
612
  const c = this._sheetsThreadCommentModel.getComment(r, o, a);
@@ -615,50 +625,54 @@ let F = class extends U {
615
625
  );
616
626
  }
617
627
  };
618
- F = Zt([
619
- x(D.Rendered, F),
620
- H(0, p(mt)),
621
- H(1, p(y)),
622
- H(2, p($)),
623
- H(3, p(Ce))
624
- ], F);
625
- var zt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, Kt = (t, e, n, r) => {
626
- for (var o = r > 1 ? void 0 : r ? Gt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
628
+ W = Gt([
629
+ j(V.Rendered, W),
630
+ B(0, p(pt)),
631
+ B(1, p(y)),
632
+ B(2, p(N)),
633
+ B(3, p(ge))
634
+ ], W);
635
+ var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (t, e, n, r) => {
636
+ for (var o = r > 1 ? void 0 : r ? Yt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
627
637
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
628
- return r && o && zt(e, n, o), o;
629
- }, J = (t, e) => (n, r) => e(n, r, t);
630
- let k = class extends U {
631
- constructor(t, e, n) {
632
- super(), this._sheetInterceptorService = t, this._univerInstanceService = e, this._threadCommentModel = n, this._initSheetChange();
638
+ return r && o && Kt(e, n, o), o;
639
+ }, L = (t, e) => (n, r) => e(n, r, t);
640
+ let Z = class extends R {
641
+ constructor(t, e, n, r) {
642
+ super(), this._sheetInterceptorService = t, this._univerInstanceService = e, this._threadCommentModel = n, this._threadCommentDataSourceService = r, this._initSheetChange();
633
643
  }
634
644
  _initSheetChange() {
635
645
  this.disposeWithMe(
636
646
  this._sheetInterceptorService.interceptCommand({
637
647
  getMutations: (t) => {
638
648
  var e;
639
- if (t.id === nt.id) {
649
+ if (t.id === ot.id) {
640
650
  const n = t.params, r = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET);
641
651
  if (!r)
642
652
  return { redos: [], undos: [] };
643
653
  const o = r.getUnitId(), i = n.subUnitId || ((e = r.getActiveSheet()) == null ? void 0 : e.getSheetId());
644
654
  if (!i)
645
655
  return { redos: [], undos: [] };
646
- const { commentMap: s } = this._threadCommentModel.ensureMap(o, i), a = Array.from(Object.keys(s)), d = Array.from(Object.values(s)), c = a.map((u) => ({
647
- id: z.id,
656
+ const { commentMap: s } = this._threadCommentModel.ensureMap(o, i), a = Array.from(Object.values(s)).filter((l) => !l.parentId), u = a.map((l) => l.id), c = this._threadCommentDataSourceService.syncUpdateMutationToColla, m = u.map((l) => ({
657
+ id: K.id,
648
658
  params: {
649
659
  unitId: o,
650
660
  subUnitId: i,
651
- commentId: u
661
+ commentId: l
652
662
  }
653
- })), h = d.map((u) => ({
654
- id: Q.id,
663
+ })), h = a.map(({ children: l, ...C }) => ({
664
+ id: ne.id,
655
665
  params: {
656
666
  unitId: o,
657
667
  subUnitId: i,
658
- comment: u
668
+ comment: {
669
+ ...C,
670
+ children: c ? l : void 0
671
+ },
672
+ sync: !c
659
673
  }
660
674
  }));
661
- return { redos: c, undos: h };
675
+ return { redos: m, undos: h };
662
676
  }
663
677
  return { redos: [], undos: [] };
664
678
  }
@@ -666,65 +680,67 @@ let k = class extends U {
666
680
  );
667
681
  }
668
682
  };
669
- k = Kt([
670
- x(D.Ready, k),
671
- J(0, p(ve)),
672
- J(1, R),
673
- J(2, p(_e))
674
- ], k);
675
- var Oe = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, qt = (t, e, n) => e in t ? Oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Xt = (t, e, n, r) => {
676
- for (var o = r > 1 ? void 0 : r ? Yt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
683
+ Z = qt([
684
+ j(V.Ready, Z),
685
+ L(0, p(Ce)),
686
+ L(1, $),
687
+ L(2, p(fe)),
688
+ L(3, Se)
689
+ ], Z);
690
+ var Re = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Jt = (t, e, n) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Qt = (t, e, n, r) => {
691
+ for (var o = r > 1 ? void 0 : r ? Xt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
677
692
  (s = t[i]) && (o = (r ? s(e, n, o) : s(o)) || o);
678
- return r && o && Oe(e, n, o), o;
679
- }, ue = (t, e) => (n, r) => e(n, r, t), Ee = (t, e, n) => qt(t, typeof e != "symbol" ? e + "" : e, n);
680
- let G = class extends Ve {
693
+ return r && o && Re(e, n, o), o;
694
+ }, me = (t, e) => (n, r) => e(n, r, t), $e = (t, e, n) => Jt(t, typeof e != "symbol" ? e + "" : e, n);
695
+ let Y = class extends Be {
681
696
  constructor(e = {}, n, r) {
682
697
  super();
683
- E(this, "_pluginConfig");
684
- this._injector = n, this._commandService = r, this._pluginConfig = me.deepMerge({}, Dt, e);
698
+ U(this, "_pluginConfig");
699
+ this._injector = n, this._commandService = r, this._pluginConfig = pe.deepMerge({}, jt, e);
685
700
  }
686
701
  onStarting(e) {
687
702
  [
688
703
  [
689
- N,
704
+ A,
690
705
  {
691
- useFactory: () => this._injector.createInstance(N, this._pluginConfig)
706
+ useFactory: () => this._injector.createInstance(A, this._pluginConfig)
692
707
  }
693
708
  ],
694
- [L],
695
- [B],
696
709
  [F],
697
710
  [k],
711
+ [W],
712
+ [Z],
698
713
  [y]
699
714
  ].forEach((n) => {
700
715
  e.add(n);
701
- }), [X].forEach((n) => {
716
+ }), [Q].forEach((n) => {
702
717
  this._commandService.registerCommand(n);
703
718
  });
704
719
  }
705
720
  };
706
- Ee(G, "pluginName", ye);
707
- Ee(G, "type", b.UNIVER_SHEET);
708
- G = Xt([
709
- Ae(ke, ht),
710
- ue(1, p(de)),
711
- ue(2, p(ee))
712
- ], G);
721
+ $e(Y, "pluginName", Ue);
722
+ $e(Y, "type", b.UNIVER_SHEET);
723
+ Y = Qt([
724
+ He(Ze, lt),
725
+ me(1, p(he)),
726
+ me(2, p(re))
727
+ ], Y);
713
728
  export {
714
- Cn as ICommandService,
715
- wn as IThreadCommentDataSourceService,
716
- Pn as IThreadCommentMentionDataService,
717
- vn as Inject,
718
- _n as Injector,
719
- Sn as Plugin,
720
- ye as SHEETS_THREAD_COMMENT,
721
- N as SheetsThreadCommentController,
722
- B as SheetsThreadCommentCopyPasteController,
723
- F as SheetsThreadCommentHoverController,
724
- yn as SheetsThreadCommentModel,
729
+ In as ICommandService,
730
+ yn as IThreadCommentDataSourceService,
731
+ bn as IThreadCommentMentionDataService,
732
+ Cn as Inject,
733
+ fn as Injector,
734
+ gn as Plugin,
735
+ Ue as SHEETS_THREAD_COMMENT,
736
+ A as SheetsThreadCommentController,
737
+ k as SheetsThreadCommentCopyPasteController,
738
+ W as SheetsThreadCommentHoverController,
739
+ En as SheetsThreadCommentModel,
725
740
  y as SheetsThreadCommentPopupService,
726
- k as ThreadCommentRemoveSheetsController,
727
- In as UniverInstanceType,
728
- G as UniverSheetsThreadCommentPlugin,
729
- Tn as UniverThreadCommentUIPlugin
741
+ Q as ShowAddSheetCommentModalOperation,
742
+ Z as ThreadCommentRemoveSheetsController,
743
+ Pn as UniverInstanceType,
744
+ Y as UniverSheetsThreadCommentPlugin,
745
+ Mn as UniverThreadCommentUIPlugin
730
746
  };