@univerjs/thread-comment-ui 0.16.1 → 0.17.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 +4 -4
- package/lib/es/index.js +276 -271
- package/lib/index.js +276 -271
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +4 -4
- package/package.json +8 -8
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ve = (
|
|
3
|
-
var W = (
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { ISidebarService as
|
|
6
|
-
import { BehaviorSubject as Ce, filter as
|
|
7
|
-
import { UniverThreadCommentPlugin as
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Ve = (n, e, t) => e in n ? je(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var W = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as _e, IUniverInstanceService as Pe, Disposable as Ae, UniverInstanceType as de, CommandType as we, DependentOn as Be, Injector as We, ICommandService as ne, IConfigService as Ze, Plugin as Fe, merge as ze, mergeOverrideWithDependencies as Ke, LocaleService as fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ge, BuildTextUtils as ve, DOCS_COMMENT_EDITOR_UNIT_ID_KEY as Ye, Tools as qe, CustomRangeType as Je, getBodySlice as Qe, UserManagerService as pe, generateRandomId as Xe } from "@univerjs/core";
|
|
5
|
+
import { ISidebarService as Ne, useDependency as N, KeyCode as ge, useObservable as Z, useConfigValue as et, UI_PLUGIN_CONFIG_KEY as tt } from "@univerjs/ui";
|
|
6
|
+
import { BehaviorSubject as Ce, filter as nt, debounceTime as rt } from "rxjs";
|
|
7
|
+
import { UniverThreadCommentPlugin as it, ThreadCommentModel as Se, getDT as ot, AddCommentCommand as st, ResolveCommentCommand as at, DeleteCommentTreeCommand as ke, UpdateCommentCommand as lt, DeleteCommentCommand as ct } from "@univerjs/thread-comment";
|
|
8
8
|
import { jsxs as I, jsx as a } from "react/jsx-runtime";
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useRef as
|
|
11
|
-
import { IEditorService as
|
|
12
|
-
var Ct = Object.getOwnPropertyDescriptor,
|
|
13
|
-
for (var i =
|
|
14
|
-
(c =
|
|
9
|
+
import { Button as le, clsx as me, Tooltip as dt, scrollbarClassName as ut, borderClassName as vt, Dropdown as mt, Select as Ie } from "@univerjs/design";
|
|
10
|
+
import { useRef as te, createElement as z, forwardRef as K, useState as P, useEffect as ce, useMemo as ee, useImperativeHandle as ht } from "react";
|
|
11
|
+
import { IEditorService as ft, BreakLineCommand as pt, RichTextEditor as gt } from "@univerjs/docs-ui";
|
|
12
|
+
var Ct = Object.getOwnPropertyDescriptor, It = (n, e, t, r) => {
|
|
13
|
+
for (var i = r > 1 ? void 0 : r ? Ct(e, t) : e, o = n.length - 1, c; o >= 0; o--)
|
|
14
|
+
(c = n[o]) && (i = c(i) || i);
|
|
15
15
|
return i;
|
|
16
|
-
},
|
|
17
|
-
let Y = class extends
|
|
16
|
+
}, xe = (n, e) => (t, r) => e(t, r, n);
|
|
17
|
+
let Y = class extends Ae {
|
|
18
18
|
constructor(e, t) {
|
|
19
19
|
super();
|
|
20
20
|
W(this, "_panelVisible", !1);
|
|
@@ -33,7 +33,7 @@ let Y = class extends Pe {
|
|
|
33
33
|
e.visible || this.setPanelVisible(!1);
|
|
34
34
|
})
|
|
35
35
|
), this.disposeWithMe(
|
|
36
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(de.UNIVER_SHEET).pipe(
|
|
36
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(de.UNIVER_SHEET).pipe(nt((e) => !e)).subscribe(() => {
|
|
37
37
|
this._sidebarService.close();
|
|
38
38
|
})
|
|
39
39
|
);
|
|
@@ -51,109 +51,114 @@ let Y = class extends Pe {
|
|
|
51
51
|
this._activeCommentId = e, this._activeCommentId$.next(e);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
Y =
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
Y = It([
|
|
55
|
+
xe(0, _e(Ne)),
|
|
56
|
+
xe(1, Pe)
|
|
57
57
|
], Y);
|
|
58
|
-
const
|
|
58
|
+
const xt = "thread-comment-panel", bt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", yt = {
|
|
59
59
|
id: "thread-comment-ui.operation.toggle-panel",
|
|
60
|
-
type:
|
|
61
|
-
handler(
|
|
62
|
-
const e =
|
|
60
|
+
type: we.OPERATION,
|
|
61
|
+
handler(n) {
|
|
62
|
+
const e = n.get(Ne), t = n.get(Y);
|
|
63
63
|
return t.panelVisible ? (e.close(), t.setPanelVisible(!1)) : (e.open({
|
|
64
64
|
header: { title: "threadCommentUI.panel.title" },
|
|
65
|
-
children: { label:
|
|
65
|
+
children: { label: xt },
|
|
66
66
|
width: 360
|
|
67
67
|
}), t.setPanelVisible(!0)), !0;
|
|
68
68
|
}
|
|
69
69
|
}, F = {
|
|
70
70
|
id: "thread-comment-ui.operation.set-active-comment",
|
|
71
|
-
type:
|
|
72
|
-
handler(
|
|
73
|
-
return
|
|
71
|
+
type: we.OPERATION,
|
|
72
|
+
handler(n, e) {
|
|
73
|
+
return n.get(Y).setActiveComment(e), !0;
|
|
74
74
|
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
}, _t = "@univerjs/thread-comment-ui", wt = "0.17.0", $e = {
|
|
76
|
+
name: _t,
|
|
77
|
+
version: wt
|
|
78
|
+
}, Nt = "thread-comment-ui.config", be = {};
|
|
79
|
+
var St = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, $t = (n, e, t) => e in n ? St(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Ut = (n, e, t, r) => {
|
|
80
|
+
for (var i = r > 1 ? void 0 : r ? kt(e, t) : e, o = n.length - 1, c; o >= 0; o--)
|
|
81
|
+
(c = n[o]) && (i = c(i) || i);
|
|
79
82
|
return i;
|
|
80
|
-
},
|
|
81
|
-
let
|
|
82
|
-
constructor(
|
|
83
|
-
super(), this._config =
|
|
84
|
-
const { menu: i, ...o } =
|
|
83
|
+
}, he = (n, e) => (t, r) => e(t, r, n), ue = (n, e, t) => $t(n, typeof e != "symbol" ? e + "" : e, t);
|
|
84
|
+
let q = class extends Fe {
|
|
85
|
+
constructor(n = be, e, t, r) {
|
|
86
|
+
super(), this._config = n, this._injector = e, this._commandService = t, this._configService = r;
|
|
87
|
+
const { menu: i, ...o } = ze(
|
|
85
88
|
{},
|
|
86
|
-
|
|
89
|
+
be,
|
|
87
90
|
this._config
|
|
88
91
|
);
|
|
89
|
-
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(
|
|
92
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Nt, o);
|
|
90
93
|
}
|
|
91
94
|
onStarting() {
|
|
92
|
-
var
|
|
93
|
-
|
|
95
|
+
var n;
|
|
96
|
+
Ke([
|
|
94
97
|
[Y]
|
|
95
|
-
], (
|
|
98
|
+
], (n = this._config) == null ? void 0 : n.overrides).forEach((e) => {
|
|
96
99
|
this._injector.add(e);
|
|
97
|
-
}), [
|
|
100
|
+
}), [yt, F].forEach((e) => {
|
|
98
101
|
this._commandService.registerCommand(e);
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
ue(q, "pluginName", bt);
|
|
106
|
+
ue(q, "packageName", $e.name);
|
|
107
|
+
ue(q, "version", $e.version);
|
|
108
|
+
ue(q, "type", de.UNIVER_UNKNOWN);
|
|
109
|
+
q = Ut([
|
|
110
|
+
Be(it),
|
|
111
|
+
he(1, _e(We)),
|
|
112
|
+
he(2, ne),
|
|
113
|
+
he(3, Ze)
|
|
114
|
+
], q);
|
|
115
|
+
function G({ ref: n, ...e }) {
|
|
116
|
+
const { icon: t, id: r, className: i, extend: o, ...c } = e, x = `univerjs-icon univerjs-icon-${r} ${i || ""}`.trim(), h = te(`_${Et()}`);
|
|
117
|
+
return Ue(t, `${r}`, {
|
|
113
118
|
defIds: t.defIds,
|
|
114
119
|
idSuffix: h.current
|
|
115
120
|
}, {
|
|
116
|
-
ref:
|
|
121
|
+
ref: n,
|
|
117
122
|
className: x,
|
|
118
123
|
...c
|
|
119
124
|
}, o);
|
|
120
125
|
}
|
|
121
|
-
function Ue(
|
|
122
|
-
return z(
|
|
126
|
+
function Ue(n, e, t, r, i) {
|
|
127
|
+
return z(n.tag, {
|
|
123
128
|
key: e,
|
|
124
|
-
|
|
125
|
-
...
|
|
126
|
-
}, (
|
|
129
|
+
...Tt(n, t, i),
|
|
130
|
+
...r
|
|
131
|
+
}, (Dt(n, t).children || []).map((o, c) => Ue(o, `${e}-${n.tag}-${c}`, t, void 0, i)));
|
|
127
132
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
t != null && t.colorChannel1 &&
|
|
131
|
-
o === "mask" && typeof c == "string" && (
|
|
133
|
+
function Tt(n, e, t) {
|
|
134
|
+
const r = { ...n.attrs };
|
|
135
|
+
t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1), n.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(([o, c]) => {
|
|
136
|
+
o === "mask" && typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
132
137
|
});
|
|
133
138
|
const { defIds: i } = e;
|
|
134
|
-
return !i || i.length === 0 || (
|
|
135
|
-
typeof c == "string" && (
|
|
136
|
-
})),
|
|
139
|
+
return !i || i.length === 0 || (n.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(([o, c]) => {
|
|
140
|
+
typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
141
|
+
})), r;
|
|
137
142
|
}
|
|
138
|
-
function
|
|
139
|
-
var
|
|
143
|
+
function Dt(n, e) {
|
|
144
|
+
var r;
|
|
140
145
|
const { defIds: t } = e;
|
|
141
|
-
return !t || t.length === 0 ?
|
|
142
|
-
...
|
|
143
|
-
children:
|
|
146
|
+
return !t || t.length === 0 ? n : n.tag === "defs" && ((r = n.children) != null && r.length) ? {
|
|
147
|
+
...n,
|
|
148
|
+
children: n.children.map((i) => typeof i.attrs.id == "string" && t && t.includes(i.attrs.id) ? {
|
|
144
149
|
...i,
|
|
145
150
|
attrs: {
|
|
146
151
|
...i.attrs,
|
|
147
152
|
id: i.attrs.id + e.idSuffix
|
|
148
153
|
}
|
|
149
154
|
} : i)
|
|
150
|
-
} :
|
|
155
|
+
} : n;
|
|
151
156
|
}
|
|
152
|
-
function
|
|
157
|
+
function Et() {
|
|
153
158
|
return Math.random().toString(36).substring(2, 8);
|
|
154
159
|
}
|
|
155
160
|
G.displayName = "UniverIcon";
|
|
156
|
-
const
|
|
161
|
+
const Mt = {
|
|
157
162
|
tag: "svg",
|
|
158
163
|
attrs: {
|
|
159
164
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -194,15 +199,15 @@ const Tt = {
|
|
|
194
199
|
}
|
|
195
200
|
}
|
|
196
201
|
]
|
|
197
|
-
},
|
|
202
|
+
}, Te = K(function(e, t) {
|
|
198
203
|
return z(G, Object.assign({}, e, {
|
|
199
204
|
id: "delete-icon",
|
|
200
205
|
ref: t,
|
|
201
|
-
icon:
|
|
206
|
+
icon: Mt
|
|
202
207
|
}));
|
|
203
208
|
});
|
|
204
|
-
|
|
205
|
-
const
|
|
209
|
+
Te.displayName = "DeleteIcon";
|
|
210
|
+
const Ot = {
|
|
206
211
|
tag: "svg",
|
|
207
212
|
attrs: {
|
|
208
213
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -218,15 +223,15 @@ const Dt = {
|
|
|
218
223
|
d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"
|
|
219
224
|
}
|
|
220
225
|
}]
|
|
221
|
-
},
|
|
226
|
+
}, De = K(function(e, t) {
|
|
222
227
|
return z(G, Object.assign({}, e, {
|
|
223
228
|
id: "increase-icon",
|
|
224
229
|
ref: t,
|
|
225
|
-
icon:
|
|
230
|
+
icon: Ot
|
|
226
231
|
}));
|
|
227
232
|
});
|
|
228
|
-
|
|
229
|
-
const
|
|
233
|
+
De.displayName = "IncreaseIcon";
|
|
234
|
+
const Rt = {
|
|
230
235
|
tag: "svg",
|
|
231
236
|
attrs: {
|
|
232
237
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -258,15 +263,15 @@ const Et = {
|
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
]
|
|
261
|
-
},
|
|
266
|
+
}, Ee = K(function(e, t) {
|
|
262
267
|
return z(G, Object.assign({}, e, {
|
|
263
268
|
id: "more-horizontal-icon",
|
|
264
269
|
ref: t,
|
|
265
|
-
icon:
|
|
270
|
+
icon: Rt
|
|
266
271
|
}));
|
|
267
272
|
});
|
|
268
|
-
|
|
269
|
-
const
|
|
273
|
+
Ee.displayName = "MoreHorizontalIcon";
|
|
274
|
+
const Lt = {
|
|
270
275
|
tag: "svg",
|
|
271
276
|
attrs: {
|
|
272
277
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -324,15 +329,15 @@ const Mt = {
|
|
|
324
329
|
}
|
|
325
330
|
}
|
|
326
331
|
]
|
|
327
|
-
},
|
|
332
|
+
}, Me = K(function(e, t) {
|
|
328
333
|
return z(G, Object.assign({}, e, {
|
|
329
334
|
id: "reply-to-comment-icon",
|
|
330
335
|
ref: t,
|
|
331
|
-
icon:
|
|
336
|
+
icon: Lt
|
|
332
337
|
}));
|
|
333
338
|
});
|
|
334
|
-
|
|
335
|
-
const
|
|
339
|
+
Me.displayName = "ReplyToCommentIcon";
|
|
340
|
+
const Ht = {
|
|
336
341
|
tag: "svg",
|
|
337
342
|
attrs: {
|
|
338
343
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -350,15 +355,15 @@ const Ot = {
|
|
|
350
355
|
clipRule: "evenodd"
|
|
351
356
|
}
|
|
352
357
|
}]
|
|
353
|
-
},
|
|
358
|
+
}, Oe = K(function(e, t) {
|
|
354
359
|
return z(G, Object.assign({}, e, {
|
|
355
360
|
id: "resolved-icon",
|
|
356
361
|
ref: t,
|
|
357
|
-
icon:
|
|
362
|
+
icon: Ht
|
|
358
363
|
}));
|
|
359
364
|
});
|
|
360
|
-
|
|
361
|
-
const
|
|
365
|
+
Oe.displayName = "ResolvedIcon";
|
|
366
|
+
const jt = {
|
|
362
367
|
tag: "svg",
|
|
363
368
|
attrs: {
|
|
364
369
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -386,51 +391,51 @@ const Rt = {
|
|
|
386
391
|
strokeWidth: 1.2
|
|
387
392
|
}
|
|
388
393
|
}]
|
|
389
|
-
},
|
|
394
|
+
}, Re = K(function(e, t) {
|
|
390
395
|
return z(G, Object.assign({}, e, {
|
|
391
396
|
id: "solve-icon",
|
|
392
397
|
ref: t,
|
|
393
|
-
icon:
|
|
398
|
+
icon: jt
|
|
394
399
|
}));
|
|
395
400
|
});
|
|
396
|
-
|
|
397
|
-
function
|
|
401
|
+
Re.displayName = "SolveIcon";
|
|
402
|
+
function ye(n) {
|
|
398
403
|
return {
|
|
399
404
|
id: "d",
|
|
400
|
-
body:
|
|
405
|
+
body: n,
|
|
401
406
|
documentStyle: {}
|
|
402
407
|
};
|
|
403
408
|
}
|
|
404
|
-
const
|
|
409
|
+
const Le = K((n, e) => {
|
|
405
410
|
var O;
|
|
406
|
-
const { comment: t, onSave:
|
|
411
|
+
const { comment: t, onSave: r, id: i, onCancel: o, autoFocus: c, unitId: x, type: h } = n, S = N(ne), $ = N(fe), [j, U] = P(!1), b = N(ft), u = te(null), v = h === de.UNIVER_DOC ? Ge : x, [T, y] = P(() => {
|
|
407
412
|
var d, m, f;
|
|
408
|
-
return
|
|
413
|
+
return ve.transform.getPlainText((f = (m = (d = u.current) == null ? void 0 : d.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? f : "");
|
|
409
414
|
});
|
|
410
|
-
|
|
415
|
+
ce(() => {
|
|
411
416
|
var m, f, _, p;
|
|
412
|
-
y(
|
|
417
|
+
y(ve.transform.getPlainText((_ = (f = (m = u.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? _ : ""));
|
|
413
418
|
const d = (p = u.current) == null ? void 0 : p.selectionChange$.subscribe(() => {
|
|
414
419
|
var s, w, A;
|
|
415
|
-
y(
|
|
420
|
+
y(ve.transform.getPlainText((A = (w = (s = u.current) == null ? void 0 : s.getDocumentData().body) == null ? void 0 : w.dataStream) != null ? A : ""));
|
|
416
421
|
});
|
|
417
422
|
return () => d == null ? void 0 : d.unsubscribe();
|
|
418
423
|
}, [(O = u.current) == null ? void 0 : O.selectionChange$]);
|
|
419
|
-
const
|
|
420
|
-
keyCodes: [{ keyCode:
|
|
424
|
+
const V = ee(() => ({
|
|
425
|
+
keyCodes: [{ keyCode: ge.ENTER }],
|
|
421
426
|
handler: (d) => {
|
|
422
|
-
d ===
|
|
423
|
-
|
|
427
|
+
d === ge.ENTER && S.executeCommand(
|
|
428
|
+
pt.id
|
|
424
429
|
);
|
|
425
430
|
}
|
|
426
431
|
}), [S]);
|
|
427
|
-
|
|
432
|
+
ht(e, () => ({
|
|
428
433
|
reply(d) {
|
|
429
434
|
var f, _;
|
|
430
435
|
if (!u.current)
|
|
431
436
|
return;
|
|
432
437
|
b.focus((f = u.current.getEditorId()) != null ? f : "");
|
|
433
|
-
const m =
|
|
438
|
+
const m = ye(d);
|
|
434
439
|
(_ = u.current) == null || _.setDocumentData(m, [{
|
|
435
440
|
startOffset: m.body.dataStream.length - 2,
|
|
436
441
|
endOffset: m.body.dataStream.length - 2,
|
|
@@ -438,10 +443,10 @@ const Re = K((r, e) => {
|
|
|
438
443
|
}]);
|
|
439
444
|
}
|
|
440
445
|
}));
|
|
441
|
-
const
|
|
446
|
+
const g = () => {
|
|
442
447
|
if (u.current) {
|
|
443
|
-
const d =
|
|
444
|
-
|
|
448
|
+
const d = qe.deepClone(u.current.getDocumentData().body);
|
|
449
|
+
U(!1), r == null || r({
|
|
445
450
|
...t,
|
|
446
451
|
text: d
|
|
447
452
|
}), u.current.replaceText(""), setTimeout(() => {
|
|
@@ -452,16 +457,16 @@ const Re = K((r, e) => {
|
|
|
452
457
|
};
|
|
453
458
|
return /* @__PURE__ */ I("div", { onClick: (d) => d.preventDefault(), children: [
|
|
454
459
|
/* @__PURE__ */ a(
|
|
455
|
-
|
|
460
|
+
gt,
|
|
456
461
|
{
|
|
457
462
|
className: "univer-w-full",
|
|
458
463
|
editorRef: u,
|
|
459
|
-
editorId:
|
|
464
|
+
editorId: Ye,
|
|
460
465
|
autoFocus: c,
|
|
461
|
-
keyboardEventConfig:
|
|
462
|
-
placeholder:
|
|
463
|
-
initialValue: (t == null ? void 0 : t.text) &&
|
|
464
|
-
onFocusChange: (d) => d &&
|
|
466
|
+
keyboardEventConfig: V,
|
|
467
|
+
placeholder: $.t("threadCommentUI.editor.placeholder"),
|
|
468
|
+
initialValue: (t == null ? void 0 : t.text) && ye(t.text),
|
|
469
|
+
onFocusChange: (d) => d && U(d),
|
|
465
470
|
isSingle: !1,
|
|
466
471
|
maxHeight: 64,
|
|
467
472
|
onClickOutside: () => {
|
|
@@ -471,30 +476,30 @@ const Re = K((r, e) => {
|
|
|
471
476
|
}
|
|
472
477
|
}
|
|
473
478
|
),
|
|
474
|
-
|
|
479
|
+
j ? /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
|
475
480
|
/* @__PURE__ */ a(
|
|
476
|
-
|
|
481
|
+
le,
|
|
477
482
|
{
|
|
478
483
|
onClick: () => {
|
|
479
484
|
var d;
|
|
480
|
-
o == null || o(),
|
|
485
|
+
o == null || o(), U(!1), (d = u.current) == null || d.replaceText("", !0), S.executeCommand(F.id);
|
|
481
486
|
},
|
|
482
|
-
children:
|
|
487
|
+
children: $.t("threadCommentUI.editor.cancel")
|
|
483
488
|
}
|
|
484
489
|
),
|
|
485
490
|
/* @__PURE__ */ a(
|
|
486
|
-
|
|
491
|
+
le,
|
|
487
492
|
{
|
|
488
493
|
variant: "primary",
|
|
489
494
|
disabled: !T,
|
|
490
|
-
onClick:
|
|
491
|
-
children:
|
|
495
|
+
onClick: g,
|
|
496
|
+
children: $.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
|
|
492
497
|
}
|
|
493
498
|
)
|
|
494
499
|
] }) : null
|
|
495
500
|
] });
|
|
496
|
-
}),
|
|
497
|
-
const { dataStream: e, customRanges: t } =
|
|
501
|
+
}), Vt = (n) => {
|
|
502
|
+
const { dataStream: e, customRanges: t } = n, r = e.endsWith(`\r
|
|
498
503
|
`) ? e.length - 2 : e.length, i = [];
|
|
499
504
|
let o = 0;
|
|
500
505
|
return t == null || t.forEach((c) => {
|
|
@@ -510,31 +515,31 @@ const Re = K((r, e) => {
|
|
|
510
515
|
}), o = c.endIndex + 1;
|
|
511
516
|
}), i.push({
|
|
512
517
|
type: "text",
|
|
513
|
-
content: e.slice(o,
|
|
518
|
+
content: e.slice(o, r)
|
|
514
519
|
}), i;
|
|
515
|
-
},
|
|
516
|
-
if (!
|
|
520
|
+
}, Pt = (n) => {
|
|
521
|
+
if (!n)
|
|
517
522
|
return [];
|
|
518
|
-
const { paragraphs: e = [] } =
|
|
519
|
-
return e.map((t,
|
|
520
|
-
const i =
|
|
521
|
-
return
|
|
523
|
+
const { paragraphs: e = [] } = n;
|
|
524
|
+
return e.map((t, r) => {
|
|
525
|
+
const i = r === 0 ? 0 : e[r - 1].startIndex + 1, o = Qe(n, i, t.startIndex);
|
|
526
|
+
return Vt(o);
|
|
522
527
|
});
|
|
523
|
-
},
|
|
528
|
+
}, At = (n) => {
|
|
524
529
|
let e = "";
|
|
525
530
|
const t = [];
|
|
526
|
-
return
|
|
527
|
-
switch (
|
|
531
|
+
return n.forEach((r) => {
|
|
532
|
+
switch (r.type) {
|
|
528
533
|
case "text":
|
|
529
|
-
e +=
|
|
534
|
+
e += r.content;
|
|
530
535
|
break;
|
|
531
536
|
case "mention": {
|
|
532
537
|
const i = e.length;
|
|
533
|
-
e +=
|
|
538
|
+
e += r.content.label;
|
|
534
539
|
const o = e.length - 1;
|
|
535
540
|
t.push({
|
|
536
|
-
rangeId:
|
|
537
|
-
rangeType:
|
|
541
|
+
rangeId: r.content.id,
|
|
542
|
+
rangeType: Je.MENTION,
|
|
538
543
|
startIndex: i,
|
|
539
544
|
endIndex: o,
|
|
540
545
|
properties: {},
|
|
@@ -560,13 +565,13 @@ const Re = K((r, e) => {
|
|
|
560
565
|
dataStream: e,
|
|
561
566
|
customRanges: t
|
|
562
567
|
};
|
|
563
|
-
},
|
|
564
|
-
const { item: e, unitId: t, subUnitId:
|
|
565
|
-
(
|
|
566
|
-
h ?
|
|
568
|
+
}, He = "__mock__", Bt = (n) => {
|
|
569
|
+
const { item: e, unitId: t, subUnitId: r, editing: i, onEditingChange: o, onReply: c, resolved: x, isRoot: h, onClose: S, onDeleteComment: $, type: j } = n, U = N(ne), b = N(fe), u = N(pe), v = u.getUser(e.personId), T = Z(u.currentUser$), y = (T == null ? void 0 : T.userID) === e.personId, V = e.id === He, [g, O] = P(!1), d = et(tt), m = d == null ? void 0 : d.avatarFallback, f = () => {
|
|
570
|
+
($ == null ? void 0 : $(e)) !== !1 && (U.executeCommand(
|
|
571
|
+
h ? ke.id : ct.id,
|
|
567
572
|
{
|
|
568
573
|
unitId: t,
|
|
569
|
-
subUnitId:
|
|
574
|
+
subUnitId: r,
|
|
570
575
|
commentId: e.id
|
|
571
576
|
}
|
|
572
577
|
), h && (S == null || S()));
|
|
@@ -584,16 +589,16 @@ const Re = K((r, e) => {
|
|
|
584
589
|
v ? /* @__PURE__ */ I("div", { className: "univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between", children: [
|
|
585
590
|
/* @__PURE__ */ a("div", { className: "univer-text-sm univer-font-medium univer-leading-5", children: (v == null ? void 0 : v.name) || " " }),
|
|
586
591
|
/* @__PURE__ */ I("div", { children: [
|
|
587
|
-
|
|
592
|
+
V || x ? null : g && v ? /* @__PURE__ */ a(
|
|
588
593
|
"div",
|
|
589
594
|
{
|
|
590
595
|
className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50",
|
|
591
596
|
onClick: () => c(v),
|
|
592
|
-
children: /* @__PURE__ */ a(
|
|
597
|
+
children: /* @__PURE__ */ a(Me, {})
|
|
593
598
|
}
|
|
594
599
|
) : null,
|
|
595
|
-
y && !
|
|
596
|
-
|
|
600
|
+
y && !V && !x ? /* @__PURE__ */ a(
|
|
601
|
+
mt,
|
|
597
602
|
{
|
|
598
603
|
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ I(
|
|
599
604
|
"ul",
|
|
@@ -623,7 +628,7 @@ const Re = K((r, e) => {
|
|
|
623
628
|
"div",
|
|
624
629
|
{
|
|
625
630
|
className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50",
|
|
626
|
-
children: /* @__PURE__ */ a(
|
|
631
|
+
children: /* @__PURE__ */ a(Ee, {})
|
|
627
632
|
}
|
|
628
633
|
)
|
|
629
634
|
}
|
|
@@ -638,21 +643,21 @@ const Re = K((r, e) => {
|
|
|
638
643
|
}
|
|
639
644
|
),
|
|
640
645
|
i ? /* @__PURE__ */ a(
|
|
641
|
-
|
|
646
|
+
Le,
|
|
642
647
|
{
|
|
643
|
-
type:
|
|
648
|
+
type: j,
|
|
644
649
|
id: e.id,
|
|
645
650
|
comment: e,
|
|
646
651
|
onCancel: () => o == null ? void 0 : o(!1),
|
|
647
652
|
autoFocus: !0,
|
|
648
653
|
unitId: t,
|
|
649
|
-
subUnitId:
|
|
654
|
+
subUnitId: r,
|
|
650
655
|
onSave: ({ text: _, attachments: p }) => {
|
|
651
|
-
o == null || o(!1),
|
|
652
|
-
|
|
656
|
+
o == null || o(!1), U.executeCommand(
|
|
657
|
+
lt.id,
|
|
653
658
|
{
|
|
654
659
|
unitId: t,
|
|
655
|
-
subUnitId:
|
|
660
|
+
subUnitId: r,
|
|
656
661
|
payload: {
|
|
657
662
|
commentId: e.id,
|
|
658
663
|
text: _,
|
|
@@ -666,91 +671,91 @@ const Re = K((r, e) => {
|
|
|
666
671
|
"div",
|
|
667
672
|
{
|
|
668
673
|
className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
669
|
-
children:
|
|
674
|
+
children: Pt(e.text).map((_, p) => /* @__PURE__ */ a("div", { className: "univer-break-words", children: _.map((s, w) => s.type === "mention" ? /* @__PURE__ */ I("a", { className: "univer-text-primary-600", children: [
|
|
670
675
|
s.content.label,
|
|
671
676
|
" "
|
|
672
677
|
] }, w) : s.content) }, p))
|
|
673
678
|
}
|
|
674
679
|
)
|
|
675
680
|
] });
|
|
676
|
-
},
|
|
677
|
-
var
|
|
681
|
+
}, Wt = (n) => {
|
|
682
|
+
var ae, X, l;
|
|
678
683
|
const {
|
|
679
684
|
id: e,
|
|
680
685
|
unitId: t,
|
|
681
|
-
subUnitId:
|
|
686
|
+
subUnitId: r,
|
|
682
687
|
refStr: i,
|
|
683
688
|
showEdit: o = !0,
|
|
684
689
|
onClick: c,
|
|
685
690
|
showHighlight: x,
|
|
686
691
|
onClose: h,
|
|
687
692
|
getSubUnitName: S,
|
|
688
|
-
prefix:
|
|
689
|
-
autoFocus:
|
|
690
|
-
onMouseEnter:
|
|
693
|
+
prefix: $,
|
|
694
|
+
autoFocus: j,
|
|
695
|
+
onMouseEnter: U,
|
|
691
696
|
onMouseLeave: b,
|
|
692
697
|
onAddComment: u,
|
|
693
698
|
onDeleteComment: v,
|
|
694
699
|
onResolve: T,
|
|
695
700
|
type: y,
|
|
696
|
-
style:
|
|
697
|
-
full:
|
|
698
|
-
} =
|
|
701
|
+
style: V,
|
|
702
|
+
full: g
|
|
703
|
+
} = n, O = N(Se), [d, m] = P(!1), [f, _] = P(""), p = ee(() => O.commentUpdate$.pipe(rt(16)), [O]);
|
|
699
704
|
Z(p);
|
|
700
|
-
const s = e ? O.getCommentWithChildren(t,
|
|
705
|
+
const s = e ? O.getCommentWithChildren(t, r, e) : null, w = N(ne), A = N(pe), D = s == null ? void 0 : s.root.resolved, E = Z(A.currentUser$), L = te(null), J = [
|
|
701
706
|
...s ? [s.root] : (
|
|
702
707
|
// mock empty comment
|
|
703
708
|
[{
|
|
704
|
-
id:
|
|
709
|
+
id: He,
|
|
705
710
|
text: {
|
|
706
711
|
dataStream: `
|
|
707
712
|
\r`
|
|
708
713
|
},
|
|
709
|
-
personId: (
|
|
714
|
+
personId: (ae = E == null ? void 0 : E.userID) != null ? ae : "",
|
|
710
715
|
ref: i != null ? i : "",
|
|
711
716
|
dT: "",
|
|
712
717
|
unitId: t,
|
|
713
|
-
subUnitId:
|
|
718
|
+
subUnitId: r,
|
|
714
719
|
threadId: ""
|
|
715
720
|
}]
|
|
716
721
|
),
|
|
717
|
-
...(
|
|
718
|
-
], R =
|
|
719
|
-
|
|
722
|
+
...(X = s == null ? void 0 : s.children) != null ? X : []
|
|
723
|
+
], R = te(null), re = (C) => {
|
|
724
|
+
C.stopPropagation(), D ? w.executeCommand(F.id, {
|
|
720
725
|
unitId: t,
|
|
721
|
-
subUnitId:
|
|
726
|
+
subUnitId: r,
|
|
722
727
|
commentId: e
|
|
723
|
-
}) : w.executeCommand(F.id), w.executeCommand(
|
|
728
|
+
}) : w.executeCommand(F.id), w.executeCommand(at.id, {
|
|
724
729
|
unitId: t,
|
|
725
|
-
subUnitId:
|
|
730
|
+
subUnitId: r,
|
|
726
731
|
commentId: e,
|
|
727
732
|
resolved: !D
|
|
728
733
|
}), T == null || T(!D);
|
|
729
|
-
},
|
|
730
|
-
|
|
731
|
-
|
|
734
|
+
}, Q = (C) => {
|
|
735
|
+
C.stopPropagation(), w.executeCommand(F.id), !(s != null && s.root && (v == null ? void 0 : v(s.root)) === !1) && (w.executeCommand(
|
|
736
|
+
ke.id,
|
|
732
737
|
{
|
|
733
738
|
unitId: t,
|
|
734
|
-
subUnitId:
|
|
739
|
+
subUnitId: r,
|
|
735
740
|
commentId: e
|
|
736
741
|
}
|
|
737
742
|
), h == null || h());
|
|
738
743
|
};
|
|
739
|
-
|
|
740
|
-
const
|
|
744
|
+
ce(() => b == null ? void 0 : b(), []);
|
|
745
|
+
const ie = S((l = s == null ? void 0 : s.root.subUnitId) != null ? l : r), oe = o && !f && !D, se = `${i || (s == null ? void 0 : s.root.ref) || ""}${ie ? " · " : ""}${ie}`;
|
|
741
746
|
return /* @__PURE__ */ I(
|
|
742
747
|
"div",
|
|
743
748
|
{
|
|
744
|
-
id: `${
|
|
745
|
-
className:
|
|
746
|
-
"univer-w-[278px]": !
|
|
747
|
-
"univer-w-full":
|
|
748
|
-
"univer-shadow": !D && (x || d ||
|
|
749
|
+
id: `${$}-${t}-${r}-${e}`,
|
|
750
|
+
className: me("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white", vt, {
|
|
751
|
+
"univer-w-[278px]": !g,
|
|
752
|
+
"univer-w-full": g,
|
|
753
|
+
"univer-shadow": !D && (x || d || $ === "cell")
|
|
749
754
|
}),
|
|
750
|
-
style:
|
|
755
|
+
style: V,
|
|
751
756
|
onClick: c,
|
|
752
757
|
onMouseEnter: () => {
|
|
753
|
-
|
|
758
|
+
U == null || U(), m(!0);
|
|
754
759
|
},
|
|
755
760
|
onMouseLeave: () => {
|
|
756
761
|
b == null || b(), m(!1);
|
|
@@ -774,11 +779,11 @@ const Re = K((r, e) => {
|
|
|
774
779
|
className: "univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0 univer-rounded-sm univer-bg-yellow-500"
|
|
775
780
|
}
|
|
776
781
|
),
|
|
777
|
-
/* @__PURE__ */ a(
|
|
782
|
+
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title: se, children: /* @__PURE__ */ a(
|
|
778
783
|
"span",
|
|
779
784
|
{
|
|
780
785
|
className: "univer-flex-1 univer-truncate",
|
|
781
|
-
children:
|
|
786
|
+
children: se
|
|
782
787
|
}
|
|
783
788
|
) })
|
|
784
789
|
] }),
|
|
@@ -786,19 +791,19 @@ const Re = K((r, e) => {
|
|
|
786
791
|
/* @__PURE__ */ a(
|
|
787
792
|
"div",
|
|
788
793
|
{
|
|
789
|
-
className:
|
|
794
|
+
className: me("univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800", {
|
|
790
795
|
"univer-text-green-500": D
|
|
791
796
|
}),
|
|
792
797
|
onClick: re,
|
|
793
|
-
children: D ? /* @__PURE__ */ a(
|
|
798
|
+
children: D ? /* @__PURE__ */ a(Oe, {}) : /* @__PURE__ */ a(Re, {})
|
|
794
799
|
}
|
|
795
800
|
),
|
|
796
801
|
(E == null ? void 0 : E.userID) === s.root.personId ? /* @__PURE__ */ a(
|
|
797
802
|
"div",
|
|
798
803
|
{
|
|
799
804
|
className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800",
|
|
800
|
-
onClick:
|
|
801
|
-
children: /* @__PURE__ */ a(
|
|
805
|
+
onClick: Q,
|
|
806
|
+
children: /* @__PURE__ */ a(Te, {})
|
|
802
807
|
}
|
|
803
808
|
) : null
|
|
804
809
|
] })
|
|
@@ -809,26 +814,26 @@ const Re = K((r, e) => {
|
|
|
809
814
|
"div",
|
|
810
815
|
{
|
|
811
816
|
ref: R,
|
|
812
|
-
className:
|
|
813
|
-
children:
|
|
814
|
-
(
|
|
815
|
-
|
|
817
|
+
className: me("univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden", ut),
|
|
818
|
+
children: J.map(
|
|
819
|
+
(C) => /* @__PURE__ */ a(
|
|
820
|
+
Bt,
|
|
816
821
|
{
|
|
817
822
|
unitId: t,
|
|
818
|
-
subUnitId:
|
|
819
|
-
item:
|
|
820
|
-
isRoot:
|
|
821
|
-
editing: f ===
|
|
823
|
+
subUnitId: r,
|
|
824
|
+
item: C,
|
|
825
|
+
isRoot: C.id === (s == null ? void 0 : s.root.id),
|
|
826
|
+
editing: f === C.id,
|
|
822
827
|
resolved: s == null ? void 0 : s.root.resolved,
|
|
823
828
|
type: y,
|
|
824
829
|
onClose: h,
|
|
825
830
|
onEditingChange: (M) => {
|
|
826
|
-
_(M ?
|
|
831
|
+
_(M ? C.id : "");
|
|
827
832
|
},
|
|
828
833
|
onReply: (M) => {
|
|
829
834
|
M && requestAnimationFrame(() => {
|
|
830
835
|
var H;
|
|
831
|
-
(H = L.current) == null || H.reply(
|
|
836
|
+
(H = L.current) == null || H.reply(At([
|
|
832
837
|
{
|
|
833
838
|
type: "mention",
|
|
834
839
|
content: {
|
|
@@ -846,102 +851,102 @@ const Re = K((r, e) => {
|
|
|
846
851
|
onAddComment: u,
|
|
847
852
|
onDeleteComment: v
|
|
848
853
|
},
|
|
849
|
-
|
|
854
|
+
C.id
|
|
850
855
|
)
|
|
851
856
|
)
|
|
852
857
|
}
|
|
853
858
|
),
|
|
854
|
-
|
|
855
|
-
|
|
859
|
+
oe && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
860
|
+
Le,
|
|
856
861
|
{
|
|
857
862
|
ref: L,
|
|
858
863
|
type: y,
|
|
859
864
|
unitId: t,
|
|
860
|
-
subUnitId:
|
|
861
|
-
onSave: async ({ text:
|
|
865
|
+
subUnitId: r,
|
|
866
|
+
onSave: async ({ text: C, attachments: M }) => {
|
|
862
867
|
const H = {
|
|
863
|
-
text:
|
|
868
|
+
text: C,
|
|
864
869
|
attachments: M,
|
|
865
|
-
dT:
|
|
866
|
-
id:
|
|
870
|
+
dT: ot(),
|
|
871
|
+
id: Xe(),
|
|
867
872
|
ref: i,
|
|
868
873
|
personId: E == null ? void 0 : E.userID,
|
|
869
874
|
parentId: s == null ? void 0 : s.root.id,
|
|
870
875
|
unitId: t,
|
|
871
|
-
subUnitId:
|
|
876
|
+
subUnitId: r,
|
|
872
877
|
threadId: s == null ? void 0 : s.root.threadId
|
|
873
878
|
};
|
|
874
879
|
(u == null ? void 0 : u(H)) !== !1 && (await w.executeCommand(
|
|
875
|
-
|
|
880
|
+
st.id,
|
|
876
881
|
{
|
|
877
882
|
unitId: t,
|
|
878
|
-
subUnitId:
|
|
883
|
+
subUnitId: r,
|
|
879
884
|
comment: H
|
|
880
885
|
}
|
|
881
886
|
), R.current && (R.current.scrollTop = R.current.scrollHeight));
|
|
882
887
|
},
|
|
883
|
-
autoFocus:
|
|
888
|
+
autoFocus: j || !s,
|
|
884
889
|
onCancel: () => {
|
|
885
890
|
s || h == null || h();
|
|
886
891
|
}
|
|
887
892
|
},
|
|
888
|
-
`${
|
|
893
|
+
`${j}`
|
|
889
894
|
) })
|
|
890
895
|
]
|
|
891
896
|
}
|
|
892
897
|
);
|
|
893
|
-
},
|
|
898
|
+
}, Xt = (n) => {
|
|
894
899
|
const {
|
|
895
900
|
unitId: e,
|
|
896
901
|
subUnitId$: t,
|
|
897
|
-
type:
|
|
902
|
+
type: r,
|
|
898
903
|
onAdd: i,
|
|
899
904
|
getSubUnitName: o,
|
|
900
905
|
onResolve: c,
|
|
901
906
|
sortComments: x,
|
|
902
907
|
onItemLeave: h,
|
|
903
908
|
onItemEnter: S,
|
|
904
|
-
disableAdd:
|
|
905
|
-
tempComment:
|
|
906
|
-
onAddComment:
|
|
909
|
+
disableAdd: $,
|
|
910
|
+
tempComment: j,
|
|
911
|
+
onAddComment: U,
|
|
907
912
|
onDeleteComment: b,
|
|
908
913
|
showComments: u
|
|
909
|
-
} =
|
|
914
|
+
} = n, [v, T] = P("all"), [y, V] = P("all"), g = N(fe), O = N(pe), d = N(Se), [m, f] = P(() => d.getUnit(e)), _ = N(Y), p = Z(_.activeCommentId$), s = Z(d.commentUpdate$), w = N(ne), A = Z(t), D = te(!0), E = "panel", L = Z(O.currentUser$), J = ee(() => {
|
|
910
915
|
var H;
|
|
911
|
-
const l = v === "all" ? m : (H = m.filter((
|
|
916
|
+
const l = v === "all" ? m : (H = m.filter((k) => k.subUnitId === A)) != null ? H : [], C = x != null ? x : ((k) => k), M = l.map((k) => {
|
|
912
917
|
var B;
|
|
913
|
-
return {
|
|
918
|
+
return { ...k.root, children: (B = k.children) != null ? B : [], users: k.relativeUsers };
|
|
914
919
|
});
|
|
915
920
|
if (u) {
|
|
916
|
-
const
|
|
921
|
+
const k = /* @__PURE__ */ new Map();
|
|
917
922
|
return M.forEach((B) => {
|
|
918
|
-
|
|
919
|
-
}), [...u, ""].map((B) =>
|
|
923
|
+
k.set(B.id, B);
|
|
924
|
+
}), [...u, ""].map((B) => k.get(B)).filter(Boolean);
|
|
920
925
|
} else
|
|
921
|
-
return
|
|
922
|
-
}, [u, v, m, x, A]), R =
|
|
923
|
-
...
|
|
924
|
-
...
|
|
925
|
-
], [
|
|
926
|
-
|
|
926
|
+
return C(M);
|
|
927
|
+
}, [u, v, m, x, A]), R = ee(() => [
|
|
928
|
+
...J.filter((l) => !l.resolved),
|
|
929
|
+
...J.filter((l) => l.resolved)
|
|
930
|
+
], [J]), re = ee(() => y === "resolved" ? R.filter((l) => l.resolved) : y === "unsolved" ? R.filter((l) => !l.resolved) : y === "concern_me" && L != null && L.userID ? R.filter((l) => l == null ? void 0 : l.users.has(L.userID)) : R, [R, L == null ? void 0 : L.userID, y]), Q = j ? [j, ...re] : re, ie = Q.filter((l) => !l.resolved), oe = Q.filter((l) => l.resolved), se = y !== "all" || v !== "all", ae = () => {
|
|
931
|
+
V("all"), T("all");
|
|
927
932
|
};
|
|
928
|
-
|
|
933
|
+
ce(() => {
|
|
929
934
|
e && f(
|
|
930
935
|
d.getUnit(e)
|
|
931
936
|
);
|
|
932
|
-
}, [e, d, s]),
|
|
933
|
-
var
|
|
937
|
+
}, [e, d, s]), ce(() => {
|
|
938
|
+
var k;
|
|
934
939
|
if (!p)
|
|
935
940
|
return;
|
|
936
941
|
if (!D.current) {
|
|
937
942
|
D.current = !0;
|
|
938
943
|
return;
|
|
939
944
|
}
|
|
940
|
-
const { unitId: l, subUnitId:
|
|
941
|
-
(
|
|
945
|
+
const { unitId: l, subUnitId: C, commentId: M } = p, H = `${E}-${l}-${C}-${M}`;
|
|
946
|
+
(k = document.getElementById(H)) == null || k.scrollIntoView({ block: "center" });
|
|
942
947
|
}, [p]);
|
|
943
|
-
const
|
|
944
|
-
|
|
948
|
+
const X = (l) => /* @__PURE__ */ a(
|
|
949
|
+
Wt,
|
|
945
950
|
{
|
|
946
951
|
prefix: E,
|
|
947
952
|
getSubUnitName: o,
|
|
@@ -949,7 +954,7 @@ const Re = K((r, e) => {
|
|
|
949
954
|
unitId: l.unitId,
|
|
950
955
|
subUnitId: l.subUnitId,
|
|
951
956
|
refStr: l.ref,
|
|
952
|
-
type:
|
|
957
|
+
type: r,
|
|
953
958
|
showEdit: (p == null ? void 0 : p.commentId) === l.id,
|
|
954
959
|
showHighlight: (p == null ? void 0 : p.commentId) === l.id,
|
|
955
960
|
onClick: () => {
|
|
@@ -965,84 +970,84 @@ const Re = K((r, e) => {
|
|
|
965
970
|
},
|
|
966
971
|
onMouseEnter: () => S == null ? void 0 : S(l),
|
|
967
972
|
onMouseLeave: () => h == null ? void 0 : h(l),
|
|
968
|
-
onAddComment:
|
|
973
|
+
onAddComment: U,
|
|
969
974
|
onDeleteComment: b,
|
|
970
|
-
onResolve: (
|
|
975
|
+
onResolve: (C) => c == null ? void 0 : c(l.id, C)
|
|
971
976
|
},
|
|
972
977
|
l.id
|
|
973
978
|
);
|
|
974
979
|
return /* @__PURE__ */ I("div", { className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3", children: [
|
|
975
980
|
/* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-between", children: [
|
|
976
|
-
|
|
977
|
-
|
|
981
|
+
r === de.UNIVER_SHEET ? /* @__PURE__ */ a(
|
|
982
|
+
Ie,
|
|
978
983
|
{
|
|
979
984
|
borderless: !0,
|
|
980
985
|
value: v,
|
|
981
986
|
options: [
|
|
982
987
|
{
|
|
983
988
|
value: "current",
|
|
984
|
-
label:
|
|
989
|
+
label: g.t("threadCommentUI.filter.sheet.current")
|
|
985
990
|
},
|
|
986
991
|
{
|
|
987
992
|
value: "all",
|
|
988
|
-
label:
|
|
993
|
+
label: g.t("threadCommentUI.filter.sheet.all")
|
|
989
994
|
}
|
|
990
995
|
],
|
|
991
996
|
onChange: T
|
|
992
997
|
}
|
|
993
998
|
) : null,
|
|
994
999
|
/* @__PURE__ */ a(
|
|
995
|
-
|
|
1000
|
+
Ie,
|
|
996
1001
|
{
|
|
997
1002
|
borderless: !0,
|
|
998
1003
|
value: y,
|
|
999
1004
|
options: [
|
|
1000
1005
|
{
|
|
1001
1006
|
value: "all",
|
|
1002
|
-
label:
|
|
1007
|
+
label: g.t("threadCommentUI.filter.status.all")
|
|
1003
1008
|
},
|
|
1004
1009
|
{
|
|
1005
1010
|
value: "resolved",
|
|
1006
|
-
label:
|
|
1011
|
+
label: g.t("threadCommentUI.filter.status.resolved")
|
|
1007
1012
|
},
|
|
1008
1013
|
{
|
|
1009
1014
|
value: "unsolved",
|
|
1010
|
-
label:
|
|
1015
|
+
label: g.t("threadCommentUI.filter.status.unsolved")
|
|
1011
1016
|
},
|
|
1012
1017
|
{
|
|
1013
1018
|
value: "concern_me",
|
|
1014
|
-
label:
|
|
1019
|
+
label: g.t("threadCommentUI.filter.status.concernMe")
|
|
1015
1020
|
}
|
|
1016
1021
|
],
|
|
1017
|
-
onChange:
|
|
1022
|
+
onChange: V
|
|
1018
1023
|
}
|
|
1019
1024
|
)
|
|
1020
1025
|
] }),
|
|
1021
|
-
|
|
1026
|
+
Q.length === 0 ? /* @__PURE__ */ I(
|
|
1022
1027
|
"div",
|
|
1023
1028
|
{
|
|
1024
1029
|
className: "univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1025
1030
|
children: [
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
/* @__PURE__ */ a(
|
|
1029
|
-
|
|
1031
|
+
g.t("threadCommentUI.panel.empty"),
|
|
1032
|
+
se ? /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ a(le, { onClick: ae, children: g.t("threadCommentUI.panel.reset") }) }) : $ ? null : /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ I(le, { onClick: i, children: [
|
|
1033
|
+
/* @__PURE__ */ a(De, { className: "univer-mr-1.5" }),
|
|
1034
|
+
g.t("threadCommentUI.panel.addComment")
|
|
1030
1035
|
] }) })
|
|
1031
1036
|
]
|
|
1032
1037
|
}
|
|
1033
1038
|
) : /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3", children: [
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1039
|
+
ie.map(X),
|
|
1040
|
+
oe.length > 0 && /* @__PURE__ */ a("div", { className: "univer-text-xs", children: g.t("threadCommentUI.panel.solved") }),
|
|
1041
|
+
oe.map(X)
|
|
1037
1042
|
] })
|
|
1038
1043
|
] });
|
|
1039
1044
|
};
|
|
1040
1045
|
export {
|
|
1041
1046
|
F as SetActiveCommentOperation,
|
|
1042
|
-
|
|
1043
|
-
|
|
1047
|
+
xt as THREAD_COMMENT_PANEL,
|
|
1048
|
+
Xt as ThreadCommentPanel,
|
|
1044
1049
|
Y as ThreadCommentPanelService,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1050
|
+
Wt as ThreadCommentTree,
|
|
1051
|
+
yt as ToggleSheetCommentPanelOperation,
|
|
1052
|
+
q as UniverThreadCommentUIPlugin
|
|
1048
1053
|
};
|