@univerjs/thread-comment-ui 0.24.0 → 0.25.0

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.
Files changed (92) hide show
  1. package/lib/cjs/index.js +182 -124
  2. package/lib/cjs/locale/ar-SA.js +37 -0
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/de-DE.js +37 -0
  5. package/lib/cjs/locale/en-US.js +1 -1
  6. package/lib/cjs/locale/es-ES.js +1 -1
  7. package/lib/cjs/locale/fa-IR.js +1 -1
  8. package/lib/cjs/locale/fr-FR.js +1 -1
  9. package/lib/cjs/locale/id-ID.js +37 -0
  10. package/lib/cjs/locale/it-IT.js +37 -0
  11. package/lib/cjs/locale/ja-JP.js +1 -1
  12. package/lib/cjs/locale/ko-KR.js +1 -1
  13. package/lib/cjs/locale/pl-PL.js +37 -0
  14. package/lib/cjs/locale/pt-BR.js +37 -0
  15. package/lib/cjs/locale/ru-RU.js +1 -1
  16. package/lib/cjs/locale/sk-SK.js +1 -1
  17. package/lib/cjs/locale/vi-VN.js +1 -1
  18. package/lib/cjs/locale/zh-CN.js +1 -1
  19. package/lib/cjs/locale/zh-HK.js +37 -0
  20. package/lib/cjs/locale/zh-TW.js +1 -1
  21. package/lib/es/index.js +182 -124
  22. package/lib/es/locale/ar-SA.js +36 -0
  23. package/lib/es/locale/ca-ES.js +1 -1
  24. package/lib/es/locale/de-DE.js +36 -0
  25. package/lib/es/locale/en-US.js +1 -1
  26. package/lib/es/locale/es-ES.js +1 -1
  27. package/lib/es/locale/fa-IR.js +1 -1
  28. package/lib/es/locale/fr-FR.js +1 -1
  29. package/lib/es/locale/id-ID.js +36 -0
  30. package/lib/es/locale/it-IT.js +36 -0
  31. package/lib/es/locale/ja-JP.js +1 -1
  32. package/lib/es/locale/ko-KR.js +1 -1
  33. package/lib/es/locale/pl-PL.js +36 -0
  34. package/lib/es/locale/pt-BR.js +36 -0
  35. package/lib/es/locale/ru-RU.js +1 -1
  36. package/lib/es/locale/sk-SK.js +1 -1
  37. package/lib/es/locale/vi-VN.js +1 -1
  38. package/lib/es/locale/zh-CN.js +1 -1
  39. package/lib/es/locale/zh-HK.js +36 -0
  40. package/lib/es/locale/zh-TW.js +1 -1
  41. package/lib/index.js +182 -124
  42. package/lib/locale/ar-SA.js +36 -0
  43. package/lib/locale/ca-ES.js +1 -1
  44. package/lib/locale/de-DE.js +36 -0
  45. package/lib/locale/en-US.js +1 -1
  46. package/lib/locale/es-ES.js +1 -1
  47. package/lib/locale/fa-IR.js +1 -1
  48. package/lib/locale/fr-FR.js +1 -1
  49. package/lib/locale/id-ID.js +36 -0
  50. package/lib/locale/it-IT.js +36 -0
  51. package/lib/locale/ja-JP.js +1 -1
  52. package/lib/locale/ko-KR.js +1 -1
  53. package/lib/locale/pl-PL.js +36 -0
  54. package/lib/locale/pt-BR.js +36 -0
  55. package/lib/locale/ru-RU.js +1 -1
  56. package/lib/locale/sk-SK.js +1 -1
  57. package/lib/locale/vi-VN.js +1 -1
  58. package/lib/locale/zh-CN.js +1 -1
  59. package/lib/locale/zh-HK.js +36 -0
  60. package/lib/locale/zh-TW.js +1 -1
  61. package/lib/types/locale/ar-SA.d.ts +18 -0
  62. package/lib/types/locale/de-DE.d.ts +18 -0
  63. package/lib/types/locale/en-US.d.ts +1 -1
  64. package/lib/types/locale/id-ID.d.ts +18 -0
  65. package/lib/types/locale/it-IT.d.ts +18 -0
  66. package/lib/types/locale/pl-PL.d.ts +18 -0
  67. package/lib/types/locale/pt-BR.d.ts +18 -0
  68. package/lib/types/locale/zh-HK.d.ts +18 -0
  69. package/lib/types/views/thread-comment-editor/util.d.ts +8 -0
  70. package/lib/types/views/thread-comment-panel/util.d.ts +18 -0
  71. package/lib/types/views/thread-comment-tree/util.d.ts +25 -0
  72. package/lib/umd/index.js +4 -4
  73. package/lib/umd/locale/ar-SA.js +1 -0
  74. package/lib/umd/locale/ca-ES.js +1 -1
  75. package/lib/umd/locale/de-DE.js +1 -0
  76. package/lib/umd/locale/en-US.js +1 -1
  77. package/lib/umd/locale/es-ES.js +1 -1
  78. package/lib/umd/locale/fa-IR.js +1 -1
  79. package/lib/umd/locale/fr-FR.js +1 -1
  80. package/lib/umd/locale/id-ID.js +1 -0
  81. package/lib/umd/locale/it-IT.js +1 -0
  82. package/lib/umd/locale/ja-JP.js +1 -1
  83. package/lib/umd/locale/ko-KR.js +1 -1
  84. package/lib/umd/locale/pl-PL.js +1 -0
  85. package/lib/umd/locale/pt-BR.js +1 -0
  86. package/lib/umd/locale/ru-RU.js +1 -1
  87. package/lib/umd/locale/sk-SK.js +1 -1
  88. package/lib/umd/locale/vi-VN.js +1 -1
  89. package/lib/umd/locale/zh-CN.js +1 -1
  90. package/lib/umd/locale/zh-HK.js +1 -0
  91. package/lib/umd/locale/zh-TW.js +1 -1
  92. package/package.json +9 -9
