@univerjs/thread-comment-ui 0.4.1 → 0.4.2-nightly.202410301606

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/es/index.js CHANGED
@@ -2,304 +2,16 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { UniverThreadCommentPlugin, ThreadCommentModel, AddCommentCommand, UpdateCommentCommand, ResolveCommentCommand, DeleteCommentTreeCommand, DeleteCommentCommand } from "@univerjs/thread-comment";
6
5
  import { Inject, Disposable, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, DependentOn, Injector, Plugin, mergeOverrideWithDependencies, ICommandService, IConfigService, CustomRangeType, useDependency, LocaleService, UserManagerService, generateRandomId } from "@univerjs/core";
6
+ import { UniverThreadCommentPlugin, ThreadCommentModel, getDT, AddCommentCommand, UpdateCommentCommand, ResolveCommentCommand, DeleteCommentTreeCommand, DeleteCommentCommand } from "@univerjs/thread-comment";
7
7
  import { ISidebarService, useObservable } from "@univerjs/ui";
8
- import { BehaviorSubject, filter } from "rxjs";
8
+ import { BehaviorSubject, filter, debounceTime } from "rxjs";
9
9
  import { Mentions, Mention, Button, Tooltip, Dropdown, Menu, MenuItem, Select } from "@univerjs/design";
10
- import React, { forwardRef, useRef, createElement, useState, useImperativeHandle, useEffect, useMemo } from "react";
10
+ import React, { forwardRef, useRef, createElement, useState, useImperativeHandle, useMemo, useEffect } from "react";
11
11
  import { DocSelectionManagerService } from "@univerjs/docs";
12
12
  import { DocSelectionRenderService } from "@univerjs/docs-ui";
13
13
  import { IRenderManagerService } from "@univerjs/engine-render";
