@univerjs/thread-comment-ui 0.2.4 → 0.2.5
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 +3 -3
- package/lib/es/index.js +271 -288
- package/lib/types/plugin.d.ts +1 -2
- package/lib/types/services/thread-comment-mention-data.service.d.ts +1 -1
- package/lib/types/views/thread-comment-panel/index.d.ts +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +14 -16
- package/lib/types/controllers/thread-comment-ui.controller.d.ts +0 -6
package/lib/es/index.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { UniverThreadCommentPlugin as
|
|
6
|
-
import { Disposable as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function ft() {
|
|
17
|
-
return ze().format("YYYY/MM/DD HH:mm");
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Be = (t, e, n) => e in t ? je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var H = (t, e, n) => Be(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import We from "dayjs";
|
|
5
|
+
import { UniverThreadCommentPlugin as Fe, ThreadCommentModel as Ee, AddCommentCommand as ze, UpdateCommentCommand as Ze, ResolveCommentCommand as Ye, DeleteCommentTreeCommand as ye, DeleteCommentCommand as Ge } from "@univerjs/thread-comment";
|
|
6
|
+
import { Disposable as Ke, UniverInstanceType as he, Inject as xe, IUniverInstanceService as qe, CommandType as _e, createIdentifier as Je, Plugin as Qe, mergeOverrideWithDependencies as Xe, DependentOn as et, Injector as tt, ICommandService as X, CustomRangeType as nt, useDependency as S, LocaleService as Ce, UserManagerService as ve, Tools as rt } from "@univerjs/core";
|
|
7
|
+
import { ISidebarService as Te, useObservable as V } from "@univerjs/ui";
|
|
8
|
+
import { BehaviorSubject as ge, filter as ot } from "rxjs";
|
|
9
|
+
import a, { forwardRef as A, useRef as me, createElement as B, useState as k, useImperativeHandle as at, useEffect as ue, useMemo as ce } from "react";
|
|
10
|
+
import { Mentions as it, Mention as lt, Button as ie, Dropdown as st, Menu as mt, MenuItem as pe, Select as Ie } from "@univerjs/design";
|
|
11
|
+
import dt from "clsx";
|
|
12
|
+
import { ITextSelectionRenderManager as ct } from "@univerjs/engine-render";
|
|
13
|
+
import { TextSelectionManagerService as ut } from "@univerjs/docs";
|
|
14
|
+
function ht() {
|
|
15
|
+
return We().format("YYYY/MM/DD HH:mm");
|
|
18
16
|
}
|
|
19
|
-
const
|
|
20
|
-
var
|
|
21
|
-
for (var o = r > 1 ? void 0 : r ?
|
|
22
|
-
(m = t[
|
|
23
|
-
return r && o &&
|
|
24
|
-
},
|
|
25
|
-
let z = class extends
|
|
17
|
+
const Ct = "thread-comment-panel", vt = "THREAD_COMMENT_UI_PLUGIN";
|
|
18
|
+
var ft = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, pt = (t, e, n, r) => {
|
|
19
|
+
for (var o = r > 1 ? void 0 : r ? gt(e, n) : e, s = t.length - 1, m; s >= 0; s--)
|
|
20
|
+
(m = t[s]) && (o = (r ? m(e, n, o) : m(o)) || o);
|
|
21
|
+
return r && o && ft(e, n, o), o;
|
|
22
|
+
}, be = (t, e) => (n, r) => e(n, r, t);
|
|
23
|
+
let z = class extends Ke {
|
|
26
24
|
constructor(e, n) {
|
|
27
25
|
super();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
H(this, "_panelVisible", !1);
|
|
27
|
+
H(this, "_panelVisible$", new ge(!1));
|
|
28
|
+
H(this, "_activeCommentId");
|
|
29
|
+
H(this, "_activeCommentId$", new ge(void 0));
|
|
30
|
+
H(this, "panelVisible$", this._panelVisible$.asObservable());
|
|
31
|
+
H(this, "activeCommentId$", this._activeCommentId$.asObservable());
|
|
34
32
|
this._sidebarService = e, this._univerInstanceService = n, this._init(), this.disposeWithMe(() => {
|
|
35
33
|
this._activeCommentId$.complete(), this._panelVisible$.complete();
|
|
36
34
|
});
|
|
@@ -41,7 +39,7 @@ let z = class extends Te {
|
|
|
41
39
|
e.visible || this.setPanelVisible(!1);
|
|
42
40
|
})
|
|
43
41
|
), this.disposeWithMe(
|
|
44
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
42
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(ot((e) => !e)).subscribe(() => {
|
|
45
43
|
this._sidebarService.close();
|
|
46
44
|
})
|
|
47
45
|
);
|
|
@@ -59,82 +57,67 @@ let z = class extends Te {
|
|
|
59
57
|
this._activeCommentId = e, this._activeCommentId$.next(e);
|
|
60
58
|
}
|
|
61
59
|
};
|
|
62
|
-
z =
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
z = pt([
|
|
61
|
+
be(0, xe(Te)),
|
|
62
|
+
be(1, qe)
|
|
65
63
|
], z);
|
|
66
|
-
const
|
|
64
|
+
const It = {
|
|
67
65
|
id: "thread-comment-ui.operation.toggle-panel",
|
|
68
|
-
type:
|
|
66
|
+
type: _e.OPERATION,
|
|
69
67
|
handler(t) {
|
|
70
|
-
const e = t.get(
|
|
68
|
+
const e = t.get(Te), n = t.get(z);
|
|
71
69
|
return n.panelVisible ? (e.close(), n.setPanelVisible(!1)) : (e.open({
|
|
72
70
|
header: { title: "threadCommentUI.panel.title" },
|
|
73
|
-
children: { label:
|
|
71
|
+
children: { label: Ct },
|
|
74
72
|
width: 320
|
|
75
73
|
}), n.setPanelVisible(!0)), !0;
|
|
76
74
|
}
|
|
77
|
-
},
|
|
75
|
+
}, j = {
|
|
78
76
|
id: "thread-comment-ui.operation.set-active-comment",
|
|
79
|
-
type:
|
|
77
|
+
type: _e.OPERATION,
|
|
80
78
|
handler(t, e) {
|
|
81
79
|
return t.get(z).setActiveComment(e), !0;
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
|
|
85
|
-
for (var o = r > 1 ? void 0 : r ? xt(e, n) : e, i = t.length - 1, m; i >= 0; i--)
|
|
86
|
-
(m = t[i]) && (o = (r ? m(e, n, o) : m(o)) || o);
|
|
87
|
-
return r && o && yt(e, n, o), o;
|
|
88
|
-
}, Tt = (t, e) => (n, r) => e(n, r, t);
|
|
89
|
-
let ie = class extends Te {
|
|
90
|
-
constructor(t) {
|
|
91
|
-
super(), this._localeService = t;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
ie = _t([
|
|
95
|
-
Qe(Xe.Starting, ie),
|
|
96
|
-
Tt(0, ge(de))
|
|
97
|
-
], ie);
|
|
98
|
-
class Nt {
|
|
82
|
+
class bt {
|
|
99
83
|
constructor() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
H(this, "dataSource");
|
|
85
|
+
H(this, "renderSuggestion");
|
|
86
|
+
H(this, "trigger", "@");
|
|
103
87
|
}
|
|
104
88
|
async getMentions(e, n, r) {
|
|
105
89
|
return this.dataSource ? this.dataSource.getMentions(e, n, r) : [];
|
|
106
90
|
}
|
|
107
91
|
}
|
|
108
|
-
const
|
|
109
|
-
var
|
|
110
|
-
for (var o = r > 1 ? void 0 : r ?
|
|
111
|
-
(m = t[
|
|
112
|
-
return r && o &&
|
|
113
|
-
},
|
|
114
|
-
let
|
|
92
|
+
const Ne = Je("thread-comment.mention-data.service");
|
|
93
|
+
var Me = Object.defineProperty, St = Object.getOwnPropertyDescriptor, Et = (t, e, n) => e in t ? Me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, yt = (t, e, n, r) => {
|
|
94
|
+
for (var o = r > 1 ? void 0 : r ? St(e, n) : e, s = t.length - 1, m; s >= 0; s--)
|
|
95
|
+
(m = t[s]) && (o = (r ? m(e, n, o) : m(o)) || o);
|
|
96
|
+
return r && o && Me(e, n, o), o;
|
|
97
|
+
}, Se = (t, e) => (n, r) => e(n, r, t), Ue = (t, e, n) => Et(t, typeof e != "symbol" ? e + "" : e, n);
|
|
98
|
+
let le = class extends Qe {
|
|
115
99
|
constructor(t, e, n) {
|
|
116
100
|
super(), this._config = t, this._injector = e, this._commandService = n;
|
|
117
101
|
}
|
|
118
102
|
onStarting(t) {
|
|
119
103
|
var e;
|
|
120
|
-
|
|
121
|
-
[ie],
|
|
104
|
+
Xe([
|
|
122
105
|
[z],
|
|
123
|
-
[
|
|
106
|
+
[Ne, { useClass: bt }]
|
|
124
107
|
], (e = this._config) == null ? void 0 : e.overrides).forEach((n) => {
|
|
125
108
|
t.add(n);
|
|
126
|
-
}), [
|
|
109
|
+
}), [It, j].forEach((n) => {
|
|
127
110
|
this._commandService.registerCommand(n);
|
|
128
111
|
});
|
|
129
112
|
}
|
|
130
113
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
114
|
+
Ue(le, "pluginName", vt);
|
|
115
|
+
Ue(le, "type", he.UNIVER_UNKNOWN);
|
|
116
|
+
le = yt([
|
|
117
|
+
et(Fe),
|
|
118
|
+
Se(1, xe(tt)),
|
|
119
|
+
Se(2, X)
|
|
120
|
+
], le);
|
|
138
121
|
var T = function() {
|
|
139
122
|
return T = Object.assign || function(t) {
|
|
140
123
|
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
@@ -143,7 +126,7 @@ var T = function() {
|
|
|
143
126
|
}
|
|
144
127
|
return t;
|
|
145
128
|
}, T.apply(this, arguments);
|
|
146
|
-
},
|
|
129
|
+
}, xt = function(t, e) {
|
|
147
130
|
var n = {};
|
|
148
131
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
149
132
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -151,87 +134,87 @@ var T = function() {
|
|
|
151
134
|
e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
|
|
152
135
|
return n;
|
|
153
136
|
}, W = A(function(t, e) {
|
|
154
|
-
var n = t.icon, r = t.id, o = t.className,
|
|
155
|
-
return
|
|
137
|
+
var n = t.icon, r = t.id, o = t.className, s = t.extend, m = xt(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), f = me("_".concat(Nt()));
|
|
138
|
+
return Pe(n, "".concat(r), { defIds: n.defIds, idSuffix: f.current }, T({ ref: e, className: c }, m), s);
|
|
156
139
|
});
|
|
157
|
-
function
|
|
158
|
-
return B(t.tag, T(T({ key: e },
|
|
159
|
-
return
|
|
140
|
+
function Pe(t, e, n, r, o) {
|
|
141
|
+
return B(t.tag, T(T({ key: e }, _t(t, n, o)), r), (Tt(t, n).children || []).map(function(s, m) {
|
|
142
|
+
return Pe(s, "".concat(e, "-").concat(t.tag, "-").concat(m), n, void 0, o);
|
|
160
143
|
}));
|
|
161
144
|
}
|
|
162
|
-
function
|
|
145
|
+
function _t(t, e, n) {
|
|
163
146
|
var r = T({}, t.attrs);
|
|
164
147
|
n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
|
|
165
148
|
var o = e.defIds;
|
|
166
|
-
return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(
|
|
167
|
-
var m =
|
|
149
|
+
return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(s) {
|
|
150
|
+
var m = s[0], c = s[1];
|
|
168
151
|
typeof c == "string" && (r[m] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
169
152
|
})), r;
|
|
170
153
|
}
|
|
171
|
-
function
|
|
154
|
+
function Tt(t, e) {
|
|
172
155
|
var n, r = e.defIds;
|
|
173
156
|
return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? T(T({}, t), { children: t.children.map(function(o) {
|
|
174
157
|
return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? T(T({}, o), { attrs: T(T({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
|
|
175
158
|
}) }) : t;
|
|
176
159
|
}
|
|
177
|
-
function
|
|
160
|
+
function Nt() {
|
|
178
161
|
return Math.random().toString(36).substring(2, 8);
|
|
179
162
|
}
|
|
180
163
|
W.displayName = "UniverIcon";
|
|
181
|
-
var
|
|
164
|
+
var Mt = { 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" } }] }, $e = A(function(t, e) {
|
|
182
165
|
return B(W, Object.assign({}, t, {
|
|
183
166
|
id: "delete-single",
|
|
184
167
|
ref: e,
|
|
185
|
-
icon:
|
|
168
|
+
icon: Mt
|
|
186
169
|
}));
|
|
187
170
|
});
|
|
188
|
-
|
|
189
|
-
var
|
|
171
|
+
$e.displayName = "DeleteSingle";
|
|
172
|
+
var Ut = { 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" } }] }, Oe = A(function(t, e) {
|
|
190
173
|
return B(W, Object.assign({}, t, {
|
|
191
174
|
id: "increase-single",
|
|
192
175
|
ref: e,
|
|
193
|
-
icon:
|
|
176
|
+
icon: Ut
|
|
194
177
|
}));
|
|
195
178
|
});
|
|
196
|
-
|
|
197
|
-
var
|
|
179
|
+
Oe.displayName = "IncreaseSingle";
|
|
180
|
+
var Pt = { 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" } }] }, He = A(function(t, e) {
|
|
198
181
|
return B(W, Object.assign({}, t, {
|
|
199
182
|
id: "more-horizontal-single",
|
|
200
183
|
ref: e,
|
|
201
|
-
icon:
|
|
184
|
+
icon: Pt
|
|
202
185
|
}));
|
|
203
186
|
});
|
|
204
|
-
|
|
205
|
-
var
|
|
187
|
+
He.displayName = "MoreHorizontalSingle";
|
|
188
|
+
var $t = { 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 } }] }, we = A(function(t, e) {
|
|
206
189
|
return B(W, Object.assign({}, t, {
|
|
207
190
|
id: "reply-to-comment-single",
|
|
208
191
|
ref: e,
|
|
209
|
-
icon:
|
|
192
|
+
icon: $t
|
|
210
193
|
}));
|
|
211
194
|
});
|
|
212
|
-
|
|
213
|
-
var
|
|
195
|
+
we.displayName = "ReplyToCommentSingle";
|
|
196
|
+
var Ot = { 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 = A(function(t, e) {
|
|
214
197
|
return B(W, Object.assign({}, t, {
|
|
215
198
|
id: "resolved-single",
|
|
216
199
|
ref: e,
|
|
217
|
-
icon:
|
|
200
|
+
icon: Ot
|
|
218
201
|
}));
|
|
219
202
|
});
|
|
220
|
-
|
|
221
|
-
var
|
|
203
|
+
Re.displayName = "ResolvedSingle";
|
|
204
|
+
var Ht = { 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 } }] }, De = A(function(t, e) {
|
|
222
205
|
return B(W, Object.assign({}, t, {
|
|
223
206
|
id: "solve-single",
|
|
224
207
|
ref: e,
|
|
225
|
-
icon:
|
|
208
|
+
icon: Ht
|
|
226
209
|
}));
|
|
227
210
|
});
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
threadCommentEditorButtons:
|
|
231
|
-
threadCommentEditorSuggestion:
|
|
232
|
-
threadCommentEditorSuggestionActive:
|
|
233
|
-
threadCommentEditorSuggestionIcon:
|
|
234
|
-
},
|
|
211
|
+
De.displayName = "SolveSingle";
|
|
212
|
+
const wt = "univer-thread-comment-editor-buttons", Rt = "univer-thread-comment-editor-suggestion", Dt = "univer-thread-comment-editor-suggestionActive", kt = "univer-thread-comment-editor-suggestion-icon", se = {
|
|
213
|
+
threadCommentEditorButtons: wt,
|
|
214
|
+
threadCommentEditorSuggestion: Rt,
|
|
215
|
+
threadCommentEditorSuggestionActive: Dt,
|
|
216
|
+
threadCommentEditorSuggestionIcon: kt
|
|
217
|
+
}, At = (t) => {
|
|
235
218
|
const e = /@\[(.*?)\]\((.*?)\)|(\w+)/g;
|
|
236
219
|
let n, r = 0;
|
|
237
220
|
const o = [];
|
|
@@ -253,32 +236,32 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
253
236
|
type: "text",
|
|
254
237
|
content: t.substring(r)
|
|
255
238
|
}), o;
|
|
256
|
-
},
|
|
239
|
+
}, Lt = (t) => t.map((e) => {
|
|
257
240
|
switch (e.type) {
|
|
258
241
|
case "mention":
|
|
259
242
|
return `@[${e.content.label}](${e.content.id})`;
|
|
260
243
|
default:
|
|
261
244
|
return e.content;
|
|
262
245
|
}
|
|
263
|
-
}).join(""),
|
|
246
|
+
}).join(""), ke = (t) => {
|
|
264
247
|
const { dataStream: e, customRanges: n } = t, r = e.length - 2, o = [];
|
|
265
|
-
let
|
|
248
|
+
let s = 0;
|
|
266
249
|
return n == null || n.forEach((m) => {
|
|
267
|
-
|
|
250
|
+
s < m.startIndex && o.push({
|
|
268
251
|
type: "text",
|
|
269
|
-
content: e.slice(
|
|
252
|
+
content: e.slice(s, m.startIndex)
|
|
270
253
|
}), o.push({
|
|
271
254
|
type: "mention",
|
|
272
255
|
content: {
|
|
273
256
|
label: e.slice(m.startIndex, m.endIndex).slice(1, -1),
|
|
274
257
|
id: m.rangeId
|
|
275
258
|
}
|
|
276
|
-
}),
|
|
259
|
+
}), s = m.endIndex;
|
|
277
260
|
}), o.push({
|
|
278
261
|
type: "text",
|
|
279
|
-
content: e.slice(
|
|
262
|
+
content: e.slice(s, r)
|
|
280
263
|
}), o;
|
|
281
|
-
},
|
|
264
|
+
}, Ae = (t) => {
|
|
282
265
|
let e = "";
|
|
283
266
|
const n = [];
|
|
284
267
|
return t.forEach((r) => {
|
|
@@ -289,12 +272,12 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
289
272
|
case "mention": {
|
|
290
273
|
const o = e.length;
|
|
291
274
|
e += `${r.content.label}`;
|
|
292
|
-
const
|
|
275
|
+
const s = e.length;
|
|
293
276
|
n.push({
|
|
294
277
|
rangeId: r.content.id,
|
|
295
|
-
rangeType:
|
|
278
|
+
rangeType: nt.MENTION,
|
|
296
279
|
startIndex: o,
|
|
297
|
-
endIndex:
|
|
280
|
+
endIndex: s
|
|
298
281
|
});
|
|
299
282
|
break;
|
|
300
283
|
}
|
|
@@ -316,63 +299,63 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
316
299
|
dataStream: e,
|
|
317
300
|
customRanges: n
|
|
318
301
|
};
|
|
319
|
-
},
|
|
302
|
+
}, Vt = (t) => ({
|
|
320
303
|
display: t.label,
|
|
321
304
|
id: `${t.id}`,
|
|
322
305
|
raw: t
|
|
323
|
-
}),
|
|
306
|
+
}), jt = (t, e, n, r, o) => {
|
|
324
307
|
var m, c;
|
|
325
|
-
const
|
|
326
|
-
return /* @__PURE__ */ a.createElement("div", { className:
|
|
327
|
-
},
|
|
328
|
-
var
|
|
329
|
-
const { comment: n, onSave: r, id: o, onCancel:
|
|
330
|
-
return
|
|
331
|
-
reply(
|
|
308
|
+
const s = (m = t.raw) == null ? void 0 : m.icon;
|
|
309
|
+
return /* @__PURE__ */ a.createElement("div", { className: se.threadCommentEditorSuggestion }, s ? /* @__PURE__ */ a.createElement("img", { className: se.threadCommentEditorSuggestionIcon, src: s }) : null, /* @__PURE__ */ a.createElement("div", null, (c = t.display) != null ? c : t.id));
|
|
310
|
+
}, Le = A((t, e) => {
|
|
311
|
+
var C;
|
|
312
|
+
const { comment: n, onSave: r, id: o, onCancel: s, autoFocus: m, unitId: c, subUnitId: f } = t, y = S(Ne), U = S(X), _ = S(Ce), [I, h] = k({ ...n }), [g, b] = k(!1), N = me(null), E = S(ct), w = S(ut);
|
|
313
|
+
return at(e, () => ({
|
|
314
|
+
reply(v) {
|
|
332
315
|
var d;
|
|
333
316
|
h({
|
|
334
317
|
...n,
|
|
335
|
-
text:
|
|
318
|
+
text: v,
|
|
336
319
|
attachments: []
|
|
337
320
|
}), (d = N.current) == null || d.inputElement.focus();
|
|
338
321
|
}
|
|
339
|
-
})), /* @__PURE__ */ a.createElement("div", { className:
|
|
340
|
-
|
|
322
|
+
})), /* @__PURE__ */ a.createElement("div", { className: se.threadCommentEditor, onClick: (v) => v.preventDefault() }, /* @__PURE__ */ a.createElement(
|
|
323
|
+
it,
|
|
341
324
|
{
|
|
342
325
|
ref: N,
|
|
343
326
|
autoFocus: m,
|
|
344
327
|
style: { width: "100%" },
|
|
345
328
|
placeholder: _.t("threadCommentUI.editor.placeholder"),
|
|
346
|
-
value: I != null && I.text ?
|
|
347
|
-
onChange: (
|
|
348
|
-
|
|
329
|
+
value: I != null && I.text ? Lt(ke(I.text)) : "",
|
|
330
|
+
onChange: (v) => {
|
|
331
|
+
v.target.value || h({ ...n, text: void 0 }), h == null || h({ ...n, text: Ae(At(v.target.value)) });
|
|
349
332
|
},
|
|
350
333
|
onFocus: () => {
|
|
351
|
-
const
|
|
352
|
-
|
|
334
|
+
const v = w.getActiveRange();
|
|
335
|
+
v && v.collapsed && E.removeAllTextRanges(), E.blur(), b(!0);
|
|
353
336
|
}
|
|
354
337
|
},
|
|
355
338
|
/* @__PURE__ */ a.createElement(
|
|
356
|
-
|
|
339
|
+
lt,
|
|
357
340
|
{
|
|
358
341
|
key: y.trigger,
|
|
359
342
|
trigger: y.trigger,
|
|
360
|
-
data: (
|
|
361
|
-
displayTransform: (
|
|
362
|
-
renderSuggestion: (
|
|
343
|
+
data: (v, d) => y.getMentions(v, c, f).then((i) => i.map(Vt)).then(d),
|
|
344
|
+
displayTransform: (v, d) => `@${d} `,
|
|
345
|
+
renderSuggestion: (C = y.renderSuggestion) != null ? C : jt
|
|
363
346
|
}
|
|
364
347
|
)
|
|
365
|
-
), g ? /* @__PURE__ */ a.createElement("div", { className:
|
|
366
|
-
|
|
348
|
+
), g ? /* @__PURE__ */ a.createElement("div", { className: se.threadCommentEditorButtons }, /* @__PURE__ */ a.createElement(
|
|
349
|
+
ie,
|
|
367
350
|
{
|
|
368
351
|
style: { marginRight: 12 },
|
|
369
352
|
onClick: () => {
|
|
370
|
-
|
|
353
|
+
s == null || s(), b(!1), h({ text: void 0 }), U.executeCommand(j.id);
|
|
371
354
|
}
|
|
372
355
|
},
|
|
373
356
|
_.t("threadCommentUI.editor.cancel")
|
|
374
357
|
), /* @__PURE__ */ a.createElement(
|
|
375
|
-
|
|
358
|
+
ie,
|
|
376
359
|
{
|
|
377
360
|
type: "primary",
|
|
378
361
|
disabled: !I.text,
|
|
@@ -380,35 +363,35 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
380
363
|
I.text && (r == null || r({
|
|
381
364
|
...I,
|
|
382
365
|
text: I.text
|
|
383
|
-
}),
|
|
366
|
+
}), b(!1), h({ text: void 0 }));
|
|
384
367
|
}
|
|
385
368
|
},
|
|
386
369
|
_.t(o ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
|
|
387
370
|
)) : null);
|
|
388
|
-
}),
|
|
389
|
-
threadComment:
|
|
390
|
-
threadCommentActive:
|
|
391
|
-
threadCommentContent:
|
|
392
|
-
threadCommentHighlight:
|
|
393
|
-
threadCommentIconContainer:
|
|
394
|
-
threadCommentIcon:
|
|
395
|
-
threadCommentTitle:
|
|
396
|
-
threadCommentTitlePosition:
|
|
397
|
-
threadCommentTitleHighlight:
|
|
398
|
-
threadCommentTitlePositionText:
|
|
399
|
-
threadCommentUsername:
|
|
400
|
-
threadCommentItem:
|
|
401
|
-
threadCommentItemHead:
|
|
402
|
-
threadCommentItemTitle:
|
|
403
|
-
threadCommentItemTitlePosition:
|
|
404
|
-
threadCommentItemTitleHighlight:
|
|
405
|
-
threadCommentItemTime:
|
|
406
|
-
threadCommentItemContent:
|
|
407
|
-
threadCommentItemAt:
|
|
408
|
-
},
|
|
409
|
-
const { item: e, unitId: n, subUnitId: r, editing: o, onEditingChange:
|
|
410
|
-
(
|
|
411
|
-
f ?
|
|
371
|
+
}), Bt = "univer-thread-comment", Wt = "univer-thread-comment-active", Ft = "univer-thread-comment-content", zt = "univer-thread-comment-highlight", Zt = "univer-thread-comment-icon-container", Yt = "univer-thread-comment-icon", Gt = "univer-thread-comment-title", Kt = "univer-thread-comment-title-position", qt = "univer-thread-comment-title-highlight", Jt = "univer-thread-comment-title-position-text", Qt = "univer-thread-comment-username", Xt = "univer-thread-comment-item", en = "univer-thread-comment-item-head", tn = "univer-thread-comment-item-title", nn = "univer-thread-comment-item-title-position", rn = "univer-thread-comment-item-title-highlight", on = "univer-thread-comment-item-time", an = "univer-thread-comment-item-content", ln = "univer-thread-comment-item-at", u = {
|
|
372
|
+
threadComment: Bt,
|
|
373
|
+
threadCommentActive: Wt,
|
|
374
|
+
threadCommentContent: Ft,
|
|
375
|
+
threadCommentHighlight: zt,
|
|
376
|
+
threadCommentIconContainer: Zt,
|
|
377
|
+
threadCommentIcon: Yt,
|
|
378
|
+
threadCommentTitle: Gt,
|
|
379
|
+
threadCommentTitlePosition: Kt,
|
|
380
|
+
threadCommentTitleHighlight: qt,
|
|
381
|
+
threadCommentTitlePositionText: Jt,
|
|
382
|
+
threadCommentUsername: Qt,
|
|
383
|
+
threadCommentItem: Xt,
|
|
384
|
+
threadCommentItemHead: en,
|
|
385
|
+
threadCommentItemTitle: tn,
|
|
386
|
+
threadCommentItemTitlePosition: nn,
|
|
387
|
+
threadCommentItemTitleHighlight: rn,
|
|
388
|
+
threadCommentItemTime: on,
|
|
389
|
+
threadCommentItemContent: an,
|
|
390
|
+
threadCommentItemAt: ln
|
|
391
|
+
}, Ve = "__mock__", sn = (t) => {
|
|
392
|
+
const { item: e, unitId: n, subUnitId: r, editing: o, onEditingChange: s, onReply: m, resolved: c, isRoot: f, onClose: y, onDeleteComment: U } = t, _ = S(X), I = S(Ce), h = S(ve), g = h.getUser(e.personId), b = V(h.currentUser$), N = (b == null ? void 0 : b.userID) === e.personId, E = e.id === Ve, [w, C] = k(!1), v = () => {
|
|
393
|
+
(U == null ? void 0 : U(e)) !== !1 && (_.executeCommand(
|
|
394
|
+
f ? ye.id : Ge.id,
|
|
412
395
|
{
|
|
413
396
|
unitId: n,
|
|
414
397
|
subUnitId: r,
|
|
@@ -416,70 +399,70 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
416
399
|
}
|
|
417
400
|
), f && (y == null || y()));
|
|
418
401
|
};
|
|
419
|
-
return /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItem, onMouseLeave: () =>
|
|
420
|
-
|
|
402
|
+
return /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItem, onMouseLeave: () => C(!1), onMouseEnter: () => C(!0) }, /* @__PURE__ */ a.createElement("img", { className: u.threadCommentItemHead, src: g == null ? void 0 : g.avatar }), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemTitle }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentUsername }, (g == null ? void 0 : g.name) || " "), /* @__PURE__ */ a.createElement("div", null, E || c ? null : w ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon, onClick: () => m(g) }, /* @__PURE__ */ a.createElement(we, null)) : null, N && !E && !c ? /* @__PURE__ */ a.createElement(
|
|
403
|
+
st,
|
|
421
404
|
{
|
|
422
|
-
overlay: /* @__PURE__ */ a.createElement(
|
|
405
|
+
overlay: /* @__PURE__ */ a.createElement(mt, null, /* @__PURE__ */ a.createElement(pe, { key: "edit", onClick: () => s == null ? void 0 : s(!0) }, I.t("threadCommentUI.item.edit")), /* @__PURE__ */ a.createElement(pe, { key: "delete", onClick: v }, I.t("threadCommentUI.item.delete")))
|
|
423
406
|
},
|
|
424
|
-
/* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon }, /* @__PURE__ */ a.createElement(
|
|
407
|
+
/* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon }, /* @__PURE__ */ a.createElement(He, null))
|
|
425
408
|
) : null)), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemTime }, e.dT), o ? /* @__PURE__ */ a.createElement(
|
|
426
|
-
|
|
409
|
+
Le,
|
|
427
410
|
{
|
|
428
411
|
id: e.id,
|
|
429
412
|
comment: e,
|
|
430
|
-
onCancel: () =>
|
|
413
|
+
onCancel: () => s == null ? void 0 : s(!1),
|
|
431
414
|
autoFocus: !0,
|
|
432
415
|
unitId: n,
|
|
433
416
|
subUnitId: r,
|
|
434
|
-
onSave: ({ text: d, attachments:
|
|
435
|
-
|
|
436
|
-
|
|
417
|
+
onSave: ({ text: d, attachments: i }) => {
|
|
418
|
+
s == null || s(!1), _.executeCommand(
|
|
419
|
+
Ze.id,
|
|
437
420
|
{
|
|
438
421
|
unitId: n,
|
|
439
422
|
subUnitId: r,
|
|
440
423
|
payload: {
|
|
441
424
|
commentId: e.id,
|
|
442
425
|
text: d,
|
|
443
|
-
attachments:
|
|
426
|
+
attachments: i
|
|
444
427
|
}
|
|
445
428
|
}
|
|
446
429
|
);
|
|
447
430
|
}
|
|
448
431
|
}
|
|
449
|
-
) : /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemContent },
|
|
432
|
+
) : /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemContent }, ke(e.text).map((d, i) => {
|
|
450
433
|
switch (d.type) {
|
|
451
434
|
case "mention":
|
|
452
|
-
return /* @__PURE__ */ a.createElement("a", { className: u.threadCommentItemAt, key:
|
|
435
|
+
return /* @__PURE__ */ a.createElement("a", { className: u.threadCommentItemAt, key: i }, "@", d.content.label, " ");
|
|
453
436
|
default:
|
|
454
437
|
return d.content;
|
|
455
438
|
}
|
|
456
439
|
})));
|
|
457
|
-
},
|
|
440
|
+
}, mn = (t) => {
|
|
458
441
|
var K, F, ne;
|
|
459
442
|
const {
|
|
460
443
|
id: e,
|
|
461
444
|
unitId: n,
|
|
462
445
|
subUnitId: r,
|
|
463
446
|
refStr: o,
|
|
464
|
-
showEdit:
|
|
447
|
+
showEdit: s = !0,
|
|
465
448
|
onClick: m,
|
|
466
449
|
showHighlight: c,
|
|
467
450
|
onClose: f,
|
|
468
451
|
getSubUnitName: y,
|
|
469
|
-
prefix:
|
|
452
|
+
prefix: U,
|
|
470
453
|
autoFocus: _,
|
|
471
454
|
onMouseEnter: I,
|
|
472
455
|
onMouseLeave: h,
|
|
473
456
|
onAddComment: g,
|
|
474
|
-
onDeleteComment:
|
|
457
|
+
onDeleteComment: b,
|
|
475
458
|
onResolve: N
|
|
476
|
-
} = t, E =
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
...
|
|
459
|
+
} = t, E = S(Ee), [w, C] = k(!1), [v, d] = k("");
|
|
460
|
+
V(E.commentMap$);
|
|
461
|
+
const i = e ? E.getCommentWithChildren(n, r, e) : null, R = S(X), de = S(ve), p = i == null ? void 0 : i.root.resolved, M = V(de.currentUser$), Z = me(null), ee = [
|
|
462
|
+
...i ? [i.root] : (
|
|
480
463
|
// mock empty comment
|
|
481
464
|
[{
|
|
482
|
-
id:
|
|
465
|
+
id: Ve,
|
|
483
466
|
text: {
|
|
484
467
|
dataStream: `
|
|
485
468
|
\r`
|
|
@@ -492,21 +475,21 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
492
475
|
threadId: ""
|
|
493
476
|
}]
|
|
494
477
|
),
|
|
495
|
-
...(F =
|
|
478
|
+
...(F = i == null ? void 0 : i.children) != null ? F : []
|
|
496
479
|
], Y = (x) => {
|
|
497
|
-
x.stopPropagation(), p ? R.executeCommand(
|
|
480
|
+
x.stopPropagation(), p ? R.executeCommand(j.id, {
|
|
498
481
|
unitId: n,
|
|
499
482
|
subUnitId: r,
|
|
500
483
|
commentId: e
|
|
501
|
-
}) : R.executeCommand(
|
|
484
|
+
}) : R.executeCommand(j.id), R.executeCommand(Ye.id, {
|
|
502
485
|
unitId: n,
|
|
503
486
|
subUnitId: r,
|
|
504
487
|
commentId: e,
|
|
505
488
|
resolved: !p
|
|
506
489
|
}), N == null || N(!p);
|
|
507
490
|
}, te = (x) => {
|
|
508
|
-
x.stopPropagation(), R.executeCommand(
|
|
509
|
-
|
|
491
|
+
x.stopPropagation(), R.executeCommand(j.id), !(i != null && i.root && (b == null ? void 0 : b(i.root)) === !1) && (R.executeCommand(
|
|
492
|
+
ye.id,
|
|
510
493
|
{
|
|
511
494
|
unitId: n,
|
|
512
495
|
subUnitId: r,
|
|
@@ -514,52 +497,52 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
514
497
|
}
|
|
515
498
|
), f == null || f());
|
|
516
499
|
};
|
|
517
|
-
|
|
518
|
-
const
|
|
500
|
+
ue(() => h == null ? void 0 : h(), []);
|
|
501
|
+
const P = y((ne = i == null ? void 0 : i.root.subUnitId) != null ? ne : r), G = s && !v && !p, D = `${o || (i == null ? void 0 : i.root.ref) || ""}${P ? " · " : ""}${P}`;
|
|
519
502
|
return /* @__PURE__ */ a.createElement(
|
|
520
503
|
"div",
|
|
521
504
|
{
|
|
522
|
-
className:
|
|
523
|
-
[u.threadCommentActive]: !p && (c ||
|
|
505
|
+
className: dt(u.threadComment, {
|
|
506
|
+
[u.threadCommentActive]: !p && (c || w || U === "cell")
|
|
524
507
|
}),
|
|
525
508
|
onClick: m,
|
|
526
|
-
id: `${
|
|
509
|
+
id: `${U}-${n}-${r}-${e}`,
|
|
527
510
|
onMouseEnter: () => {
|
|
528
|
-
I == null || I(),
|
|
511
|
+
I == null || I(), C(!0);
|
|
529
512
|
},
|
|
530
513
|
onMouseLeave: () => {
|
|
531
|
-
h == null || h(),
|
|
514
|
+
h == null || h(), C(!1);
|
|
532
515
|
}
|
|
533
516
|
},
|
|
534
517
|
!p && c ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentHighlight }) : null,
|
|
535
|
-
/* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitle }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePosition }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitleHighlight }), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePositionText }, D)),
|
|
518
|
+
/* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitle }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePosition }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitleHighlight }), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePositionText }, D)), i ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIconContainer }, /* @__PURE__ */ a.createElement(
|
|
536
519
|
"div",
|
|
537
520
|
{
|
|
538
521
|
onClick: Y,
|
|
539
522
|
className: u.threadCommentIcon,
|
|
540
523
|
style: { color: p ? "rgb(var(--green-500))" : "" }
|
|
541
524
|
},
|
|
542
|
-
p ? /* @__PURE__ */ a.createElement(
|
|
543
|
-
), (M == null ? void 0 : M.userID) ===
|
|
525
|
+
p ? /* @__PURE__ */ a.createElement(Re, null) : /* @__PURE__ */ a.createElement(De, null)
|
|
526
|
+
), (M == null ? void 0 : M.userID) === i.root.personId ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon, onClick: te }, /* @__PURE__ */ a.createElement($e, null)) : null) : null),
|
|
544
527
|
/* @__PURE__ */ a.createElement("div", { className: u.threadCommentContent }, ee.map(
|
|
545
528
|
(x) => /* @__PURE__ */ a.createElement(
|
|
546
|
-
|
|
529
|
+
sn,
|
|
547
530
|
{
|
|
548
531
|
onClose: f,
|
|
549
532
|
unitId: n,
|
|
550
533
|
subUnitId: r,
|
|
551
534
|
item: x,
|
|
552
535
|
key: x.id,
|
|
553
|
-
isRoot: x.id === (
|
|
554
|
-
editing:
|
|
555
|
-
resolved:
|
|
536
|
+
isRoot: x.id === (i == null ? void 0 : i.root.id),
|
|
537
|
+
editing: v === x.id,
|
|
538
|
+
resolved: i == null ? void 0 : i.root.resolved,
|
|
556
539
|
onEditingChange: ($) => {
|
|
557
540
|
d($ ? x.id : "");
|
|
558
541
|
},
|
|
559
542
|
onReply: ($) => {
|
|
560
543
|
$ && requestAnimationFrame(() => {
|
|
561
544
|
var L;
|
|
562
|
-
(L = Z.current) == null || L.reply(
|
|
545
|
+
(L = Z.current) == null || L.reply(Ae([{
|
|
563
546
|
type: "mention",
|
|
564
547
|
content: {
|
|
565
548
|
id: $.userID,
|
|
@@ -569,12 +552,12 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
569
552
|
});
|
|
570
553
|
},
|
|
571
554
|
onAddComment: g,
|
|
572
|
-
onDeleteComment:
|
|
555
|
+
onDeleteComment: b
|
|
573
556
|
}
|
|
574
557
|
)
|
|
575
558
|
)),
|
|
576
559
|
G ? /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(
|
|
577
|
-
|
|
560
|
+
Le,
|
|
578
561
|
{
|
|
579
562
|
key: `${_}`,
|
|
580
563
|
ref: Z,
|
|
@@ -584,17 +567,17 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
584
567
|
const L = {
|
|
585
568
|
text: x,
|
|
586
569
|
attachments: $,
|
|
587
|
-
dT:
|
|
588
|
-
id:
|
|
570
|
+
dT: ht(),
|
|
571
|
+
id: rt.generateRandomId(),
|
|
589
572
|
ref: o,
|
|
590
573
|
personId: M == null ? void 0 : M.userID,
|
|
591
|
-
parentId:
|
|
574
|
+
parentId: i == null ? void 0 : i.root.id,
|
|
592
575
|
unitId: n,
|
|
593
576
|
subUnitId: r,
|
|
594
|
-
threadId:
|
|
577
|
+
threadId: i == null ? void 0 : i.root.threadId
|
|
595
578
|
};
|
|
596
579
|
(g == null ? void 0 : g(L)) !== !1 && R.executeCommand(
|
|
597
|
-
|
|
580
|
+
ze.id,
|
|
598
581
|
{
|
|
599
582
|
unitId: n,
|
|
600
583
|
subUnitId: r,
|
|
@@ -602,40 +585,40 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
602
585
|
}
|
|
603
586
|
);
|
|
604
587
|
},
|
|
605
|
-
autoFocus: _ || !
|
|
588
|
+
autoFocus: _ || !i,
|
|
606
589
|
onCancel: () => {
|
|
607
|
-
|
|
590
|
+
i || f == null || f();
|
|
608
591
|
}
|
|
609
592
|
}
|
|
610
593
|
)) : null
|
|
611
594
|
);
|
|
612
|
-
},
|
|
613
|
-
threadCommentPanel:
|
|
614
|
-
threadComment:
|
|
615
|
-
threadCommentPanelForms:
|
|
616
|
-
select:
|
|
617
|
-
threadCommentPanelEmpty:
|
|
618
|
-
threadCommentPanelAdd:
|
|
619
|
-
threadCommentPanelSolved:
|
|
620
|
-
},
|
|
595
|
+
}, dn = "univer-thread-comment-panel", cn = "univer-thread-comment", un = "univer-thread-comment-panel-forms", hn = "univer-select", Cn = "univer-thread-comment-panel-empty", vn = "univer-thread-comment-panel-add", fn = "univer-thread-comment-panel-solved", Q = {
|
|
596
|
+
threadCommentPanel: dn,
|
|
597
|
+
threadComment: cn,
|
|
598
|
+
threadCommentPanelForms: un,
|
|
599
|
+
select: hn,
|
|
600
|
+
threadCommentPanelEmpty: Cn,
|
|
601
|
+
threadCommentPanelAdd: vn,
|
|
602
|
+
threadCommentPanelSolved: fn
|
|
603
|
+
}, Mn = (t) => {
|
|
621
604
|
const {
|
|
622
605
|
unitId: e,
|
|
623
606
|
subUnitId$: n,
|
|
624
607
|
type: r,
|
|
625
608
|
onAdd: o,
|
|
626
|
-
getSubUnitName:
|
|
609
|
+
getSubUnitName: s,
|
|
627
610
|
onResolve: m,
|
|
628
611
|
sortComments: c,
|
|
629
612
|
onItemLeave: f,
|
|
630
613
|
onItemEnter: y,
|
|
631
|
-
disableAdd:
|
|
614
|
+
disableAdd: U,
|
|
632
615
|
tempComment: _,
|
|
633
616
|
onAddComment: I,
|
|
634
617
|
onDeleteComment: h,
|
|
635
618
|
showComments: g
|
|
636
|
-
} = t, [
|
|
619
|
+
} = t, [b, N] = k("all"), [E, w] = k("all"), C = S(Ce), v = S(ve), d = S(Ee), [i, R] = k(() => d.getUnit(e)), de = S(z), p = V(de.activeCommentId$), M = V(d.commentUpdate$), Z = S(X), ee = V(n), Y = me(!0), te = "panel", P = V(v.currentUser$), G = ce(() => {
|
|
637
620
|
var oe, J;
|
|
638
|
-
const
|
|
621
|
+
const l = (b === "all" ? i.map((O) => O[1]).flat() : (J = (oe = i.find((O) => O[0] === ee)) == null ? void 0 : oe[1]) != null ? J : []).filter((O) => !O.parentId), q = c != null ? c : (O) => O, re = l;
|
|
639
622
|
if (g) {
|
|
640
623
|
const O = /* @__PURE__ */ new Map();
|
|
641
624
|
return re.forEach((ae) => {
|
|
@@ -643,17 +626,17 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
643
626
|
}), [...g, ""].map((ae) => O.get(ae)).filter(Boolean);
|
|
644
627
|
} else
|
|
645
628
|
return q(re);
|
|
646
|
-
}, [g,
|
|
647
|
-
...G.filter((
|
|
648
|
-
...G.filter((
|
|
649
|
-
], [G]), K =
|
|
650
|
-
|
|
629
|
+
}, [g, b, i, c, ee]), D = ce(() => [
|
|
630
|
+
...G.filter((l) => !l.resolved),
|
|
631
|
+
...G.filter((l) => l.resolved)
|
|
632
|
+
], [G]), K = ce(() => E === "resolved" ? D.filter((l) => l.resolved) : E === "unsolved" ? D.filter((l) => !l.resolved) : E === "concern_me" && P != null && P.userID ? D.map((l) => d.getCommentWithChildren(l.unitId, l.subUnitId, l.id)).map((l) => l != null && l.relativeUsers.has(P.userID) ? l.root : null).filter(Boolean) : D, [D, P == null ? void 0 : P.userID, E, d]), F = _ ? [_, ...K] : K, ne = F.filter((l) => !l.resolved), x = F.filter((l) => l.resolved), $ = E !== "all" || b !== "all", L = () => {
|
|
633
|
+
w("all"), N("all");
|
|
651
634
|
};
|
|
652
|
-
|
|
635
|
+
ue(() => {
|
|
653
636
|
e && R(
|
|
654
637
|
d.getUnit(e)
|
|
655
638
|
);
|
|
656
|
-
}, [e, d, M]),
|
|
639
|
+
}, [e, d, M]), ue(() => {
|
|
657
640
|
var J;
|
|
658
641
|
if (!p)
|
|
659
642
|
return;
|
|
@@ -661,110 +644,110 @@ const Vt = "univer-thread-comment-editor-buttons", Bt = "univer-thread-comment-e
|
|
|
661
644
|
Y.current = !0;
|
|
662
645
|
return;
|
|
663
646
|
}
|
|
664
|
-
const { unitId:
|
|
647
|
+
const { unitId: l, subUnitId: q, commentId: re } = p, oe = `${te}-${l}-${q}-${re}`;
|
|
665
648
|
(J = document.getElementById(oe)) == null || J.scrollIntoView({ block: "center" });
|
|
666
649
|
}, [p]);
|
|
667
|
-
const
|
|
668
|
-
|
|
650
|
+
const fe = (l) => /* @__PURE__ */ a.createElement(
|
|
651
|
+
mn,
|
|
669
652
|
{
|
|
670
653
|
prefix: te,
|
|
671
|
-
getSubUnitName:
|
|
672
|
-
key:
|
|
673
|
-
id:
|
|
674
|
-
unitId:
|
|
675
|
-
subUnitId:
|
|
676
|
-
refStr:
|
|
654
|
+
getSubUnitName: s,
|
|
655
|
+
key: l.id,
|
|
656
|
+
id: l.id,
|
|
657
|
+
unitId: l.unitId,
|
|
658
|
+
subUnitId: l.subUnitId,
|
|
659
|
+
refStr: l.ref,
|
|
677
660
|
type: r,
|
|
678
|
-
showEdit: (p == null ? void 0 : p.commentId) ===
|
|
679
|
-
showHighlight: (p == null ? void 0 : p.commentId) ===
|
|
661
|
+
showEdit: (p == null ? void 0 : p.commentId) === l.id,
|
|
662
|
+
showHighlight: (p == null ? void 0 : p.commentId) === l.id,
|
|
680
663
|
onClick: () => {
|
|
681
|
-
Y.current = !1,
|
|
682
|
-
|
|
664
|
+
Y.current = !1, l.resolved ? Z.executeCommand(j.id) : Z.executeCommand(
|
|
665
|
+
j.id,
|
|
683
666
|
{
|
|
684
|
-
unitId:
|
|
685
|
-
subUnitId:
|
|
686
|
-
commentId:
|
|
667
|
+
unitId: l.unitId,
|
|
668
|
+
subUnitId: l.subUnitId,
|
|
669
|
+
commentId: l.id,
|
|
687
670
|
temp: !1
|
|
688
671
|
}
|
|
689
672
|
);
|
|
690
673
|
},
|
|
691
|
-
onMouseEnter: () => y == null ? void 0 : y(
|
|
692
|
-
onMouseLeave: () => f == null ? void 0 : f(
|
|
674
|
+
onMouseEnter: () => y == null ? void 0 : y(l),
|
|
675
|
+
onMouseLeave: () => f == null ? void 0 : f(l),
|
|
693
676
|
onAddComment: I,
|
|
694
677
|
onDeleteComment: h,
|
|
695
|
-
onResolve: (q) => m == null ? void 0 : m(
|
|
678
|
+
onResolve: (q) => m == null ? void 0 : m(l.id, q)
|
|
696
679
|
}
|
|
697
680
|
);
|
|
698
|
-
return /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanel }, /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanelForms }, r ===
|
|
699
|
-
|
|
681
|
+
return /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanel }, /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanelForms }, r === he.UNIVER_SHEET ? /* @__PURE__ */ a.createElement(
|
|
682
|
+
Ie,
|
|
700
683
|
{
|
|
701
684
|
borderless: !0,
|
|
702
|
-
value:
|
|
703
|
-
onChange: (
|
|
685
|
+
value: b,
|
|
686
|
+
onChange: (l) => N(l),
|
|
704
687
|
options: [
|
|
705
688
|
{
|
|
706
689
|
value: "current",
|
|
707
|
-
label:
|
|
690
|
+
label: C.t("threadCommentUI.filter.sheet.current")
|
|
708
691
|
},
|
|
709
692
|
{
|
|
710
693
|
value: "all",
|
|
711
|
-
label:
|
|
694
|
+
label: C.t("threadCommentUI.filter.sheet.all")
|
|
712
695
|
}
|
|
713
696
|
]
|
|
714
697
|
}
|
|
715
698
|
) : null, /* @__PURE__ */ a.createElement(
|
|
716
|
-
|
|
699
|
+
Ie,
|
|
717
700
|
{
|
|
718
701
|
borderless: !0,
|
|
719
702
|
value: E,
|
|
720
|
-
onChange: (
|
|
703
|
+
onChange: (l) => w(l),
|
|
721
704
|
options: [
|
|
722
705
|
{
|
|
723
706
|
value: "all",
|
|
724
|
-
label:
|
|
707
|
+
label: C.t("threadCommentUI.filter.status.all")
|
|
725
708
|
},
|
|
726
709
|
{
|
|
727
710
|
value: "resolved",
|
|
728
|
-
label:
|
|
711
|
+
label: C.t("threadCommentUI.filter.status.resolved")
|
|
729
712
|
},
|
|
730
713
|
{
|
|
731
714
|
value: "unsolved",
|
|
732
|
-
label:
|
|
715
|
+
label: C.t("threadCommentUI.filter.status.unsolved")
|
|
733
716
|
},
|
|
734
717
|
{
|
|
735
718
|
value: "concern_me",
|
|
736
|
-
label:
|
|
719
|
+
label: C.t("threadCommentUI.filter.status.concernMe")
|
|
737
720
|
}
|
|
738
721
|
]
|
|
739
722
|
}
|
|
740
|
-
)), ne.map(
|
|
741
|
-
|
|
723
|
+
)), ne.map(fe), x.length ? /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanelSolved }, "已解决") : null, x.map(fe), F.length ? null : /* @__PURE__ */ a.createElement("div", { className: Q.threadCommentPanelEmpty }, $ ? C.t("threadCommentUI.panel.filterEmpty") : C.t("threadCommentUI.panel.empty"), $ ? /* @__PURE__ */ a.createElement(
|
|
724
|
+
ie,
|
|
742
725
|
{
|
|
743
726
|
onClick: L,
|
|
744
727
|
type: "link"
|
|
745
728
|
},
|
|
746
|
-
|
|
729
|
+
C.t("threadCommentUI.panel.reset")
|
|
747
730
|
) : /* @__PURE__ */ a.createElement(
|
|
748
|
-
|
|
731
|
+
ie,
|
|
749
732
|
{
|
|
750
733
|
id: "thread-comment-add",
|
|
751
734
|
className: Q.threadCommentPanelAdd,
|
|
752
735
|
type: "primary",
|
|
753
736
|
onClick: o,
|
|
754
|
-
disabled:
|
|
737
|
+
disabled: U
|
|
755
738
|
},
|
|
756
|
-
/* @__PURE__ */ a.createElement(
|
|
757
|
-
|
|
739
|
+
/* @__PURE__ */ a.createElement(Oe, null),
|
|
740
|
+
C.t("threadCommentUI.panel.addComment")
|
|
758
741
|
)));
|
|
759
742
|
};
|
|
760
743
|
export {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
744
|
+
Ne as IThreadCommentMentionDataService,
|
|
745
|
+
j as SetActiveCommentOperation,
|
|
746
|
+
Ct as THREAD_COMMENT_PANEL,
|
|
747
|
+
Mn as ThreadCommentPanel,
|
|
765
748
|
z as ThreadCommentPanelService,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
749
|
+
mn as ThreadCommentTree,
|
|
750
|
+
It as ToggleSheetCommentPanelOperation,
|
|
751
|
+
le as UniverThreadCommentUIPlugin,
|
|
752
|
+
ht as getDT
|
|
770
753
|
};
|