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