@univerjs/thread-comment-ui 0.14.0 → 0.15.0-insiders.20251227-dafc157
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 +158 -164
- package/lib/index.js +158 -164
- package/lib/umd/index.js +4 -4
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var He = Object.defineProperty;
|
|
2
|
-
var Ve = (
|
|
3
|
-
var W = (
|
|
2
|
+
var Ve = (r, e, t) => e in r ? He(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var W = (r, e, t) => Ve(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { Inject as ye, IUniverInstanceService as je, Disposable as Pe, UniverInstanceType as de, CommandType as we, DependentOn as Ae, Injector as Be, ICommandService as te, IConfigService as We, Plugin as Ze, merge as Fe, mergeOverrideWithDependencies as Ke, LocaleService as he, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ge, BuildTextUtils as ue, DOCS_COMMENT_EDITOR_UNIT_ID_KEY as ze, Tools as Ye, CustomRangeType as qe, getBodySlice as Je, UserManagerService as fe, generateRandomId as Qe } from "@univerjs/core";
|
|
5
5
|
import { ISidebarService as _e, useDependency as N, KeyCode as pe, useObservable as Z, useConfigValue as Xe, UI_PLUGIN_CONFIG_KEY as et } from "@univerjs/ui";
|
|
6
|
-
import { BehaviorSubject as Ce, filter as tt, debounceTime as
|
|
7
|
-
import { UniverThreadCommentPlugin as
|
|
8
|
-
import { jsxs as I, jsx as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useRef as ee, createElement as K, forwardRef as G, useState as P, useEffect as
|
|
6
|
+
import { BehaviorSubject as Ce, filter as tt, debounceTime as rt } from "rxjs";
|
|
7
|
+
import { UniverThreadCommentPlugin as nt, ThreadCommentModel as Ne, getDT as it, AddCommentCommand as ot, ResolveCommentCommand as st, DeleteCommentTreeCommand as Se, UpdateCommentCommand as at, DeleteCommentCommand as lt } from "@univerjs/thread-comment";
|
|
8
|
+
import { jsxs as I, jsx as a } from "react/jsx-runtime";
|
|
9
|
+
import { Button as ae, clsx as ve, Tooltip as ct, scrollbarClassName as dt, borderClassName as ut, Dropdown as vt, Select as ge } from "@univerjs/design";
|
|
10
|
+
import { useRef as ee, createElement as K, forwardRef as G, useState as P, useEffect as le, useMemo as X, useImperativeHandle as mt } from "react";
|
|
11
11
|
import { IEditorService as ht, BreakLineCommand as ft, RichTextEditor as pt } from "@univerjs/docs-ui";
|
|
12
|
-
var Ct = Object.getOwnPropertyDescriptor, gt = (
|
|
13
|
-
for (var i =
|
|
14
|
-
(c =
|
|
12
|
+
var Ct = Object.getOwnPropertyDescriptor, gt = (r, e, t, n) => {
|
|
13
|
+
for (var i = n > 1 ? void 0 : n ? Ct(e, t) : e, o = r.length - 1, c; o >= 0; o--)
|
|
14
|
+
(c = r[o]) && (i = c(i) || i);
|
|
15
15
|
return i;
|
|
16
|
-
}, Ie = (
|
|
16
|
+
}, Ie = (r, e) => (t, n) => e(t, n, r);
|
|
17
17
|
let Y = class extends Pe {
|
|
18
18
|
constructor(e, t) {
|
|
19
19
|
super();
|
|
@@ -58,29 +58,29 @@ Y = gt([
|
|
|
58
58
|
const It = "thread-comment-panel", xt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", bt = {
|
|
59
59
|
id: "thread-comment-ui.operation.toggle-panel",
|
|
60
60
|
type: we.OPERATION,
|
|
61
|
-
handler(
|
|
62
|
-
const e =
|
|
61
|
+
handler(r) {
|
|
62
|
+
const e = r.get(_e), t = r.get(Y);
|
|
63
63
|
return t.panelVisible ? (e.close(), t.setPanelVisible(!1)) : (e.open({
|
|
64
64
|
header: { title: "threadCommentUI.panel.title" },
|
|
65
65
|
children: { label: It },
|
|
66
|
-
width:
|
|
66
|
+
width: 360
|
|
67
67
|
}), t.setPanelVisible(!0)), !0;
|
|
68
68
|
}
|
|
69
69
|
}, F = {
|
|
70
70
|
id: "thread-comment-ui.operation.set-active-comment",
|
|
71
71
|
type: we.OPERATION,
|
|
72
|
-
handler(
|
|
73
|
-
return
|
|
72
|
+
handler(r, e) {
|
|
73
|
+
return r.get(Y).setActiveComment(e), !0;
|
|
74
74
|
}
|
|
75
75
|
}, yt = "thread-comment-ui.config", xe = {};
|
|
76
|
-
var wt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, Nt = (
|
|
77
|
-
for (var i =
|
|
78
|
-
(c =
|
|
76
|
+
var wt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, Nt = (r, e, t) => e in r ? wt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, St = (r, e, t, n) => {
|
|
77
|
+
for (var i = n > 1 ? void 0 : n ? _t(e, t) : e, o = r.length - 1, c; o >= 0; o--)
|
|
78
|
+
(c = r[o]) && (i = c(i) || i);
|
|
79
79
|
return i;
|
|
80
|
-
}, me = (
|
|
80
|
+
}, me = (r, e) => (t, n) => e(t, n, r), $e = (r, e, t) => Nt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
81
81
|
let ce = class extends Ze {
|
|
82
|
-
constructor(
|
|
83
|
-
super(), this._config =
|
|
82
|
+
constructor(r = xe, e, t, n) {
|
|
83
|
+
super(), this._config = r, this._injector = e, this._commandService = t, this._configService = n;
|
|
84
84
|
const { menu: i, ...o } = Fe(
|
|
85
85
|
{},
|
|
86
86
|
xe,
|
|
@@ -89,10 +89,10 @@ let ce = class extends Ze {
|
|
|
89
89
|
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(yt, o);
|
|
90
90
|
}
|
|
91
91
|
onStarting() {
|
|
92
|
-
var
|
|
92
|
+
var r;
|
|
93
93
|
Ke([
|
|
94
94
|
[Y]
|
|
95
|
-
], (
|
|
95
|
+
], (r = this._config) == null ? void 0 : r.overrides).forEach((e) => {
|
|
96
96
|
this._injector.add(e);
|
|
97
97
|
}), [bt, F].forEach((e) => {
|
|
98
98
|
this._commandService.registerCommand(e);
|
|
@@ -102,52 +102,52 @@ let ce = class extends Ze {
|
|
|
102
102
|
$e(ce, "pluginName", xt);
|
|
103
103
|
$e(ce, "type", de.UNIVER_UNKNOWN);
|
|
104
104
|
ce = St([
|
|
105
|
-
Ae(
|
|
105
|
+
Ae(nt),
|
|
106
106
|
me(1, ye(Be)),
|
|
107
107
|
me(2, te),
|
|
108
108
|
me(3, We)
|
|
109
109
|
], ce);
|
|
110
|
-
function z({ ref:
|
|
111
|
-
const { icon: t, id:
|
|
112
|
-
return Ue(t, `${
|
|
110
|
+
function z({ ref: r, ...e }) {
|
|
111
|
+
const { icon: t, id: n, className: i, extend: o, ...c } = e, x = `univerjs-icon univerjs-icon-${n} ${i || ""}`.trim(), h = ee(`_${kt()}`);
|
|
112
|
+
return Ue(t, `${n}`, {
|
|
113
113
|
defIds: t.defIds,
|
|
114
114
|
idSuffix: h.current
|
|
115
115
|
}, {
|
|
116
|
-
ref:
|
|
116
|
+
ref: r,
|
|
117
117
|
className: x,
|
|
118
118
|
...c
|
|
119
119
|
}, o);
|
|
120
120
|
}
|
|
121
|
-
function Ue(
|
|
122
|
-
return K(
|
|
121
|
+
function Ue(r, e, t, n, i) {
|
|
122
|
+
return K(r.tag, {
|
|
123
123
|
key: e,
|
|
124
|
-
...$t(
|
|
125
|
-
...
|
|
126
|
-
}, (Ut(
|
|
124
|
+
...$t(r, t, i),
|
|
125
|
+
...n
|
|
126
|
+
}, (Ut(r, t).children || []).map((o, c) => Ue(o, `${e}-${r.tag}-${c}`, t, void 0, i)));
|
|
127
127
|
}
|
|
128
|
-
function $t(
|
|
129
|
-
const
|
|
130
|
-
t != null && t.colorChannel1 &&
|
|
131
|
-
o === "mask" && typeof c == "string" && (
|
|
128
|
+
function $t(r, e, t) {
|
|
129
|
+
const n = { ...r.attrs };
|
|
130
|
+
t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1), r.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(([o, c]) => {
|
|
131
|
+
o === "mask" && typeof c == "string" && (n[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
132
132
|
});
|
|
133
133
|
const { defIds: i } = e;
|
|
134
|
-
return !i || i.length === 0 || (
|
|
135
|
-
typeof c == "string" && (
|
|
136
|
-
})),
|
|
134
|
+
return !i || i.length === 0 || (r.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(([o, c]) => {
|
|
135
|
+
typeof c == "string" && (n[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
136
|
+
})), n;
|
|
137
137
|
}
|
|
138
|
-
function Ut(
|
|
139
|
-
var
|
|
138
|
+
function Ut(r, e) {
|
|
139
|
+
var n;
|
|
140
140
|
const { defIds: t } = e;
|
|
141
|
-
return !t || t.length === 0 ?
|
|
142
|
-
...
|
|
143
|
-
children:
|
|
141
|
+
return !t || t.length === 0 ? r : r.tag === "defs" && ((n = r.children) != null && n.length) ? {
|
|
142
|
+
...r,
|
|
143
|
+
children: r.children.map((i) => typeof i.attrs.id == "string" && t && t.includes(i.attrs.id) ? {
|
|
144
144
|
...i,
|
|
145
145
|
attrs: {
|
|
146
146
|
...i.attrs,
|
|
147
147
|
id: i.attrs.id + e.idSuffix
|
|
148
148
|
}
|
|
149
149
|
} : i)
|
|
150
|
-
} :
|
|
150
|
+
} : r;
|
|
151
151
|
}
|
|
152
152
|
function kt() {
|
|
153
153
|
return Math.random().toString(36).substring(2, 8);
|
|
@@ -394,20 +394,20 @@ const Rt = {
|
|
|
394
394
|
}));
|
|
395
395
|
});
|
|
396
396
|
Oe.displayName = "SolveIcon";
|
|
397
|
-
function be(
|
|
397
|
+
function be(r) {
|
|
398
398
|
return {
|
|
399
399
|
id: "d",
|
|
400
|
-
body:
|
|
400
|
+
body: r,
|
|
401
401
|
documentStyle: {}
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
|
-
const Re = G((
|
|
404
|
+
const Re = G((r, e) => {
|
|
405
405
|
var O;
|
|
406
|
-
const { comment: t, onSave:
|
|
406
|
+
const { comment: t, onSave: n, id: i, onCancel: o, autoFocus: c, unitId: x, type: h } = r, S = N(te), U = N(he), [V, k] = P(!1), b = N(ht), u = ee(null), v = h === de.UNIVER_DOC ? Ge : x, [T, y] = P(() => {
|
|
407
407
|
var d, m, f;
|
|
408
408
|
return ue.transform.getPlainText((f = (m = (d = u.current) == null ? void 0 : d.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? f : "");
|
|
409
409
|
});
|
|
410
|
-
|
|
410
|
+
le(() => {
|
|
411
411
|
var m, f, w, p;
|
|
412
412
|
y(ue.transform.getPlainText((w = (f = (m = u.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? w : ""));
|
|
413
413
|
const d = (p = u.current) == null ? void 0 : p.selectionChange$.subscribe(() => {
|
|
@@ -441,7 +441,7 @@ const Re = G((n, e) => {
|
|
|
441
441
|
const C = () => {
|
|
442
442
|
if (u.current) {
|
|
443
443
|
const d = Ye.deepClone(u.current.getDocumentData().body);
|
|
444
|
-
k(!1),
|
|
444
|
+
k(!1), n == null || n({
|
|
445
445
|
...t,
|
|
446
446
|
text: d
|
|
447
447
|
}), u.current.replaceText(""), setTimeout(() => {
|
|
@@ -451,7 +451,7 @@ const Re = G((n, e) => {
|
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
453
|
return /* @__PURE__ */ I("div", { onClick: (d) => d.preventDefault(), children: [
|
|
454
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ a(
|
|
455
455
|
pt,
|
|
456
456
|
{
|
|
457
457
|
className: "univer-w-full",
|
|
@@ -472,8 +472,8 @@ const Re = G((n, e) => {
|
|
|
472
472
|
}
|
|
473
473
|
),
|
|
474
474
|
V ? /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2", children: [
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
|
|
475
|
+
/* @__PURE__ */ a(
|
|
476
|
+
ae,
|
|
477
477
|
{
|
|
478
478
|
onClick: () => {
|
|
479
479
|
var d;
|
|
@@ -482,8 +482,8 @@ const Re = G((n, e) => {
|
|
|
482
482
|
children: U.t("threadCommentUI.editor.cancel")
|
|
483
483
|
}
|
|
484
484
|
),
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
|
|
485
|
+
/* @__PURE__ */ a(
|
|
486
|
+
ae,
|
|
487
487
|
{
|
|
488
488
|
variant: "primary",
|
|
489
489
|
disabled: !T,
|
|
@@ -493,8 +493,8 @@ const Re = G((n, e) => {
|
|
|
493
493
|
)
|
|
494
494
|
] }) : null
|
|
495
495
|
] });
|
|
496
|
-
}), Lt = (
|
|
497
|
-
const { dataStream: e, customRanges: t } =
|
|
496
|
+
}), Lt = (r) => {
|
|
497
|
+
const { dataStream: e, customRanges: t } = r, n = e.endsWith(`\r
|
|
498
498
|
`) ? e.length - 2 : e.length, i = [];
|
|
499
499
|
let o = 0;
|
|
500
500
|
return t == null || t.forEach((c) => {
|
|
@@ -510,29 +510,30 @@ const Re = G((n, e) => {
|
|
|
510
510
|
}), o = c.endIndex + 1;
|
|
511
511
|
}), i.push({
|
|
512
512
|
type: "text",
|
|
513
|
-
content: e.slice(o,
|
|
513
|
+
content: e.slice(o, n)
|
|
514
514
|
}), i;
|
|
515
|
-
}, Ht = (
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
515
|
+
}, Ht = (r) => {
|
|
516
|
+
if (!r)
|
|
517
|
+
return [];
|
|
518
|
+
const { paragraphs: e = [] } = r;
|
|
519
|
+
return e.map((t, n) => {
|
|
520
|
+
const i = n === 0 ? 0 : e[n - 1].startIndex + 1, o = Je(r, i, t.startIndex);
|
|
521
|
+
return Lt(o);
|
|
521
522
|
});
|
|
522
|
-
}, Vt = (
|
|
523
|
+
}, Vt = (r) => {
|
|
523
524
|
let e = "";
|
|
524
525
|
const t = [];
|
|
525
|
-
return
|
|
526
|
-
switch (
|
|
526
|
+
return r.forEach((n) => {
|
|
527
|
+
switch (n.type) {
|
|
527
528
|
case "text":
|
|
528
|
-
e +=
|
|
529
|
+
e += n.content;
|
|
529
530
|
break;
|
|
530
531
|
case "mention": {
|
|
531
532
|
const i = e.length;
|
|
532
|
-
e +=
|
|
533
|
+
e += n.content.label;
|
|
533
534
|
const o = e.length - 1;
|
|
534
535
|
t.push({
|
|
535
|
-
rangeId:
|
|
536
|
+
rangeId: n.content.id,
|
|
536
537
|
rangeType: qe.MENTION,
|
|
537
538
|
startIndex: i,
|
|
538
539
|
endIndex: o,
|
|
@@ -559,19 +560,19 @@ const Re = G((n, e) => {
|
|
|
559
560
|
dataStream: e,
|
|
560
561
|
customRanges: t
|
|
561
562
|
};
|
|
562
|
-
}, Le = "__mock__", jt = (
|
|
563
|
-
const { item: e, unitId: t, subUnitId:
|
|
563
|
+
}, Le = "__mock__", jt = (r) => {
|
|
564
|
+
const { item: e, unitId: t, subUnitId: n, editing: i, onEditingChange: o, onReply: c, resolved: x, isRoot: h, onClose: S, onDeleteComment: U, type: V } = r, k = N(te), b = N(he), u = N(fe), v = u.getUser(e.personId), T = Z(u.currentUser$), y = (T == null ? void 0 : T.userID) === e.personId, j = e.id === Le, [C, O] = P(!1), d = Xe(et), m = d == null ? void 0 : d.avatarFallback, f = () => {
|
|
564
565
|
(U == null ? void 0 : U(e)) !== !1 && (k.executeCommand(
|
|
565
|
-
h ? Se.id :
|
|
566
|
+
h ? Se.id : lt.id,
|
|
566
567
|
{
|
|
567
568
|
unitId: t,
|
|
568
|
-
subUnitId:
|
|
569
|
+
subUnitId: n,
|
|
569
570
|
commentId: e.id
|
|
570
571
|
}
|
|
571
572
|
), h && (S == null || S()));
|
|
572
573
|
};
|
|
573
574
|
return /* @__PURE__ */ I("div", { className: "univer-relative univer-mb-3 univer-pl-[30px]", onMouseLeave: () => O(!1), onMouseEnter: () => O(!0), children: [
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ a(
|
|
575
576
|
"div",
|
|
576
577
|
{
|
|
577
578
|
className: "univer-absolute univer-left-0 univer-top-0 univer-h-6 univer-w-6 univer-rounded-full univer-bg-cover univer-bg-center univer-bg-no-repeat",
|
|
@@ -581,25 +582,25 @@ const Re = G((n, e) => {
|
|
|
581
582
|
}
|
|
582
583
|
),
|
|
583
584
|
v ? /* @__PURE__ */ I("div", { className: "univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between", children: [
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ a("div", { className: "univer-text-sm univer-font-medium univer-leading-5", children: (v == null ? void 0 : v.name) || " " }),
|
|
585
586
|
/* @__PURE__ */ I("div", { children: [
|
|
586
|
-
j || x ? null : C && v ? /* @__PURE__ */
|
|
587
|
+
j || x ? null : C && v ? /* @__PURE__ */ a(
|
|
587
588
|
"div",
|
|
588
589
|
{
|
|
589
590
|
className: "univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50",
|
|
590
591
|
onClick: () => c(v),
|
|
591
|
-
children: /* @__PURE__ */
|
|
592
|
+
children: /* @__PURE__ */ a(Ee, {})
|
|
592
593
|
}
|
|
593
594
|
) : null,
|
|
594
|
-
y && !j && !x ? /* @__PURE__ */
|
|
595
|
+
y && !j && !x ? /* @__PURE__ */ a(
|
|
595
596
|
vt,
|
|
596
597
|
{
|
|
597
|
-
overlay: /* @__PURE__ */
|
|
598
|
+
overlay: /* @__PURE__ */ a("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ I(
|
|
598
599
|
"ul",
|
|
599
600
|
{
|
|
600
601
|
className: "univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm [&_a]:univer-block [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5 [&_a]:univer-transition-colors",
|
|
601
602
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
603
604
|
"a",
|
|
604
605
|
{
|
|
605
606
|
className: "hover:univer-bg-gray-200",
|
|
@@ -607,7 +608,7 @@ const Re = G((n, e) => {
|
|
|
607
608
|
children: b.t("threadCommentUI.item.edit")
|
|
608
609
|
}
|
|
609
610
|
) }),
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
611
612
|
"a",
|
|
612
613
|
{
|
|
613
614
|
className: "hover:univer-bg-gray-200",
|
|
@@ -618,25 +619,25 @@ const Re = G((n, e) => {
|
|
|
618
619
|
]
|
|
619
620
|
}
|
|
620
621
|
) }),
|
|
621
|
-
children: /* @__PURE__ */
|
|
622
|
+
children: /* @__PURE__ */ a(
|
|
622
623
|
"div",
|
|
623
624
|
{
|
|
624
625
|
className: "univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50",
|
|
625
|
-
children: /* @__PURE__ */
|
|
626
|
+
children: /* @__PURE__ */ a(De, {})
|
|
626
627
|
}
|
|
627
628
|
)
|
|
628
629
|
}
|
|
629
630
|
) : null
|
|
630
631
|
] })
|
|
631
632
|
] }) : null,
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
+
/* @__PURE__ */ a(
|
|
633
634
|
"time",
|
|
634
635
|
{
|
|
635
636
|
className: "univer-mb-1 univer-text-xs/normal univer-text-gray-600 dark:!univer-text-gray-200",
|
|
636
637
|
children: e.dT
|
|
637
638
|
}
|
|
638
639
|
),
|
|
639
|
-
i ? /* @__PURE__ */
|
|
640
|
+
i ? /* @__PURE__ */ a(
|
|
640
641
|
Re,
|
|
641
642
|
{
|
|
642
643
|
type: V,
|
|
@@ -645,13 +646,13 @@ const Re = G((n, e) => {
|
|
|
645
646
|
onCancel: () => o == null ? void 0 : o(!1),
|
|
646
647
|
autoFocus: !0,
|
|
647
648
|
unitId: t,
|
|
648
|
-
subUnitId:
|
|
649
|
+
subUnitId: n,
|
|
649
650
|
onSave: ({ text: w, attachments: p }) => {
|
|
650
651
|
o == null || o(!1), k.executeCommand(
|
|
651
|
-
|
|
652
|
+
at.id,
|
|
652
653
|
{
|
|
653
654
|
unitId: t,
|
|
654
|
-
subUnitId:
|
|
655
|
+
subUnitId: n,
|
|
655
656
|
payload: {
|
|
656
657
|
commentId: e.id,
|
|
657
658
|
text: w,
|
|
@@ -661,30 +662,23 @@ const Re = G((n, e) => {
|
|
|
661
662
|
);
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
|
-
) : /* @__PURE__ */
|
|
665
|
+
) : /* @__PURE__ */ a(
|
|
665
666
|
"div",
|
|
666
667
|
{
|
|
667
668
|
className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
668
|
-
children: Ht(e.text).map((w, p) => /* @__PURE__ */
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
s.content.label,
|
|
673
|
-
" "
|
|
674
|
-
] }, _);
|
|
675
|
-
default:
|
|
676
|
-
return s.content;
|
|
677
|
-
}
|
|
678
|
-
}) }, p))
|
|
669
|
+
children: Ht(e.text).map((w, p) => /* @__PURE__ */ a("div", { className: "univer-break-words", children: w.map((s, _) => s.type === "mention" ? /* @__PURE__ */ I("a", { className: "univer-text-primary-600", children: [
|
|
670
|
+
s.content.label,
|
|
671
|
+
" "
|
|
672
|
+
] }, _) : s.content) }, p))
|
|
679
673
|
}
|
|
680
674
|
)
|
|
681
675
|
] });
|
|
682
|
-
}, Pt = (
|
|
683
|
-
var se, Q,
|
|
676
|
+
}, Pt = (r) => {
|
|
677
|
+
var se, Q, l;
|
|
684
678
|
const {
|
|
685
679
|
id: e,
|
|
686
680
|
unitId: t,
|
|
687
|
-
subUnitId:
|
|
681
|
+
subUnitId: n,
|
|
688
682
|
refStr: i,
|
|
689
683
|
showEdit: o = !0,
|
|
690
684
|
onClick: c,
|
|
@@ -701,9 +695,9 @@ const Re = G((n, e) => {
|
|
|
701
695
|
type: y,
|
|
702
696
|
style: j,
|
|
703
697
|
full: C
|
|
704
|
-
} =
|
|
698
|
+
} = r, O = N(Ne), [d, m] = P(!1), [f, w] = P(""), p = X(() => O.commentUpdate$.pipe(rt(16)), [O]);
|
|
705
699
|
Z(p);
|
|
706
|
-
const s = e ? O.getCommentWithChildren(t,
|
|
700
|
+
const s = e ? O.getCommentWithChildren(t, n, e) : null, _ = N(te), A = N(fe), D = s == null ? void 0 : s.root.resolved, E = Z(A.currentUser$), L = ee(null), q = [
|
|
707
701
|
...s ? [s.root] : (
|
|
708
702
|
// mock empty comment
|
|
709
703
|
[{
|
|
@@ -716,19 +710,19 @@ const Re = G((n, e) => {
|
|
|
716
710
|
ref: i != null ? i : "",
|
|
717
711
|
dT: "",
|
|
718
712
|
unitId: t,
|
|
719
|
-
subUnitId:
|
|
713
|
+
subUnitId: n,
|
|
720
714
|
threadId: ""
|
|
721
715
|
}]
|
|
722
716
|
),
|
|
723
717
|
...(Q = s == null ? void 0 : s.children) != null ? Q : []
|
|
724
|
-
], R = ee(null),
|
|
718
|
+
], R = ee(null), re = (g) => {
|
|
725
719
|
g.stopPropagation(), D ? _.executeCommand(F.id, {
|
|
726
720
|
unitId: t,
|
|
727
|
-
subUnitId:
|
|
721
|
+
subUnitId: n,
|
|
728
722
|
commentId: e
|
|
729
723
|
}) : _.executeCommand(F.id), _.executeCommand(st.id, {
|
|
730
724
|
unitId: t,
|
|
731
|
-
subUnitId:
|
|
725
|
+
subUnitId: n,
|
|
732
726
|
commentId: e,
|
|
733
727
|
resolved: !D
|
|
734
728
|
}), T == null || T(!D);
|
|
@@ -737,17 +731,17 @@ const Re = G((n, e) => {
|
|
|
737
731
|
Se.id,
|
|
738
732
|
{
|
|
739
733
|
unitId: t,
|
|
740
|
-
subUnitId:
|
|
734
|
+
subUnitId: n,
|
|
741
735
|
commentId: e
|
|
742
736
|
}
|
|
743
737
|
), h == null || h());
|
|
744
738
|
};
|
|
745
|
-
|
|
746
|
-
const
|
|
739
|
+
le(() => b == null ? void 0 : b(), []);
|
|
740
|
+
const ne = S((l = s == null ? void 0 : s.root.subUnitId) != null ? l : n), ie = o && !f && !D, oe = `${i || (s == null ? void 0 : s.root.ref) || ""}${ne ? " · " : ""}${ne}`;
|
|
747
741
|
return /* @__PURE__ */ I(
|
|
748
742
|
"div",
|
|
749
743
|
{
|
|
750
|
-
id: `${U}-${t}-${
|
|
744
|
+
id: `${U}-${t}-${n}-${e}`,
|
|
751
745
|
className: ve("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white", ut, {
|
|
752
746
|
"univer-w-[278px]": !C,
|
|
753
747
|
"univer-w-full": C,
|
|
@@ -762,7 +756,7 @@ const Re = G((n, e) => {
|
|
|
762
756
|
b == null || b(), m(!1);
|
|
763
757
|
},
|
|
764
758
|
children: [
|
|
765
|
-
!D && x && /* @__PURE__ */
|
|
759
|
+
!D && x && /* @__PURE__ */ a(
|
|
766
760
|
"div",
|
|
767
761
|
{
|
|
768
762
|
className: "univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md univer-bg-yellow-400"
|
|
@@ -774,13 +768,13 @@ const Re = G((n, e) => {
|
|
|
774
768
|
className: "univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm univer-leading-5",
|
|
775
769
|
children: [
|
|
776
770
|
/* @__PURE__ */ I("div", { className: "univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden", children: [
|
|
777
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ a(
|
|
778
772
|
"div",
|
|
779
773
|
{
|
|
780
774
|
className: "univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0 univer-rounded-sm univer-bg-yellow-500"
|
|
781
775
|
}
|
|
782
776
|
),
|
|
783
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ a(ct, { showIfEllipsis: !0, title: oe, children: /* @__PURE__ */ a(
|
|
784
778
|
"span",
|
|
785
779
|
{
|
|
786
780
|
className: "univer-flex-1 univer-truncate",
|
|
@@ -789,39 +783,39 @@ const Re = G((n, e) => {
|
|
|
789
783
|
) })
|
|
790
784
|
] }),
|
|
791
785
|
!!s && /* @__PURE__ */ I("div", { className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row", children: [
|
|
792
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ a(
|
|
793
787
|
"div",
|
|
794
788
|
{
|
|
795
789
|
className: ve("univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800", {
|
|
796
790
|
"univer-text-green-500": D
|
|
797
791
|
}),
|
|
798
|
-
onClick:
|
|
799
|
-
children: D ? /* @__PURE__ */
|
|
792
|
+
onClick: re,
|
|
793
|
+
children: D ? /* @__PURE__ */ a(Me, {}) : /* @__PURE__ */ a(Oe, {})
|
|
800
794
|
}
|
|
801
795
|
),
|
|
802
|
-
(E == null ? void 0 : E.userID) === s.root.personId ? /* @__PURE__ */
|
|
796
|
+
(E == null ? void 0 : E.userID) === s.root.personId ? /* @__PURE__ */ a(
|
|
803
797
|
"div",
|
|
804
798
|
{
|
|
805
799
|
className: "univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800",
|
|
806
800
|
onClick: J,
|
|
807
|
-
children: /* @__PURE__ */
|
|
801
|
+
children: /* @__PURE__ */ a(ke, {})
|
|
808
802
|
}
|
|
809
803
|
) : null
|
|
810
804
|
] })
|
|
811
805
|
]
|
|
812
806
|
}
|
|
813
807
|
),
|
|
814
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ a(
|
|
815
809
|
"div",
|
|
816
810
|
{
|
|
817
811
|
ref: R,
|
|
818
812
|
className: ve("univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden", dt),
|
|
819
813
|
children: q.map(
|
|
820
|
-
(g) => /* @__PURE__ */
|
|
814
|
+
(g) => /* @__PURE__ */ a(
|
|
821
815
|
jt,
|
|
822
816
|
{
|
|
823
817
|
unitId: t,
|
|
824
|
-
subUnitId:
|
|
818
|
+
subUnitId: n,
|
|
825
819
|
item: g,
|
|
826
820
|
isRoot: g.id === (s == null ? void 0 : s.root.id),
|
|
827
821
|
editing: f === g.id,
|
|
@@ -857,13 +851,13 @@ const Re = G((n, e) => {
|
|
|
857
851
|
)
|
|
858
852
|
}
|
|
859
853
|
),
|
|
860
|
-
ie && /* @__PURE__ */
|
|
854
|
+
ie && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
861
855
|
Re,
|
|
862
856
|
{
|
|
863
857
|
ref: L,
|
|
864
858
|
type: y,
|
|
865
859
|
unitId: t,
|
|
866
|
-
subUnitId:
|
|
860
|
+
subUnitId: n,
|
|
867
861
|
onSave: async ({ text: g, attachments: M }) => {
|
|
868
862
|
const H = {
|
|
869
863
|
text: g,
|
|
@@ -874,14 +868,14 @@ const Re = G((n, e) => {
|
|
|
874
868
|
personId: E == null ? void 0 : E.userID,
|
|
875
869
|
parentId: s == null ? void 0 : s.root.id,
|
|
876
870
|
unitId: t,
|
|
877
|
-
subUnitId:
|
|
871
|
+
subUnitId: n,
|
|
878
872
|
threadId: s == null ? void 0 : s.root.threadId
|
|
879
873
|
};
|
|
880
874
|
(u == null ? void 0 : u(H)) !== !1 && (await _.executeCommand(
|
|
881
875
|
ot.id,
|
|
882
876
|
{
|
|
883
877
|
unitId: t,
|
|
884
|
-
subUnitId:
|
|
878
|
+
subUnitId: n,
|
|
885
879
|
comment: H
|
|
886
880
|
}
|
|
887
881
|
), R.current && (R.current.scrollTop = R.current.scrollHeight));
|
|
@@ -896,11 +890,11 @@ const Re = G((n, e) => {
|
|
|
896
890
|
]
|
|
897
891
|
}
|
|
898
892
|
);
|
|
899
|
-
}, qt = (
|
|
893
|
+
}, qt = (r) => {
|
|
900
894
|
const {
|
|
901
895
|
unitId: e,
|
|
902
896
|
subUnitId$: t,
|
|
903
|
-
type:
|
|
897
|
+
type: n,
|
|
904
898
|
onAdd: i,
|
|
905
899
|
getSubUnitName: o,
|
|
906
900
|
onResolve: c,
|
|
@@ -912,9 +906,9 @@ const Re = G((n, e) => {
|
|
|
912
906
|
onAddComment: k,
|
|
913
907
|
onDeleteComment: b,
|
|
914
908
|
showComments: u
|
|
915
|
-
} =
|
|
909
|
+
} = r, [v, T] = P("all"), [y, j] = P("all"), C = N(he), O = N(fe), d = N(Ne), [m, f] = P(() => d.getUnit(e)), w = N(Y), p = Z(w.activeCommentId$), s = Z(d.commentUpdate$), _ = N(te), A = Z(t), D = ee(!0), E = "panel", L = Z(O.currentUser$), q = X(() => {
|
|
916
910
|
var H;
|
|
917
|
-
const
|
|
911
|
+
const l = v === "all" ? m : (H = m.filter(($) => $.subUnitId === A)) != null ? H : [], g = x != null ? x : (($) => $), M = l.map(($) => {
|
|
918
912
|
var B;
|
|
919
913
|
return { ...$.root, children: (B = $.children) != null ? B : [], users: $.relativeUsers };
|
|
920
914
|
});
|
|
@@ -926,16 +920,16 @@ const Re = G((n, e) => {
|
|
|
926
920
|
} else
|
|
927
921
|
return g(M);
|
|
928
922
|
}, [u, v, m, x, A]), R = X(() => [
|
|
929
|
-
...q.filter((
|
|
930
|
-
...q.filter((
|
|
931
|
-
], [q]),
|
|
923
|
+
...q.filter((l) => !l.resolved),
|
|
924
|
+
...q.filter((l) => l.resolved)
|
|
925
|
+
], [q]), re = X(() => y === "resolved" ? R.filter((l) => l.resolved) : y === "unsolved" ? R.filter((l) => !l.resolved) : y === "concern_me" && L != null && L.userID ? R.filter((l) => l == null ? void 0 : l.users.has(L.userID)) : R, [R, L == null ? void 0 : L.userID, y]), J = V ? [V, ...re] : re, ne = J.filter((l) => !l.resolved), ie = J.filter((l) => l.resolved), oe = y !== "all" || v !== "all", se = () => {
|
|
932
926
|
j("all"), T("all");
|
|
933
927
|
};
|
|
934
|
-
|
|
928
|
+
le(() => {
|
|
935
929
|
e && f(
|
|
936
930
|
d.getUnit(e)
|
|
937
931
|
);
|
|
938
|
-
}, [e, d, s]),
|
|
932
|
+
}, [e, d, s]), le(() => {
|
|
939
933
|
var $;
|
|
940
934
|
if (!p)
|
|
941
935
|
return;
|
|
@@ -943,43 +937,43 @@ const Re = G((n, e) => {
|
|
|
943
937
|
D.current = !0;
|
|
944
938
|
return;
|
|
945
939
|
}
|
|
946
|
-
const { unitId:
|
|
940
|
+
const { unitId: l, subUnitId: g, commentId: M } = p, H = `${E}-${l}-${g}-${M}`;
|
|
947
941
|
($ = document.getElementById(H)) == null || $.scrollIntoView({ block: "center" });
|
|
948
942
|
}, [p]);
|
|
949
|
-
const Q = (
|
|
943
|
+
const Q = (l) => /* @__PURE__ */ a(
|
|
950
944
|
Pt,
|
|
951
945
|
{
|
|
952
946
|
prefix: E,
|
|
953
947
|
getSubUnitName: o,
|
|
954
|
-
id:
|
|
955
|
-
unitId:
|
|
956
|
-
subUnitId:
|
|
957
|
-
refStr:
|
|
958
|
-
type:
|
|
959
|
-
showEdit: (p == null ? void 0 : p.commentId) ===
|
|
960
|
-
showHighlight: (p == null ? void 0 : p.commentId) ===
|
|
948
|
+
id: l.id,
|
|
949
|
+
unitId: l.unitId,
|
|
950
|
+
subUnitId: l.subUnitId,
|
|
951
|
+
refStr: l.ref,
|
|
952
|
+
type: n,
|
|
953
|
+
showEdit: (p == null ? void 0 : p.commentId) === l.id,
|
|
954
|
+
showHighlight: (p == null ? void 0 : p.commentId) === l.id,
|
|
961
955
|
onClick: () => {
|
|
962
|
-
D.current = !1,
|
|
956
|
+
D.current = !1, l.resolved ? _.executeCommand(F.id) : _.executeCommand(
|
|
963
957
|
F.id,
|
|
964
958
|
{
|
|
965
|
-
unitId:
|
|
966
|
-
subUnitId:
|
|
967
|
-
commentId:
|
|
959
|
+
unitId: l.unitId,
|
|
960
|
+
subUnitId: l.subUnitId,
|
|
961
|
+
commentId: l.id,
|
|
968
962
|
temp: !1
|
|
969
963
|
}
|
|
970
964
|
);
|
|
971
965
|
},
|
|
972
|
-
onMouseEnter: () => S == null ? void 0 : S(
|
|
973
|
-
onMouseLeave: () => h == null ? void 0 : h(
|
|
966
|
+
onMouseEnter: () => S == null ? void 0 : S(l),
|
|
967
|
+
onMouseLeave: () => h == null ? void 0 : h(l),
|
|
974
968
|
onAddComment: k,
|
|
975
969
|
onDeleteComment: b,
|
|
976
|
-
onResolve: (g) => c == null ? void 0 : c(
|
|
970
|
+
onResolve: (g) => c == null ? void 0 : c(l.id, g)
|
|
977
971
|
},
|
|
978
|
-
|
|
972
|
+
l.id
|
|
979
973
|
);
|
|
980
974
|
return /* @__PURE__ */ I("div", { className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3", children: [
|
|
981
975
|
/* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-row univer-justify-between", children: [
|
|
982
|
-
|
|
976
|
+
n === de.UNIVER_SHEET ? /* @__PURE__ */ a(
|
|
983
977
|
ge,
|
|
984
978
|
{
|
|
985
979
|
borderless: !0,
|
|
@@ -997,7 +991,7 @@ const Re = G((n, e) => {
|
|
|
997
991
|
onChange: T
|
|
998
992
|
}
|
|
999
993
|
) : null,
|
|
1000
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ a(
|
|
1001
995
|
ge,
|
|
1002
996
|
{
|
|
1003
997
|
borderless: !0,
|
|
@@ -1030,15 +1024,15 @@ const Re = G((n, e) => {
|
|
|
1030
1024
|
className: "univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1031
1025
|
children: [
|
|
1032
1026
|
C.t("threadCommentUI.panel.empty"),
|
|
1033
|
-
oe ? /* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1027
|
+
oe ? /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ a(ae, { onClick: se, children: C.t("threadCommentUI.panel.reset") }) }) : U ? null : /* @__PURE__ */ a("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ I(ae, { onClick: i, children: [
|
|
1028
|
+
/* @__PURE__ */ a(Te, { className: "univer-mr-1.5" }),
|
|
1035
1029
|
C.t("threadCommentUI.panel.addComment")
|
|
1036
1030
|
] }) })
|
|
1037
1031
|
]
|
|
1038
1032
|
}
|
|
1039
1033
|
) : /* @__PURE__ */ I("div", { className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3", children: [
|
|
1040
|
-
|
|
1041
|
-
ie.length > 0 && /* @__PURE__ */
|
|
1034
|
+
ne.map(Q),
|
|
1035
|
+
ie.length > 0 && /* @__PURE__ */ a("div", { className: "univer-text-xs", children: C.t("threadCommentUI.panel.solved") }),
|
|
1042
1036
|
ie.map(Q)
|
|
1043
1037
|
] })
|
|
1044
1038
|
] });
|