14
- var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
15
- function getDefaultExportFromCjs(x) {
16
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
17
- }
18
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
19
- var dayjs_min = { exports: {} };
20
- (function(module, exports) {
21
- (function(t, e) {
22
- module.exports = e();
23
- })(commonjsGlobal, function() {
24
- var t = 1e3, e = 6e4, n = 36e5, r2 = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: /* @__PURE__ */ __name(function(t2) {
25
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
26
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
27
- }, "ordinal") }, m = /* @__PURE__ */ __name(function(t2, e2, n2) {
28
- var r3 = String(t2);
29
- return !r3 || r3.length >= e2 ? t2 : "" + Array(e2 + 1 - r3.length).join(n2) + t2;
30
- }, "m"), v = { s: m, z: /* @__PURE__ */ __name(function(t2) {
31
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r3 = Math.floor(n2 / 60), i2 = n2 % 60;
32
- return (e2 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i2, 2, "0");
33
- }, "z"), m: /* @__PURE__ */ __name(function t2(e2, n2) {
34
- if (e2.date() < n2.date()) return -t2(n2, e2);
35
- var r3 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r3, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r3 + (s2 ? -1 : 1), c);
36
- return +(-(r3 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
37
- }, "t"), a: /* @__PURE__ */ __name(function(t2) {
38
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
39
- }, "a"), p: /* @__PURE__ */ __name(function(t2) {
40
- return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r2, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
41
- }, "p"), u: /* @__PURE__ */ __name(function(t2) {
42
- return t2 === void 0;
43
- }, "u") }, g = "en", D = {};
44
- D[g] = M;
45
- var p = "$isDayjsObject", S = /* @__PURE__ */ __name(function(t2) {
46
- return t2 instanceof _ || !(!t2 || !t2[p]);
47
- }, "S"), w = /* @__PURE__ */ __name(function t2(e2, n2, r3) {
48
- var i2;
49
- if (!e2) return g;
50
- if (typeof e2 == "string") {
51
- var s2 = e2.toLowerCase();
52
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
53
- var u2 = e2.split("-");
54
- if (!i2 && u2.length > 1) return t2(u2[0]);
55
- } else {
56
- var a2 = e2.name;
57
- D[a2] = e2, i2 = a2;
58
- }
59
- return !r3 && i2 && (g = i2), i2 || !r3 && g;
60
- }, "t"), O = /* @__PURE__ */ __name(function(t2, e2) {
61
- if (S(t2)) return t2.clone();
62
- var n2 = typeof e2 == "object" ? e2 : {};
63
- return n2.date = t2, n2.args = arguments, new _(n2);
64
- }, "O"), b = v;
65
- b.l = w, b.i = S, b.w = function(t2, e2) {
66
- return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
67
- };
68
- var _ = function() {
69
- function M2(t2) {
70
- this.$L = w(t2.locale, null, !0), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = !0;
71
- }
72
- __name(M2, "M");
73
- var m2 = M2.prototype;
74
- return m2.parse = function(t2) {
75
- this.$d = function(t3) {
76
- var e2 = t3.date, n2 = t3.utc;
77
- if (e2 === null) return /* @__PURE__ */ new Date(NaN);
78
- if (b.u(e2)) return /* @__PURE__ */ new Date();
79
- if (e2 instanceof Date) return new Date(e2);
80
- if (typeof e2 == "string" && !/Z$/i.test(e2)) {
81
- var r3 = e2.match($);
82
- if (r3) {
83
- var i2 = r3[2] - 1 || 0, s2 = (r3[7] || "0").substring(0, 3);
84
- return n2 ? new Date(Date.UTC(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2)) : new Date(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2);
85
- }
86
- }
87
- return new Date(e2);
88
- }(t2), this.init();
89
- }, m2.init = function() {
90
- var t2 = this.$d;
91
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
92
- }, m2.$utils = function() {
93
- return b;
94
- }, m2.isValid = function() {
95
- return this.$d.toString() !== l;
96
- }, m2.isSame = function(t2, e2) {
97
- var n2 = O(t2);
98
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
99
- }, m2.isAfter = function(t2, e2) {
100
- return O(t2) < this.startOf(e2);
101
- }, m2.isBefore = function(t2, e2) {
102
- return this.endOf(e2) < O(t2);
103
- }, m2.$g = function(t2, e2, n2) {
104
- return b.u(t2) ? this[e2] : this.set(n2, t2);
105
- }, m2.unix = function() {
106
- return Math.floor(this.valueOf() / 1e3);
107
- }, m2.valueOf = function() {
108
- return this.$d.getTime();
109
- }, m2.startOf = function(t2, e2) {
110
- var n2 = this, r3 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = /* @__PURE__ */ __name(function(t3, e3) {
111
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
112
- return r3 ? i2 : i2.endOf(a);
113
- }, "l"), $2 = /* @__PURE__ */ __name(function(t3, e3) {
114
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
115
- }, "$"), y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
116
- switch (f2) {
117
- case h:
118
- return r3 ? l2(1, 0) : l2(31, 11);
119
- case c:
120
- return r3 ? l2(1, M3) : l2(0, M3 + 1);
121
- case o:
122
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
123
- return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
124
- case a:
125
- case d:
126
- return $2(v2 + "Hours", 0);
127
- case u:
128
- return $2(v2 + "Minutes", 1);
129
- case s:
130
- return $2(v2 + "Seconds", 2);
131
- case i:
132
- return $2(v2 + "Milliseconds", 3);
133
- default:
134
- return this.clone();
135
- }
136
- }, m2.endOf = function(t2) {
137
- return this.startOf(t2, !1);
138
- }, m2.$set = function(t2, e2) {
139
- var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r2] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
140
- if (o2 === c || o2 === h) {
141
- var y2 = this.clone().set(d, 1);
142
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
143
- } else l2 && this.$d[l2]($2);
144
- return this.init(), this;
145
- }, m2.set = function(t2, e2) {
146
- return this.clone().$set(t2, e2);
147
- }, m2.get = function(t2) {
148
- return this[b.p(t2)]();
149
- }, m2.add = function(r3, f2) {
150
- var d2, l2 = this;
151
- r3 = Number(r3);
152
- var $2 = b.p(f2), y2 = /* @__PURE__ */ __name(function(t2) {
153
- var e2 = O(l2);
154
- return b.w(e2.date(e2.date() + Math.round(t2 * r3)), l2);
155
- }, "y");
156
- if ($2 === c) return this.set(c, this.$M + r3);
157
- if ($2 === h) return this.set(h, this.$y + r3);
158
- if ($2 === a) return y2(1);
159
- if ($2 === o) return y2(7);
160
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
161
- return b.w(m3, this);
162
- }, m2.subtract = function(t2, e2) {
163
- return this.add(-1 * t2, e2);
164
- }, m2.format = function(t2) {
165
- var e2 = this, n2 = this.$locale();
166
- if (!this.isValid()) return n2.invalidDate || l;
167
- var r3 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = /* @__PURE__ */ __name(function(t3, n3, i3, s3) {
168
- return t3 && (t3[n3] || t3(e2, r3)) || i3[n3].slice(0, s3);
169
- }, "h"), d2 = /* @__PURE__ */ __name(function(t3) {
170
- return b.s(s2 % 12 || 12, t3, "0");
171
- }, "d"), $2 = f2 || function(t3, e3, n3) {
172
- var r4 = t3 < 12 ? "AM" : "PM";
173
- return n3 ? r4.toLowerCase() : r4;
174
- };
175
- return r3.replace(y, function(t3, r4) {
176
- return r4 || function(t4) {
177
- switch (t4) {
178
- case "YY":
179
- return String(e2.$y).slice(-2);
180
- case "YYYY":
181
- return b.s(e2.$y, 4, "0");
182
- case "M":
183
- return a2 + 1;
184
- case "MM":
185
- return b.s(a2 + 1, 2, "0");
186
- case "MMM":
187
- return h2(n2.monthsShort, a2, c2, 3);
188
- case "MMMM":
189
- return h2(c2, a2);
190
- case "D":
191
- return e2.$D;
192
- case "DD":
193
- return b.s(e2.$D, 2, "0");
194
- case "d":
195
- return String(e2.$W);
196
- case "dd":
197
- return h2(n2.weekdaysMin, e2.$W, o2, 2);
198
- case "ddd":
199
- return h2(n2.weekdaysShort, e2.$W, o2, 3);
200
- case "dddd":
201
- return o2[e2.$W];
202
- case "H":
203
- return String(s2);
204
- case "HH":
205
- return b.s(s2, 2, "0");
206
- case "h":
207
- return d2(1);
208
- case "hh":
209
- return d2(2);
210
- case "a":
211
- return $2(s2, u2, !0);
212
- case "A":
213
- return $2(s2, u2, !1);
214
- case "m":
215
- return String(u2);
216
- case "mm":
217
- return b.s(u2, 2, "0");
218
- case "s":
219
- return String(e2.$s);
220
- case "ss":
221
- return b.s(e2.$s, 2, "0");
222
- case "SSS":
223
- return b.s(e2.$ms, 3, "0");
224
- case "Z":
225
- return i2;
226
- }
227
- return null;
228
- }(t3) || i2.replace(":", "");
229
- });
230
- }, m2.utcOffset = function() {
231
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
232
- }, m2.diff = function(r3, d2, l2) {
233
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = /* @__PURE__ */ __name(function() {
234
- return b.m(y2, m3);
235
- }, "D");
236
- switch (M3) {
237
- case h:
238
- $2 = D2() / 12;
239
- break;
240
- case c:
241
- $2 = D2();
242
- break;
243
- case f:
244
- $2 = D2() / 3;
245
- break;
246
- case o:
247
- $2 = (g2 - v2) / 6048e5;
248
- break;
249
- case a:
250
- $2 = (g2 - v2) / 864e5;
251
- break;
252
- case u:
253
- $2 = g2 / n;
254
- break;
255
- case s:
256
- $2 = g2 / e;
257
- break;
258
- case i:
259
- $2 = g2 / t;
260
- break;
261
- default:
262
- $2 = g2;
263
- }
264
- return l2 ? $2 : b.a($2);
265
- }, m2.daysInMonth = function() {
266
- return this.endOf(c).$D;
267
- }, m2.$locale = function() {
268
- return D[this.$L];
269
- }, m2.locale = function(t2, e2) {
270
- if (!t2) return this.$L;
271
- var n2 = this.clone(), r3 = w(t2, e2, !0);
272
- return r3 && (n2.$L = r3), n2;
273
- }, m2.clone = function() {
274
- return b.w(this.$d, this);
275
- }, m2.toDate = function() {
276
- return new Date(this.valueOf());
277
- }, m2.toJSON = function() {
278
- return this.isValid() ? this.toISOString() : null;
279
- }, m2.toISOString = function() {
280
- return this.$d.toISOString();
281
- }, m2.toString = function() {
282
- return this.$d.toUTCString();
283
- }, M2;
284
- }(), k = _.prototype;
285
- return O.prototype = k, [["$ms", r2], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
286
- k[t2[1]] = function(e2) {
287
- return this.$g(e2, t2[0], t2[1]);
288
- };
289
- }), O.extend = function(t2, e2) {
290
- return t2.$i || (t2(e2, _, O), t2.$i = !0), O;
291
- }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
292
- return O(1e3 * t2);
293
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
294
- });
295
- })(dayjs_min);
296
- var dayjs_minExports = dayjs_min.exports;
297
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
298
- function getDT() {
299
- return dayjs().format("YYYY/MM/DD HH:mm");
300
- }
301
- __name(getDT, "getDT");
302
- const THREAD_COMMENT_PANEL = "thread-comment-panel", PLUGIN_NAME = "UNIVER_THREAD_COMMENT_UI_PLUGIN";
14
+ import { IThreadCommentMentionDataService as IThreadCommentMentionDataService$1 } from "@univerjs/thread-comment-ui";
303
15
  var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
