@univerjs/sheets-thread-comment 0.2.3 → 0.2.4

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