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