@univerjs/thread-comment-ui 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +812 -0
- package/lib/locale/en-US.js +36 -0
- package/lib/locale/fa-IR.js +36 -0
- package/lib/locale/fr-FR.js +36 -0
- package/lib/locale/ru-RU.js +36 -0
- package/lib/locale/vi-VN.js +36 -0
- package/lib/locale/zh-CN.js +36 -0
- package/lib/locale/zh-TW.js +36 -0
- package/package.json +9 -9
package/lib/index.js
ADDED
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Ae = (t, e, n) => e in t ? je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var B = (t, e, n) => Ae(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Inject as Ne, IUniverInstanceService as Be, Disposable as We, UniverInstanceType as he, CommandType as Te, DependentOn as Fe, Injector as ze, ICommandService as ie, IConfigService as Ze, Plugin as Ke, merge as Ge, mergeOverrideWithDependencies as Ye, LocaleService as fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as qe, BuildTextUtils as Ce, Tools as Je, CustomRangeType as Qe, getBodySlice as Xe, UserManagerService as pe, generateRandomId as et } from "@univerjs/core";
|
|
5
|
+
import { UniverThreadCommentPlugin as tt, ThreadCommentModel as Ue, getDT as nt, AddCommentCommand as rt, ResolveCommentCommand as it, DeleteCommentTreeCommand as Ee, UpdateCommentCommand as ot, DeleteCommentCommand as at } from "@univerjs/thread-comment";
|
|
6
|
+
import { ISidebarService as Oe, useDependency as N, KeyCode as ge, useObservable as W } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as Ie, filter as st, debounceTime as lt } from "rxjs";
|
|
8
|
+
import { jsxs as S, jsx as l } from "react/jsx-runtime";
|
|
9
|
+
import { Button as ce, clsx as dt, Tooltip as ct, Dropdown as mt, Select as be } from "@univerjs/design";
|
|
10
|
+
import { forwardRef as j, useRef as re, createElement as z, useState as V, useEffect as me, useMemo as ne, useImperativeHandle as ut } from "react";
|
|
11
|
+
import { IEditorService as ht, BreakLineCommand as Ct, RichTextEditor as vt } from "@univerjs/docs-ui";
|
|
12
|
+
var ft = Object.getOwnPropertyDescriptor, pt = (t, e, n, r) => {
|
|
13
|
+
for (var i = r > 1 ? void 0 : r ? ft(e, n) : e, a = t.length - 1, d; a >= 0; a--)
|
|
14
|
+
(d = t[a]) && (i = d(i) || i);
|
|
15
|
+
return i;
|
|
16
|
+
}, Se = (t, e) => (n, r) => e(n, r, t);
|
|
17
|
+
let Y = class extends We {
|
|
18
|
+
constructor(e, n) {
|
|
19
|
+
super();
|
|
20
|
+
B(this, "_panelVisible", !1);
|
|
21
|
+
B(this, "_panelVisible$", new Ie(!1));
|
|
22
|
+
B(this, "_activeCommentId");
|
|
23
|
+
B(this, "_activeCommentId$", new Ie(void 0));
|
|
24
|
+
B(this, "panelVisible$", this._panelVisible$.asObservable());
|
|
25
|
+
B(this, "activeCommentId$", this._activeCommentId$.asObservable());
|
|
26
|
+
this._sidebarService = e, this._univerInstanceService = n, this._init(), this.disposeWithMe(() => {
|
|
27
|
+
this._activeCommentId$.complete(), this._panelVisible$.complete();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
_init() {
|
|
31
|
+
this.disposeWithMe(
|
|
32
|
+
this._sidebarService.sidebarOptions$.subscribe((e) => {
|
|
33
|
+
e.visible || this.setPanelVisible(!1);
|
|
34
|
+
})
|
|
35
|
+
), this.disposeWithMe(
|
|
36
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(st((e) => !e)).subscribe(() => {
|
|
37
|
+
this._sidebarService.close();
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
get panelVisible() {
|
|
42
|
+
return this._panelVisible;
|
|
43
|
+
}
|
|
44
|
+
get activeCommentId() {
|
|
45
|
+
return this._activeCommentId;
|
|
46
|
+
}
|
|
47
|
+
setPanelVisible(e) {
|
|
48
|
+
this._panelVisible = e, this._panelVisible$.next(e);
|
|
49
|
+
}
|
|
50
|
+
setActiveComment(e) {
|
|
51
|
+
this._activeCommentId = e, this._activeCommentId$.next(e);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
Y = pt([
|
|
55
|
+
Se(0, Ne(Oe)),
|
|
56
|
+
Se(1, Be)
|
|
57
|
+
], Y);
|
|
58
|
+
const gt = "thread-comment-panel", It = "UNIVER_THREAD_COMMENT_UI_PLUGIN", bt = {
|
|
59
|
+
id: "thread-comment-ui.operation.toggle-panel",
|
|
60
|
+
type: Te.OPERATION,
|
|
61
|
+
handler(t) {
|
|
62
|
+
const e = t.get(Oe), n = t.get(Y);
|
|
63
|
+
return n.panelVisible ? (e.close(), n.setPanelVisible(!1)) : (e.open({
|
|
64
|
+
header: { title: "threadCommentUI.panel.title" },
|
|
65
|
+
children: { label: gt },
|
|
66
|
+
width: 330
|
|
67
|
+
}), n.setPanelVisible(!0)), !0;
|
|
68
|
+
}
|
|
69
|
+
}, F = {
|
|
70
|
+
id: "thread-comment-ui.operation.set-active-comment",
|
|
71
|
+
type: Te.OPERATION,
|
|
72
|
+
handler(t, e) {
|
|
73
|
+
return t.get(Y).setActiveComment(e), !0;
|
|
74
|
+
}
|
|
75
|
+
}, St = "thread-comment-ui.config", ye = {};
|
|
76
|
+
var yt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, xt = (t, e, n) => e in t ? yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Nt = (t, e, n, r) => {
|
|
77
|
+
for (var i = r > 1 ? void 0 : r ? _t(e, n) : e, a = t.length - 1, d; a >= 0; a--)
|
|
78
|
+
(d = t[a]) && (i = d(i) || i);
|
|
79
|
+
return i;
|
|
80
|
+
}, ve = (t, e) => (n, r) => e(n, r, t), Pe = (t, e, n) => xt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
81
|
+
let ue = class extends Ke {
|
|
82
|
+
constructor(t = ye, e, n, r) {
|
|
83
|
+
super(), this._config = t, this._injector = e, this._commandService = n, this._configService = r;
|
|
84
|
+
const { menu: i, ...a } = Ge(
|
|
85
|
+
{},
|
|
86
|
+
ye,
|
|
87
|
+
this._config
|
|
88
|
+
);
|
|
89
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(St, a);
|
|
90
|
+
}
|
|
91
|
+
onStarting() {
|
|
92
|
+
var t;
|
|
93
|
+
Ye([
|
|
94
|
+
[Y]
|
|
95
|
+
], (t = this._config) == null ? void 0 : t.overrides).forEach((e) => {
|
|
96
|
+
this._injector.add(e);
|
|
97
|
+
}), [bt, F].forEach((e) => {
|
|
98
|
+
this._commandService.registerCommand(e);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
Pe(ue, "pluginName", It);
|
|
103
|
+
Pe(ue, "type", he.UNIVER_UNKNOWN);
|
|
104
|
+
ue = Nt([
|
|
105
|
+
Fe(tt),
|
|
106
|
+
ve(1, Ne(ze)),
|
|
107
|
+
ve(2, ie),
|
|
108
|
+
ve(3, Ze)
|
|
109
|
+
], ue);
|
|
110
|
+
var H = function() {
|
|
111
|
+
return H = Object.assign || function(t) {
|
|
112
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
113
|
+
e = arguments[n];
|
|
114
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
115
|
+
}
|
|
116
|
+
return t;
|
|
117
|
+
}, H.apply(this, arguments);
|
|
118
|
+
}, Tt = function(t, e) {
|
|
119
|
+
var n = {};
|
|
120
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
121
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
122
|
+
for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++)
|
|
123
|
+
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
|
|
124
|
+
return n;
|
|
125
|
+
}, Z = j(function(t, e) {
|
|
126
|
+
var n = t.icon, r = t.id, i = t.className, a = t.extend, d = Tt(t, ["icon", "id", "className", "extend"]), C = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), g = re("_".concat(Ot()));
|
|
127
|
+
return $e(n, "".concat(r), { defIds: n.defIds, idSuffix: g.current }, H({ ref: e, className: C }, d), a);
|
|
128
|
+
});
|
|
129
|
+
function $e(t, e, n, r, i) {
|
|
130
|
+
return z(t.tag, H(H({ key: e }, Ut(t, n, i)), r), (Et(t, n).children || []).map(function(a, d) {
|
|
131
|
+
return $e(a, "".concat(e, "-").concat(t.tag, "-").concat(d), n, void 0, i);
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
function Ut(t, e, n) {
|
|
135
|
+
var r = H({}, t.attrs);
|
|
136
|
+
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1), t.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(function(a) {
|
|
137
|
+
var d = a[0], C = a[1];
|
|
138
|
+
d === "mask" && typeof C == "string" && (r[d] = C.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
139
|
+
});
|
|
140
|
+
var i = e.defIds;
|
|
141
|
+
return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(a) {
|
|
142
|
+
var d = a[0], C = a[1];
|
|
143
|
+
typeof C == "string" && (r[d] = C.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
144
|
+
})), r;
|
|
145
|
+
}
|
|
146
|
+
function Et(t, e) {
|
|
147
|
+
var n, r = e.defIds;
|
|
148
|
+
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? H(H({}, t), { children: t.children.map(function(i) {
|
|
149
|
+
return typeof i.attrs.id == "string" && r && r.indexOf(i.attrs.id) > -1 ? H(H({}, i), { attrs: H(H({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
|
|
150
|
+
}) }) : t;
|
|
151
|
+
}
|
|
152
|
+
function Ot() {
|
|
153
|
+
return Math.random().toString(36).substring(2, 8);
|
|
154
|
+
}
|
|
155
|
+
Z.displayName = "UniverIcon";
|
|
156
|
+
var Pt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, De = j(function(t, e) {
|
|
157
|
+
return z(Z, Object.assign({}, t, {
|
|
158
|
+
id: "delete-single",
|
|
159
|
+
ref: e,
|
|
160
|
+
icon: Pt
|
|
161
|
+
}));
|
|
162
|
+
});
|
|
163
|
+
De.displayName = "DeleteSingle";
|
|
164
|
+
var $t = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }] }, He = j(function(t, e) {
|
|
165
|
+
return z(Z, Object.assign({}, t, {
|
|
166
|
+
id: "increase-single",
|
|
167
|
+
ref: e,
|
|
168
|
+
icon: $t
|
|
169
|
+
}));
|
|
170
|
+
});
|
|
171
|
+
He.displayName = "IncreaseSingle";
|
|
172
|
+
var Dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, Me = j(function(t, e) {
|
|
173
|
+
return z(Z, Object.assign({}, t, {
|
|
174
|
+
id: "more-horizontal-single",
|
|
175
|
+
ref: e,
|
|
176
|
+
icon: Dt
|
|
177
|
+
}));
|
|
178
|
+
});
|
|
179
|
+
Me.displayName = "MoreHorizontalSingle";
|
|
180
|
+
var Ht = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", 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", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", 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", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252", strokeLinecap: "round", strokeWidth: 1.2 } }] }, ke = j(function(t, e) {
|
|
181
|
+
return z(Z, Object.assign({}, t, {
|
|
182
|
+
id: "reply-to-comment-single",
|
|
183
|
+
ref: e,
|
|
184
|
+
icon: Ht
|
|
185
|
+
}));
|
|
186
|
+
});
|
|
187
|
+
ke.displayName = "ReplyToCommentSingle";
|
|
188
|
+
var Mt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, Re = j(function(t, e) {
|
|
189
|
+
return z(Z, Object.assign({}, t, {
|
|
190
|
+
id: "resolved-single",
|
|
191
|
+
ref: e,
|
|
192
|
+
icon: Mt
|
|
193
|
+
}));
|
|
194
|
+
});
|
|
195
|
+
Re.displayName = "ResolvedSingle";
|
|
196
|
+
var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "circle", attrs: { cx: 8.73, cy: 8.4, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }] }, we = j(function(t, e) {
|
|
197
|
+
return z(Z, Object.assign({}, t, {
|
|
198
|
+
id: "solve-single",
|
|
199
|
+
ref: e,
|
|
200
|
+
icon: kt
|
|
201
|
+
}));
|
|
202
|
+
});
|
|
203
|
+
we.displayName = "SolveSingle";
|
|
204
|
+
const Rt = "univer-thread-comment-editor-buttons", _e = {
|
|
205
|
+
threadCommentEditorButtons: Rt
|
|
206
|
+
};
|
|
207
|
+
function xe(t) {
|
|
208
|
+
return {
|
|
209
|
+
id: "d",
|
|
210
|
+
body: t,
|
|
211
|
+
documentStyle: {}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const Le = j((t, e) => {
|
|
215
|
+
var R;
|
|
216
|
+
const { comment: n, onSave: r, id: i, onCancel: a, autoFocus: d, unitId: C, type: g } = t, T = N(ie), O = N(fe), [w, P] = V(!1), U = N(ht), m = re(null), f = g === he.UNIVER_SHEET ? qe : C, [$, y] = V(() => {
|
|
217
|
+
var c, u, p;
|
|
218
|
+
return Ce.transform.getPlainText((p = (u = (c = m.current) == null ? void 0 : c.getDocumentData().body) == null ? void 0 : u.dataStream) != null ? p : "");
|
|
219
|
+
});
|
|
220
|
+
me(() => {
|
|
221
|
+
var u, p, s, h;
|
|
222
|
+
y(Ce.transform.getPlainText((s = (p = (u = m.current) == null ? void 0 : u.getDocumentData().body) == null ? void 0 : p.dataStream) != null ? s : ""));
|
|
223
|
+
const c = (h = m.current) == null ? void 0 : h.selectionChange$.subscribe(() => {
|
|
224
|
+
var K, _, b;
|
|
225
|
+
y(Ce.transform.getPlainText((b = (_ = (K = m.current) == null ? void 0 : K.getDocumentData().body) == null ? void 0 : _.dataStream) != null ? b : ""));
|
|
226
|
+
});
|
|
227
|
+
return () => c == null ? void 0 : c.unsubscribe();
|
|
228
|
+
}, [(R = m.current) == null ? void 0 : R.selectionChange$]);
|
|
229
|
+
const M = ne(() => ({
|
|
230
|
+
keyCodes: [{ keyCode: ge.ENTER }],
|
|
231
|
+
handler: (c) => {
|
|
232
|
+
c === ge.ENTER && T.executeCommand(
|
|
233
|
+
Ct.id
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}), [T]);
|
|
237
|
+
ut(e, () => ({
|
|
238
|
+
reply(c) {
|
|
239
|
+
var u, p;
|
|
240
|
+
(u = m.current) == null || u.focus(), (p = m.current) == null || p.setDocumentData(xe(c));
|
|
241
|
+
}
|
|
242
|
+
}));
|
|
243
|
+
const I = () => {
|
|
244
|
+
if (m.current) {
|
|
245
|
+
const c = Je.deepClone(m.current.getDocumentData().body);
|
|
246
|
+
P(!1), r == null || r({
|
|
247
|
+
...n,
|
|
248
|
+
text: c
|
|
249
|
+
}), m.current.replaceText(""), setTimeout(() => {
|
|
250
|
+
var u, p;
|
|
251
|
+
(u = m.current) == null || u.setSelectionRanges([]), (p = m.current) == null || p.blur();
|
|
252
|
+
}, 10);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
return /* @__PURE__ */ S("div", { className: _e.threadCommentEditor, onClick: (c) => c.preventDefault(), children: [
|
|
256
|
+
/* @__PURE__ */ l(
|
|
257
|
+
vt,
|
|
258
|
+
{
|
|
259
|
+
editorRef: m,
|
|
260
|
+
autoFocus: d,
|
|
261
|
+
style: { width: "100%" },
|
|
262
|
+
keyboardEventConfig: M,
|
|
263
|
+
placeholder: O.t("threadCommentUI.editor.placeholder"),
|
|
264
|
+
initialValue: (n == null ? void 0 : n.text) && xe(n.text),
|
|
265
|
+
onFocusChange: (c) => c && P(c),
|
|
266
|
+
isSingle: !1,
|
|
267
|
+
maxHeight: 64,
|
|
268
|
+
onClickOutside: () => {
|
|
269
|
+
setTimeout(() => {
|
|
270
|
+
U.focus(f);
|
|
271
|
+
}, 30);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
w ? /* @__PURE__ */ S("div", { className: _e.threadCommentEditorButtons, children: [
|
|
276
|
+
/* @__PURE__ */ l(
|
|
277
|
+
ce,
|
|
278
|
+
{
|
|
279
|
+
style: { marginRight: 12 },
|
|
280
|
+
onClick: () => {
|
|
281
|
+
var c;
|
|
282
|
+
a == null || a(), P(!1), (c = m.current) == null || c.replaceText("", !0), T.executeCommand(F.id);
|
|
283
|
+
},
|
|
284
|
+
children: O.t("threadCommentUI.editor.cancel")
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ l(
|
|
288
|
+
ce,
|
|
289
|
+
{
|
|
290
|
+
type: "primary",
|
|
291
|
+
disabled: !$,
|
|
292
|
+
onClick: I,
|
|
293
|
+
children: O.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] }) : null
|
|
297
|
+
] });
|
|
298
|
+
}), wt = (t) => {
|
|
299
|
+
const { dataStream: e, customRanges: n } = t, r = e.endsWith(`\r
|
|
300
|
+
`) ? e.length - 2 : e.length, i = [];
|
|
301
|
+
let a = 0;
|
|
302
|
+
return n == null || n.forEach((d) => {
|
|
303
|
+
a < d.startIndex && i.push({
|
|
304
|
+
type: "text",
|
|
305
|
+
content: e.slice(a, d.startIndex)
|
|
306
|
+
}), i.push({
|
|
307
|
+
type: "mention",
|
|
308
|
+
content: {
|
|
309
|
+
label: e.slice(d.startIndex, d.endIndex + 1),
|
|
310
|
+
id: d.rangeId
|
|
311
|
+
}
|
|
312
|
+
}), a = d.endIndex + 1;
|
|
313
|
+
}), i.push({
|
|
314
|
+
type: "text",
|
|
315
|
+
content: e.slice(a, r)
|
|
316
|
+
}), i;
|
|
317
|
+
}, Lt = (t) => {
|
|
318
|
+
const { paragraphs: e = [] } = t;
|
|
319
|
+
let n = 0;
|
|
320
|
+
return e.map((r) => {
|
|
321
|
+
const i = Xe(t, n, r.startIndex);
|
|
322
|
+
return n = r.startIndex + 1, wt(i);
|
|
323
|
+
});
|
|
324
|
+
}, Vt = (t) => {
|
|
325
|
+
let e = "";
|
|
326
|
+
const n = [];
|
|
327
|
+
return t.forEach((r) => {
|
|
328
|
+
switch (r.type) {
|
|
329
|
+
case "text":
|
|
330
|
+
e += r.content;
|
|
331
|
+
break;
|
|
332
|
+
case "mention": {
|
|
333
|
+
const i = e.length;
|
|
334
|
+
e += r.content.label;
|
|
335
|
+
const a = e.length - 1;
|
|
336
|
+
n.push({
|
|
337
|
+
rangeId: r.content.id,
|
|
338
|
+
rangeType: Qe.MENTION,
|
|
339
|
+
startIndex: i,
|
|
340
|
+
endIndex: a,
|
|
341
|
+
properties: {}
|
|
342
|
+
});
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}), e += `
|
|
347
|
+
\r`, {
|
|
348
|
+
textRuns: [],
|
|
349
|
+
paragraphs: [
|
|
350
|
+
{
|
|
351
|
+
startIndex: e.length - 2,
|
|
352
|
+
paragraphStyle: {}
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
sectionBreaks: [
|
|
356
|
+
{
|
|
357
|
+
startIndex: e.length - 1
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
dataStream: e,
|
|
361
|
+
customRanges: n
|
|
362
|
+
};
|
|
363
|
+
}, jt = "univer-thread-comment", At = "univer-thread-comment-active", Bt = "univer-thread-comment-content", Wt = "univer-thread-comment-highlight", Ft = "univer-thread-comment-icon-container", zt = "univer-thread-comment-icon", Zt = "univer-thread-comment-title", Kt = "univer-thread-comment-title-position", Gt = "univer-thread-comment-title-highlight", Yt = "univer-thread-comment-title-position-text", qt = "univer-thread-comment-username", Jt = "univer-thread-comment-item", Qt = "univer-thread-comment-item-head", Xt = "univer-thread-comment-item-title", en = "univer-thread-comment-item-time", tn = "univer-thread-comment-item-content", nn = "univer-thread-comment-item-at", v = {
|
|
364
|
+
threadComment: jt,
|
|
365
|
+
threadCommentActive: At,
|
|
366
|
+
threadCommentContent: Bt,
|
|
367
|
+
threadCommentHighlight: Wt,
|
|
368
|
+
threadCommentIconContainer: Ft,
|
|
369
|
+
threadCommentIcon: zt,
|
|
370
|
+
threadCommentTitle: Zt,
|
|
371
|
+
threadCommentTitlePosition: Kt,
|
|
372
|
+
threadCommentTitleHighlight: Gt,
|
|
373
|
+
threadCommentTitlePositionText: Yt,
|
|
374
|
+
threadCommentUsername: qt,
|
|
375
|
+
threadCommentItem: Jt,
|
|
376
|
+
threadCommentItemHead: Qt,
|
|
377
|
+
threadCommentItemTitle: Xt,
|
|
378
|
+
threadCommentItemTime: en,
|
|
379
|
+
threadCommentItemContent: tn,
|
|
380
|
+
threadCommentItemAt: nn
|
|
381
|
+
}, Ve = "__mock__", rn = (t) => {
|
|
382
|
+
const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: a, onReply: d, resolved: C, isRoot: g, onClose: T, onDeleteComment: O, type: w } = t, P = N(ie), U = N(fe), m = N(pe), f = m.getUser(e.personId), $ = W(m.currentUser$), y = ($ == null ? void 0 : $.userID) === e.personId, M = e.id === Ve, [I, R] = V(!1), c = () => {
|
|
383
|
+
(O == null ? void 0 : O(e)) !== !1 && (P.executeCommand(
|
|
384
|
+
g ? Ee.id : at.id,
|
|
385
|
+
{
|
|
386
|
+
unitId: n,
|
|
387
|
+
subUnitId: r,
|
|
388
|
+
commentId: e.id
|
|
389
|
+
}
|
|
390
|
+
), g && (T == null || T()));
|
|
391
|
+
};
|
|
392
|
+
return /* @__PURE__ */ S("div", { className: v.threadCommentItem, onMouseLeave: () => R(!1), onMouseEnter: () => R(!0), children: [
|
|
393
|
+
/* @__PURE__ */ l("img", { className: v.threadCommentItemHead, src: f == null ? void 0 : f.avatar }),
|
|
394
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentItemTitle, children: [
|
|
395
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentUsername, children: (f == null ? void 0 : f.name) || " " }),
|
|
396
|
+
/* @__PURE__ */ S("div", { children: [
|
|
397
|
+
M || C ? null : I ? /* @__PURE__ */ l("div", { className: v.threadCommentIcon, onClick: () => d(f), children: /* @__PURE__ */ l(ke, {}) }) : null,
|
|
398
|
+
y && !M && !C ? /* @__PURE__ */ l(
|
|
399
|
+
mt,
|
|
400
|
+
{
|
|
401
|
+
overlay: /* @__PURE__ */ l("div", { className: "univer-rounded-lg univer-p-4 univer-theme", children: /* @__PURE__ */ S(
|
|
402
|
+
"ul",
|
|
403
|
+
{
|
|
404
|
+
className: `
|
|
405
|
+
univer-m-0 univer-grid univer-list-none univer-gap-2 univer-p-0
|
|
406
|
+
univer-text-sm
|
|
407
|
+
[&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-p-1
|
|
408
|
+
`,
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
|
|
411
|
+
"a",
|
|
412
|
+
{
|
|
413
|
+
className: "hover:univer-bg-gray-200",
|
|
414
|
+
onClick: () => a == null ? void 0 : a(!0),
|
|
415
|
+
children: U.t("threadCommentUI.item.edit")
|
|
416
|
+
}
|
|
417
|
+
) }),
|
|
418
|
+
/* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
|
|
419
|
+
"a",
|
|
420
|
+
{
|
|
421
|
+
className: "hover:univer-bg-gray-200",
|
|
422
|
+
onClick: c,
|
|
423
|
+
children: U.t("threadCommentUI.item.delete")
|
|
424
|
+
}
|
|
425
|
+
) })
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
) }),
|
|
429
|
+
children: /* @__PURE__ */ l("div", { className: v.threadCommentIcon, children: /* @__PURE__ */ l(Me, {}) })
|
|
430
|
+
}
|
|
431
|
+
) : null
|
|
432
|
+
] })
|
|
433
|
+
] }),
|
|
434
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentItemTime, children: e.dT }),
|
|
435
|
+
i ? /* @__PURE__ */ l(
|
|
436
|
+
Le,
|
|
437
|
+
{
|
|
438
|
+
type: w,
|
|
439
|
+
id: e.id,
|
|
440
|
+
comment: e,
|
|
441
|
+
onCancel: () => a == null ? void 0 : a(!1),
|
|
442
|
+
autoFocus: !0,
|
|
443
|
+
unitId: n,
|
|
444
|
+
subUnitId: r,
|
|
445
|
+
onSave: ({ text: u, attachments: p }) => {
|
|
446
|
+
a == null || a(!1), P.executeCommand(
|
|
447
|
+
ot.id,
|
|
448
|
+
{
|
|
449
|
+
unitId: n,
|
|
450
|
+
subUnitId: r,
|
|
451
|
+
payload: {
|
|
452
|
+
commentId: e.id,
|
|
453
|
+
text: u,
|
|
454
|
+
attachments: p
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
) : /* @__PURE__ */ l("div", { className: v.threadCommentItemContent, children: Lt(e.text).map((u, p) => /* @__PURE__ */ l("div", { className: "univer-break-words", children: u.map((s, h) => {
|
|
461
|
+
switch (s.type) {
|
|
462
|
+
case "mention":
|
|
463
|
+
return /* @__PURE__ */ S("a", { className: v.threadCommentItemAt, children: [
|
|
464
|
+
s.content.label,
|
|
465
|
+
" "
|
|
466
|
+
] }, h);
|
|
467
|
+
default:
|
|
468
|
+
return s.content;
|
|
469
|
+
}
|
|
470
|
+
}) }, p)) })
|
|
471
|
+
] });
|
|
472
|
+
}, on = (t) => {
|
|
473
|
+
var X, ee, se;
|
|
474
|
+
const {
|
|
475
|
+
id: e,
|
|
476
|
+
unitId: n,
|
|
477
|
+
subUnitId: r,
|
|
478
|
+
refStr: i,
|
|
479
|
+
showEdit: a = !0,
|
|
480
|
+
onClick: d,
|
|
481
|
+
showHighlight: C,
|
|
482
|
+
onClose: g,
|
|
483
|
+
getSubUnitName: T,
|
|
484
|
+
prefix: O,
|
|
485
|
+
autoFocus: w,
|
|
486
|
+
onMouseEnter: P,
|
|
487
|
+
onMouseLeave: U,
|
|
488
|
+
onAddComment: m,
|
|
489
|
+
onDeleteComment: f,
|
|
490
|
+
onResolve: $,
|
|
491
|
+
type: y
|
|
492
|
+
} = t, M = N(Ue), [I, R] = V(!1), [c, u] = V(""), p = ne(() => M.commentUpdate$.pipe(lt(16)), [M]);
|
|
493
|
+
W(p);
|
|
494
|
+
const s = e ? M.getCommentWithChildren(n, r, e) : null, h = N(ie), K = N(pe), _ = s == null ? void 0 : s.root.resolved, b = W(K.currentUser$), G = re(null), oe = [
|
|
495
|
+
...s ? [s.root] : (
|
|
496
|
+
// mock empty comment
|
|
497
|
+
[{
|
|
498
|
+
id: Ve,
|
|
499
|
+
text: {
|
|
500
|
+
dataStream: `
|
|
501
|
+
\r`
|
|
502
|
+
},
|
|
503
|
+
personId: (X = b == null ? void 0 : b.userID) != null ? X : "",
|
|
504
|
+
ref: i != null ? i : "",
|
|
505
|
+
dT: "",
|
|
506
|
+
unitId: n,
|
|
507
|
+
subUnitId: r,
|
|
508
|
+
threadId: ""
|
|
509
|
+
}]
|
|
510
|
+
),
|
|
511
|
+
...(ee = s == null ? void 0 : s.children) != null ? ee : []
|
|
512
|
+
], D = re(null), q = (x) => {
|
|
513
|
+
x.stopPropagation(), _ ? h.executeCommand(F.id, {
|
|
514
|
+
unitId: n,
|
|
515
|
+
subUnitId: r,
|
|
516
|
+
commentId: e
|
|
517
|
+
}) : h.executeCommand(F.id), h.executeCommand(it.id, {
|
|
518
|
+
unitId: n,
|
|
519
|
+
subUnitId: r,
|
|
520
|
+
commentId: e,
|
|
521
|
+
resolved: !_
|
|
522
|
+
}), $ == null || $(!_);
|
|
523
|
+
}, L = (x) => {
|
|
524
|
+
x.stopPropagation(), h.executeCommand(F.id), !(s != null && s.root && (f == null ? void 0 : f(s.root)) === !1) && (h.executeCommand(
|
|
525
|
+
Ee.id,
|
|
526
|
+
{
|
|
527
|
+
unitId: n,
|
|
528
|
+
subUnitId: r,
|
|
529
|
+
commentId: e
|
|
530
|
+
}
|
|
531
|
+
), g == null || g());
|
|
532
|
+
};
|
|
533
|
+
me(() => U == null ? void 0 : U(), []);
|
|
534
|
+
const J = T((se = s == null ? void 0 : s.root.subUnitId) != null ? se : r), Q = a && !c && !_, ae = `${i || (s == null ? void 0 : s.root.ref) || ""}${J ? " · " : ""}${J}`;
|
|
535
|
+
return /* @__PURE__ */ S(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
className: dt(v.threadComment, {
|
|
539
|
+
[v.threadCommentActive]: !_ && (C || I || O === "cell")
|
|
540
|
+
}),
|
|
541
|
+
onClick: d,
|
|
542
|
+
id: `${O}-${n}-${r}-${e}`,
|
|
543
|
+
onMouseEnter: () => {
|
|
544
|
+
P == null || P(), R(!0);
|
|
545
|
+
},
|
|
546
|
+
onMouseLeave: () => {
|
|
547
|
+
U == null || U(), R(!1);
|
|
548
|
+
},
|
|
549
|
+
children: [
|
|
550
|
+
!_ && C ? /* @__PURE__ */ l("div", { className: v.threadCommentHighlight }) : null,
|
|
551
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentTitle, children: [
|
|
552
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentTitlePosition, children: [
|
|
553
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentTitleHighlight }),
|
|
554
|
+
/* @__PURE__ */ l(ct, { showIfEllipsis: !0, title: ae, children: /* @__PURE__ */ l("div", { className: v.threadCommentTitlePositionText, children: ae }) })
|
|
555
|
+
] }),
|
|
556
|
+
s ? /* @__PURE__ */ S("div", { className: v.threadCommentIconContainer, children: [
|
|
557
|
+
/* @__PURE__ */ l(
|
|
558
|
+
"div",
|
|
559
|
+
{
|
|
560
|
+
onClick: q,
|
|
561
|
+
className: v.threadCommentIcon,
|
|
562
|
+
style: { color: _ ? "rgb(var(--green-500))" : "" },
|
|
563
|
+
children: _ ? /* @__PURE__ */ l(Re, {}) : /* @__PURE__ */ l(we, {})
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
(b == null ? void 0 : b.userID) === s.root.personId ? /* @__PURE__ */ l("div", { className: v.threadCommentIcon, onClick: L, children: /* @__PURE__ */ l(De, {}) }) : null
|
|
567
|
+
] }) : null
|
|
568
|
+
] }),
|
|
569
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentContent, ref: D, children: oe.map(
|
|
570
|
+
(x) => /* @__PURE__ */ l(
|
|
571
|
+
rn,
|
|
572
|
+
{
|
|
573
|
+
onClose: g,
|
|
574
|
+
unitId: n,
|
|
575
|
+
subUnitId: r,
|
|
576
|
+
item: x,
|
|
577
|
+
isRoot: x.id === (s == null ? void 0 : s.root.id),
|
|
578
|
+
editing: c === x.id,
|
|
579
|
+
resolved: s == null ? void 0 : s.root.resolved,
|
|
580
|
+
type: y,
|
|
581
|
+
onEditingChange: (o) => {
|
|
582
|
+
u(o ? x.id : "");
|
|
583
|
+
},
|
|
584
|
+
onReply: (o) => {
|
|
585
|
+
o && requestAnimationFrame(() => {
|
|
586
|
+
var k;
|
|
587
|
+
(k = G.current) == null || k.reply(Vt([{
|
|
588
|
+
type: "mention",
|
|
589
|
+
content: {
|
|
590
|
+
id: o.userID,
|
|
591
|
+
label: o.name
|
|
592
|
+
}
|
|
593
|
+
}]));
|
|
594
|
+
});
|
|
595
|
+
},
|
|
596
|
+
onAddComment: m,
|
|
597
|
+
onDeleteComment: f
|
|
598
|
+
},
|
|
599
|
+
x.id
|
|
600
|
+
)
|
|
601
|
+
) }),
|
|
602
|
+
Q ? /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(
|
|
603
|
+
Le,
|
|
604
|
+
{
|
|
605
|
+
ref: G,
|
|
606
|
+
type: y,
|
|
607
|
+
unitId: n,
|
|
608
|
+
subUnitId: r,
|
|
609
|
+
onSave: async ({ text: x, attachments: o }) => {
|
|
610
|
+
const k = {
|
|
611
|
+
text: x,
|
|
612
|
+
attachments: o,
|
|
613
|
+
dT: nt(),
|
|
614
|
+
id: et(),
|
|
615
|
+
ref: i,
|
|
616
|
+
personId: b == null ? void 0 : b.userID,
|
|
617
|
+
parentId: s == null ? void 0 : s.root.id,
|
|
618
|
+
unitId: n,
|
|
619
|
+
subUnitId: r,
|
|
620
|
+
threadId: s == null ? void 0 : s.root.threadId
|
|
621
|
+
};
|
|
622
|
+
(m == null ? void 0 : m(k)) !== !1 && (await h.executeCommand(
|
|
623
|
+
rt.id,
|
|
624
|
+
{
|
|
625
|
+
unitId: n,
|
|
626
|
+
subUnitId: r,
|
|
627
|
+
comment: k
|
|
628
|
+
}
|
|
629
|
+
), D.current && (D.current.scrollTop = D.current.scrollHeight));
|
|
630
|
+
},
|
|
631
|
+
autoFocus: w || !s,
|
|
632
|
+
onCancel: () => {
|
|
633
|
+
s || g == null || g();
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
`${w}`
|
|
637
|
+
) }) : null
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
}, an = "univer-thread-comment-panel", sn = "univer-thread-comment-panel-forms", ln = "univer-thread-comment-panel-empty", dn = "univer-thread-comment-panel-add", cn = "univer-thread-comment-panel-solved", te = {
|
|
642
|
+
threadCommentPanel: an,
|
|
643
|
+
threadCommentPanelForms: sn,
|
|
644
|
+
threadCommentPanelEmpty: ln,
|
|
645
|
+
threadCommentPanelAdd: dn,
|
|
646
|
+
threadCommentPanelSolved: cn
|
|
647
|
+
}, bn = (t) => {
|
|
648
|
+
const {
|
|
649
|
+
unitId: e,
|
|
650
|
+
subUnitId$: n,
|
|
651
|
+
type: r,
|
|
652
|
+
onAdd: i,
|
|
653
|
+
getSubUnitName: a,
|
|
654
|
+
onResolve: d,
|
|
655
|
+
sortComments: C,
|
|
656
|
+
onItemLeave: g,
|
|
657
|
+
onItemEnter: T,
|
|
658
|
+
disableAdd: O,
|
|
659
|
+
tempComment: w,
|
|
660
|
+
onAddComment: P,
|
|
661
|
+
onDeleteComment: U,
|
|
662
|
+
showComments: m
|
|
663
|
+
} = t, [f, $] = V("all"), [y, M] = V("all"), I = N(fe), R = N(pe), c = N(Ue), [u, p] = V(() => c.getUnit(e)), s = N(Y), h = W(s.activeCommentId$), K = W(c.commentUpdate$), _ = N(ie), b = W(n), G = re(!0), oe = "panel", D = W(R.currentUser$), q = ne(() => {
|
|
664
|
+
var de;
|
|
665
|
+
const o = f === "all" ? u : (de = u.filter((E) => E.subUnitId === b)) != null ? de : [], k = C != null ? C : (E) => E, le = o.map((E) => {
|
|
666
|
+
var A;
|
|
667
|
+
return { ...E.root, children: (A = E.children) != null ? A : [], users: E.relativeUsers };
|
|
668
|
+
});
|
|
669
|
+
if (m) {
|
|
670
|
+
const E = /* @__PURE__ */ new Map();
|
|
671
|
+
return le.forEach((A) => {
|
|
672
|
+
E.set(A.id, A);
|
|
673
|
+
}), [...m, ""].map((A) => E.get(A)).filter(Boolean);
|
|
674
|
+
} else
|
|
675
|
+
return k(le);
|
|
676
|
+
}, [m, f, u, C, b]), L = ne(() => [
|
|
677
|
+
...q.filter((o) => !o.resolved),
|
|
678
|
+
...q.filter((o) => o.resolved)
|
|
679
|
+
], [q]), J = ne(() => y === "resolved" ? L.filter((o) => o.resolved) : y === "unsolved" ? L.filter((o) => !o.resolved) : y === "concern_me" && D != null && D.userID ? L.filter((o) => o == null ? void 0 : o.users.has(D.userID)) : L, [L, D == null ? void 0 : D.userID, y]), Q = w ? [w, ...J] : J, ae = Q.filter((o) => !o.resolved), X = Q.filter((o) => o.resolved), ee = y !== "all" || f !== "all", se = () => {
|
|
680
|
+
M("all"), $("all");
|
|
681
|
+
};
|
|
682
|
+
me(() => {
|
|
683
|
+
e && p(
|
|
684
|
+
c.getUnit(e)
|
|
685
|
+
);
|
|
686
|
+
}, [e, c, K]), me(() => {
|
|
687
|
+
var E;
|
|
688
|
+
if (!h)
|
|
689
|
+
return;
|
|
690
|
+
if (!G.current) {
|
|
691
|
+
G.current = !0;
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const { unitId: o, subUnitId: k, commentId: le } = h, de = `${oe}-${o}-${k}-${le}`;
|
|
695
|
+
(E = document.getElementById(de)) == null || E.scrollIntoView({ block: "center" });
|
|
696
|
+
}, [h]);
|
|
697
|
+
const x = (o) => /* @__PURE__ */ l(
|
|
698
|
+
on,
|
|
699
|
+
{
|
|
700
|
+
prefix: oe,
|
|
701
|
+
getSubUnitName: a,
|
|
702
|
+
id: o.id,
|
|
703
|
+
unitId: o.unitId,
|
|
704
|
+
subUnitId: o.subUnitId,
|
|
705
|
+
refStr: o.ref,
|
|
706
|
+
type: r,
|
|
707
|
+
showEdit: (h == null ? void 0 : h.commentId) === o.id,
|
|
708
|
+
showHighlight: (h == null ? void 0 : h.commentId) === o.id,
|
|
709
|
+
onClick: () => {
|
|
710
|
+
G.current = !1, o.resolved ? _.executeCommand(F.id) : _.executeCommand(
|
|
711
|
+
F.id,
|
|
712
|
+
{
|
|
713
|
+
unitId: o.unitId,
|
|
714
|
+
subUnitId: o.subUnitId,
|
|
715
|
+
commentId: o.id,
|
|
716
|
+
temp: !1
|
|
717
|
+
}
|
|
718
|
+
);
|
|
719
|
+
},
|
|
720
|
+
onMouseEnter: () => T == null ? void 0 : T(o),
|
|
721
|
+
onMouseLeave: () => g == null ? void 0 : g(o),
|
|
722
|
+
onAddComment: P,
|
|
723
|
+
onDeleteComment: U,
|
|
724
|
+
onResolve: (k) => d == null ? void 0 : d(o.id, k)
|
|
725
|
+
},
|
|
726
|
+
o.id
|
|
727
|
+
);
|
|
728
|
+
return /* @__PURE__ */ S("div", { className: te.threadCommentPanel, children: [
|
|
729
|
+
/* @__PURE__ */ S("div", { className: te.threadCommentPanelForms, children: [
|
|
730
|
+
r === he.UNIVER_SHEET ? /* @__PURE__ */ l(
|
|
731
|
+
be,
|
|
732
|
+
{
|
|
733
|
+
borderless: !0,
|
|
734
|
+
value: f,
|
|
735
|
+
onChange: (o) => $(o),
|
|
736
|
+
options: [
|
|
737
|
+
{
|
|
738
|
+
value: "current",
|
|
739
|
+
label: I.t("threadCommentUI.filter.sheet.current")
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
value: "all",
|
|
743
|
+
label: I.t("threadCommentUI.filter.sheet.all")
|
|
744
|
+
}
|
|
745
|
+
]
|
|
746
|
+
}
|
|
747
|
+
) : null,
|
|
748
|
+
/* @__PURE__ */ l(
|
|
749
|
+
be,
|
|
750
|
+
{
|
|
751
|
+
borderless: !0,
|
|
752
|
+
value: y,
|
|
753
|
+
onChange: (o) => M(o),
|
|
754
|
+
options: [
|
|
755
|
+
{
|
|
756
|
+
value: "all",
|
|
757
|
+
label: I.t("threadCommentUI.filter.status.all")
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
value: "resolved",
|
|
761
|
+
label: I.t("threadCommentUI.filter.status.resolved")
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
value: "unsolved",
|
|
765
|
+
label: I.t("threadCommentUI.filter.status.unsolved")
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
value: "concern_me",
|
|
769
|
+
label: I.t("threadCommentUI.filter.status.concernMe")
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
] }),
|
|
775
|
+
ae.map(x),
|
|
776
|
+
X.length ? /* @__PURE__ */ l("div", { className: te.threadCommentPanelSolved, children: "已解决" }) : null,
|
|
777
|
+
X.map(x),
|
|
778
|
+
Q.length ? null : /* @__PURE__ */ S("div", { className: te.threadCommentPanelEmpty, children: [
|
|
779
|
+
ee ? I.t("threadCommentUI.panel.filterEmpty") : I.t("threadCommentUI.panel.empty"),
|
|
780
|
+
ee ? /* @__PURE__ */ l(
|
|
781
|
+
ce,
|
|
782
|
+
{
|
|
783
|
+
onClick: se,
|
|
784
|
+
type: "link",
|
|
785
|
+
children: I.t("threadCommentUI.panel.reset")
|
|
786
|
+
}
|
|
787
|
+
) : /* @__PURE__ */ S(
|
|
788
|
+
ce,
|
|
789
|
+
{
|
|
790
|
+
id: "thread-comment-add",
|
|
791
|
+
className: te.threadCommentPanelAdd,
|
|
792
|
+
type: "primary",
|
|
793
|
+
onClick: i,
|
|
794
|
+
disabled: O,
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ l(He, {}),
|
|
797
|
+
I.t("threadCommentUI.panel.addComment")
|
|
798
|
+
]
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
] })
|
|
802
|
+
] });
|
|
803
|
+
};
|
|
804
|
+
export {
|
|
805
|
+
F as SetActiveCommentOperation,
|
|
806
|
+
gt as THREAD_COMMENT_PANEL,
|
|
807
|
+
bn as ThreadCommentPanel,
|
|
808
|
+
Y as ThreadCommentPanelService,
|
|
809
|
+
on as ThreadCommentTree,
|
|
810
|
+
bt as ToggleSheetCommentPanelOperation,
|
|
811
|
+
ue as UniverThreadCommentUIPlugin
|
|
812
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "Comment Management",
|
|
5
|
+
empty: "No comments yet",
|
|
6
|
+
filterEmpty: "No match result",
|
|
7
|
+
reset: "Reset Filter",
|
|
8
|
+
addComment: "Add Comment"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "Reply or add others with @",
|
|
12
|
+
reply: "Comment",
|
|
13
|
+
cancel: "Cancel",
|
|
14
|
+
save: "Save"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "Edit",
|
|
18
|
+
delete: "Delete This Comment"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "All sheet",
|
|
23
|
+
current: "Current sheet"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "All comments",
|
|
27
|
+
resolved: "Resolved",
|
|
28
|
+
unsolved: "Not resolved",
|
|
29
|
+
concernMe: "Concern me"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "مدیریت نظرات",
|
|
5
|
+
empty: "هنوز نظری وجود ندارد",
|
|
6
|
+
filterEmpty: "نتیجه ای یافت نشد",
|
|
7
|
+
reset: "بازنشانی فیلتر",
|
|
8
|
+
addComment: "افزودن نظر"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "پاسخ یا اضافه کردن دیگران با @",
|
|
12
|
+
reply: "نظر",
|
|
13
|
+
cancel: "انصراف",
|
|
14
|
+
save: "ذخیره"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "ویرایش",
|
|
18
|
+
delete: "حذف این نظر"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "همه برگهها",
|
|
23
|
+
current: "برگه فعلی"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "همه نظرات",
|
|
27
|
+
resolved: "حل شده",
|
|
28
|
+
unsolved: "حل نشده",
|
|
29
|
+
concernMe: "موضوع مربوط به من"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "Gestion des commentaires",
|
|
5
|
+
empty: "Pas encore de commentaires",
|
|
6
|
+
filterEmpty: "Aucun résultat correspondant",
|
|
7
|
+
reset: "Réinitialiser le filtre",
|
|
8
|
+
addComment: "Ajouter un commentaire"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "Répondre ou ajouter d'autres avec @",
|
|
12
|
+
reply: "Commenter",
|
|
13
|
+
cancel: "Annuler",
|
|
14
|
+
save: "Enregistrer"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "Modifier",
|
|
18
|
+
delete: "Supprimer ce commentaire"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "Toutes les feuilles",
|
|
23
|
+
current: "Feuille actuelle"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "Tous les commentaires",
|
|
27
|
+
resolved: "Résolu",
|
|
28
|
+
unsolved: "Non résolu",
|
|
29
|
+
concernMe: "Me concerne"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "Comment Management",
|
|
5
|
+
empty: "No comments yet",
|
|
6
|
+
filterEmpty: "No match result",
|
|
7
|
+
reset: "Reset Filter",
|
|
8
|
+
addComment: "Add Comment"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "Reply or add others with @",
|
|
12
|
+
reply: "Comment",
|
|
13
|
+
cancel: "Cancel",
|
|
14
|
+
save: "Save"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "Edit",
|
|
18
|
+
delete: "Delete This Comment"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "All sheet",
|
|
23
|
+
current: "Current sheet"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "All comments",
|
|
27
|
+
resolved: "Resolved",
|
|
28
|
+
unsolved: "Not resolved",
|
|
29
|
+
concernMe: "Concern me"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "Quản lý Bình luận",
|
|
5
|
+
empty: "Chưa có bình luận",
|
|
6
|
+
filterEmpty: "Không có kết quả phù hợp",
|
|
7
|
+
reset: "Đặt lại",
|
|
8
|
+
addComment: "Thêm bình luận"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "Phản hồi",
|
|
12
|
+
reply: "Phản hồi",
|
|
13
|
+
cancel: "Hủy",
|
|
14
|
+
save: "Lưu"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "Chỉnh sửa",
|
|
18
|
+
delete: "Xóa"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "Tất cả bảng",
|
|
23
|
+
current: "Bảng hiện tại"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "Tất cả bình luận",
|
|
27
|
+
resolved: "Đã giải quyết",
|
|
28
|
+
unsolved: "Chưa giải quyết",
|
|
29
|
+
concernMe: "Liên quan đến tôi"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "评论管理",
|
|
5
|
+
empty: "暂无评论",
|
|
6
|
+
filterEmpty: "没有匹配的结果",
|
|
7
|
+
reset: "重置",
|
|
8
|
+
addComment: "添加评论"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "回复",
|
|
12
|
+
reply: "回复",
|
|
13
|
+
cancel: "取消",
|
|
14
|
+
save: "保存"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "编辑",
|
|
18
|
+
delete: "删除"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "所有表格",
|
|
23
|
+
current: "当前表格"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "所有评论",
|
|
27
|
+
resolved: "已解决",
|
|
28
|
+
unsolved: "未解决",
|
|
29
|
+
concernMe: "与我有关"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
threadCommentUI: {
|
|
3
|
+
panel: {
|
|
4
|
+
title: "評論管理",
|
|
5
|
+
empty: "暫無評論",
|
|
6
|
+
filterEmpty: "沒有符合的結果",
|
|
7
|
+
reset: "重置",
|
|
8
|
+
addComment: "新增評論"
|
|
9
|
+
},
|
|
10
|
+
editor: {
|
|
11
|
+
placeholder: "回覆",
|
|
12
|
+
reply: "回覆",
|
|
13
|
+
cancel: "取消",
|
|
14
|
+
save: "儲存"
|
|
15
|
+
},
|
|
16
|
+
item: {
|
|
17
|
+
edit: "編輯",
|
|
18
|
+
delete: "刪除"
|
|
19
|
+
},
|
|
20
|
+
filter: {
|
|
21
|
+
sheet: {
|
|
22
|
+
all: "所有表格",
|
|
23
|
+
current: "當前表格"
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
all: "所有評論",
|
|
27
|
+
resolved: "已解決",
|
|
28
|
+
unsolved: "未解決",
|
|
29
|
+
concernMe: "與我有關"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
e as default
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/thread-comment-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer common thread comment UI plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"lib"
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"react": "
|
|
51
|
+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
52
52
|
"rxjs": ">=7.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@univerjs/icons": "^0.2.
|
|
56
|
-
"@univerjs/core": "0.6.
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/ui": "0.6.
|
|
55
|
+
"@univerjs/icons": "^0.2.31",
|
|
56
|
+
"@univerjs/core": "0.6.8",
|
|
57
|
+
"@univerjs/design": "0.6.8",
|
|
58
|
+
"@univerjs/docs-ui": "0.6.8",
|
|
59
|
+
"@univerjs/thread-comment": "0.6.8",
|
|
60
|
+
"@univerjs/ui": "0.6.8"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"less": "^4.2.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript": "^5.8.2",
|
|
69
69
|
"vite": "^6.2.3",
|
|
70
70
|
"vitest": "^3.0.9",
|
|
71
|
-
"@univerjs-infra/shared": "0.6.
|
|
71
|
+
"@univerjs-infra/shared": "0.6.8"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"test": "vitest run",
|