@univerjs/thread-comment-ui 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +274 -271
- package/lib/umd/index.js +4 -4
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var Be = Object.defineProperty;
|
|
2
|
-
var We = (t, e,
|
|
3
|
-
var B = (t, e,
|
|
2
|
+
var We = (t, e, r) => e in t ? Be(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var B = (t, e, r) => We(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { Inject as Ne, IUniverInstanceService as Fe, Disposable as ze, UniverInstanceType as he, CommandType as Ue, DependentOn as Ze, Injector as Ke, ICommandService as oe, IConfigService as Ge, Plugin as Ye, merge as qe, mergeOverrideWithDependencies as Je, LocaleService as fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Qe, BuildTextUtils as Ce, Tools as Xe, CustomRangeType as et, getBodySlice as tt, UserManagerService as pe, generateRandomId as nt } from "@univerjs/core";
|
|
5
|
-
import { UniverThreadCommentPlugin as rt, ThreadCommentModel as Ee, getDT as ot, AddCommentCommand as it, ResolveCommentCommand as at, DeleteCommentTreeCommand as
|
|
6
|
-
import { ISidebarService as
|
|
5
|
+
import { UniverThreadCommentPlugin as rt, ThreadCommentModel as Ee, getDT as ot, AddCommentCommand as it, ResolveCommentCommand as at, DeleteCommentTreeCommand as Oe, UpdateCommentCommand as st, DeleteCommentCommand as lt } from "@univerjs/thread-comment";
|
|
6
|
+
import { ISidebarService as Pe, useDependency as T, KeyCode as ge, useObservable as W } from "@univerjs/ui";
|
|
7
7
|
import { BehaviorSubject as Ie, filter as dt, debounceTime as ct } from "rxjs";
|
|
8
8
|
import { jsxs as S, jsx as l } from "react/jsx-runtime";
|
|
9
9
|
import { Button as ce, Tooltip as mt, DropdownLegacy as ut, Menu as ht, MenuItem as be, Select as Se } from "@univerjs/design";
|
|
10
|
-
import { forwardRef as
|
|
10
|
+
import { forwardRef as j, useRef as re, createElement as z, useState as V, useEffect as me, useMemo as ne, useImperativeHandle as Ct } from "react";
|
|
11
11
|
import { IEditorService as vt, BreakLineCommand as ft, RichTextEditor as pt } from "@univerjs/docs-ui";
|
|
12
|
-
var gt = Object.getOwnPropertyDescriptor, It = (t, e,
|
|
13
|
-
for (var o =
|
|
14
|
-
(
|
|
12
|
+
var gt = Object.getOwnPropertyDescriptor, It = (t, e, r, n) => {
|
|
13
|
+
for (var o = n > 1 ? void 0 : n ? gt(e, r) : e, a = t.length - 1, d; a >= 0; a--)
|
|
14
|
+
(d = t[a]) && (o = d(o) || o);
|
|
15
15
|
return o;
|
|
16
|
-
}, ye = (t, e) => (
|
|
16
|
+
}, ye = (t, e) => (r, n) => e(r, n, t);
|
|
17
17
|
let Y = class extends ze {
|
|
18
|
-
constructor(e,
|
|
18
|
+
constructor(e, r) {
|
|
19
19
|
super();
|
|
20
20
|
B(this, "_panelVisible", !1);
|
|
21
21
|
B(this, "_panelVisible$", new Ie(!1));
|
|
@@ -23,7 +23,7 @@ let Y = class extends ze {
|
|
|
23
23
|
B(this, "_activeCommentId$", new Ie(void 0));
|
|
24
24
|
B(this, "panelVisible$", this._panelVisible$.asObservable());
|
|
25
25
|
B(this, "activeCommentId$", this._activeCommentId$.asObservable());
|
|
26
|
-
this._sidebarService = e, this._univerInstanceService =
|
|
26
|
+
this._sidebarService = e, this._univerInstanceService = r, this._init(), this.disposeWithMe(() => {
|
|
27
27
|
this._activeCommentId$.complete(), this._panelVisible$.complete();
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -52,19 +52,19 @@ let Y = class extends ze {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
Y = It([
|
|
55
|
-
ye(0, Ne(
|
|
55
|
+
ye(0, Ne(Pe)),
|
|
56
56
|
ye(1, Fe)
|
|
57
57
|
], Y);
|
|
58
58
|
const bt = "thread-comment-panel", St = "UNIVER_THREAD_COMMENT_UI_PLUGIN", yt = {
|
|
59
59
|
id: "thread-comment-ui.operation.toggle-panel",
|
|
60
60
|
type: Ue.OPERATION,
|
|
61
61
|
handler(t) {
|
|
62
|
-
const e = t.get(
|
|
63
|
-
return
|
|
62
|
+
const e = t.get(Pe), r = t.get(Y);
|
|
63
|
+
return r.panelVisible ? (e.close(), r.setPanelVisible(!1)) : (e.open({
|
|
64
64
|
header: { title: "threadCommentUI.panel.title" },
|
|
65
65
|
children: { label: bt },
|
|
66
66
|
width: 330
|
|
67
|
-
}),
|
|
67
|
+
}), r.setPanelVisible(!0)), !0;
|
|
68
68
|
}
|
|
69
69
|
}, F = {
|
|
70
70
|
id: "thread-comment-ui.operation.set-active-comment",
|
|
@@ -73,20 +73,20 @@ const bt = "thread-comment-panel", St = "UNIVER_THREAD_COMMENT_UI_PLUGIN", yt =
|
|
|
73
73
|
return t.get(Y).setActiveComment(e), !0;
|
|
74
74
|
}
|
|
75
75
|
}, _t = "thread-comment-ui.config", _e = {};
|
|
76
|
-
var xt = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, Nt = (t, e,
|
|
77
|
-
for (var o =
|
|
78
|
-
(
|
|
76
|
+
var xt = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, Nt = (t, e, r) => e in t ? xt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ut = (t, e, r, n) => {
|
|
77
|
+
for (var o = n > 1 ? void 0 : n ? Tt(e, r) : e, a = t.length - 1, d; a >= 0; a--)
|
|
78
|
+
(d = t[a]) && (o = d(o) || o);
|
|
79
79
|
return o;
|
|
80
|
-
}, ve = (t, e) => (
|
|
80
|
+
}, ve = (t, e) => (r, n) => e(r, n, t), Me = (t, e, r) => Nt(t, typeof e != "symbol" ? e + "" : e, r);
|
|
81
81
|
let ue = class extends Ye {
|
|
82
|
-
constructor(t = _e, e,
|
|
83
|
-
super(), this._config = t, this._injector = e, this._commandService =
|
|
84
|
-
const { menu: o, ...
|
|
82
|
+
constructor(t = _e, e, r, n) {
|
|
83
|
+
super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
|
|
84
|
+
const { menu: o, ...a } = qe(
|
|
85
85
|
{},
|
|
86
86
|
_e,
|
|
87
87
|
this._config
|
|
88
88
|
);
|
|
89
|
-
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(_t,
|
|
89
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(_t, a);
|
|
90
90
|
}
|
|
91
91
|
onStarting() {
|
|
92
92
|
var t;
|
|
@@ -107,109 +107,112 @@ ue = Ut([
|
|
|
107
107
|
ve(2, oe),
|
|
108
108
|
ve(3, Ge)
|
|
109
109
|
], ue);
|
|
110
|
-
var
|
|
111
|
-
return
|
|
112
|
-
for (var e,
|
|
113
|
-
e = arguments[
|
|
110
|
+
var D = function() {
|
|
111
|
+
return D = Object.assign || function(t) {
|
|
112
|
+
for (var e, r = 1, n = arguments.length; r < n; r++) {
|
|
113
|
+
e = arguments[r];
|
|
114
114
|
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
|
|
115
115
|
}
|
|
116
116
|
return t;
|
|
117
|
-
},
|
|
117
|
+
}, D.apply(this, arguments);
|
|
118
118
|
}, Et = function(t, e) {
|
|
119
|
-
var
|
|
120
|
-
for (var
|
|
119
|
+
var r = {};
|
|
120
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
|
|
121
121
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
122
|
-
for (var o = 0,
|
|
123
|
-
e.indexOf(
|
|
124
|
-
return
|
|
125
|
-
}, Z =
|
|
126
|
-
var
|
|
127
|
-
return
|
|
122
|
+
for (var o = 0, n = Object.getOwnPropertySymbols(t); o < n.length; o++)
|
|
123
|
+
e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[o]) && (r[n[o]] = t[n[o]]);
|
|
124
|
+
return r;
|
|
125
|
+
}, Z = j(function(t, e) {
|
|
126
|
+
var r = t.icon, n = t.id, o = t.className, a = t.extend, d = Et(t, ["icon", "id", "className", "extend"]), C = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), g = re("_".concat(Mt()));
|
|
127
|
+
return $e(r, "".concat(n), { defIds: r.defIds, idSuffix: g.current }, D({ ref: e, className: C }, d), a);
|
|
128
128
|
});
|
|
129
|
-
function
|
|
130
|
-
return z(t.tag,
|
|
131
|
-
return
|
|
129
|
+
function $e(t, e, r, n, o) {
|
|
130
|
+
return z(t.tag, D(D({ key: e }, Ot(t, r, o)), n), (Pt(t, r).children || []).map(function(a, d) {
|
|
131
|
+
return $e(a, "".concat(e, "-").concat(t.tag, "-").concat(d), r, void 0, o);
|
|
132
132
|
}));
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
var
|
|
136
|
-
|
|
134
|
+
function Ot(t, e, r) {
|
|
135
|
+
var n = D({}, t.attrs);
|
|
136
|
+
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(a) {
|
|
137
|
+
var d = a[0], C = a[1];
|
|
138
|
+
d === "mask" && typeof C == "string" && (n[d] = C.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
139
|
+
});
|
|
137
140
|
var o = e.defIds;
|
|
138
|
-
return !o || o.length === 0 || (t.tag === "use" &&
|
|
139
|
-
var
|
|
140
|
-
typeof
|
|
141
|
-
})),
|
|
141
|
+
return !o || o.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(a) {
|
|
142
|
+
var d = a[0], C = a[1];
|
|
143
|
+
typeof C == "string" && (n[d] = C.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
144
|
+
})), n;
|
|
142
145
|
}
|
|
143
|
-
function
|
|
144
|
-
var
|
|
145
|
-
return !
|
|
146
|
-
return typeof o.attrs.id == "string" &&
|
|
146
|
+
function Pt(t, e) {
|
|
147
|
+
var r, n = e.defIds;
|
|
148
|
+
return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? D(D({}, t), { children: t.children.map(function(o) {
|
|
149
|
+
return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? D(D({}, o), { attrs: D(D({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
|
|
147
150
|
}) }) : t;
|
|
148
151
|
}
|
|
149
152
|
function Mt() {
|
|
150
153
|
return Math.random().toString(36).substring(2, 8);
|
|
151
154
|
}
|
|
152
155
|
Z.displayName = "UniverIcon";
|
|
153
|
-
var
|
|
156
|
+
var $t = { 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) {
|
|
154
157
|
return z(Z, Object.assign({}, t, {
|
|
155
158
|
id: "delete-single",
|
|
156
159
|
ref: e,
|
|
157
|
-
icon:
|
|
160
|
+
icon: $t
|
|
158
161
|
}));
|
|
159
162
|
});
|
|
160
|
-
|
|
161
|
-
var
|
|
163
|
+
De.displayName = "DeleteSingle";
|
|
164
|
+
var Dt = { 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) {
|
|
162
165
|
return z(Z, Object.assign({}, t, {
|
|
163
166
|
id: "increase-single",
|
|
164
167
|
ref: e,
|
|
165
|
-
icon:
|
|
168
|
+
icon: Dt
|
|
166
169
|
}));
|
|
167
170
|
});
|
|
168
|
-
|
|
169
|
-
var
|
|
171
|
+
He.displayName = "IncreaseSingle";
|
|
172
|
+
var Ht = { 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" } }] }, ke = j(function(t, e) {
|
|
170
173
|
return z(Z, Object.assign({}, t, {
|
|
171
174
|
id: "more-horizontal-single",
|
|
172
175
|
ref: e,
|
|
173
|
-
icon:
|
|
176
|
+
icon: Ht
|
|
174
177
|
}));
|
|
175
178
|
});
|
|
176
|
-
|
|
177
|
-
var
|
|
179
|
+
ke.displayName = "MoreHorizontalSingle";
|
|
180
|
+
var kt = { 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 } }] }, Re = j(function(t, e) {
|
|
178
181
|
return z(Z, Object.assign({}, t, {
|
|
179
182
|
id: "reply-to-comment-single",
|
|
180
183
|
ref: e,
|
|
181
|
-
icon:
|
|
184
|
+
icon: kt
|
|
182
185
|
}));
|
|
183
186
|
});
|
|
184
|
-
|
|
185
|
-
var
|
|
187
|
+
Re.displayName = "ReplyToCommentSingle";
|
|
188
|
+
var Rt = { 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" } }] }, we = j(function(t, e) {
|
|
186
189
|
return z(Z, Object.assign({}, t, {
|
|
187
190
|
id: "resolved-single",
|
|
188
191
|
ref: e,
|
|
189
|
-
icon:
|
|
192
|
+
icon: Rt
|
|
190
193
|
}));
|
|
191
194
|
});
|
|
192
|
-
|
|
193
|
-
var
|
|
195
|
+
we.displayName = "ResolvedSingle";
|
|
196
|
+
var wt = { 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 } }] }, Le = j(function(t, e) {
|
|
194
197
|
return z(Z, Object.assign({}, t, {
|
|
195
198
|
id: "solve-single",
|
|
196
199
|
ref: e,
|
|
197
|
-
icon:
|
|
200
|
+
icon: wt
|
|
198
201
|
}));
|
|
199
202
|
});
|
|
200
203
|
Le.displayName = "SolveSingle";
|
|
201
204
|
function Ve(t) {
|
|
202
|
-
var e,
|
|
203
|
-
if (typeof t == "string" || typeof t == "number")
|
|
205
|
+
var e, r, n = "";
|
|
206
|
+
if (typeof t == "string" || typeof t == "number") n += t;
|
|
204
207
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
205
208
|
var o = t.length;
|
|
206
|
-
for (e = 0; e < o; e++) t[e] && (
|
|
207
|
-
} else for (
|
|
208
|
-
return
|
|
209
|
+
for (e = 0; e < o; e++) t[e] && (r = Ve(t[e])) && (n && (n += " "), n += r);
|
|
210
|
+
} else for (r in t) t[r] && (n && (n += " "), n += r);
|
|
211
|
+
return n;
|
|
209
212
|
}
|
|
210
213
|
function Lt() {
|
|
211
|
-
for (var t, e,
|
|
212
|
-
return
|
|
214
|
+
for (var t, e, r = 0, n = "", o = arguments.length; r < o; r++) (t = arguments[r]) && (e = Ve(t)) && (n && (n += " "), n += e);
|
|
215
|
+
return n;
|
|
213
216
|
}
|
|
214
217
|
const Vt = "univer-thread-comment-editor-buttons", xe = {
|
|
215
218
|
threadCommentEditorButtons: Vt
|
|
@@ -221,77 +224,77 @@ function Te(t) {
|
|
|
221
224
|
documentStyle: {}
|
|
222
225
|
};
|
|
223
226
|
}
|
|
224
|
-
const
|
|
225
|
-
var
|
|
226
|
-
const { comment:
|
|
227
|
-
var
|
|
228
|
-
return Ce.transform.getPlainText((
|
|
227
|
+
const je = j((t, e) => {
|
|
228
|
+
var R;
|
|
229
|
+
const { comment: r, onSave: n, id: o, onCancel: a, autoFocus: d, unitId: C, type: g } = t, N = T(oe), O = T(fe), [w, P] = V(!1), U = T(vt), m = re(null), f = g === he.UNIVER_SHEET ? Qe : C, [M, y] = V(() => {
|
|
230
|
+
var c, u, p;
|
|
231
|
+
return Ce.transform.getPlainText((p = (u = (c = m.current) == null ? void 0 : c.getDocumentData().body) == null ? void 0 : u.dataStream) != null ? p : "");
|
|
229
232
|
});
|
|
230
233
|
me(() => {
|
|
231
|
-
var u,
|
|
232
|
-
y(Ce.transform.getPlainText((
|
|
233
|
-
const
|
|
234
|
+
var u, p, s, h;
|
|
235
|
+
y(Ce.transform.getPlainText((s = (p = (u = m.current) == null ? void 0 : u.getDocumentData().body) == null ? void 0 : p.dataStream) != null ? s : ""));
|
|
236
|
+
const c = (h = m.current) == null ? void 0 : h.selectionChange$.subscribe(() => {
|
|
234
237
|
var K, _, b;
|
|
235
238
|
y(Ce.transform.getPlainText((b = (_ = (K = m.current) == null ? void 0 : K.getDocumentData().body) == null ? void 0 : _.dataStream) != null ? b : ""));
|
|
236
239
|
});
|
|
237
|
-
return () =>
|
|
238
|
-
}, [(
|
|
239
|
-
const
|
|
240
|
+
return () => c == null ? void 0 : c.unsubscribe();
|
|
241
|
+
}, [(R = m.current) == null ? void 0 : R.selectionChange$]);
|
|
242
|
+
const H = ne(() => ({
|
|
240
243
|
keyCodes: [{ keyCode: ge.ENTER }],
|
|
241
|
-
handler: (
|
|
242
|
-
|
|
244
|
+
handler: (c) => {
|
|
245
|
+
c === ge.ENTER && N.executeCommand(
|
|
243
246
|
ft.id
|
|
244
247
|
);
|
|
245
248
|
}
|
|
246
249
|
}), [N]);
|
|
247
250
|
Ct(e, () => ({
|
|
248
|
-
reply(
|
|
249
|
-
var u,
|
|
250
|
-
(u = m.current) == null || u.focus(), (
|
|
251
|
+
reply(c) {
|
|
252
|
+
var u, p;
|
|
253
|
+
(u = m.current) == null || u.focus(), (p = m.current) == null || p.setDocumentData(Te(c));
|
|
251
254
|
}
|
|
252
255
|
}));
|
|
253
256
|
const I = () => {
|
|
254
257
|
if (m.current) {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
...
|
|
258
|
-
text:
|
|
258
|
+
const c = Xe.deepClone(m.current.getDocumentData().body);
|
|
259
|
+
P(!1), n == null || n({
|
|
260
|
+
...r,
|
|
261
|
+
text: c
|
|
259
262
|
}), m.current.replaceText(""), setTimeout(() => {
|
|
260
|
-
var u,
|
|
261
|
-
(u = m.current) == null || u.setSelectionRanges([]), (
|
|
263
|
+
var u, p;
|
|
264
|
+
(u = m.current) == null || u.setSelectionRanges([]), (p = m.current) == null || p.blur();
|
|
262
265
|
}, 10);
|
|
263
266
|
}
|
|
264
267
|
};
|
|
265
|
-
return /* @__PURE__ */ S("div", { className: xe.threadCommentEditor, onClick: (
|
|
268
|
+
return /* @__PURE__ */ S("div", { className: xe.threadCommentEditor, onClick: (c) => c.preventDefault(), children: [
|
|
266
269
|
/* @__PURE__ */ l(
|
|
267
270
|
pt,
|
|
268
271
|
{
|
|
269
272
|
ref: m,
|
|
270
|
-
autoFocus:
|
|
273
|
+
autoFocus: d,
|
|
271
274
|
style: { width: "100%" },
|
|
272
|
-
keyboardEventConfig:
|
|
273
|
-
placeholder:
|
|
274
|
-
initialValue: (
|
|
275
|
-
onFocusChange: (
|
|
275
|
+
keyboardEventConfig: H,
|
|
276
|
+
placeholder: O.t("threadCommentUI.editor.placeholder"),
|
|
277
|
+
initialValue: (r == null ? void 0 : r.text) && Te(r.text),
|
|
278
|
+
onFocusChange: (c) => c && P(c),
|
|
276
279
|
isSingle: !1,
|
|
277
280
|
maxHeight: 64,
|
|
278
281
|
onClickOutside: () => {
|
|
279
282
|
setTimeout(() => {
|
|
280
|
-
U.focus(
|
|
283
|
+
U.focus(f);
|
|
281
284
|
}, 30);
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
),
|
|
285
|
-
|
|
288
|
+
w ? /* @__PURE__ */ S("div", { className: xe.threadCommentEditorButtons, children: [
|
|
286
289
|
/* @__PURE__ */ l(
|
|
287
290
|
ce,
|
|
288
291
|
{
|
|
289
292
|
style: { marginRight: 12 },
|
|
290
293
|
onClick: () => {
|
|
291
|
-
var
|
|
292
|
-
|
|
294
|
+
var c;
|
|
295
|
+
a == null || a(), P(!1), (c = m.current) == null || c.replaceText("", !0), N.executeCommand(F.id);
|
|
293
296
|
},
|
|
294
|
-
children:
|
|
297
|
+
children: O.t("threadCommentUI.editor.cancel")
|
|
295
298
|
}
|
|
296
299
|
),
|
|
297
300
|
/* @__PURE__ */ l(
|
|
@@ -300,54 +303,54 @@ const Ae = A((t, e) => {
|
|
|
300
303
|
type: "primary",
|
|
301
304
|
disabled: !M,
|
|
302
305
|
onClick: I,
|
|
303
|
-
children:
|
|
306
|
+
children: O.t(o ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
|
|
304
307
|
}
|
|
305
308
|
)
|
|
306
309
|
] }) : null
|
|
307
310
|
] });
|
|
308
|
-
}),
|
|
309
|
-
const { dataStream: e, customRanges:
|
|
311
|
+
}), jt = (t) => {
|
|
312
|
+
const { dataStream: e, customRanges: r } = t, n = e.endsWith(`\r
|
|
310
313
|
`) ? e.length - 2 : e.length, o = [];
|
|
311
|
-
let
|
|
312
|
-
return
|
|
313
|
-
|
|
314
|
+
let a = 0;
|
|
315
|
+
return r == null || r.forEach((d) => {
|
|
316
|
+
a < d.startIndex && o.push({
|
|
314
317
|
type: "text",
|
|
315
|
-
content: e.slice(
|
|
318
|
+
content: e.slice(a, d.startIndex)
|
|
316
319
|
}), o.push({
|
|
317
320
|
type: "mention",
|
|
318
321
|
content: {
|
|
319
|
-
label: e.slice(
|
|
320
|
-
id:
|
|
322
|
+
label: e.slice(d.startIndex, d.endIndex + 1),
|
|
323
|
+
id: d.rangeId
|
|
321
324
|
}
|
|
322
|
-
}),
|
|
325
|
+
}), a = d.endIndex + 1;
|
|
323
326
|
}), o.push({
|
|
324
327
|
type: "text",
|
|
325
|
-
content: e.slice(
|
|
328
|
+
content: e.slice(a, n)
|
|
326
329
|
}), o;
|
|
327
|
-
},
|
|
330
|
+
}, At = (t) => {
|
|
328
331
|
const { paragraphs: e = [] } = t;
|
|
329
|
-
let
|
|
330
|
-
return e.map((
|
|
331
|
-
const o = tt(t,
|
|
332
|
-
return
|
|
332
|
+
let r = 0;
|
|
333
|
+
return e.map((n) => {
|
|
334
|
+
const o = tt(t, r, n.startIndex);
|
|
335
|
+
return r = n.startIndex + 1, jt(o);
|
|
333
336
|
});
|
|
334
337
|
}, Bt = (t) => {
|
|
335
338
|
let e = "";
|
|
336
|
-
const
|
|
337
|
-
return t.forEach((
|
|
338
|
-
switch (
|
|
339
|
+
const r = [];
|
|
340
|
+
return t.forEach((n) => {
|
|
341
|
+
switch (n.type) {
|
|
339
342
|
case "text":
|
|
340
|
-
e +=
|
|
343
|
+
e += n.content;
|
|
341
344
|
break;
|
|
342
345
|
case "mention": {
|
|
343
346
|
const o = e.length;
|
|
344
|
-
e +=
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
rangeId:
|
|
347
|
+
e += n.content.label;
|
|
348
|
+
const a = e.length - 1;
|
|
349
|
+
r.push({
|
|
350
|
+
rangeId: n.content.id,
|
|
348
351
|
rangeType: et.MENTION,
|
|
349
352
|
startIndex: o,
|
|
350
|
-
endIndex:
|
|
353
|
+
endIndex: a,
|
|
351
354
|
properties: {}
|
|
352
355
|
});
|
|
353
356
|
break;
|
|
@@ -368,9 +371,9 @@ const Ae = A((t, e) => {
|
|
|
368
371
|
}
|
|
369
372
|
],
|
|
370
373
|
dataStream: e,
|
|
371
|
-
customRanges:
|
|
374
|
+
customRanges: r
|
|
372
375
|
};
|
|
373
|
-
}, Wt = "univer-thread-comment", Ft = "univer-thread-comment-active", zt = "univer-thread-comment-content", Zt = "univer-thread-comment-highlight", Kt = "univer-thread-comment-icon-container", Gt = "univer-thread-comment-icon", Yt = "univer-thread-comment-title", qt = "univer-thread-comment-title-position", Jt = "univer-thread-comment-title-highlight", Qt = "univer-thread-comment-title-position-text", Xt = "univer-thread-comment-username", en = "univer-thread-comment-item", tn = "univer-thread-comment-item-head", nn = "univer-thread-comment-item-title", rn = "univer-thread-comment-item-time", on = "univer-thread-comment-item-content", an = "univer-thread-comment-item-at",
|
|
376
|
+
}, Wt = "univer-thread-comment", Ft = "univer-thread-comment-active", zt = "univer-thread-comment-content", Zt = "univer-thread-comment-highlight", Kt = "univer-thread-comment-icon-container", Gt = "univer-thread-comment-icon", Yt = "univer-thread-comment-title", qt = "univer-thread-comment-title-position", Jt = "univer-thread-comment-title-highlight", Qt = "univer-thread-comment-title-position-text", Xt = "univer-thread-comment-username", en = "univer-thread-comment-item", tn = "univer-thread-comment-item-head", nn = "univer-thread-comment-item-title", rn = "univer-thread-comment-item-time", on = "univer-thread-comment-item-content", an = "univer-thread-comment-item-at", v = {
|
|
374
377
|
threadComment: Wt,
|
|
375
378
|
threadCommentActive: Ft,
|
|
376
379
|
threadCommentContent: zt,
|
|
@@ -388,100 +391,100 @@ const Ae = A((t, e) => {
|
|
|
388
391
|
threadCommentItemTime: rn,
|
|
389
392
|
threadCommentItemContent: on,
|
|
390
393
|
threadCommentItemAt: an
|
|
391
|
-
},
|
|
392
|
-
const { item: e, unitId:
|
|
393
|
-
(
|
|
394
|
-
|
|
394
|
+
}, Ae = "__mock__", sn = (t) => {
|
|
395
|
+
const { item: e, unitId: r, subUnitId: n, editing: o, onEditingChange: a, onReply: d, resolved: C, isRoot: g, onClose: N, onDeleteComment: O, type: w } = t, P = T(oe), U = T(fe), m = T(pe), f = m.getUser(e.personId), M = W(m.currentUser$), y = (M == null ? void 0 : M.userID) === e.personId, H = e.id === Ae, [I, R] = V(!1), c = () => {
|
|
396
|
+
(O == null ? void 0 : O(e)) !== !1 && (P.executeCommand(
|
|
397
|
+
g ? Oe.id : lt.id,
|
|
395
398
|
{
|
|
396
|
-
unitId:
|
|
397
|
-
subUnitId:
|
|
399
|
+
unitId: r,
|
|
400
|
+
subUnitId: n,
|
|
398
401
|
commentId: e.id
|
|
399
402
|
}
|
|
400
|
-
),
|
|
403
|
+
), g && (N == null || N()));
|
|
401
404
|
};
|
|
402
|
-
return /* @__PURE__ */ S("div", { className:
|
|
403
|
-
/* @__PURE__ */ l("img", { className:
|
|
404
|
-
/* @__PURE__ */ S("div", { className:
|
|
405
|
-
/* @__PURE__ */ l("div", { className:
|
|
405
|
+
return /* @__PURE__ */ S("div", { className: v.threadCommentItem, onMouseLeave: () => R(!1), onMouseEnter: () => R(!0), children: [
|
|
406
|
+
/* @__PURE__ */ l("img", { className: v.threadCommentItemHead, src: f == null ? void 0 : f.avatar }),
|
|
407
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentItemTitle, children: [
|
|
408
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentUsername, children: (f == null ? void 0 : f.name) || " " }),
|
|
406
409
|
/* @__PURE__ */ S("div", { children: [
|
|
407
|
-
|
|
408
|
-
y &&
|
|
410
|
+
H || C ? null : I ? /* @__PURE__ */ l("div", { className: v.threadCommentIcon, onClick: () => d(f), children: /* @__PURE__ */ l(Re, {}) }) : null,
|
|
411
|
+
y && !H && !C ? /* @__PURE__ */ l(
|
|
409
412
|
ut,
|
|
410
413
|
{
|
|
411
414
|
overlay: /* @__PURE__ */ S(ht, { children: [
|
|
412
|
-
/* @__PURE__ */ l(be, { onClick: () =>
|
|
413
|
-
/* @__PURE__ */ l(be, { onClick:
|
|
415
|
+
/* @__PURE__ */ l(be, { onClick: () => a == null ? void 0 : a(!0), children: U.t("threadCommentUI.item.edit") }, "edit"),
|
|
416
|
+
/* @__PURE__ */ l(be, { onClick: c, children: U.t("threadCommentUI.item.delete") }, "delete")
|
|
414
417
|
] }),
|
|
415
|
-
children: /* @__PURE__ */ l("div", { className:
|
|
418
|
+
children: /* @__PURE__ */ l("div", { className: v.threadCommentIcon, children: /* @__PURE__ */ l(ke, {}) })
|
|
416
419
|
}
|
|
417
420
|
) : null
|
|
418
421
|
] })
|
|
419
422
|
] }),
|
|
420
|
-
/* @__PURE__ */ l("div", { className:
|
|
423
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentItemTime, children: e.dT }),
|
|
421
424
|
o ? /* @__PURE__ */ l(
|
|
422
|
-
|
|
425
|
+
je,
|
|
423
426
|
{
|
|
424
|
-
type:
|
|
427
|
+
type: w,
|
|
425
428
|
id: e.id,
|
|
426
429
|
comment: e,
|
|
427
|
-
onCancel: () =>
|
|
430
|
+
onCancel: () => a == null ? void 0 : a(!1),
|
|
428
431
|
autoFocus: !0,
|
|
429
|
-
unitId:
|
|
430
|
-
subUnitId:
|
|
431
|
-
onSave: ({ text: u, attachments:
|
|
432
|
-
|
|
432
|
+
unitId: r,
|
|
433
|
+
subUnitId: n,
|
|
434
|
+
onSave: ({ text: u, attachments: p }) => {
|
|
435
|
+
a == null || a(!1), P.executeCommand(
|
|
433
436
|
st.id,
|
|
434
437
|
{
|
|
435
|
-
unitId:
|
|
436
|
-
subUnitId:
|
|
438
|
+
unitId: r,
|
|
439
|
+
subUnitId: n,
|
|
437
440
|
payload: {
|
|
438
441
|
commentId: e.id,
|
|
439
442
|
text: u,
|
|
440
|
-
attachments:
|
|
443
|
+
attachments: p
|
|
441
444
|
}
|
|
442
445
|
}
|
|
443
446
|
);
|
|
444
447
|
}
|
|
445
448
|
}
|
|
446
|
-
) : /* @__PURE__ */ l("div", { className:
|
|
447
|
-
switch (
|
|
449
|
+
) : /* @__PURE__ */ l("div", { className: v.threadCommentItemContent, children: At(e.text).map((u, p) => /* @__PURE__ */ l("div", { children: u.map((s, h) => {
|
|
450
|
+
switch (s.type) {
|
|
448
451
|
case "mention":
|
|
449
|
-
return /* @__PURE__ */ S("a", { className:
|
|
450
|
-
|
|
452
|
+
return /* @__PURE__ */ S("a", { className: v.threadCommentItemAt, children: [
|
|
453
|
+
s.content.label,
|
|
451
454
|
" "
|
|
452
455
|
] }, h);
|
|
453
456
|
default:
|
|
454
|
-
return
|
|
457
|
+
return s.content;
|
|
455
458
|
}
|
|
456
|
-
}) },
|
|
459
|
+
}) }, p)) })
|
|
457
460
|
] });
|
|
458
461
|
}, ln = (t) => {
|
|
459
462
|
var X, ee, se;
|
|
460
463
|
const {
|
|
461
464
|
id: e,
|
|
462
|
-
unitId:
|
|
463
|
-
subUnitId:
|
|
465
|
+
unitId: r,
|
|
466
|
+
subUnitId: n,
|
|
464
467
|
refStr: o,
|
|
465
|
-
showEdit:
|
|
466
|
-
onClick:
|
|
467
|
-
showHighlight:
|
|
468
|
-
onClose:
|
|
468
|
+
showEdit: a = !0,
|
|
469
|
+
onClick: d,
|
|
470
|
+
showHighlight: C,
|
|
471
|
+
onClose: g,
|
|
469
472
|
getSubUnitName: N,
|
|
470
|
-
prefix:
|
|
471
|
-
autoFocus:
|
|
472
|
-
onMouseEnter:
|
|
473
|
+
prefix: O,
|
|
474
|
+
autoFocus: w,
|
|
475
|
+
onMouseEnter: P,
|
|
473
476
|
onMouseLeave: U,
|
|
474
477
|
onAddComment: m,
|
|
475
|
-
onDeleteComment:
|
|
478
|
+
onDeleteComment: f,
|
|
476
479
|
onResolve: M,
|
|
477
480
|
type: y
|
|
478
|
-
} = t,
|
|
479
|
-
W(
|
|
480
|
-
const
|
|
481
|
-
...
|
|
481
|
+
} = t, H = T(Ee), [I, R] = V(!1), [c, u] = V(""), p = ne(() => H.commentUpdate$.pipe(ct(16)), [H]);
|
|
482
|
+
W(p);
|
|
483
|
+
const s = e ? H.getCommentWithChildren(r, n, e) : null, h = T(oe), K = T(pe), _ = s == null ? void 0 : s.root.resolved, b = W(K.currentUser$), G = re(null), ie = [
|
|
484
|
+
...s ? [s.root] : (
|
|
482
485
|
// mock empty comment
|
|
483
486
|
[{
|
|
484
|
-
id:
|
|
487
|
+
id: Ae,
|
|
485
488
|
text: {
|
|
486
489
|
dataStream: `
|
|
487
490
|
\r`
|
|
@@ -489,88 +492,88 @@ const Ae = A((t, e) => {
|
|
|
489
492
|
personId: (X = b == null ? void 0 : b.userID) != null ? X : "",
|
|
490
493
|
ref: o != null ? o : "",
|
|
491
494
|
dT: "",
|
|
492
|
-
unitId:
|
|
493
|
-
subUnitId:
|
|
495
|
+
unitId: r,
|
|
496
|
+
subUnitId: n,
|
|
494
497
|
threadId: ""
|
|
495
498
|
}]
|
|
496
499
|
),
|
|
497
|
-
...(ee =
|
|
498
|
-
],
|
|
500
|
+
...(ee = s == null ? void 0 : s.children) != null ? ee : []
|
|
501
|
+
], $ = re(null), q = (x) => {
|
|
499
502
|
x.stopPropagation(), _ ? h.executeCommand(F.id, {
|
|
500
|
-
unitId:
|
|
501
|
-
subUnitId:
|
|
503
|
+
unitId: r,
|
|
504
|
+
subUnitId: n,
|
|
502
505
|
commentId: e
|
|
503
506
|
}) : h.executeCommand(F.id), h.executeCommand(at.id, {
|
|
504
|
-
unitId:
|
|
505
|
-
subUnitId:
|
|
507
|
+
unitId: r,
|
|
508
|
+
subUnitId: n,
|
|
506
509
|
commentId: e,
|
|
507
510
|
resolved: !_
|
|
508
511
|
}), M == null || M(!_);
|
|
509
512
|
}, L = (x) => {
|
|
510
|
-
x.stopPropagation(), h.executeCommand(F.id), !(
|
|
511
|
-
|
|
513
|
+
x.stopPropagation(), h.executeCommand(F.id), !(s != null && s.root && (f == null ? void 0 : f(s.root)) === !1) && (h.executeCommand(
|
|
514
|
+
Oe.id,
|
|
512
515
|
{
|
|
513
|
-
unitId:
|
|
514
|
-
subUnitId:
|
|
516
|
+
unitId: r,
|
|
517
|
+
subUnitId: n,
|
|
515
518
|
commentId: e
|
|
516
519
|
}
|
|
517
|
-
),
|
|
520
|
+
), g == null || g());
|
|
518
521
|
};
|
|
519
522
|
me(() => U == null ? void 0 : U(), []);
|
|
520
|
-
const J = N((se =
|
|
523
|
+
const J = N((se = s == null ? void 0 : s.root.subUnitId) != null ? se : n), Q = a && !c && !_, ae = `${o || (s == null ? void 0 : s.root.ref) || ""}${J ? " · " : ""}${J}`;
|
|
521
524
|
return /* @__PURE__ */ S(
|
|
522
525
|
"div",
|
|
523
526
|
{
|
|
524
|
-
className: Lt(
|
|
525
|
-
[
|
|
527
|
+
className: Lt(v.threadComment, {
|
|
528
|
+
[v.threadCommentActive]: !_ && (C || I || O === "cell")
|
|
526
529
|
}),
|
|
527
|
-
onClick:
|
|
528
|
-
id: `${
|
|
530
|
+
onClick: d,
|
|
531
|
+
id: `${O}-${r}-${n}-${e}`,
|
|
529
532
|
onMouseEnter: () => {
|
|
530
|
-
|
|
533
|
+
P == null || P(), R(!0);
|
|
531
534
|
},
|
|
532
535
|
onMouseLeave: () => {
|
|
533
|
-
U == null || U(),
|
|
536
|
+
U == null || U(), R(!1);
|
|
534
537
|
},
|
|
535
538
|
children: [
|
|
536
|
-
!_ &&
|
|
537
|
-
/* @__PURE__ */ S("div", { className:
|
|
538
|
-
/* @__PURE__ */ S("div", { className:
|
|
539
|
-
/* @__PURE__ */ l("div", { className:
|
|
540
|
-
/* @__PURE__ */ l(mt, { showIfEllipsis: !0, title: ae, children: /* @__PURE__ */ l("div", { className:
|
|
539
|
+
!_ && C ? /* @__PURE__ */ l("div", { className: v.threadCommentHighlight }) : null,
|
|
540
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentTitle, children: [
|
|
541
|
+
/* @__PURE__ */ S("div", { className: v.threadCommentTitlePosition, children: [
|
|
542
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentTitleHighlight }),
|
|
543
|
+
/* @__PURE__ */ l(mt, { showIfEllipsis: !0, title: ae, children: /* @__PURE__ */ l("div", { className: v.threadCommentTitlePositionText, children: ae }) })
|
|
541
544
|
] }),
|
|
542
|
-
|
|
545
|
+
s ? /* @__PURE__ */ S("div", { className: v.threadCommentIconContainer, children: [
|
|
543
546
|
/* @__PURE__ */ l(
|
|
544
547
|
"div",
|
|
545
548
|
{
|
|
546
549
|
onClick: q,
|
|
547
|
-
className:
|
|
550
|
+
className: v.threadCommentIcon,
|
|
548
551
|
style: { color: _ ? "rgb(var(--green-500))" : "" },
|
|
549
|
-
children: _ ? /* @__PURE__ */ l(
|
|
552
|
+
children: _ ? /* @__PURE__ */ l(we, {}) : /* @__PURE__ */ l(Le, {})
|
|
550
553
|
}
|
|
551
554
|
),
|
|
552
|
-
(b == null ? void 0 : b.userID) ===
|
|
555
|
+
(b == null ? void 0 : b.userID) === s.root.personId ? /* @__PURE__ */ l("div", { className: v.threadCommentIcon, onClick: L, children: /* @__PURE__ */ l(De, {}) }) : null
|
|
553
556
|
] }) : null
|
|
554
557
|
] }),
|
|
555
|
-
/* @__PURE__ */ l("div", { className:
|
|
558
|
+
/* @__PURE__ */ l("div", { className: v.threadCommentContent, ref: $, children: ie.map(
|
|
556
559
|
(x) => /* @__PURE__ */ l(
|
|
557
560
|
sn,
|
|
558
561
|
{
|
|
559
|
-
onClose:
|
|
560
|
-
unitId:
|
|
561
|
-
subUnitId:
|
|
562
|
+
onClose: g,
|
|
563
|
+
unitId: r,
|
|
564
|
+
subUnitId: n,
|
|
562
565
|
item: x,
|
|
563
|
-
isRoot: x.id === (
|
|
564
|
-
editing:
|
|
565
|
-
resolved:
|
|
566
|
+
isRoot: x.id === (s == null ? void 0 : s.root.id),
|
|
567
|
+
editing: c === x.id,
|
|
568
|
+
resolved: s == null ? void 0 : s.root.resolved,
|
|
566
569
|
type: y,
|
|
567
570
|
onEditingChange: (i) => {
|
|
568
571
|
u(i ? x.id : "");
|
|
569
572
|
},
|
|
570
573
|
onReply: (i) => {
|
|
571
574
|
i && requestAnimationFrame(() => {
|
|
572
|
-
var
|
|
573
|
-
(
|
|
575
|
+
var k;
|
|
576
|
+
(k = G.current) == null || k.reply(Bt([{
|
|
574
577
|
type: "mention",
|
|
575
578
|
content: {
|
|
576
579
|
id: i.userID,
|
|
@@ -580,46 +583,46 @@ const Ae = A((t, e) => {
|
|
|
580
583
|
});
|
|
581
584
|
},
|
|
582
585
|
onAddComment: m,
|
|
583
|
-
onDeleteComment:
|
|
586
|
+
onDeleteComment: f
|
|
584
587
|
},
|
|
585
588
|
x.id
|
|
586
589
|
)
|
|
587
590
|
) }),
|
|
588
591
|
Q ? /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(
|
|
589
|
-
|
|
592
|
+
je,
|
|
590
593
|
{
|
|
591
594
|
ref: G,
|
|
592
595
|
type: y,
|
|
593
|
-
unitId:
|
|
594
|
-
subUnitId:
|
|
596
|
+
unitId: r,
|
|
597
|
+
subUnitId: n,
|
|
595
598
|
onSave: async ({ text: x, attachments: i }) => {
|
|
596
|
-
const
|
|
599
|
+
const k = {
|
|
597
600
|
text: x,
|
|
598
601
|
attachments: i,
|
|
599
602
|
dT: ot(),
|
|
600
603
|
id: nt(),
|
|
601
604
|
ref: o,
|
|
602
605
|
personId: b == null ? void 0 : b.userID,
|
|
603
|
-
parentId:
|
|
604
|
-
unitId:
|
|
605
|
-
subUnitId:
|
|
606
|
-
threadId:
|
|
606
|
+
parentId: s == null ? void 0 : s.root.id,
|
|
607
|
+
unitId: r,
|
|
608
|
+
subUnitId: n,
|
|
609
|
+
threadId: s == null ? void 0 : s.root.threadId
|
|
607
610
|
};
|
|
608
|
-
(m == null ? void 0 : m(
|
|
611
|
+
(m == null ? void 0 : m(k)) !== !1 && (await h.executeCommand(
|
|
609
612
|
it.id,
|
|
610
613
|
{
|
|
611
|
-
unitId:
|
|
612
|
-
subUnitId:
|
|
613
|
-
comment:
|
|
614
|
+
unitId: r,
|
|
615
|
+
subUnitId: n,
|
|
616
|
+
comment: k
|
|
614
617
|
}
|
|
615
|
-
),
|
|
618
|
+
), $.current && ($.current.scrollTop = $.current.scrollHeight));
|
|
616
619
|
},
|
|
617
|
-
autoFocus:
|
|
620
|
+
autoFocus: w || !s,
|
|
618
621
|
onCancel: () => {
|
|
619
|
-
|
|
622
|
+
s || g == null || g();
|
|
620
623
|
}
|
|
621
624
|
},
|
|
622
|
-
`${
|
|
625
|
+
`${w}`
|
|
623
626
|
) }) : null
|
|
624
627
|
]
|
|
625
628
|
}
|
|
@@ -633,43 +636,43 @@ const Ae = A((t, e) => {
|
|
|
633
636
|
}, _n = (t) => {
|
|
634
637
|
const {
|
|
635
638
|
unitId: e,
|
|
636
|
-
subUnitId$:
|
|
637
|
-
type:
|
|
639
|
+
subUnitId$: r,
|
|
640
|
+
type: n,
|
|
638
641
|
onAdd: o,
|
|
639
|
-
getSubUnitName:
|
|
640
|
-
onResolve:
|
|
641
|
-
sortComments:
|
|
642
|
-
onItemLeave:
|
|
642
|
+
getSubUnitName: a,
|
|
643
|
+
onResolve: d,
|
|
644
|
+
sortComments: C,
|
|
645
|
+
onItemLeave: g,
|
|
643
646
|
onItemEnter: N,
|
|
644
|
-
disableAdd:
|
|
645
|
-
tempComment:
|
|
646
|
-
onAddComment:
|
|
647
|
+
disableAdd: O,
|
|
648
|
+
tempComment: w,
|
|
649
|
+
onAddComment: P,
|
|
647
650
|
onDeleteComment: U,
|
|
648
651
|
showComments: m
|
|
649
|
-
} = t, [
|
|
652
|
+
} = t, [f, M] = V("all"), [y, H] = V("all"), I = T(fe), R = T(pe), c = T(Ee), [u, p] = V(() => c.getUnit(e)), s = T(Y), h = W(s.activeCommentId$), K = W(c.commentUpdate$), _ = T(oe), b = W(r), G = re(!0), ie = "panel", $ = W(R.currentUser$), q = ne(() => {
|
|
650
653
|
var de;
|
|
651
|
-
const i =
|
|
652
|
-
var
|
|
653
|
-
return { ...E.root, children: (
|
|
654
|
+
const i = f === "all" ? u : (de = u.filter((E) => E.subUnitId === b)) != null ? de : [], k = C != null ? C : (E) => E, le = i.map((E) => {
|
|
655
|
+
var A;
|
|
656
|
+
return { ...E.root, children: (A = E.children) != null ? A : [], users: E.relativeUsers };
|
|
654
657
|
});
|
|
655
658
|
if (m) {
|
|
656
659
|
const E = /* @__PURE__ */ new Map();
|
|
657
|
-
return le.forEach((
|
|
658
|
-
E.set(
|
|
659
|
-
}), [...m, ""].map((
|
|
660
|
+
return le.forEach((A) => {
|
|
661
|
+
E.set(A.id, A);
|
|
662
|
+
}), [...m, ""].map((A) => E.get(A)).filter(Boolean);
|
|
660
663
|
} else
|
|
661
|
-
return
|
|
662
|
-
}, [m,
|
|
664
|
+
return k(le);
|
|
665
|
+
}, [m, f, u, C, b]), L = ne(() => [
|
|
663
666
|
...q.filter((i) => !i.resolved),
|
|
664
667
|
...q.filter((i) => i.resolved)
|
|
665
|
-
], [q]), J = ne(() => y === "resolved" ? L.filter((i) => i.resolved) : y === "unsolved" ? L.filter((i) => !i.resolved) : y === "concern_me" &&
|
|
666
|
-
|
|
668
|
+
], [q]), J = ne(() => y === "resolved" ? L.filter((i) => i.resolved) : y === "unsolved" ? L.filter((i) => !i.resolved) : y === "concern_me" && $ != null && $.userID ? L.filter((i) => i == null ? void 0 : i.users.has($.userID)) : L, [L, $ == null ? void 0 : $.userID, y]), Q = w ? [w, ...J] : J, ae = Q.filter((i) => !i.resolved), X = Q.filter((i) => i.resolved), ee = y !== "all" || f !== "all", se = () => {
|
|
669
|
+
H("all"), M("all");
|
|
667
670
|
};
|
|
668
671
|
me(() => {
|
|
669
|
-
e &&
|
|
670
|
-
|
|
672
|
+
e && p(
|
|
673
|
+
c.getUnit(e)
|
|
671
674
|
);
|
|
672
|
-
}, [e,
|
|
675
|
+
}, [e, c, K]), me(() => {
|
|
673
676
|
var E;
|
|
674
677
|
if (!h)
|
|
675
678
|
return;
|
|
@@ -677,19 +680,19 @@ const Ae = A((t, e) => {
|
|
|
677
680
|
G.current = !0;
|
|
678
681
|
return;
|
|
679
682
|
}
|
|
680
|
-
const { unitId: i, subUnitId:
|
|
683
|
+
const { unitId: i, subUnitId: k, commentId: le } = h, de = `${ie}-${i}-${k}-${le}`;
|
|
681
684
|
(E = document.getElementById(de)) == null || E.scrollIntoView({ block: "center" });
|
|
682
685
|
}, [h]);
|
|
683
686
|
const x = (i) => /* @__PURE__ */ l(
|
|
684
687
|
ln,
|
|
685
688
|
{
|
|
686
689
|
prefix: ie,
|
|
687
|
-
getSubUnitName:
|
|
690
|
+
getSubUnitName: a,
|
|
688
691
|
id: i.id,
|
|
689
692
|
unitId: i.unitId,
|
|
690
693
|
subUnitId: i.subUnitId,
|
|
691
694
|
refStr: i.ref,
|
|
692
|
-
type:
|
|
695
|
+
type: n,
|
|
693
696
|
showEdit: (h == null ? void 0 : h.commentId) === i.id,
|
|
694
697
|
showHighlight: (h == null ? void 0 : h.commentId) === i.id,
|
|
695
698
|
onClick: () => {
|
|
@@ -704,20 +707,20 @@ const Ae = A((t, e) => {
|
|
|
704
707
|
);
|
|
705
708
|
},
|
|
706
709
|
onMouseEnter: () => N == null ? void 0 : N(i),
|
|
707
|
-
onMouseLeave: () =>
|
|
708
|
-
onAddComment:
|
|
710
|
+
onMouseLeave: () => g == null ? void 0 : g(i),
|
|
711
|
+
onAddComment: P,
|
|
709
712
|
onDeleteComment: U,
|
|
710
|
-
onResolve: (
|
|
713
|
+
onResolve: (k) => d == null ? void 0 : d(i.id, k)
|
|
711
714
|
},
|
|
712
715
|
i.id
|
|
713
716
|
);
|
|
714
717
|
return /* @__PURE__ */ S("div", { className: te.threadCommentPanel, children: [
|
|
715
718
|
/* @__PURE__ */ S("div", { className: te.threadCommentPanelForms, children: [
|
|
716
|
-
|
|
719
|
+
n === he.UNIVER_SHEET ? /* @__PURE__ */ l(
|
|
717
720
|
Se,
|
|
718
721
|
{
|
|
719
722
|
borderless: !0,
|
|
720
|
-
value:
|
|
723
|
+
value: f,
|
|
721
724
|
onChange: (i) => M(i),
|
|
722
725
|
options: [
|
|
723
726
|
{
|
|
@@ -736,7 +739,7 @@ const Ae = A((t, e) => {
|
|
|
736
739
|
{
|
|
737
740
|
borderless: !0,
|
|
738
741
|
value: y,
|
|
739
|
-
onChange: (i) =>
|
|
742
|
+
onChange: (i) => H(i),
|
|
740
743
|
options: [
|
|
741
744
|
{
|
|
742
745
|
value: "all",
|
|
@@ -777,9 +780,9 @@ const Ae = A((t, e) => {
|
|
|
777
780
|
className: te.threadCommentPanelAdd,
|
|
778
781
|
type: "primary",
|
|
779
782
|
onClick: o,
|
|
780
|
-
disabled:
|
|
783
|
+
disabled: O,
|
|
781
784
|
children: [
|
|
782
|
-
/* @__PURE__ */ l(
|
|
785
|
+
/* @__PURE__ */ l(He, {}),
|
|
783
786
|
I.t("threadCommentUI.panel.addComment")
|
|
784
787
|
]
|
|
785
788
|
}
|