@univerjs/thread-comment-ui 0.17.0 → 0.18.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 +55 -4
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +55 -1053
- package/lib/es/locale/ca-ES.js +1 -37
- package/lib/es/locale/en-US.js +1 -37
- package/lib/es/locale/es-ES.js +1 -37
- package/lib/es/locale/fa-IR.js +1 -37
- package/lib/es/locale/fr-FR.js +1 -37
- package/lib/es/locale/ja-JP.js +1 -37
- package/lib/es/locale/ko-KR.js +1 -37
- package/lib/es/locale/ru-RU.js +1 -37
- package/lib/es/locale/sk-SK.js +1 -37
- package/lib/es/locale/vi-VN.js +1 -37
- package/lib/es/locale/zh-CN.js +1 -37
- package/lib/es/locale/zh-TW.js +1 -37
- package/lib/index.css +358 -1
- package/lib/index.js +55 -1053
- package/lib/locale/ca-ES.js +1 -37
- package/lib/locale/en-US.js +1 -37
- package/lib/locale/es-ES.js +1 -37
- package/lib/locale/fa-IR.js +1 -37
- package/lib/locale/fr-FR.js +1 -37
- package/lib/locale/ja-JP.js +1 -37
- package/lib/locale/ko-KR.js +1 -37
- package/lib/locale/ru-RU.js +1 -37
- package/lib/locale/sk-SK.js +1 -37
- package/lib/locale/vi-VN.js +1 -37
- package/lib/locale/zh-CN.js +1 -37
- package/lib/locale/zh-TW.js +1 -37
- package/lib/types/commands/operations/comment.operations.d.ts +16 -1
- package/lib/types/config/config.d.ts +17 -2
- package/lib/types/locale/ca-ES.d.ts +16 -1
- package/lib/types/locale/es-ES.d.ts +16 -1
- package/lib/types/locale/fa-IR.d.ts +16 -1
- package/lib/types/locale/fr-FR.d.ts +16 -1
- package/lib/types/locale/ja-JP.d.ts +16 -1
- package/lib/types/locale/ko-KR.d.ts +16 -1
- package/lib/types/locale/ru-RU.d.ts +16 -1
- package/lib/types/locale/sk-SK.d.ts +16 -1
- package/lib/types/locale/vi-VN.d.ts +16 -1
- package/lib/types/locale/zh-CN.d.ts +16 -1
- package/lib/types/locale/zh-TW.d.ts +16 -1
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/thread-comment-panel.service.d.ts +19 -3
- package/lib/types/views/thread-comment-editor/index.d.ts +19 -3
- package/lib/types/views/thread-comment-editor/util.d.ts +17 -2
- package/lib/types/views/thread-comment-panel/index.d.ts +20 -4
- package/lib/types/views/thread-comment-tree/index.d.ts +17 -2
- package/lib/umd/index.js +55 -4
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +11 -10
package/lib/index.js
CHANGED
|
@@ -1,1053 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
xe(1, Pe)
|
|
57
|
-
], Y);
|
|
58
|
-
const xt = "thread-comment-panel", bt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", yt = {
|
|
59
|
-
id: "thread-comment-ui.operation.toggle-panel",
|
|
60
|
-
type: we.OPERATION,
|
|
61
|
-
handler(n) {
|
|
62
|
-
const e = n.get(Ne), t = n.get(Y);
|
|
63
|
-
return t.panelVisible ? (e.close(), t.setPanelVisible(!1)) : (e.open({
|
|
64
|
-
header: { title: "threadCommentUI.panel.title" },
|
|
65
|
-
children: { label: xt },
|
|
66
|
-
width: 360
|
|
67
|
-
}), t.setPanelVisible(!0)), !0;
|
|
68
|
-
}
|
|
69
|
-
}, F = {
|
|
70
|
-
id: "thread-comment-ui.operation.set-active-comment",
|
|
71
|
-
type: we.OPERATION,
|
|
72
|
-
handler(n, e) {
|
|
73
|
-
return n.get(Y).setActiveComment(e), !0;
|
|
74
|
-
}
|
|
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);
|
|
82
|
-
return i;
|
|
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(
|
|
88
|
-
{},
|
|
89
|
-
be,
|
|
90
|
-
this._config
|
|
91
|
-
);
|
|
92
|
-
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Nt, o);
|
|
93
|
-
}
|
|
94
|
-
onStarting() {
|
|
95
|
-
var n;
|
|
96
|
-
Ke([
|
|
97
|
-
[Y]
|
|
98
|
-
], (n = this._config) == null ? void 0 : n.overrides).forEach((e) => {
|
|
99
|
-
this._injector.add(e);
|
|
100
|
-
}), [yt, F].forEach((e) => {
|
|
101
|
-
this._commandService.registerCommand(e);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
};
|
|
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}`, {
|
|
118
|
-
defIds: t.defIds,
|
|
119
|
-
idSuffix: h.current
|
|
120
|
-
}, {
|
|
121
|
-
ref: n,
|
|
122
|
-
className: x,
|
|
123
|
-
...c
|
|
124
|
-
}, o);
|
|
125
|
-
}
|
|
126
|
-
function Ue(n, e, t, r, i) {
|
|
127
|
-
return z(n.tag, {
|
|
128
|
-
key: e,
|
|
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)));
|
|
132
|
-
}
|
|
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})`));
|
|
137
|
-
});
|
|
138
|
-
const { defIds: i } = e;
|
|
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;
|
|
142
|
-
}
|
|
143
|
-
function Dt(n, e) {
|
|
144
|
-
var r;
|
|
145
|
-
const { defIds: t } = e;
|
|
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) ? {
|
|
149
|
-
...i,
|
|
150
|
-
attrs: {
|
|
151
|
-
...i.attrs,
|
|
152
|
-
id: i.attrs.id + e.idSuffix
|
|
153
|
-
}
|
|
154
|
-
} : i)
|
|
155
|
-
} : n;
|
|
156
|
-
}
|
|
157
|
-
function Et() {
|
|
158
|
-
return Math.random().toString(36).substring(2, 8);
|
|
159
|
-
}
|
|
160
|
-
G.displayName = "UniverIcon";
|
|
161
|
-
const Mt = {
|
|
162
|
-
tag: "svg",
|
|
163
|
-
attrs: {
|
|
164
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
165
|
-
fill: "none",
|
|
166
|
-
viewBox: "0 0 16 16",
|
|
167
|
-
width: "1em",
|
|
168
|
-
height: "1em"
|
|
169
|
-
},
|
|
170
|
-
children: [
|
|
171
|
-
{
|
|
172
|
-
tag: "path",
|
|
173
|
-
attrs: {
|
|
174
|
-
fill: "currentColor",
|
|
175
|
-
d: "M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
tag: "path",
|
|
180
|
-
attrs: {
|
|
181
|
-
fill: "currentColor",
|
|
182
|
-
d: "M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
tag: "path",
|
|
187
|
-
attrs: {
|
|
188
|
-
fill: "currentColor",
|
|
189
|
-
d: "M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
tag: "path",
|
|
194
|
-
attrs: {
|
|
195
|
-
fill: "currentColor",
|
|
196
|
-
d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",
|
|
197
|
-
fillRule: "evenodd",
|
|
198
|
-
clipRule: "evenodd"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}, Te = K(function(e, t) {
|
|
203
|
-
return z(G, Object.assign({}, e, {
|
|
204
|
-
id: "delete-icon",
|
|
205
|
-
ref: t,
|
|
206
|
-
icon: Mt
|
|
207
|
-
}));
|
|
208
|
-
});
|
|
209
|
-
Te.displayName = "DeleteIcon";
|
|
210
|
-
const Ot = {
|
|
211
|
-
tag: "svg",
|
|
212
|
-
attrs: {
|
|
213
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
214
|
-
fill: "none",
|
|
215
|
-
viewBox: "0 0 16 16",
|
|
216
|
-
width: "1em",
|
|
217
|
-
height: "1em"
|
|
218
|
-
},
|
|
219
|
-
children: [{
|
|
220
|
-
tag: "path",
|
|
221
|
-
attrs: {
|
|
222
|
-
fill: "currentColor",
|
|
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"
|
|
224
|
-
}
|
|
225
|
-
}]
|
|
226
|
-
}, De = K(function(e, t) {
|
|
227
|
-
return z(G, Object.assign({}, e, {
|
|
228
|
-
id: "increase-icon",
|
|
229
|
-
ref: t,
|
|
230
|
-
icon: Ot
|
|
231
|
-
}));
|
|
232
|
-
});
|
|
233
|
-
De.displayName = "IncreaseIcon";
|
|
234
|
-
const Rt = {
|
|
235
|
-
tag: "svg",
|
|
236
|
-
attrs: {
|
|
237
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
238
|
-
fill: "none",
|
|
239
|
-
viewBox: "0 0 16 16",
|
|
240
|
-
width: "1em",
|
|
241
|
-
height: "1em"
|
|
242
|
-
},
|
|
243
|
-
children: [
|
|
244
|
-
{
|
|
245
|
-
tag: "path",
|
|
246
|
-
attrs: {
|
|
247
|
-
fill: "currentColor",
|
|
248
|
-
d: "M3 9C3.55228 9 4 8.55228 4 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z"
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
tag: "path",
|
|
253
|
-
attrs: {
|
|
254
|
-
fill: "currentColor",
|
|
255
|
-
d: "M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z"
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
tag: "path",
|
|
260
|
-
attrs: {
|
|
261
|
-
fill: "currentColor",
|
|
262
|
-
d: "M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z"
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
]
|
|
266
|
-
}, Ee = K(function(e, t) {
|
|
267
|
-
return z(G, Object.assign({}, e, {
|
|
268
|
-
id: "more-horizontal-icon",
|
|
269
|
-
ref: t,
|
|
270
|
-
icon: Rt
|
|
271
|
-
}));
|
|
272
|
-
});
|
|
273
|
-
Ee.displayName = "MoreHorizontalIcon";
|
|
274
|
-
const Lt = {
|
|
275
|
-
tag: "svg",
|
|
276
|
-
attrs: {
|
|
277
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
278
|
-
fill: "none",
|
|
279
|
-
viewBox: "0 0 16 16",
|
|
280
|
-
width: "1em",
|
|
281
|
-
height: "1em"
|
|
282
|
-
},
|
|
283
|
-
children: [
|
|
284
|
-
{
|
|
285
|
-
tag: "path",
|
|
286
|
-
attrs: {
|
|
287
|
-
stroke: "currentColor",
|
|
288
|
-
d: "M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",
|
|
289
|
-
strokeLinecap: "round",
|
|
290
|
-
strokeLinejoin: "round",
|
|
291
|
-
strokeWidth: 1.2
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
tag: "path",
|
|
296
|
-
attrs: {
|
|
297
|
-
stroke: "currentColor",
|
|
298
|
-
d: "M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",
|
|
299
|
-
strokeLinecap: "round",
|
|
300
|
-
strokeLinejoin: "round",
|
|
301
|
-
strokeWidth: 1.2
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
tag: "path",
|
|
306
|
-
attrs: {
|
|
307
|
-
stroke: "currentColor",
|
|
308
|
-
d: "M6.41016 6.1311H6.76813",
|
|
309
|
-
strokeLinecap: "round",
|
|
310
|
-
strokeWidth: 1.2
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
tag: "path",
|
|
315
|
-
attrs: {
|
|
316
|
-
stroke: "currentColor",
|
|
317
|
-
d: "M8.91626 6.1311H9.27424",
|
|
318
|
-
strokeLinecap: "round",
|
|
319
|
-
strokeWidth: 1.2
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
tag: "path",
|
|
324
|
-
attrs: {
|
|
325
|
-
stroke: "currentColor",
|
|
326
|
-
d: "M3.90454 6.1311H4.26252",
|
|
327
|
-
strokeLinecap: "round",
|
|
328
|
-
strokeWidth: 1.2
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
]
|
|
332
|
-
}, Me = K(function(e, t) {
|
|
333
|
-
return z(G, Object.assign({}, e, {
|
|
334
|
-
id: "reply-to-comment-icon",
|
|
335
|
-
ref: t,
|
|
336
|
-
icon: Lt
|
|
337
|
-
}));
|
|
338
|
-
});
|
|
339
|
-
Me.displayName = "ReplyToCommentIcon";
|
|
340
|
-
const Ht = {
|
|
341
|
-
tag: "svg",
|
|
342
|
-
attrs: {
|
|
343
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
344
|
-
fill: "none",
|
|
345
|
-
viewBox: "0 0 17 17",
|
|
346
|
-
width: "1em",
|
|
347
|
-
height: "1em"
|
|
348
|
-
},
|
|
349
|
-
children: [{
|
|
350
|
-
tag: "path",
|
|
351
|
-
attrs: {
|
|
352
|
-
fill: "currentColor",
|
|
353
|
-
d: "M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",
|
|
354
|
-
fillRule: "evenodd",
|
|
355
|
-
clipRule: "evenodd"
|
|
356
|
-
}
|
|
357
|
-
}]
|
|
358
|
-
}, Oe = K(function(e, t) {
|
|
359
|
-
return z(G, Object.assign({}, e, {
|
|
360
|
-
id: "resolved-icon",
|
|
361
|
-
ref: t,
|
|
362
|
-
icon: Ht
|
|
363
|
-
}));
|
|
364
|
-
});
|
|
365
|
-
Oe.displayName = "ResolvedIcon";
|
|
366
|
-
const jt = {
|
|
367
|
-
tag: "svg",
|
|
368
|
-
attrs: {
|
|
369
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
370
|
-
fill: "none",
|
|
371
|
-
viewBox: "0 0 17 17",
|
|
372
|
-
width: "1em",
|
|
373
|
-
height: "1em"
|
|
374
|
-
},
|
|
375
|
-
children: [{
|
|
376
|
-
tag: "circle",
|
|
377
|
-
attrs: {
|
|
378
|
-
cx: 8.73,
|
|
379
|
-
cy: 8.4,
|
|
380
|
-
r: 6.4,
|
|
381
|
-
stroke: "currentColor",
|
|
382
|
-
strokeWidth: 1.2
|
|
383
|
-
}
|
|
384
|
-
}, {
|
|
385
|
-
tag: "path",
|
|
386
|
-
attrs: {
|
|
387
|
-
stroke: "currentColor",
|
|
388
|
-
d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",
|
|
389
|
-
strokeLinecap: "round",
|
|
390
|
-
strokeLinejoin: "round",
|
|
391
|
-
strokeWidth: 1.2
|
|
392
|
-
}
|
|
393
|
-
}]
|
|
394
|
-
}, Re = K(function(e, t) {
|
|
395
|
-
return z(G, Object.assign({}, e, {
|
|
396
|
-
id: "solve-icon",
|
|
397
|
-
ref: t,
|
|
398
|
-
icon: jt
|
|
399
|
-
}));
|
|
400
|
-
});
|
|
401
|
-
Re.displayName = "SolveIcon";
|
|
402
|
-
function ye(n) {
|
|
403
|
-
return {
|
|
404
|
-
id: "d",
|
|
405
|
-
body: n,
|
|
406
|
-
documentStyle: {}
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
const Le = K((n, e) => {
|
|
410
|
-
var O;
|
|
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(() => {
|
|
412
|
-
var d, m, f;
|
|
413
|
-
return ve.transform.getPlainText((f = (m = (d = u.current) == null ? void 0 : d.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? f : "");
|
|
414
|
-
});
|
|
415
|
-
ce(() => {
|
|
416
|
-
var m, f, _, p;
|
|
417
|
-
y(ve.transform.getPlainText((_ = (f = (m = u.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? _ : ""));
|
|
418
|
-
const d = (p = u.current) == null ? void 0 : p.selectionChange$.subscribe(() => {
|
|
419
|
-
var s, w, A;
|
|
420
|
-
y(ve.transform.getPlainText((A = (w = (s = u.current) == null ? void 0 : s.getDocumentData().body) == null ? void 0 : w.dataStream) != null ? A : ""));
|
|
421
|
-
});
|
|
422
|
-
return () => d == null ? void 0 : d.unsubscribe();
|
|
423
|
-
}, [(O = u.current) == null ? void 0 : O.selectionChange$]);
|
|
424
|
-
const V = ee(() => ({
|
|
425
|
-
keyCodes: [{ keyCode: ge.ENTER }],
|
|
426
|
-
handler: (d) => {
|
|
427
|
-
d === ge.ENTER && S.executeCommand(
|
|
428
|
-
pt.id
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
}), [S]);
|
|
432
|
-
ht(e, () => ({
|
|
433
|
-
reply(d) {
|
|
434
|
-
var f, _;
|
|
435
|
-
if (!u.current)
|
|
436
|
-
return;
|
|
437
|
-
b.focus((f = u.current.getEditorId()) != null ? f : "");
|
|
438
|
-
const m = ye(d);
|
|
439
|
-
(_ = u.current) == null || _.setDocumentData(m, [{
|
|
440
|
-
startOffset: m.body.dataStream.length - 2,
|
|
441
|
-
endOffset: m.body.dataStream.length - 2,
|
|
442
|
-
collapsed: !0
|
|
443
|
-
}]);
|
|
444
|
-
}
|
|
445
|
-
}));
|
|
446
|
-
const g = () => {
|
|
447
|
-
if (u.current) {
|
|
448
|
-
const d = qe.deepClone(u.current.getDocumentData().body);
|
|
449
|
-
U(!1), r == null || r({
|
|
450
|
-
...t,
|
|
451
|
-
text: d
|
|
452
|
-
}), u.current.replaceText(""), setTimeout(() => {
|
|
453
|
-
var m, f;
|
|
454
|
-
(m = u.current) == null || m.setSelectionRanges([]), (f = u.current) == null || f.blur();
|
|
455
|
-
}, 10);
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
return /* @__PURE__ */ I("div", { onClick: (d) => d.preventDefault(), children: [
|
|
459
|
-
/* @__PURE__ */ a(
|
|
460
|
-
gt,
|
|
461
|
-
{
|
|
462
|
-
className: "univer-w-full",
|
|
463
|
-
editorRef: u,
|
|
464
|
-
editorId: Ye,
|
|
465
|
-
autoFocus: c,
|
|
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),
|
|
470
|
-
isSingle: !1,
|
|
471
|
-
maxHeight: 64,
|
|
472
|
-
onClickOutside: () => {
|
|
473
|
-
setTimeout(() => {
|
|
474
|
-
b.focus(v);
|
|
475
|
-
}, 30);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
),
|
|
479
|
-
j ? /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
|
480
|
-
/* @__PURE__ */ a(
|
|
481
|
-
le,
|
|
482
|
-
{
|
|
483
|
-
onClick: () => {
|
|
484
|
-
var d;
|
|
485
|
-
o == null || o(), U(!1), (d = u.current) == null || d.replaceText("", !0), S.executeCommand(F.id);
|
|
486
|
-
},
|
|
487
|
-
children: $.t("threadCommentUI.editor.cancel")
|
|
488
|
-
}
|
|
489
|
-
),
|
|
490
|
-
/* @__PURE__ */ a(
|
|
491
|
-
le,
|
|
492
|
-
{
|
|
493
|
-
variant: "primary",
|
|
494
|
-
disabled: !T,
|
|
495
|
-
onClick: g,
|
|
496
|
-
children: $.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
|
|
497
|
-
}
|
|
498
|
-
)
|
|
499
|
-
] }) : null
|
|
500
|
-
] });
|
|
501
|
-
}), Vt = (n) => {
|
|
502
|
-
const { dataStream: e, customRanges: t } = n, r = e.endsWith(`\r
|
|
503
|
-
`) ? e.length - 2 : e.length, i = [];
|
|
504
|
-
let o = 0;
|
|
505
|
-
return t == null || t.forEach((c) => {
|
|
506
|
-
o < c.startIndex && i.push({
|
|
507
|
-
type: "text",
|
|
508
|
-
content: e.slice(o, c.startIndex)
|
|
509
|
-
}), i.push({
|
|
510
|
-
type: "mention",
|
|
511
|
-
content: {
|
|
512
|
-
label: e.slice(c.startIndex, c.endIndex + 1),
|
|
513
|
-
id: c.rangeId
|
|
514
|
-
}
|
|
515
|
-
}), o = c.endIndex + 1;
|
|
516
|
-
}), i.push({
|
|
517
|
-
type: "text",
|
|
518
|
-
content: e.slice(o, r)
|
|
519
|
-
}), i;
|
|
520
|
-
}, Pt = (n) => {
|
|
521
|
-
if (!n)
|
|
522
|
-
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);
|
|
527
|
-
});
|
|
528
|
-
}, At = (n) => {
|
|
529
|
-
let e = "";
|
|
530
|
-
const t = [];
|
|
531
|
-
return n.forEach((r) => {
|
|
532
|
-
switch (r.type) {
|
|
533
|
-
case "text":
|
|
534
|
-
e += r.content;
|
|
535
|
-
break;
|
|
536
|
-
case "mention": {
|
|
537
|
-
const i = e.length;
|
|
538
|
-
e += r.content.label;
|
|
539
|
-
const o = e.length - 1;
|
|
540
|
-
t.push({
|
|
541
|
-
rangeId: r.content.id,
|
|
542
|
-
rangeType: Je.MENTION,
|
|
543
|
-
startIndex: i,
|
|
544
|
-
endIndex: o,
|
|
545
|
-
properties: {},
|
|
546
|
-
wholeEntity: !0
|
|
547
|
-
});
|
|
548
|
-
break;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}), e += `\r
|
|
552
|
-
`, {
|
|
553
|
-
textRuns: [],
|
|
554
|
-
paragraphs: [
|
|
555
|
-
{
|
|
556
|
-
startIndex: e.length - 2,
|
|
557
|
-
paragraphStyle: {}
|
|
558
|
-
}
|
|
559
|
-
],
|
|
560
|
-
sectionBreaks: [
|
|
561
|
-
{
|
|
562
|
-
startIndex: e.length - 1
|
|
563
|
-
}
|
|
564
|
-
],
|
|
565
|
-
dataStream: e,
|
|
566
|
-
customRanges: t
|
|
567
|
-
};
|
|
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,
|
|
572
|
-
{
|
|
573
|
-
unitId: t,
|
|
574
|
-
subUnitId: r,
|
|
575
|
-
commentId: e.id
|
|
576
|
-
}
|
|
577
|
-
), h && (S == null || S()));
|
|
578
|
-
};
|
|
579
|
-
return /* @__PURE__ */ I("div", { className: "univer-relative univer-mb-3 univer-pl-[30px]", onMouseLeave: () => O(!1), onMouseEnter: () => O(!0), children: [
|
|
580
|
-
/* @__PURE__ */ a(
|
|
581
|
-
"div",
|
|
582
|
-
{
|
|
583
|
-
className: "univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover univer-bg-center univer-bg-no-repeat",
|
|
584
|
-
style: {
|
|
585
|
-
backgroundImage: `url(${(v == null ? void 0 : v.avatar) || m})`
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
),
|
|
589
|
-
v ? /* @__PURE__ */ I("div", { className: "univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between", children: [
|
|
590
|
-
/* @__PURE__ */ a("div", { className: "univer-text-sm univer-font-medium univer-leading-5", children: (v == null ? void 0 : v.name) || " " }),
|
|
591
|
-
/* @__PURE__ */ I("div", { children: [
|
|
592
|
-
V || x ? null : g && v ? /* @__PURE__ */ a(
|
|
593
|
-
"div",
|
|
594
|
-
{
|
|
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",
|
|
596
|
-
onClick: () => c(v),
|
|
597
|
-
children: /* @__PURE__ */ a(Me, {})
|
|
598
|
-
}
|
|
599
|
-
) : null,
|
|
600
|
-
y && !V && !x ? /* @__PURE__ */ a(
|
|
601
|
-
mt,
|
|
602
|
-
{
|
|
603
|
-
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ I(
|
|
604
|
-
"ul",
|
|
605
|
-
{
|
|
606
|
-
className: "univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm [&_a]:univer-block [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5 [&_a]:univer-transition-colors",
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
609
|
-
"a",
|
|
610
|
-
{
|
|
611
|
-
className: "hover:univer-bg-gray-200",
|
|
612
|
-
onClick: () => o == null ? void 0 : o(!0),
|
|
613
|
-
children: b.t("threadCommentUI.item.edit")
|
|
614
|
-
}
|
|
615
|
-
) }),
|
|
616
|
-
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
617
|
-
"a",
|
|
618
|
-
{
|
|
619
|
-
className: "hover:univer-bg-gray-200",
|
|
620
|
-
onClick: f,
|
|
621
|
-
children: b.t("threadCommentUI.item.delete")
|
|
622
|
-
}
|
|
623
|
-
) })
|
|
624
|
-
]
|
|
625
|
-
}
|
|
626
|
-
) }),
|
|
627
|
-
children: /* @__PURE__ */ a(
|
|
628
|
-
"div",
|
|
629
|
-
{
|
|
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",
|
|
631
|
-
children: /* @__PURE__ */ a(Ee, {})
|
|
632
|
-
}
|
|
633
|
-
)
|
|
634
|
-
}
|
|
635
|
-
) : null
|
|
636
|
-
] })
|
|
637
|
-
] }) : null,
|
|
638
|
-
/* @__PURE__ */ a(
|
|
639
|
-
"time",
|
|
640
|
-
{
|
|
641
|
-
className: "univer-mb-1 univer-text-xs/normal univer-text-gray-600 dark:!univer-text-gray-200",
|
|
642
|
-
children: e.dT
|
|
643
|
-
}
|
|
644
|
-
),
|
|
645
|
-
i ? /* @__PURE__ */ a(
|
|
646
|
-
Le,
|
|
647
|
-
{
|
|
648
|
-
type: j,
|
|
649
|
-
id: e.id,
|
|
650
|
-
comment: e,
|
|
651
|
-
onCancel: () => o == null ? void 0 : o(!1),
|
|
652
|
-
autoFocus: !0,
|
|
653
|
-
unitId: t,
|
|
654
|
-
subUnitId: r,
|
|
655
|
-
onSave: ({ text: _, attachments: p }) => {
|
|
656
|
-
o == null || o(!1), U.executeCommand(
|
|
657
|
-
lt.id,
|
|
658
|
-
{
|
|
659
|
-
unitId: t,
|
|
660
|
-
subUnitId: r,
|
|
661
|
-
payload: {
|
|
662
|
-
commentId: e.id,
|
|
663
|
-
text: _,
|
|
664
|
-
attachments: p
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
) : /* @__PURE__ */ a(
|
|
671
|
-
"div",
|
|
672
|
-
{
|
|
673
|
-
className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
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: [
|
|
675
|
-
s.content.label,
|
|
676
|
-
" "
|
|
677
|
-
] }, w) : s.content) }, p))
|
|
678
|
-
}
|
|
679
|
-
)
|
|
680
|
-
] });
|
|
681
|
-
}, Wt = (n) => {
|
|
682
|
-
var ae, X, l;
|
|
683
|
-
const {
|
|
684
|
-
id: e,
|
|
685
|
-
unitId: t,
|
|
686
|
-
subUnitId: r,
|
|
687
|
-
refStr: i,
|
|
688
|
-
showEdit: o = !0,
|
|
689
|
-
onClick: c,
|
|
690
|
-
showHighlight: x,
|
|
691
|
-
onClose: h,
|
|
692
|
-
getSubUnitName: S,
|
|
693
|
-
prefix: $,
|
|
694
|
-
autoFocus: j,
|
|
695
|
-
onMouseEnter: U,
|
|
696
|
-
onMouseLeave: b,
|
|
697
|
-
onAddComment: u,
|
|
698
|
-
onDeleteComment: v,
|
|
699
|
-
onResolve: T,
|
|
700
|
-
type: y,
|
|
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]);
|
|
704
|
-
Z(p);
|
|
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 = [
|
|
706
|
-
...s ? [s.root] : (
|
|
707
|
-
// mock empty comment
|
|
708
|
-
[{
|
|
709
|
-
id: He,
|
|
710
|
-
text: {
|
|
711
|
-
dataStream: `
|
|
712
|
-
\r`
|
|
713
|
-
},
|
|
714
|
-
personId: (ae = E == null ? void 0 : E.userID) != null ? ae : "",
|
|
715
|
-
ref: i != null ? i : "",
|
|
716
|
-
dT: "",
|
|
717
|
-
unitId: t,
|
|
718
|
-
subUnitId: r,
|
|
719
|
-
threadId: ""
|
|
720
|
-
}]
|
|
721
|
-
),
|
|
722
|
-
...(X = s == null ? void 0 : s.children) != null ? X : []
|
|
723
|
-
], R = te(null), re = (C) => {
|
|
724
|
-
C.stopPropagation(), D ? w.executeCommand(F.id, {
|
|
725
|
-
unitId: t,
|
|
726
|
-
subUnitId: r,
|
|
727
|
-
commentId: e
|
|
728
|
-
}) : w.executeCommand(F.id), w.executeCommand(at.id, {
|
|
729
|
-
unitId: t,
|
|
730
|
-
subUnitId: r,
|
|
731
|
-
commentId: e,
|
|
732
|
-
resolved: !D
|
|
733
|
-
}), T == null || T(!D);
|
|
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,
|
|
737
|
-
{
|
|
738
|
-
unitId: t,
|
|
739
|
-
subUnitId: r,
|
|
740
|
-
commentId: e
|
|
741
|
-
}
|
|
742
|
-
), h == null || h());
|
|
743
|
-
};
|
|
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}`;
|
|
746
|
-
return /* @__PURE__ */ I(
|
|
747
|
-
"div",
|
|
748
|
-
{
|
|
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")
|
|
754
|
-
}),
|
|
755
|
-
style: V,
|
|
756
|
-
onClick: c,
|
|
757
|
-
onMouseEnter: () => {
|
|
758
|
-
U == null || U(), m(!0);
|
|
759
|
-
},
|
|
760
|
-
onMouseLeave: () => {
|
|
761
|
-
b == null || b(), m(!1);
|
|
762
|
-
},
|
|
763
|
-
children: [
|
|
764
|
-
!D && x && /* @__PURE__ */ a(
|
|
765
|
-
"div",
|
|
766
|
-
{
|
|
767
|
-
className: "univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md univer-bg-yellow-400"
|
|
768
|
-
}
|
|
769
|
-
),
|
|
770
|
-
/* @__PURE__ */ I(
|
|
771
|
-
"div",
|
|
772
|
-
{
|
|
773
|
-
className: "univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm univer-leading-5",
|
|
774
|
-
children: [
|
|
775
|
-
/* @__PURE__ */ I("div", { className: "univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden", children: [
|
|
776
|
-
/* @__PURE__ */ a(
|
|
777
|
-
"div",
|
|
778
|
-
{
|
|
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"
|
|
780
|
-
}
|
|
781
|
-
),
|
|
782
|
-
/* @__PURE__ */ a(dt, { showIfEllipsis: !0, title: se, children: /* @__PURE__ */ a(
|
|
783
|
-
"span",
|
|
784
|
-
{
|
|
785
|
-
className: "univer-flex-1 univer-truncate",
|
|
786
|
-
children: se
|
|
787
|
-
}
|
|
788
|
-
) })
|
|
789
|
-
] }),
|
|
790
|
-
!!s && /* @__PURE__ */ I("div", { className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row", children: [
|
|
791
|
-
/* @__PURE__ */ a(
|
|
792
|
-
"div",
|
|
793
|
-
{
|
|
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", {
|
|
795
|
-
"univer-text-green-500": D
|
|
796
|
-
}),
|
|
797
|
-
onClick: re,
|
|
798
|
-
children: D ? /* @__PURE__ */ a(Oe, {}) : /* @__PURE__ */ a(Re, {})
|
|
799
|
-
}
|
|
800
|
-
),
|
|
801
|
-
(E == null ? void 0 : E.userID) === s.root.personId ? /* @__PURE__ */ a(
|
|
802
|
-
"div",
|
|
803
|
-
{
|
|
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",
|
|
805
|
-
onClick: Q,
|
|
806
|
-
children: /* @__PURE__ */ a(Te, {})
|
|
807
|
-
}
|
|
808
|
-
) : null
|
|
809
|
-
] })
|
|
810
|
-
]
|
|
811
|
-
}
|
|
812
|
-
),
|
|
813
|
-
/* @__PURE__ */ a(
|
|
814
|
-
"div",
|
|
815
|
-
{
|
|
816
|
-
ref: R,
|
|
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,
|
|
821
|
-
{
|
|
822
|
-
unitId: t,
|
|
823
|
-
subUnitId: r,
|
|
824
|
-
item: C,
|
|
825
|
-
isRoot: C.id === (s == null ? void 0 : s.root.id),
|
|
826
|
-
editing: f === C.id,
|
|
827
|
-
resolved: s == null ? void 0 : s.root.resolved,
|
|
828
|
-
type: y,
|
|
829
|
-
onClose: h,
|
|
830
|
-
onEditingChange: (M) => {
|
|
831
|
-
_(M ? C.id : "");
|
|
832
|
-
},
|
|
833
|
-
onReply: (M) => {
|
|
834
|
-
M && requestAnimationFrame(() => {
|
|
835
|
-
var H;
|
|
836
|
-
(H = L.current) == null || H.reply(At([
|
|
837
|
-
{
|
|
838
|
-
type: "mention",
|
|
839
|
-
content: {
|
|
840
|
-
id: M.userID,
|
|
841
|
-
label: `@${M.name}`
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
type: "text",
|
|
846
|
-
content: " "
|
|
847
|
-
}
|
|
848
|
-
]));
|
|
849
|
-
});
|
|
850
|
-
},
|
|
851
|
-
onAddComment: u,
|
|
852
|
-
onDeleteComment: v
|
|
853
|
-
},
|
|
854
|
-
C.id
|
|
855
|
-
)
|
|
856
|
-
)
|
|
857
|
-
}
|
|
858
|
-
),
|
|
859
|
-
oe && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
860
|
-
Le,
|
|
861
|
-
{
|
|
862
|
-
ref: L,
|
|
863
|
-
type: y,
|
|
864
|
-
unitId: t,
|
|
865
|
-
subUnitId: r,
|
|
866
|
-
onSave: async ({ text: C, attachments: M }) => {
|
|
867
|
-
const H = {
|
|
868
|
-
text: C,
|
|
869
|
-
attachments: M,
|
|
870
|
-
dT: ot(),
|
|
871
|
-
id: Xe(),
|
|
872
|
-
ref: i,
|
|
873
|
-
personId: E == null ? void 0 : E.userID,
|
|
874
|
-
parentId: s == null ? void 0 : s.root.id,
|
|
875
|
-
unitId: t,
|
|
876
|
-
subUnitId: r,
|
|
877
|
-
threadId: s == null ? void 0 : s.root.threadId
|
|
878
|
-
};
|
|
879
|
-
(u == null ? void 0 : u(H)) !== !1 && (await w.executeCommand(
|
|
880
|
-
st.id,
|
|
881
|
-
{
|
|
882
|
-
unitId: t,
|
|
883
|
-
subUnitId: r,
|
|
884
|
-
comment: H
|
|
885
|
-
}
|
|
886
|
-
), R.current && (R.current.scrollTop = R.current.scrollHeight));
|
|
887
|
-
},
|
|
888
|
-
autoFocus: j || !s,
|
|
889
|
-
onCancel: () => {
|
|
890
|
-
s || h == null || h();
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
`${j}`
|
|
894
|
-
) })
|
|
895
|
-
]
|
|
896
|
-
}
|
|
897
|
-
);
|
|
898
|
-
}, Xt = (n) => {
|
|
899
|
-
const {
|
|
900
|
-
unitId: e,
|
|
901
|
-
subUnitId$: t,
|
|
902
|
-
type: r,
|
|
903
|
-
onAdd: i,
|
|
904
|
-
getSubUnitName: o,
|
|
905
|
-
onResolve: c,
|
|
906
|
-
sortComments: x,
|
|
907
|
-
onItemLeave: h,
|
|
908
|
-
onItemEnter: S,
|
|
909
|
-
disableAdd: $,
|
|
910
|
-
tempComment: j,
|
|
911
|
-
onAddComment: U,
|
|
912
|
-
onDeleteComment: b,
|
|
913
|
-
showComments: u
|
|
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(() => {
|
|
915
|
-
var H;
|
|
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) => {
|
|
917
|
-
var B;
|
|
918
|
-
return { ...k.root, children: (B = k.children) != null ? B : [], users: k.relativeUsers };
|
|
919
|
-
});
|
|
920
|
-
if (u) {
|
|
921
|
-
const k = /* @__PURE__ */ new Map();
|
|
922
|
-
return M.forEach((B) => {
|
|
923
|
-
k.set(B.id, B);
|
|
924
|
-
}), [...u, ""].map((B) => k.get(B)).filter(Boolean);
|
|
925
|
-
} else
|
|
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");
|
|
932
|
-
};
|
|
933
|
-
ce(() => {
|
|
934
|
-
e && f(
|
|
935
|
-
d.getUnit(e)
|
|
936
|
-
);
|
|
937
|
-
}, [e, d, s]), ce(() => {
|
|
938
|
-
var k;
|
|
939
|
-
if (!p)
|
|
940
|
-
return;
|
|
941
|
-
if (!D.current) {
|
|
942
|
-
D.current = !0;
|
|
943
|
-
return;
|
|
944
|
-
}
|
|
945
|
-
const { unitId: l, subUnitId: C, commentId: M } = p, H = `${E}-${l}-${C}-${M}`;
|
|
946
|
-
(k = document.getElementById(H)) == null || k.scrollIntoView({ block: "center" });
|
|
947
|
-
}, [p]);
|
|
948
|
-
const X = (l) => /* @__PURE__ */ a(
|
|
949
|
-
Wt,
|
|
950
|
-
{
|
|
951
|
-
prefix: E,
|
|
952
|
-
getSubUnitName: o,
|
|
953
|
-
id: l.id,
|
|
954
|
-
unitId: l.unitId,
|
|
955
|
-
subUnitId: l.subUnitId,
|
|
956
|
-
refStr: l.ref,
|
|
957
|
-
type: r,
|
|
958
|
-
showEdit: (p == null ? void 0 : p.commentId) === l.id,
|
|
959
|
-
showHighlight: (p == null ? void 0 : p.commentId) === l.id,
|
|
960
|
-
onClick: () => {
|
|
961
|
-
D.current = !1, l.resolved ? w.executeCommand(F.id) : w.executeCommand(
|
|
962
|
-
F.id,
|
|
963
|
-
{
|
|
964
|
-
unitId: l.unitId,
|
|
965
|
-
subUnitId: l.subUnitId,
|
|
966
|
-
commentId: l.id,
|
|
967
|
-
temp: !1
|
|
968
|
-
}
|
|
969
|
-
);
|
|
970
|
-
},
|
|
971
|
-
onMouseEnter: () => S == null ? void 0 : S(l),
|
|
972
|
-
onMouseLeave: () => h == null ? void 0 : h(l),
|
|
973
|
-
onAddComment: U,
|
|
974
|
-
onDeleteComment: b,
|
|
975
|
-
onResolve: (C) => c == null ? void 0 : c(l.id, C)
|
|
976
|
-
},
|
|
977
|
-
l.id
|
|
978
|
-
);
|
|
979
|
-
return /* @__PURE__ */ I("div", { className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3", children: [
|
|
980
|
-
/* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-between", children: [
|
|
981
|
-
r === de.UNIVER_SHEET ? /* @__PURE__ */ a(
|
|
982
|
-
Ie,
|
|
983
|
-
{
|
|
984
|
-
borderless: !0,
|
|
985
|
-
value: v,
|
|
986
|
-
options: [
|
|
987
|
-
{
|
|
988
|
-
value: "current",
|
|
989
|
-
label: g.t("threadCommentUI.filter.sheet.current")
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
value: "all",
|
|
993
|
-
label: g.t("threadCommentUI.filter.sheet.all")
|
|
994
|
-
}
|
|
995
|
-
],
|
|
996
|
-
onChange: T
|
|
997
|
-
}
|
|
998
|
-
) : null,
|
|
999
|
-
/* @__PURE__ */ a(
|
|
1000
|
-
Ie,
|
|
1001
|
-
{
|
|
1002
|
-
borderless: !0,
|
|
1003
|
-
value: y,
|
|
1004
|
-
options: [
|
|
1005
|
-
{
|
|
1006
|
-
value: "all",
|
|
1007
|
-
label: g.t("threadCommentUI.filter.status.all")
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
value: "resolved",
|
|
1011
|
-
label: g.t("threadCommentUI.filter.status.resolved")
|
|
1012
|
-
},
|
|
1013
|
-
{
|
|
1014
|
-
value: "unsolved",
|
|
1015
|
-
label: g.t("threadCommentUI.filter.status.unsolved")
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
value: "concern_me",
|
|
1019
|
-
label: g.t("threadCommentUI.filter.status.concernMe")
|
|
1020
|
-
}
|
|
1021
|
-
],
|
|
1022
|
-
onChange: V
|
|
1023
|
-
}
|
|
1024
|
-
)
|
|
1025
|
-
] }),
|
|
1026
|
-
Q.length === 0 ? /* @__PURE__ */ I(
|
|
1027
|
-
"div",
|
|
1028
|
-
{
|
|
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",
|
|
1030
|
-
children: [
|
|
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")
|
|
1035
|
-
] }) })
|
|
1036
|
-
]
|
|
1037
|
-
}
|
|
1038
|
-
) : /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3", children: [
|
|
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)
|
|
1042
|
-
] })
|
|
1043
|
-
] });
|
|
1044
|
-
};
|
|
1045
|
-
export {
|
|
1046
|
-
F as SetActiveCommentOperation,
|
|
1047
|
-
xt as THREAD_COMMENT_PANEL,
|
|
1048
|
-
Xt as ThreadCommentPanel,
|
|
1049
|
-
Y as ThreadCommentPanelService,
|
|
1050
|
-
Wt as ThreadCommentTree,
|
|
1051
|
-
yt as ToggleSheetCommentPanelOperation,
|
|
1052
|
-
q as UniverThreadCommentUIPlugin
|
|
1053
|
-
};
|
|
1
|
+
import{BuildTextUtils as e,CommandType as t,CustomRangeType as n,DOCS_COMMENT_EDITOR_UNIT_ID_KEY as r,DOCS_NORMAL_EDITOR_UNIT_ID_KEY as i,DependentOn as a,Disposable as o,ICommandService as s,IConfigService as c,IUniverInstanceService as l,Inject as u,Injector as d,LocaleService as f,Plugin as p,Tools as m,UniverInstanceType as h,UserManagerService as g,generateRandomId as _,getBodySlice as v,merge as y,mergeOverrideWithDependencies as b}from"@univerjs/core";import{ISidebarService as x,KeyCode as S,UI_PLUGIN_CONFIG_KEY as C,useConfigValue as w,useDependency as T,useObservable as E}from"@univerjs/ui";import{BehaviorSubject as D,debounceTime as O,filter as k}from"rxjs";import{AddCommentCommand as A,DeleteCommentCommand as ee,DeleteCommentTreeCommand as j,ResolveCommentCommand as te,ThreadCommentModel as ne,UniverThreadCommentPlugin as M,UpdateCommentCommand as N,getDT as P}from"@univerjs/thread-comment";import{Button as F,Dropdown as I,Select as L,Tooltip as R,borderClassName as re,clsx as z,scrollbarClassName as ie}from"@univerjs/design";import{DeleteIcon as ae,IncreaseIcon as oe,MoreHorizontalIcon as B,ReplyToCommentIcon as V,ResolvedIcon as se,SolveIcon as ce}from"@univerjs/icons";import{forwardRef as le,useEffect as H,useImperativeHandle as ue,useMemo as U,useRef as de,useState as W}from"react";import{BreakLineCommand as G,IEditorService as fe,RichTextEditor as pe}from"@univerjs/docs-ui";import{jsx as K,jsxs as q}from"react/jsx-runtime";function J(e){"@babel/helpers - typeof";return J=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},J(e)}function me(e,t){if(J(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(J(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function he(e){var t=me(e,`string`);return J(t)==`symbol`?t:t+``}function Y(e,t,n){return(t=he(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(e,t){return function(n,r){t(n,r,e)}}function ge(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let Z=class extends o{constructor(e,t){super(),this._sidebarService=e,this._univerInstanceService=t,Y(this,`_panelVisible`,!1),Y(this,`_panelVisible$`,new D(!1)),Y(this,`_activeCommentId`,void 0),Y(this,`_activeCommentId$`,new D(void 0)),Y(this,`panelVisible$`,this._panelVisible$.asObservable()),Y(this,`activeCommentId$`,this._activeCommentId$.asObservable()),this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(h.UNIVER_SHEET).pipe(k(e=>!e)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(e){this._panelVisible=e,this._panelVisible$.next(e)}setActiveComment(e){this._activeCommentId=e,this._activeCommentId$.next(e)}};Z=ge([X(0,u(x)),X(1,l)],Z);const _e=`thread-comment-panel`,ve={id:`thread-comment-ui.operation.toggle-panel`,type:t.OPERATION,handler(e){let t=e.get(x),n=e.get(Z);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):(t.open({header:{title:`threadCommentUI.panel.title`},children:{label:_e},width:360}),n.setPanelVisible(!0)),!0}},Q={id:`thread-comment-ui.operation.set-active-comment`,type:t.OPERATION,handler(e,t){return e.get(Z).setActiveComment(t),!0}};var ye=`@univerjs/thread-comment-ui`,be=`0.18.0`;const xe=`thread-comment-ui.config`;Symbol(xe);const Se={};let $=class extends p{constructor(e=Se,t,n,r){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=r;let{menu:i,...a}=y({},Se,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(xe,a)}onStarting(){var e;b([[Z]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[ve,Q].forEach(e=>{this._commandService.registerCommand(e)})}};Y($,`pluginName`,`UNIVER_THREAD_COMMENT_UI_PLUGIN`),Y($,`packageName`,ye),Y($,`version`,be),Y($,`type`,h.UNIVER_UNKNOWN),$=ge([a(M),X(1,u(d)),X(2,s),X(3,c)],$);function Ce(e){return{id:`d`,body:e,documentStyle:{}}}const we=le((t,n)=>{var a;let{comment:o,onSave:c,id:l,onCancel:u,autoFocus:d,unitId:p,type:g}=t,_=T(s),v=T(f),[y,b]=W(!1),x=T(fe),C=de(null),w=g===h.UNIVER_DOC?i:p,[E,D]=W(()=>{var t,n;return e.transform.getPlainText((t=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:t)});H(()=>{var t,n,r;D(e.transform.getPlainText((t=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:t));let i=(r=C.current)==null?void 0:r.selectionChange$.subscribe(()=>{var t,n;D(e.transform.getPlainText((t=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:t))});return()=>i==null?void 0:i.unsubscribe()},[(a=C.current)==null?void 0:a.selectionChange$]);let O=U(()=>({keyCodes:[{keyCode:S.ENTER}],handler:e=>{e===S.ENTER&&_.executeCommand(G.id)}}),[_]);return ue(n,()=>({reply(e){var t,n;if(!C.current)return;x.focus((t=C.current.getEditorId())==null?``:t);let r=Ce(e);(n=C.current)==null||n.setDocumentData(r,[{startOffset:r.body.dataStream.length-2,endOffset:r.body.dataStream.length-2,collapsed:!0}])}})),q(`div`,{onClick:e=>e.preventDefault(),children:[K(pe,{className:`univer-w-full`,editorRef:C,editorId:r,autoFocus:d,keyboardEventConfig:O,placeholder:v.t(`threadCommentUI.editor.placeholder`),initialValue:(o==null?void 0:o.text)&&Ce(o.text),onFocusChange:e=>e&&b(e),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{x.focus(w)},30)}}),y?q(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[K(F,{onClick:()=>{var e;u==null||u(),b(!1),(e=C.current)==null||e.replaceText(``,!0),_.executeCommand(Q.id)},children:v.t(`threadCommentUI.editor.cancel`)}),K(F,{variant:`primary`,disabled:!E,onClick:()=>{if(C.current){let e=m.deepClone(C.current.getDocumentData().body);b(!1),c==null||c({...o,text:e}),C.current.replaceText(``),setTimeout(()=>{var e,t;(e=C.current)==null||e.setSelectionRanges([]),(t=C.current)==null||t.blur()},10)}},children:v.t(l?`threadCommentUI.editor.save`:`threadCommentUI.editor.reply`)})]}):null]})}),Te=e=>{let{dataStream:t,customRanges:n}=e,r=t.endsWith(`\r
|
|
2
|
+
`)?t.length-2:t.length,i=[],a=0;return n==null||n.forEach(e=>{a<e.startIndex&&i.push({type:`text`,content:t.slice(a,e.startIndex)}),i.push({type:`mention`,content:{label:t.slice(e.startIndex,e.endIndex+1),id:e.rangeId}}),a=e.endIndex+1}),i.push({type:`text`,content:t.slice(a,r)}),i},Ee=e=>{if(!e)return[];let{paragraphs:t=[]}=e;return t.map((n,r)=>Te(v(e,r===0?0:t[r-1].startIndex+1,n.startIndex)))},De=e=>{let t=``,r=[];return e.forEach(e=>{switch(e.type){case`text`:t+=e.content;break;case`mention`:{let i=t.length;t+=e.content.label;let a=t.length-1;r.push({rangeId:e.content.id,rangeType:n.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}default:break}}),t+=`\r
|
|
3
|
+
`,{textRuns:[],paragraphs:[{startIndex:t.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:t.length-1}],dataStream:t,customRanges:r}},Oe=`__mock__`,ke=e=>{let{item:t,unitId:n,subUnitId:r,editing:i,onEditingChange:a,onReply:o,resolved:c,isRoot:l,onClose:u,onDeleteComment:d,type:p}=e,m=T(s),h=T(f),_=T(g),v=_.getUser(t.personId),y=E(_.currentUser$),b=(y==null?void 0:y.userID)===t.personId,x=t.id===Oe,[S,D]=W(!1),O=w(C),k=O==null?void 0:O.avatarFallback;return q(`div`,{className:`univer-relative univer-mb-3 univer-pl-[30px]`,onMouseLeave:()=>D(!1),onMouseEnter:()=>D(!0),children:[K(`div`,{className:`
|
|
4
|
+
univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover
|
|
5
|
+
univer-bg-center univer-bg-no-repeat
|
|
6
|
+
`,style:{backgroundImage:`url(${(v==null?void 0:v.avatar)||k})`}}),v?q(`div`,{className:`univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between`,children:[K(`div`,{className:`univer-text-sm univer-font-medium univer-leading-5`,children:(v==null?void 0:v.name)||` `}),q(`div`,{children:[x||c?null:S&&v?K(`div`,{className:`
|
|
7
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
8
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
9
|
+
univer-text-base
|
|
10
|
+
hover:univer-bg-gray-50
|
|
11
|
+
`,onClick:()=>o(v),children:K(V,{})}):null,b&&!x&&!c?K(I,{overlay:K(`div`,{className:`univer-rounded-lg`,children:q(`ul`,{className:`
|
|
12
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
13
|
+
univer-p-1.5 univer-text-sm
|
|
14
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
15
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
16
|
+
[&_a]:univer-transition-colors
|
|
17
|
+
`,children:[K(`li`,{children:K(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>a==null?void 0:a(!0),children:h.t(`threadCommentUI.item.edit`)})}),K(`li`,{children:K(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>{(d==null?void 0:d(t))!==!1&&(m.executeCommand(l?j.id:ee.id,{unitId:n,subUnitId:r,commentId:t.id}),l&&(u==null||u()))},children:h.t(`threadCommentUI.item.delete`)})})]})}),children:K(`div`,{className:`
|
|
18
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
19
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
20
|
+
univer-text-base
|
|
21
|
+
hover:univer-bg-gray-50
|
|
22
|
+
`,children:K(B,{})})}):null]})]}):null,K(`time`,{className:`
|
|
23
|
+
univer-mb-1 univer-text-xs/normal univer-text-gray-600
|
|
24
|
+
dark:!univer-text-gray-200
|
|
25
|
+
`,children:t.dT}),i?K(we,{type:p,id:t.id,comment:t,onCancel:()=>a==null?void 0:a(!1),autoFocus:!0,unitId:n,subUnitId:r,onSave:({text:e,attachments:i})=>{a==null||a(!1),m.executeCommand(N.id,{unitId:n,subUnitId:r,payload:{commentId:t.id,text:e,attachments:i}})}}):K(`div`,{className:`
|
|
26
|
+
univer-text-sm univer-text-gray-900
|
|
27
|
+
dark:!univer-text-white
|
|
28
|
+
`,children:Ee(t.text).map((e,t)=>K(`div`,{className:`univer-break-words`,children:e.map((e,t)=>{switch(e.type){case`mention`:return q(`a`,{className:`univer-text-primary-600`,children:[e.content.label,` `]},t);default:return e.content}})},t))})]})},Ae=e=>{var t,n,r;let{id:i,unitId:a,subUnitId:o,refStr:c,showEdit:l=!0,onClick:u,showHighlight:d,onClose:f,getSubUnitName:p,prefix:m,autoFocus:h,onMouseEnter:v,onMouseLeave:y,onAddComment:b,onDeleteComment:x,onResolve:S,type:C,style:w,full:D}=e,k=T(ne),[ee,M]=W(!1),[N,F]=W(``);E(U(()=>k.commentUpdate$.pipe(O(16)),[k]));let I=i?k.getCommentWithChildren(a,o,i):null,L=T(s),oe=T(g),B=I==null?void 0:I.root.resolved,V=E(oe.currentUser$),le=de(null),ue=[...I?[I.root]:[{id:Oe,text:{dataStream:`
|
|
29
|
+
\r`},personId:(t=V==null?void 0:V.userID)==null?``:t,ref:c==null?``:c,dT:``,unitId:a,subUnitId:o,threadId:``}],...(n=I==null?void 0:I.children)==null?[]:n],G=de(null),fe=e=>{e.stopPropagation(),B?L.executeCommand(Q.id,{unitId:a,subUnitId:o,commentId:i}):L.executeCommand(Q.id),L.executeCommand(te.id,{unitId:a,subUnitId:o,commentId:i,resolved:!B}),S==null||S(!B)},pe=e=>{e.stopPropagation(),L.executeCommand(Q.id),!(I!=null&&I.root&&(x==null?void 0:x(I.root))===!1)&&(L.executeCommand(j.id,{unitId:a,subUnitId:o,commentId:i}),f==null||f())};H(()=>y==null?void 0:y(),[]);let J=p((r=I==null?void 0:I.root.subUnitId)==null?o:r),me=l&&!N&&!B,he=`${c||(I==null?void 0:I.root.ref)||``}${J?` · `:``}${J}`;return q(`div`,{id:`${m}-${a}-${o}-${i}`,className:z(`
|
|
30
|
+
univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4
|
|
31
|
+
dark:!univer-bg-gray-900 dark:!univer-text-white
|
|
32
|
+
`,re,{"univer-w-[278px]":!D,"univer-w-full":D,"univer-shadow":!B&&(d||ee||m===`cell`)}),style:w,onClick:u,onMouseEnter:()=>{v==null||v(),M(!0)},onMouseLeave:()=>{y==null||y(),M(!1)},children:[!B&&d&&K(`div`,{className:`
|
|
33
|
+
univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
|
|
34
|
+
univer-bg-yellow-400
|
|
35
|
+
`}),q(`div`,{className:`
|
|
36
|
+
univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm
|
|
37
|
+
univer-leading-5
|
|
38
|
+
`,children:[q(`div`,{className:`univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden`,children:[K(`div`,{className:`
|
|
39
|
+
univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
|
|
40
|
+
univer-rounded-sm univer-bg-yellow-500
|
|
41
|
+
`}),K(R,{showIfEllipsis:!0,title:he,children:K(`span`,{className:`univer-flex-1 univer-truncate`,children:he})})]}),!!I&&q(`div`,{className:`univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row`,children:[K(`div`,{className:z(`
|
|
42
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center
|
|
43
|
+
univer-justify-center univer-rounded-[3px] univer-text-base
|
|
44
|
+
hover:univer-bg-gray-50
|
|
45
|
+
dark:hover:!univer-bg-gray-800
|
|
46
|
+
`,{"univer-text-green-500":B}),onClick:fe,children:K(B?se:ce,{})}),(V==null?void 0:V.userID)===I.root.personId?K(`div`,{className:`
|
|
47
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
48
|
+
univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base
|
|
49
|
+
hover:univer-bg-gray-50
|
|
50
|
+
dark:hover:!univer-bg-gray-800
|
|
51
|
+
`,onClick:pe,children:K(ae,{})}):null]})]}),K(`div`,{ref:G,className:z(`univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden`,ie),children:ue.map(e=>K(ke,{unitId:a,subUnitId:o,item:e,isRoot:e.id===(I==null?void 0:I.root.id),editing:N===e.id,resolved:I==null?void 0:I.root.resolved,type:C,onClose:f,onEditingChange:t=>{F(t?e.id:``)},onReply:e=>{e&&requestAnimationFrame(()=>{var t;(t=le.current)==null||t.reply(De([{type:`mention`,content:{id:e.userID,label:`@${e.name}`}},{type:`text`,content:` `}]))})},onAddComment:b,onDeleteComment:x},e.id))}),me&&K(`div`,{children:K(we,{ref:le,type:C,unitId:a,subUnitId:o,onSave:async({text:e,attachments:t})=>{if(!(V!=null&&V.userID)||!(I!=null&&I.root))throw Error(`[ThreadCommentTree] No current user or root comment found`);let n={text:e,attachments:t,dT:P(),id:_(),ref:c,personId:V==null?void 0:V.userID,parentId:I==null?void 0:I.root.id,unitId:a,subUnitId:o,threadId:I==null?void 0:I.root.threadId};(b==null?void 0:b(n))!==!1&&(await L.executeCommand(A.id,{unitId:a,subUnitId:o,comment:n}),G.current&&(G.current.scrollTop=G.current.scrollHeight))},autoFocus:h||!I,onCancel:()=>{I||f==null||f()}},`${h}`)})]})},je=e=>{let{unitId:t,subUnitId$:n,type:r,onAdd:i,getSubUnitName:a,onResolve:o,sortComments:c,onItemLeave:l,onItemEnter:u,disableAdd:d,tempComment:p,onAddComment:m,onDeleteComment:_,showComments:v}=e,[y,b]=W(`all`),[x,S]=W(`all`),C=T(f),w=T(g),D=T(ne),[O,k]=W(()=>D.getUnit(t)),A=E(T(Z).activeCommentId$),ee=E(D.commentUpdate$),j=T(s),te=E(n),M=de(!0),N=`panel`,P=E(w.currentUser$),I=U(()=>{var e;let t=y===`all`?O:(e=O.filter(e=>e.subUnitId===te))==null?[]:e,n=c==null?(e=>e):c,r=t.map(e=>{var t;return{...e.root,children:(t=e.children)==null?[]:t,users:e.relativeUsers}});if(v){let e=new Map;return r.forEach(t=>{e.set(t.id,t)}),[...v,``].map(t=>e.get(t)).filter(Boolean)}else return n(r)},[v,y,O,c,te]),R=U(()=>[...I.filter(e=>!e.resolved),...I.filter(e=>e.resolved)],[I]),re=U(()=>x===`resolved`?R.filter(e=>e.resolved):x===`unsolved`?R.filter(e=>!e.resolved):x===`concern_me`&&P!=null&&P.userID?R.filter(e=>e==null?void 0:e.users.has(P.userID)):R,[R,P==null?void 0:P.userID,x]),z=p?[p,...re]:re,ie=z.filter(e=>!e.resolved),ae=z.filter(e=>e.resolved),B=x!==`all`||y!==`all`,V=()=>{S(`all`),b(`all`)};H(()=>{t&&k(D.getUnit(t))},[t,D,ee]),H(()=>{var e;if(!A)return;if(!M.current){M.current=!0;return}let{unitId:t,subUnitId:n,commentId:r}=A,i=`${N}-${t}-${n}-${r}`;(e=document.getElementById(i))==null||e.scrollIntoView({block:`center`})},[A]);let se=e=>K(Ae,{prefix:N,getSubUnitName:a,id:e.id,unitId:e.unitId,subUnitId:e.subUnitId,refStr:e.ref,type:r,showEdit:(A==null?void 0:A.commentId)===e.id,showHighlight:(A==null?void 0:A.commentId)===e.id,onClick:()=>{M.current=!1,e.resolved?j.executeCommand(Q.id):j.executeCommand(Q.id,{unitId:e.unitId,subUnitId:e.subUnitId,commentId:e.id,temp:!1})},onMouseEnter:()=>u==null?void 0:u(e),onMouseLeave:()=>l==null?void 0:l(e),onAddComment:m,onDeleteComment:_,onResolve:t=>o==null?void 0:o(e.id,t)},e.id);return q(`div`,{className:`univer-flex univer-min-h-full univer-flex-col univer-pb-3`,children:[q(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-between`,children:[r===h.UNIVER_SHEET?K(L,{borderless:!0,value:y,options:[{value:`current`,label:C.t(`threadCommentUI.filter.sheet.current`)},{value:`all`,label:C.t(`threadCommentUI.filter.sheet.all`)}],onChange:b}):null,K(L,{borderless:!0,value:x,options:[{value:`all`,label:C.t(`threadCommentUI.filter.status.all`)},{value:`resolved`,label:C.t(`threadCommentUI.filter.status.resolved`)},{value:`unsolved`,label:C.t(`threadCommentUI.filter.status.unsolved`)},{value:`concern_me`,label:C.t(`threadCommentUI.filter.status.concernMe`)}],onChange:S})]}),z.length===0?q(`div`,{className:`
|
|
52
|
+
univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center
|
|
53
|
+
univer-text-sm univer-text-gray-600
|
|
54
|
+
dark:!univer-text-gray-200
|
|
55
|
+
`,children:[C.t(`threadCommentUI.panel.empty`),B?K(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:K(F,{onClick:V,children:C.t(`threadCommentUI.panel.reset`)})}):d?null:K(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:q(F,{onClick:i,children:[K(oe,{className:`univer-mr-1.5`}),C.t(`threadCommentUI.panel.addComment`)]})})]}):q(`div`,{className:`univer-mt-3 univer-flex univer-flex-col univer-gap-3`,children:[ie.map(se),ae.length>0&&K(`div`,{className:`univer-text-xs`,children:C.t(`threadCommentUI.panel.solved`)}),ae.map(se)]})]})};export{Q as SetActiveCommentOperation,_e as THREAD_COMMENT_PANEL,je as ThreadCommentPanel,Z as ThreadCommentPanelService,Ae as ThreadCommentTree,ve as ToggleSheetCommentPanelOperation,$ as UniverThreadCommentUIPlugin};
|