@univerjs/sheets-thread-comment 0.1.15 → 0.1.17

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