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