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