304
16
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
305
17
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -346,7 +58,7 @@ ThreadCommentPanelService = __decorateClass$1([
346
58
  __decorateParam$1(0, Inject(ISidebarService)),
347
59
  __decorateParam$1(1, IUniverInstanceService)
348
60
  ], ThreadCommentPanelService);
349
- const ToggleSheetCommentPanelOperation = {
61
+ const THREAD_COMMENT_PANEL = "thread-comment-panel", PLUGIN_NAME = "UNIVER_THREAD_COMMENT_UI_PLUGIN", ToggleSheetCommentPanelOperation = {
350
62
  id: "thread-comment-ui.operation.toggle-panel",
351
63
  type: CommandType.OPERATION,
352
64
  handler(accessor) {
@@ -363,7 +75,7 @@ const ToggleSheetCommentPanelOperation = {
363
75
  handler(accessor, params) {
364
76
  return accessor.get(ThreadCommentPanelService).setActiveComment(params), !0;
365
77
  }
366
- }, _ThreadCommentMentionDataService = class _ThreadCommentMentionDataService {
78
+ }, PLUGIN_CONFIG_KEY = "thread-comment-ui.config", defaultPluginConfig = {}, _ThreadCommentMentionDataService = class _ThreadCommentMentionDataService {
367
79
  constructor() {
368
80
  __publicField(this, "dataSource");
369
81
  __publicField(this, "renderSuggestion");
@@ -375,7 +87,7 @@ const ToggleSheetCommentPanelOperation = {
375
87
  };
376
88
  __name(_ThreadCommentMentionDataService, "ThreadCommentMentionDataService");
377
89
  let ThreadCommentMentionDataService = _ThreadCommentMentionDataService;
378
- const IThreadCommentMentionDataService = createIdentifier("thread-comment.mention-data.service"), PLUGIN_CONFIG_KEY = "thread-comment-ui.config", defaultPluginConfig = {};
90
+ const IThreadCommentMentionDataService = createIdentifier("thread-comment.mention-data.service");
379
91
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
380
92
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
381
93
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -617,7 +329,7 @@ const threadCommentEditorButtons = "univer-thread-comment-editor-buttons", threa
617
329
  return /* @__PURE__ */ React.createElement("div", { className: styles$2.threadCommentEditorSuggestion }, icon ? /* @__PURE__ */ React.createElement("img", { className: styles$2.threadCommentEditorSuggestionIcon, src: icon }) : null, /* @__PURE__ */ React.createElement("div", null, (_b = mention.display) != null ? _b : mention.id));
618
330
  }, "defaultRenderSuggestion"), ThreadCommentEditor = forwardRef((props, ref) => {
619
331
  var _a3, _b;
620
- const { comment, onSave, id, onCancel, autoFocus, unitId, subUnitId } = props, mentionDataService = useDependency(IThreadCommentMentionDataService), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localComment, setLocalComment] = useState({ ...comment }), [editing, setEditing] = useState(!1), inputRef = useRef(null), docSelectionManagerService = useDependency(DocSelectionManagerService), docSelectionRenderService = (_a3 = useDependency(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a3.with(DocSelectionRenderService);
332
+ const { comment, onSave, id, onCancel, autoFocus, unitId, subUnitId } = props, mentionDataService = useDependency(IThreadCommentMentionDataService$1), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localComment, setLocalComment] = useState({ ...comment }), [editing, setEditing] = useState(!1), inputRef = useRef(null), docSelectionManagerService = useDependency(DocSelectionManagerService), docSelectionRenderService = (_a3 = useDependency(IRenderManagerService).getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a3.with(DocSelectionRenderService);
621
333
  useImperativeHandle(ref, () => ({
622
334
  reply(text) {
623
335
  var _a4;
@@ -767,8 +479,8 @@ const threadCommentEditorButtons = "univer-thread-comment-editor-buttons", threa
767
479
  onAddComment,
768
480
  onDeleteComment,
769
481
  onResolve
770
- } = props, threadCommentModel = useDependency(ThreadCommentModel), [isHover, setIsHover] = useState(!1), [editingId, setEditingId] = useState("");
771
- useObservable(threadCommentModel.commentMap$);
482
+ } = props, threadCommentModel = useDependency(ThreadCommentModel), [isHover, setIsHover] = useState(!1), [editingId, setEditingId] = useState(""), updte$ = useMemo(() => threadCommentModel.commentUpdate$.pipe(debounceTime(16)), [threadCommentModel]);
483
+ useObservable(updte$);
772
484
  const comments = id ? threadCommentModel.getCommentWithChildren(unitId, subUnitId, id) : null, commandService = useDependency(ICommandService), userManagerService = useDependency(UserManagerService), resolved = comments == null ? void 0 : comments.root.resolved, currentUser = useObservable(userManagerService.currentUser$), editorRef = useRef(null), renderComments = [
773
485
  ...comments ? [comments.root] : (
774
486
  // mock empty comment
@@ -928,8 +640,11 @@ const threadCommentEditorButtons = "univer-thread-comment-editor-buttons", threa
928
640
  onDeleteComment,
929
641
  showComments
930
642
  } = props, [unit, setUnit] = useState("all"), [status, setStatus] = useState("all"), localeService = useDependency(LocaleService), userService = useDependency(UserManagerService), threadCommentModel = useDependency(ThreadCommentModel), [unitComments, setUnitComments] = useState(() => threadCommentModel.getUnit(unitId)), panelService = useDependency(ThreadCommentPanelService), activeCommentId = useObservable(panelService.activeCommentId$), update = useObservable(threadCommentModel.commentUpdate$), commandService = useDependency(ICommandService), subUnitId = useObservable(subUnitId$), shouldScroll = useRef(!0), prefix = "panel", currentUser = useObservable(userService.currentUser$), comments = useMemo(() => {
931
- var _a3, _b;
932
- const allComments = (unit === "all" ? unitComments.map((i) => i[1]).flat() : (_b = (_a3 = unitComments.find((i) => i[0] === subUnitId)) == null ? void 0 : _a3[1]) != null ? _b : []).filter((i) => !i.parentId), sort = sortComments != null ? sortComments : (a) => a, res = allComments;
643
+ var _a3;
644
+ const allComments = unit === "all" ? unitComments : (_a3 = unitComments.filter((i) => i.subUnitId === subUnitId)) != null ? _a3 : [], sort = sortComments != null ? sortComments : (a) => a, res = allComments.map((i) => {
645
+ var _a4;
646
+ return { ...i.root, children: (_a4 = i.children) != null ? _a4 : [], users: i.relativeUsers };
647
+ });
933
648
  if (showComments) {
934
649
  const map = /* @__PURE__ */ new Map();
935
650
  return res.forEach((comment) => {
@@ -940,7 +655,7 @@ const threadCommentEditorButtons = "univer-thread-comment-editor-buttons", threa
940
655
  }, [showComments, unit, unitComments, sortComments, subUnitId]), commentsSorted = useMemo(() => [
941
656
  ...comments.filter((comment) => !comment.resolved),
942
657
  ...comments.filter((comment) => comment.resolved)
943
- ], [comments]), statuedComments = useMemo(() => status === "resolved" ? commentsSorted.filter((comment) => comment.resolved) : status === "unsolved" ? commentsSorted.filter((comment) => !comment.resolved) : status === "concern_me" && currentUser != null && currentUser.userID ? commentsSorted.map((comment) => threadCommentModel.getCommentWithChildren(comment.unitId, comment.subUnitId, comment.id)).map((comment) => comment != null && comment.relativeUsers.has(currentUser.userID) ? comment.root : null).filter(Boolean) : commentsSorted, [commentsSorted, currentUser == null ? void 0 : currentUser.userID, status, threadCommentModel]), renderComments = tempComment ? [tempComment, ...statuedComments] : statuedComments, unSolvedComments = renderComments.filter((comment) => !comment.resolved), solvedComments = renderComments.filter((comment) => comment.resolved), isFiltering = status !== "all" || unit !== "all", onReset = /* @__PURE__ */ __name(() => {
658
+ ], [comments]), statuedComments = useMemo(() => status === "resolved" ? commentsSorted.filter((comment) => comment.resolved) : status === "unsolved" ? commentsSorted.filter((comment) => !comment.resolved) : status === "concern_me" && currentUser != null && currentUser.userID ? commentsSorted.filter((comment) => comment == null ? void 0 : comment.users.has(currentUser.userID)) : commentsSorted, [commentsSorted, currentUser == null ? void 0 : currentUser.userID, status]), renderComments = tempComment ? [tempComment, ...statuedComments] : statuedComments, unSolvedComments = renderComments.filter((comment) => !comment.resolved), solvedComments = renderComments.filter((comment) => comment.resolved), isFiltering = status !== "all" || unit !== "all", onReset = /* @__PURE__ */ __name(() => {
944
659
  setStatus("all"), setUnit("all");
945
660
  }, "onReset");
946
661
  useEffect(() => {
@@ -1059,6 +774,5 @@ export {
1059
774
  ThreadCommentPanelService,
1060
775
  ThreadCommentTree,
1061
776
  ToggleSheetCommentPanelOperation,
1062
- UniverThreadCommentUIPlugin,
1063
- getDT
777
+ UniverThreadCommentUIPlugin
1064
778
  };
@@ -0,0 +1,36 @@
1
+ const enUS = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "Comment Management",
5
+ empty: "No comments yet",
6
+ filterEmpty: "No match result",
7
+ reset: "Reset Filter",
8
+ addComment: "Add Comment"
9
+ },
10
+ editor: {
11
+ placeholder: "Reply or add others with @",
12
+ reply: "Comment",
13
+ cancel: "Cancel",
14
+ save: "Save"
15
+ },
16
+ item: {
17
+ edit: "Edit",
18
+ delete: "Delete This Comment"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "All sheet",
23
+ current: "Current sheet"
24
+ },
25
+ status: {
26
+ all: "All comments",
27
+ resolved: "Resolved",
28
+ unsolved: "Not resolved",
29
+ concernMe: "Concern me"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ enUS as default
36
+ };
@@ -0,0 +1,36 @@
1
+ const locale = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "مدیریت نظرات",
5
+ empty: "هنوز نظری وجود ندارد",
6
+ filterEmpty: "نتیجه ای یافت نشد",
7
+ reset: "بازنشانی فیلتر",
8
+ addComment: "افزودن نظر"
9
+ },
10
+ editor: {
11
+ placeholder: "پاسخ یا اضافه کردن دیگران با @",
12
+ reply: "نظر",
13
+ cancel: "انصراف",
14
+ save: "ذخیره"
15
+ },
16
+ item: {
17
+ edit: "ویرایش",
18
+ delete: "حذف این نظر"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "همه برگه‌ها",
23
+ current: "برگه فعلی"
24
+ },
25
+ status: {
26
+ all: "همه نظرات",
27
+ resolved: "حل شده",
28
+ unsolved: "حل نشده",
29
+ concernMe: "موضوع مربوط به من"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ locale as default
36
+ };
@@ -0,0 +1,36 @@
1
+ const ruRU = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "Comment Management",
5
+ empty: "No comments yet",
6
+ filterEmpty: "No match result",
7
+ reset: "Reset Filter",
8
+ addComment: "Add Comment"
9
+ },
10
+ editor: {
11
+ placeholder: "Reply or add others with @",
12
+ reply: "Comment",
13
+ cancel: "Cancel",
14
+ save: "Save"
15
+ },
16
+ item: {
17
+ edit: "Edit",
18
+ delete: "Delete This Comment"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "All sheet",
23
+ current: "Current sheet"
24
+ },
25
+ status: {
26
+ all: "All comments",
27
+ resolved: "Resolved",
28
+ unsolved: "Not resolved",
29
+ concernMe: "Concern me"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ ruRU as default
36
+ };
@@ -0,0 +1,36 @@
1
+ const enUS = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "Quản lý Bình luận",
5
+ empty: "Chưa có bình luận",
6
+ filterEmpty: "Không có kết quả phù hợp",
7
+ reset: "Đặt lại",
8
+ addComment: "Thêm bình luận"
9
+ },
10
+ editor: {
11
+ placeholder: "Phản hồi",
12
+ reply: "Phản hồi",
13
+ cancel: "Hủy",
14
+ save: "Lưu"
15
+ },
16
+ item: {
17
+ edit: "Chỉnh sửa",
18
+ delete: "Xóa"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "Tất cả bảng",
23
+ current: "Bảng hiện tại"
24
+ },
25
+ status: {
26
+ all: "Tất cả bình luận",
27
+ resolved: "Đã giải quyết",
28
+ unsolved: "Chưa giải quyết",
29
+ concernMe: "Liên quan đến tôi"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ enUS as default
36
+ };
@@ -0,0 +1,36 @@
1
+ const zhCN = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "评论管理",
5
+ empty: "暂无评论",
6
+ filterEmpty: "没有匹配的结果",
7
+ reset: "重置",
8
+ addComment: "添加评论"
9
+ },
10
+ editor: {
11
+ placeholder: "回复",
12
+ reply: "回复",
13
+ cancel: "取消",
14
+ save: "保存"
15
+ },
16
+ item: {
17
+ edit: "编辑",
18
+ delete: "删除"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "所有表格",
23
+ current: "当前表格"
24
+ },
25
+ status: {
26
+ all: "所有评论",
27
+ resolved: "已解决",
28
+ unsolved: "未解决",
29
+ concernMe: "与我有关"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ zhCN as default
36
+ };
@@ -0,0 +1,36 @@
1
+ const enUS = {
2
+ threadCommentUI: {
3
+ panel: {
4
+ title: "評論管理",
5
+ empty: "暫無評論",
6
+ filterEmpty: "沒有符合的結果",
7
+ reset: "重置",
8
+ addComment: "新增評論"
9
+ },
10
+ editor: {
11
+ placeholder: "回覆",
12
+ reply: "回覆",
13
+ cancel: "取消",
14
+ save: "儲存"
15
+ },
16
+ item: {
17
+ edit: "編輯",
18
+ delete: "刪除"
19
+ },
20
+ filter: {
21
+ sheet: {
22
+ all: "所有表格",
23
+ current: "當前表格"
24
+ },
25
+ status: {
26
+ all: "所有評論",
27
+ resolved: "已解決",
28
+ unsolved: "未解決",
29
+ concernMe: "與我有關"
30
+ }
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ enUS as default
36
+ };
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { getDT } from './common/utils';
17
16
  export { UniverThreadCommentUIPlugin } from './plugin';
18
17
  export { type ActiveCommentInfo, ThreadCommentPanelService } from './services/thread-comment-panel.service';
19
18
  export { ThreadCommentPanel } from './views/thread-comment-panel';
@@ -1,5 +1,5 @@
1
- import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
1
  import { IUniverThreadCommentUIConfig } from './controllers/config.schema';
2
+ import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
3
  export declare class UniverThreadCommentUIPlugin extends Plugin {
4
4
  private readonly _config;
5
5
  protected _injector: Injector;
@@ -1,6 +1,6 @@
1
- import { default as React } from 'react';
2
1
  import { IDocumentBody } from '@univerjs/core';
3
2
  import { IThreadComment } from '@univerjs/thread-comment';
3
+ import { default as React } from 'react';
4
4
  export interface IThreadCommentEditorProps {
5
5
  id?: string;
6
6
  comment?: Pick<IThreadComment, 'attachments' | 'text' | 'mentions'>;
@@ -1,8 +1,8 @@
1
- import { UniverInstanceType, Nullable } from '@univerjs/core';
2
- import { default as React } from 'react';
1
+ import { Nullable, UniverInstanceType } from '@univerjs/core';
3
2
  import { IThreadComment } from '@univerjs/thread-comment';
4
3
  import { Observable } from 'rxjs';
5
4
  import { IThreadCommentTreeProps } from '../thread-comment-tree';
5
+ import { default as React } from 'react';
6
6
  export interface IThreadCommentPanelProps {
7
7
  unitId: string;
8
8
  subUnitId$: Observable<string | undefined>;
@@ -1,6 +1,6 @@
1
+ import { IThreadComment } from '@univerjs/thread-comment';
1
2
  import { IUser, UniverInstanceType } from '@univerjs/core';
2
3
  import { default as React } from 'react';
3
- import { IThreadComment } from '@univerjs/thread-comment';
4
4
  export interface IThreadCommentTreeProps {
5
5
  id?: string;
6
6
  unitId: string;