package/lib/es/index.js CHANGED
@@ -8,7 +8,7 @@ import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState }
8
8
  import { BreakLineCommand, IEditorService, RichTextEditor } from "@univerjs/docs-ui";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
 
11
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
11
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
12
12
  function _typeof(o) {
13
13
  "@babel/helpers - typeof";
14
14
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -19,7 +19,7 @@ function _typeof(o) {
19
19
  }
20
20
 
21
21
  //#endregion
22
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
22
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
23
23
  function toPrimitive(t, r) {
24
24
  if ("object" != _typeof(t) || !t) return t;
25
25
  var e = t[Symbol.toPrimitive];
@@ -32,14 +32,14 @@ function toPrimitive(t, r) {
32
32
  }
33
33
 
34
34
  //#endregion
35
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
35
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
36
36
  function toPropertyKey(t) {
37
37
  var i = toPrimitive(t, "string");
38
38
  return "symbol" == _typeof(i) ? i : i + "";
39
39
  }
40
40
 
41
41
  //#endregion
42
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
42
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
43
43
  function _defineProperty(e, r, t) {
44
44
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
45
45
  value: t,
@@ -50,7 +50,7 @@ function _defineProperty(e, r, t) {
50
50
  }
51
51
 
52
52
  //#endregion
53
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
53
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
54
54
  function __decorateParam(paramIndex, decorator) {
55
55
  return function(target, key) {
56
56
  decorator(target, key, paramIndex);
@@ -58,7 +58,7 @@ function __decorateParam(paramIndex, decorator) {
58
58
  }
59
59
 
60
60
  //#endregion
61
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
61
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
62
62
  function __decorate(decorators, target, key, desc) {
63
63
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
64
64
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -124,7 +124,7 @@ const SetActiveCommentOperation = {
124
124
  //#endregion
125
125
  //#region package.json
126
126
  var name = "@univerjs/thread-comment-ui";
127
- var version = "0.24.0";
127
+ var version = "0.25.0";
128
128
 
129
129
  //#endregion
130
130
  //#region src/config/config.ts
@@ -185,6 +185,82 @@ UniverThreadCommentUIPlugin = __decorate([
185
185
  __decorateParam(3, IConfigService)
186
186
  ], UniverThreadCommentUIPlugin);
187
187
 
188
+ //#endregion
189
+ //#region src/views/thread-comment-editor/util.ts
190
+ const transformDocument2TextNodesInParagraph = (doc) => {
191
+ const { dataStream, customRanges } = doc;
192
+ const end = dataStream.endsWith("\r\n") ? dataStream.length - 2 : dataStream.length;
193
+ const textNodes = [];
194
+ let lastIndex = 0;
195
+ customRanges === null || customRanges === void 0 || customRanges.forEach((range) => {
196
+ if (lastIndex < range.startIndex) textNodes.push({
197
+ type: "text",
198
+ content: dataStream.slice(lastIndex, range.startIndex)
199
+ });
200
+ textNodes.push({
201
+ type: "mention",
202
+ content: {
203
+ label: dataStream.slice(range.startIndex, range.endIndex + 1),
204
+ id: range.rangeId
205
+ }
206
+ });
207
+ lastIndex = range.endIndex + 1;
208
+ });
209
+ textNodes.push({
210
+ type: "text",
211
+ content: dataStream.slice(lastIndex, end)
212
+ });
213
+ return textNodes;
214
+ };
215
+ const transformDocument2TextNodes = (doc) => {
216
+ if (!doc) return [];
217
+ const { paragraphs = [] } = doc;
218
+ return paragraphs.map((paragraph, index) => {
219
+ return transformDocument2TextNodesInParagraph(getBodySlice(doc, index === 0 ? 0 : paragraphs[index - 1].startIndex + 1, paragraph.startIndex));
220
+ });
221
+ };
222
+ const transformTextNodes2Document = (nodes) => {
223
+ let str = "";
224
+ const customRanges = [];
225
+ nodes.forEach((node) => {
226
+ switch (node.type) {
227
+ case "text":
228
+ str += node.content;
229
+ break;
230
+ case "mention": {
231
+ const start = str.length;
232
+ str += node.content.label;
233
+ const end = str.length - 1;
234
+ customRanges.push({
235
+ rangeId: node.content.id,
236
+ rangeType: CustomRangeType.MENTION,
237
+ startIndex: start,
238
+ endIndex: end,
239
+ properties: {},
240
+ wholeEntity: true
241
+ });
242
+ break;
243
+ }
244
+ default: break;
245
+ }
246
+ });
247
+ str += "\r\n";
248
+ return {
249
+ textRuns: [],
250
+ paragraphs: [{
251
+ startIndex: str.length - 2,
252
+ paragraphStyle: {}
253
+ }],
254
+ sectionBreaks: [{ startIndex: str.length - 1 }],
255
+ dataStream: str,
256
+ customRanges
257
+ };
258
+ };
259
+ function focusThreadCommentEditor(editorService, editorId, editor) {
260
+ editorService.focus(editorId);
261
+ editor === null || editor === void 0 || editor.focus();
262
+ }
263
+
188
264
  //#endregion
189
265
  //#region src/views/thread-comment-editor/index.tsx
190
266
  function getSnapshot(body) {
@@ -223,142 +299,101 @@ const ThreadCommentEditor = forwardRef((props, ref) => {
223
299
  }
224
300
  }), [commandService]);
225
301
  useImperativeHandle(ref, () => ({ reply(text) {
226
- var _getEditorId, _editor$current6;
302
+ var _editor$current6;
227
303
  if (!editor.current) return;
228
- editorService.focus((_getEditorId = editor.current.getEditorId()) !== null && _getEditorId !== void 0 ? _getEditorId : "");
304
+ focusThreadCommentEditor(editorService, editorId, editor.current);
229
305
  const documentData = getSnapshot(text);
230
306
  (_editor$current6 = editor.current) === null || _editor$current6 === void 0 || _editor$current6.setDocumentData(documentData, [{
231
307
  startOffset: documentData.body.dataStream.length - 2,
232
308
  endOffset: documentData.body.dataStream.length - 2,
233
309
  collapsed: true
234
310
  }]);
311
+ setCanSubmit(BuildTextUtils.transform.getPlainText(documentData.body.dataStream));
312
+ setEditing(true);
235
313
  } }));
236
314
  const handleSave = () => {
237
- if (editor.current) {
238
- const newText = Tools.deepClone(editor.current.getDocumentData().body);
315
+ const currentEditor = editor.current;
316
+ if (currentEditor) {
317
+ const newText = Tools.deepClone(currentEditor.getDocumentData().body);
318
+ currentEditor.blur();
319
+ currentEditor.replaceText("", false);
320
+ currentEditor.setSelectionRanges([], false);
321
+ setCanSubmit("");
239
322
  setEditing(false);
240
323
  onSave === null || onSave === void 0 || onSave({
241
324
  ...comment,
242
325
  text: newText
243
326
  });
244
- editor.current.replaceText("");
245
- setTimeout(() => {
246
- var _editor$current7, _editor$current8;
247
- (_editor$current7 = editor.current) === null || _editor$current7 === void 0 || _editor$current7.setSelectionRanges([]);
248
- (_editor$current8 = editor.current) === null || _editor$current8 === void 0 || _editor$current8.blur();
249
- }, 10);
250
327
  }
251
328
  };
329
+ const handleEditorMouseDown = () => {
330
+ focusThreadCommentEditor(editorService, editorId, editor.current);
331
+ setEditing(true);
332
+ };
333
+ useEffect(() => {
334
+ if (!autoFocus) return;
335
+ const timer = setTimeout(() => {
336
+ focusThreadCommentEditor(editorService, editorId, editor.current);
337
+ });
338
+ return () => clearTimeout(timer);
339
+ }, [
340
+ autoFocus,
341
+ editorId,
342
+ editorService
343
+ ]);
252
344
  return /* @__PURE__ */ jsxs("div", {
253
345
  onClick: (e) => e.preventDefault(),
254
- children: [/* @__PURE__ */ jsx(RichTextEditor, {
255
- className: "univer-w-full",
256
- editorRef: editor,
257
- editorId,
258
- autoFocus,
259
- keyboardEventConfig,
260
- placeholder: localeService.t("threadCommentUI.editor.placeholder"),
261
- initialValue: (comment === null || comment === void 0 ? void 0 : comment.text) && getSnapshot(comment.text),
262
- onFocusChange: (isFocus) => isFocus && setEditing(isFocus),
263
- isSingle: false,
264
- maxHeight: 64,
265
- onClickOutside: () => {
266
- setTimeout(() => {
267
- editorService.focus(rootEditorId);
268
- }, 30);
269
- }
346
+ children: [/* @__PURE__ */ jsx("div", {
347
+ onMouseDown: handleEditorMouseDown,
348
+ children: /* @__PURE__ */ jsx(RichTextEditor, {
349
+ className: "univer-w-full",
350
+ editorRef: editor,
351
+ editorId,
352
+ autoFocus,
353
+ keyboardEventConfig,
354
+ placeholder: localeService.t("thread-comment-ui.editor.placeholder"),
355
+ initialValue: (comment === null || comment === void 0 ? void 0 : comment.text) && getSnapshot(comment.text),
356
+ onFocusChange: (isFocus) => isFocus && setEditing(isFocus),
357
+ isSingle: false,
358
+ maxHeight: 64,
359
+ onClickOutside: () => {
360
+ setTimeout(() => {
361
+ editorService.focus(rootEditorId);
362
+ }, 30);
363
+ }
364
+ })
270
365
  }), editing ? /* @__PURE__ */ jsxs("div", {
271
366
  className: "univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2",
272
367
  children: [/* @__PURE__ */ jsx(Button, {
368
+ type: "button",
273
369
  onClick: () => {
274
- var _editor$current9;
370
+ const currentEditor = editor.current;
371
+ currentEditor === null || currentEditor === void 0 || currentEditor.blur();
372
+ currentEditor === null || currentEditor === void 0 || currentEditor.replaceText("", false);
373
+ currentEditor === null || currentEditor === void 0 || currentEditor.setSelectionRanges([], false);
374
+ setCanSubmit("");
275
375
  onCancel === null || onCancel === void 0 || onCancel();
276
376
  setEditing(false);
277
- (_editor$current9 = editor.current) === null || _editor$current9 === void 0 || _editor$current9.replaceText("", true);
278
377
  commandService.executeCommand(SetActiveCommentOperation.id);
279
378
  },
280
- children: localeService.t("threadCommentUI.editor.cancel")
379
+ children: localeService.t("thread-comment-ui.editor.cancel")
281
380
  }), /* @__PURE__ */ jsx(Button, {
381
+ type: "button",
282
382
  variant: "primary",
283
383
  disabled: !canSubmit,
284
384
  onClick: handleSave,
285
- children: localeService.t(id ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
385
+ children: localeService.t(id ? "thread-comment-ui.editor.save" : "thread-comment-ui.editor.reply")
286
386
  })]
287
387
  }) : null]
288
388
  });
289
389
  });
290
390
 
291
391
  //#endregion
292
- //#region src/views/thread-comment-editor/util.ts
293
- const transformDocument2TextNodesInParagraph = (doc) => {
294
- const { dataStream, customRanges } = doc;
295
- const end = dataStream.endsWith("\r\n") ? dataStream.length - 2 : dataStream.length;
296
- const textNodes = [];
297
- let lastIndex = 0;
298
- customRanges === null || customRanges === void 0 || customRanges.forEach((range) => {
299
- if (lastIndex < range.startIndex) textNodes.push({
300
- type: "text",
301
- content: dataStream.slice(lastIndex, range.startIndex)
302
- });
303
- textNodes.push({
304
- type: "mention",
305
- content: {
306
- label: dataStream.slice(range.startIndex, range.endIndex + 1),
307
- id: range.rangeId
308
- }
309
- });
310
- lastIndex = range.endIndex + 1;
311
- });
312
- textNodes.push({
313
- type: "text",
314
- content: dataStream.slice(lastIndex, end)
315
- });
316
- return textNodes;
317
- };
318
- const transformDocument2TextNodes = (doc) => {
319
- if (!doc) return [];
320
- const { paragraphs = [] } = doc;
321
- return paragraphs.map((paragraph, index) => {
322
- return transformDocument2TextNodesInParagraph(getBodySlice(doc, index === 0 ? 0 : paragraphs[index - 1].startIndex + 1, paragraph.startIndex));
323
- });
324
- };
325
- const transformTextNodes2Document = (nodes) => {
326
- let str = "";
327
- const customRanges = [];
328
- nodes.forEach((node) => {
329
- switch (node.type) {
330
- case "text":
331
- str += node.content;
332
- break;
333
- case "mention": {
334
- const start = str.length;
335
- str += node.content.label;
336
- const end = str.length - 1;
337
- customRanges.push({
338
- rangeId: node.content.id,
339
- rangeType: CustomRangeType.MENTION,
340
- startIndex: start,
341
- endIndex: end,
342
- properties: {},
343
- wholeEntity: true
344
- });
345
- break;
346
- }
347
- default: break;
348
- }
349
- });
350
- str += "\r\n";
351
- return {
352
- textRuns: [],
353
- paragraphs: [{
354
- startIndex: str.length - 2,
355
- paragraphStyle: {}
356
- }],
357
- sectionBreaks: [{ startIndex: str.length - 1 }],
358
- dataStream: str,
359
- customRanges
360
- };
361
- };
392
+ //#region src/views/thread-comment-tree/util.ts
393
+ function getThreadCommentEditorId(params) {
394
+ const { location, unitId, subUnitId, commentId, fallbackId } = params;
395
+ return `${DOCS_COMMENT_EDITOR_UNIT_ID_KEY}_${location}_${unitId}_${subUnitId}_${commentId || fallbackId}`;
396
+ }
362
397
 
363
398
  //#endregion
364
399
  //#region src/views/thread-comment-tree/index.tsx
@@ -415,11 +450,11 @@ const ThreadCommentItem = (props) => {
415
450
  children: [/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
416
451
  className: "hover:univer-bg-gray-200",
417
452
  onClick: () => onEditingChange === null || onEditingChange === void 0 ? void 0 : onEditingChange(true),
418
- children: localeService.t("threadCommentUI.item.edit")
453
+ children: localeService.t("thread-comment-ui.item.edit")
419
454
  }) }), /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
420
455
  className: "hover:univer-bg-gray-200",
421
456
  onClick: handleDeleteItem,
422
- children: localeService.t("threadCommentUI.item.delete")
457
+ children: localeService.t("thread-comment-ui.item.delete")
423
458
  }) })]
424
459
  })
