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