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