425
460
  }),
@@ -485,6 +520,7 @@ const ThreadCommentTree = (props) => {
485
520
  const resolved = comments === null || comments === void 0 ? void 0 : comments.root.resolved;
486
521
  const currentUser = useObservable(userManagerService.currentUser$);
487
522
  const editorRef = useRef(null);
523
+ const fallbackEditorId = useMemo(() => generateRandomId(6), []);
488
524
  const renderComments = [...comments ? [comments.root] : [{
489
525
  id: MOCK_ID,
490
526
  text: { dataStream: "\n\r" },
@@ -529,7 +565,13 @@ const ThreadCommentTree = (props) => {
529
565
  const subUnitName = getSubUnitName((_comments$root$subUni = comments === null || comments === void 0 ? void 0 : comments.root.subUnitId) !== null && _comments$root$subUni !== void 0 ? _comments$root$subUni : subUnitId);
530
566
  const editorVisible = showEdit && !editingId && !resolved;
531
567
  const title = `${refStr || (comments === null || comments === void 0 ? void 0 : comments.root.ref) || ""}${subUnitName ? " · " : ""}${subUnitName}`;
532
- const threadCommentEditorId = `${DOCS_COMMENT_EDITOR_UNIT_ID_KEY}_${location}`;
568
+ const threadCommentEditorId = getThreadCommentEditorId({
569
+ location,
570
+ unitId,
571
+ subUnitId,
572
+ commentId: id,
573
+ fallbackId: fallbackEditorId
574
+ });
533
575
  return /* @__PURE__ */ jsxs("div", {
534
576
  id: `${location}-${unitId}-${subUnitId}-${id}`,
535
577
  className: clsx("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white", borderClassName, {
@@ -648,6 +690,22 @@ const ThreadCommentTree = (props) => {
648
690
  });
649
691
  };
650
692
 
693
+ //#endregion
694
+ //#region src/views/thread-comment-panel/util.ts
695
+ function getThreadCommentPanelItemKey(comment, index, section) {
696
+ if (comment.id) return comment.id;
697
+ return [
698
+ "thread-comment-panel-temp",
699
+ section,
700
+ comment.unitId,
701
+ comment.subUnitId,
702
+ comment.threadId,
703
+ comment.ref,
704
+ comment.dT,
705
+ index
706
+ ].join("-");
707
+ }
708
+
651
709
  //#endregion
652
710
  //#region src/views/thread-comment-panel/index.tsx
653
711
  const ThreadCommentPanel = (props) => {
@@ -731,7 +789,7 @@ const ThreadCommentPanel = (props) => {
731
789
  const id = `${location}-${unitId}-${subUnitId}-${commentId}`;
732
790
  (_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 || _document$getElementB.scrollIntoView({ block: "center" });
733
791
  }, [activeCommentId]);
734
- const renderComment = (comment) => /* @__PURE__ */ jsx(ThreadCommentTree, {
792
+ const renderComment = (section) => (comment, index) => /* @__PURE__ */ jsx(ThreadCommentTree, {
735
793
  location,
736
794
  getSubUnitName,
737
795
  id: comment.id,
@@ -756,7 +814,7 @@ const ThreadCommentPanel = (props) => {
756
814
  onAddComment,
757
815
  onDeleteComment,
758
816
  onResolve: (resolved) => onResolve === null || onResolve === void 0 ? void 0 : onResolve(comment.id, resolved)
759
- }, comment.id);
817
+ }, getThreadCommentPanelItemKey(comment, index, section));
760
818
  return /* @__PURE__ */ jsxs("div", {
761
819
  className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3",
762
820
  children: [/* @__PURE__ */ jsxs("div", {
@@ -766,10 +824,10 @@ const ThreadCommentPanel = (props) => {
766
824
  value: unit,
767
825
  options: [{
768
826
  value: "current",
769
- label: localeService.t("threadCommentUI.filter.sheet.current")
827
+ label: localeService.t("thread-comment-ui.filter.sheet.current")
770
828
  }, {
771
829
  value: "all",
772
- label: localeService.t("threadCommentUI.filter.sheet.all")
830
+ label: localeService.t("thread-comment-ui.filter.sheet.all")
773
831
  }],
774
832
  onChange: setUnit
775
833
  }) : null, /* @__PURE__ */ jsx(Select, {
@@ -778,47 +836,47 @@ const ThreadCommentPanel = (props) => {
778
836
  options: [
779
837
  {
780
838
  value: "all",
781
- label: localeService.t("threadCommentUI.filter.status.all")
839
+ label: localeService.t("thread-comment-ui.filter.status.all")
782
840
  },
783
841
  {
784
842
  value: "resolved",
785
- label: localeService.t("threadCommentUI.filter.status.resolved")
843
+ label: localeService.t("thread-comment-ui.filter.status.resolved")
786
844
  },
787
845
  {
788
846
  value: "unsolved",
789
- label: localeService.t("threadCommentUI.filter.status.unsolved")
847
+ label: localeService.t("thread-comment-ui.filter.status.unsolved")
790
848
  },
791
849
  {
792
850
  value: "concern_me",
793
- label: localeService.t("threadCommentUI.filter.status.concernMe")
851
+ label: localeService.t("thread-comment-ui.filter.status.concernMe")
794
852
  }
795
853
  ],
796
854
  onChange: setStatus
797
855
  })]
798
856
  }), renderComments.length === 0 ? /* @__PURE__ */ jsxs("div", {
799
857
  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",
800
- children: [localeService.t("threadCommentUI.panel.empty"), isFiltering ? /* @__PURE__ */ jsx("div", {
858
+ children: [localeService.t("thread-comment-ui.panel.empty"), isFiltering ? /* @__PURE__ */ jsx("div", {
801
859
  className: "univer-mt-2 univer-flex univer-flex-row",
802
860
  children: /* @__PURE__ */ jsx(Button, {
803
861
  onClick: onReset,
804
- children: localeService.t("threadCommentUI.panel.reset")
862
+ children: localeService.t("thread-comment-ui.panel.reset")
805
863
  })
806
864
  }) : !disableAdd ? /* @__PURE__ */ jsx("div", {
807
865
  className: "univer-mt-2 univer-flex univer-flex-row",
808
866
  children: /* @__PURE__ */ jsxs(Button, {
809
867
  onClick: onAdd,
810
- children: [/* @__PURE__ */ jsx(IncreaseIcon, { className: "univer-mr-1.5" }), localeService.t("threadCommentUI.panel.addComment")]
868
+ children: [/* @__PURE__ */ jsx(IncreaseIcon, { className: "univer-mr-1.5" }), localeService.t("thread-comment-ui.panel.addComment")]
811
869
  })
812
870
  }) : null]
813
871
  }) : /* @__PURE__ */ jsxs("div", {
814
872
  className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3",
815
873
  children: [
816
- unSolvedComments.map(renderComment),
874
+ unSolvedComments.map(renderComment("unsolved")),
817
875
  solvedComments.length > 0 && /* @__PURE__ */ jsx("div", {
818
876
  className: "univer-text-xs",
819
- children: localeService.t("threadCommentUI.panel.solved")
877
+ children: localeService.t("thread-comment-ui.panel.solved")
820
878
  }),
821
- solvedComments.map(renderComment)
879
+ solvedComments.map(renderComment("solved"))
822
880
  ]
823
881
  })]
824
882
  });
@@ -0,0 +1,36 @@
1
+ //#region src/locale/ar-SA.ts
2
+ const locale = { "thread-comment-ui": {
3
+ panel: {
4
+ title: "إدارة التعليقات",
5
+ empty: "لا توجد تعليقات بعد",
6
+ filterEmpty: "لا توجد نتائج مطابقة",
7
+ reset: "إعادة ضبط التصفية",
8
+ addComment: "إضافة تعليق",
9
+ solved: "تم الحل"
10
+ },
11
+ editor: {
12
+ placeholder: "رد أو إشارة إلى آخرين باستخدام @",
13
+ reply: "تعليق",
14
+ cancel: "إلغاء",
15
+ save: "حفظ"
16
+ },
17
+ item: {
18
+ edit: "تحرير",
19
+ delete: "حذف هذا التعليق"
20
+ },
21
+ filter: {
22
+ sheet: {
23
+ all: "كل الأوراق",
24
+ current: "الورقة الحالية"
25
+ },
26
+ status: {
27
+ all: "كل التعليقات",
28
+ resolved: "تم الحل",
29
+ unsolved: "لم يتم الحل",
30
+ concernMe: "يتعلق بي"
31
+ }
32
+ }
33
+ } };
34
+
35
+ //#endregion
36
+ export { locale as default };
@@ -1,5 +1,5 @@
1
1
  //#region src/locale/ca-ES.ts
2
- const locale = { threadCommentUI: {
2
+ const locale = { "thread-comment-ui": {
3
3
  panel: {
4
4
  title: "Gestió de comentaris",
5
5
  empty: "Encara no hi ha comentaris",
@@ -0,0 +1,36 @@
1
+ //#region src/locale/de-DE.ts
2
+ const locale = { "thread-comment-ui": {
3
+ panel: {
4
+ title: "Kommentarverwaltung",
5
+ empty: "Noch keine Kommentare",
6
+ filterEmpty: "Kein Treffer",
7
+ reset: "Filter zurücksetzen",
8
+ addComment: "Kommentar hinzufügen",
9
+ solved: "Gelöst"
10
+ },
11
+ editor: {
12
+ placeholder: "Antworten oder andere mit @ erwähnen",
13
+ reply: "Kommentar",
14
+ cancel: "Abbrechen",
15
+ save: "Speichern"
16
+ },
17
+ item: {
18
+ edit: "Bearbeiten",
19
+ delete: "Diesen Kommentar löschen"
20
+ },
21
+ filter: {
22
+ sheet: {
23
+ all: "Alle Blätter",
24
+ current: "Aktuelles Blatt"
25
+ },
26
+ status: {
27
+ all: "Alle Kommentare",
28
+ resolved: "Gelöst",
29
+ unsolved: "Ungelöst",
30
+ concernMe: "Betrifft mich"
31
+ }
32
+ }
33
+ } };
34
+
35
+ //#endregion
36
+ export { locale as default };
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- const locale = { threadCommentUI: {
17
+ const locale = { "thread-comment-ui": {
18
18
  panel: {
19
19
  title: "Comment Management",
20
20
  empty: "No comments yet",
@@ -1,5 +1,5 @@
1
1
  //#region src/locale/es-ES.ts
2
- const locale = { threadCommentUI: {
2
+ const locale = { "thread-comment-ui": {
3
3
  panel: {
4
4
  title: "Gestión de comentarios",
5
5
  empty: "Aún no hay comentarios",
@@ -1,5 +1,5 @@
1
1
  //#region src/locale/fa-IR.ts
2
- const locale = { threadCommentUI: {
2
+ const locale = { "thread-comment-ui": {
3
3
  panel: {
4
4
  title: "مدیریت نظرات",
5
5
  empty: "هنوز نظری وجود ندارد",
@@ -1,5 +1,5 @@
1
1
  //#region src/locale/fr-FR.ts
2
- const locale = { threadCommentUI: {
2
+ const locale = { "thread-comment-ui": {
3
3
  panel: {
4
4
  title: "Gestion des commentaires",
5
5
  empty: "Pas encore de commentaires",
@@ -0,0 +1,36 @@
1
+ //#region src/locale/id-ID.ts
2
+ const locale = { "thread-comment-ui": {
3
+ panel: {
4
+ title: "Manajemen Komentar",
5
+ empty: "Belum ada komentar",
6
+ filterEmpty: "Tidak ada hasil yang cocok",
7
+ reset: "Atur Ulang Filter",
8
+ addComment: "Tambah Komentar",
9
+ solved: "Terselesaikan"
10
+ },
11
+ editor: {
12
+ placeholder: "Balas atau tambahkan orang lain dengan @",
13
+ reply: "Komentar",
14
+ cancel: "Batal",
15
+ save: "Simpan"
16
+ },
17
+ item: {
18
+ edit: "Edit",
19
+ delete: "Hapus Komentar Ini"
20
+ },
21
+ filter: {
22
+ sheet: {
23
+ all: "Semua lembar",
24
+ current: "Lembar saat ini"
25
+ },
26
+ status: {
27
+ all: "Semua komentar",
28
+ resolved: "Terselesaikan",
29
+ unsolved: "Belum terselesaikan",
30
+ concernMe: "Yang menyangkut saya"
31
+ }
32
+ }
33
+ } };
34
+
35
+ //#endregion
36
+ export { locale as default };
@@ -0,0 +1,36 @@
1
+ //#region src/locale/it-IT.ts
2
+ const locale = { "thread-comment-ui": {
3
+ panel: {
4
+ title: "Gestione commenti",
5
+ empty: "Nessun commento",
6
+ filterEmpty: "Nessun risultato",
7
+ reset: "Reimposta filtro",
8
+ addComment: "Aggiungi commento",
9
+ solved: "Risolto"
10
+ },
11
+ editor: {
12
+ placeholder: "Rispondi o aggiungi altri con @",
13
+ reply: "Commenta",
14
+ cancel: "Annulla",
15
+ save: "Salva"
16
+ },
17
+ item: {
18
+ edit: "Modifica",
19
+ delete: "Elimina questo commento"
20
+ },
21
+ filter: {
22
+ sheet: {
23
+ all: "Tutti i fogli",
24
+ current: "Foglio corrente"
25
+ },
26
+ status: {
27
+ all: "Tutti i commenti",
28
+ resolved: "Risolti",
29
+ unsolved: "Non risolti",
30
+ concernMe: "Mi riguardano"
31
+ }
32
+ }
33
+ } };
34
+
35
+ //#endregion
36
+ export { locale as default };