@univerjs/thread-comment-ui 0.17.0 → 0.18.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.
- package/lib/cjs/index.js +55 -4
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +55 -1053
- package/lib/es/locale/ca-ES.js +1 -37
- package/lib/es/locale/en-US.js +1 -37
- package/lib/es/locale/es-ES.js +1 -37
- package/lib/es/locale/fa-IR.js +1 -37
- package/lib/es/locale/fr-FR.js +1 -37
- package/lib/es/locale/ja-JP.js +1 -37
- package/lib/es/locale/ko-KR.js +1 -37
- package/lib/es/locale/ru-RU.js +1 -37
- package/lib/es/locale/sk-SK.js +1 -37
- package/lib/es/locale/vi-VN.js +1 -37
- package/lib/es/locale/zh-CN.js +1 -37
- package/lib/es/locale/zh-TW.js +1 -37
- package/lib/index.css +358 -1
- package/lib/index.js +55 -1053
- package/lib/locale/ca-ES.js +1 -37
- package/lib/locale/en-US.js +1 -37
- package/lib/locale/es-ES.js +1 -37
- package/lib/locale/fa-IR.js +1 -37
- package/lib/locale/fr-FR.js +1 -37
- package/lib/locale/ja-JP.js +1 -37
- package/lib/locale/ko-KR.js +1 -37
- package/lib/locale/ru-RU.js +1 -37
- package/lib/locale/sk-SK.js +1 -37
- package/lib/locale/vi-VN.js +1 -37
- package/lib/locale/zh-CN.js +1 -37
- package/lib/locale/zh-TW.js +1 -37
- package/lib/types/commands/operations/comment.operations.d.ts +16 -1
- package/lib/types/config/config.d.ts +17 -2
- package/lib/types/locale/ca-ES.d.ts +16 -1
- package/lib/types/locale/es-ES.d.ts +16 -1
- package/lib/types/locale/fa-IR.d.ts +16 -1
- package/lib/types/locale/fr-FR.d.ts +16 -1
- package/lib/types/locale/ja-JP.d.ts +16 -1
- package/lib/types/locale/ko-KR.d.ts +16 -1
- package/lib/types/locale/ru-RU.d.ts +16 -1
- package/lib/types/locale/sk-SK.d.ts +16 -1
- package/lib/types/locale/vi-VN.d.ts +16 -1
- package/lib/types/locale/zh-CN.d.ts +16 -1
- package/lib/types/locale/zh-TW.d.ts +16 -1
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/thread-comment-panel.service.d.ts +19 -3
- package/lib/types/views/thread-comment-editor/index.d.ts +19 -3
- package/lib/types/views/thread-comment-editor/util.d.ts +17 -2
- package/lib/types/views/thread-comment-panel/index.d.ts +20 -4
- package/lib/types/views/thread-comment-tree/index.d.ts +17 -2
- package/lib/umd/index.js +55 -4
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +11 -10
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
2
17
|
declare const locale: typeof enUS;
|
|
3
18
|
export default locale;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
2
17
|
declare const locale: typeof enUS;
|
|
3
18
|
export default locale;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
2
17
|
declare const locale: typeof enUS;
|
|
3
18
|
export default locale;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type enUS from './en-US';
|
|
2
17
|
declare const locale: typeof enUS;
|
|
3
18
|
export default locale;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IUniverThreadCommentUIConfig } from './config/config';
|
|
2
17
|
import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
3
18
|
export declare class UniverThreadCommentUIPlugin extends Plugin {
|
|
4
19
|
private readonly _config;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Nullable } from '@univerjs/core';
|
|
17
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
18
|
import { ISidebarService } from '@univerjs/ui';
|
|
3
19
|
export type ActiveCommentInfo = Nullable<{
|
|
4
20
|
unitId: string;
|
|
@@ -13,8 +29,8 @@ export declare class ThreadCommentPanelService extends Disposable {
|
|
|
13
29
|
private _panelVisible$;
|
|
14
30
|
private _activeCommentId;
|
|
15
31
|
private _activeCommentId$;
|
|
16
|
-
panelVisible$: import(
|
|
17
|
-
activeCommentId$: import(
|
|
32
|
+
panelVisible$: import("rxjs").Observable<boolean>;
|
|
33
|
+
activeCommentId$: import("rxjs").Observable<ActiveCommentInfo>;
|
|
18
34
|
constructor(_sidebarService: ISidebarService, _univerInstanceService: IUniverInstanceService);
|
|
19
35
|
private _init;
|
|
20
36
|
get panelVisible(): boolean;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocumentBody, IUser } from '@univerjs/core';
|
|
17
|
+
import type { IThreadComment } from '@univerjs/thread-comment';
|
|
18
|
+
import { UniverInstanceType } from '@univerjs/core';
|
|
3
19
|
export interface IThreadCommentEditorProps {
|
|
4
20
|
id?: string;
|
|
5
21
|
comment?: Pick<IThreadComment, 'attachments' | 'text' | 'mentions'>;
|
|
@@ -13,7 +29,7 @@ export interface IThreadCommentEditorProps {
|
|
|
13
29
|
export interface IThreadCommentEditorInstance {
|
|
14
30
|
reply: (text: IDocumentBody) => void;
|
|
15
31
|
}
|
|
16
|
-
export declare const ThreadCommentEditor: import(
|
|
32
|
+
export declare const ThreadCommentEditor: import("react").ForwardRefExoticComponent<IThreadCommentEditorProps & import("react").RefAttributes<IThreadCommentEditorInstance>>;
|
|
17
33
|
export declare const ThreadCommentSuggestion: ({ active, user }: {
|
|
18
34
|
active: boolean;
|
|
19
35
|
user: IUser;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocumentBody } from '@univerjs/core';
|
|
17
|
+
import type { IThreadCommentMention } from '@univerjs/thread-comment';
|
|
3
18
|
export type TextNode = {
|
|
4
19
|
type: 'text';
|
|
5
20
|
content: string;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Nullable } from '@univerjs/core';
|
|
17
|
+
import type { IThreadComment } from '@univerjs/thread-comment';
|
|
18
|
+
import type { Observable } from 'rxjs';
|
|
19
|
+
import type { IThreadCommentTreeProps } from '../thread-comment-tree';
|
|
20
|
+
import { UniverInstanceType } from '@univerjs/core';
|
|
5
21
|
export interface IThreadCommentPanelProps {
|
|
6
22
|
unitId: string;
|
|
7
23
|
subUnitId$: Observable<string | undefined>;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IUser, UniverInstanceType } from '@univerjs/core';
|
|
17
|
+
import type { IThreadComment } from '@univerjs/thread-comment';
|
|
3
18
|
export interface IThreadCommentTreeProps {
|
|
4
19
|
full?: boolean;
|
|
5
20
|
id?: string;
|
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/thread-comment"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/ui","rxjs","@univerjs/thread-comment","react/jsx-runtime","@univerjs/design","react","@univerjs/docs-ui"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverThreadCommentUi={},d.UniverCore,d.UniverUi,d.rxjs,d.UniverThreadComment,d.React,d.UniverDesign,d.React,d.UniverDocsUi))})(this,(function(d,s,m,Q,V,i,N,c,se){"use strict";var qe=Object.defineProperty;var ze=(d,s,m)=>s in d?qe(d,s,{enumerable:!0,configurable:!0,writable:!0,value:m}):d[s]=m;var G=(d,s,m)=>ze(d,typeof s!="symbol"?s+"":s,m);var Se=Object.getOwnPropertyDescriptor,_e=(r,e,t,n)=>{for(var o=n>1?void 0:n?Se(e,t):e,a=r.length-1,v;a>=0;a--)(v=r[a])&&(o=v(o)||o);return o},ae=(r,e)=>(t,n)=>e(t,n,r);d.ThreadCommentPanelService=class extends s.Disposable{constructor(t,n){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new Q.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new Q.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).pipe(Q.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},d.ThreadCommentPanelService=_e([ae(0,s.Inject(m.ISidebarService)),ae(1,s.IUniverInstanceService)],d.ThreadCommentPanelService);const le="thread-comment-panel",we="UNIVER_THREAD_COMMENT_UI_PLUGIN",de={id:"thread-comment-ui.operation.toggle-panel",type:s.CommandType.OPERATION,handler(r){const e=r.get(m.ISidebarService),t=r.get(d.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:le},width:360}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:s.CommandType.OPERATION,handler(r,e){return r.get(d.ThreadCommentPanelService).setActiveComment(e),!0}},ce={name:"@univerjs/thread-comment-ui",version:"0.17.0"},Te="thread-comment-ui.config",ue={};var Ue=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,De=(r,e,t)=>e in r?Ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ee=(r,e,t,n)=>{for(var o=n>1?void 0:n?Ne(e,t):e,a=r.length-1,v;a>=0;a--)(v=r[a])&&(o=v(o)||o);return o},oe=(r,e)=>(t,n)=>e(t,n,r),X=(r,e,t)=>De(r,typeof e!="symbol"?e+"":e,t);d.UniverThreadCommentUIPlugin=class extends s.Plugin{constructor(e=ue,t,n,o){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=o;const{menu:a,...v}=s.merge({},ue,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(Te,v)}onStarting(){var e;s.mergeOverrideWithDependencies([[d.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[de,F].forEach(t=>{this._commandService.registerCommand(t)})}},X(d.UniverThreadCommentUIPlugin,"pluginName",we),X(d.UniverThreadCommentUIPlugin,"packageName",ce.name),X(d.UniverThreadCommentUIPlugin,"version",ce.version),X(d.UniverThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_UNKNOWN),d.UniverThreadCommentUIPlugin=Ee([s.DependentOn(V.UniverThreadCommentPlugin),oe(1,s.Inject(s.Injector)),oe(2,s.ICommandService),oe(3,s.IConfigService)],d.UniverThreadCommentUIPlugin);function q({ref:r,...e}){const{icon:t,id:n,className:o,extend:a,...v}=e,S=`univerjs-icon univerjs-icon-${n} ${o||""}`.trim(),g=c.useRef(`_${Me()}`);return ve(t,`${n}`,{defIds:t.defIds,idSuffix:g.current},{ref:r,className:S,...v},a)}function ve(r,e,t,n,o){return c.createElement(r.tag,{key:e,...ke(r,t,o),...n},($e(r,t).children||[]).map((a,v)=>ve(a,`${e}-${r.tag}-${v}`,t,void 0,o)))}function ke(r,e,t){const n={...r.attrs};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(([a,v])=>{a==="mask"&&typeof v=="string"&&(n[a]=v.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:o}=e;return!o||o.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(([a,v])=>{typeof v=="string"&&(n[a]=v.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),n}function $e(r,e){var n;const{defIds:t}=e;return!t||t.length===0?r:r.tag==="defs"&&((n=r.children)!=null&&n.length)?{...r,children:r.children.map(o=>typeof o.attrs.id=="string"&&t&&t.includes(o.attrs.id)?{...o,attrs:{...o.attrs,id:o.attrs.id+e.idSuffix}}:o)}:r}function Me(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";const Oe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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"}}]},me=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"delete-icon",ref:t,icon:Oe}))});me.displayName="DeleteIcon";const je={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},he=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"increase-icon",ref:t,icon:je}))});he.displayName="IncreaseIcon";const Pe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z"}}]},fe=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"more-horizontal-icon",ref:t,icon:Pe}))});fe.displayName="MoreHorizontalIcon";const Le={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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.76813",strokeLinecap:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M8.91626 6.1311H9.27424",strokeLinecap:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},Ce=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"reply-to-comment-icon",ref:t,icon:Le}))});Ce.displayName="ReplyToCommentIcon";const He={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},pe=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"resolved-icon",ref:t,icon:He}))});pe.displayName="ResolvedIcon";const Ve={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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}}]},ge=c.forwardRef(function(e,t){return c.createElement(q,Object.assign({},e,{id:"solve-icon",ref:t,icon:Ve}))});ge.displayName="SolveIcon";function Ie(r){return{id:"d",body:r,documentStyle:{}}}const be=c.forwardRef((r,e)=>{var L;const{comment:t,onSave:n,id:o,onCancel:a,autoFocus:v,unitId:S,type:g}=r,D=m.useDependency(s.ICommandService),k=m.useDependency(s.LocaleService),[W,$]=c.useState(!1),_=m.useDependency(se.IEditorService),f=c.useRef(null),C=g===s.UniverInstanceType.UNIVER_DOC?s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:S,[M,w]=c.useState(()=>{var h,p,I;return s.BuildTextUtils.transform.getPlainText((I=(p=(h=f.current)==null?void 0:h.getDocumentData().body)==null?void 0:p.dataStream)!=null?I:"")});c.useEffect(()=>{var p,I,T,b;w(s.BuildTextUtils.transform.getPlainText((T=(I=(p=f.current)==null?void 0:p.getDocumentData().body)==null?void 0:I.dataStream)!=null?T:""));const h=(b=f.current)==null?void 0:b.selectionChange$.subscribe(()=>{var l,U,z;w(s.BuildTextUtils.transform.getPlainText((z=(U=(l=f.current)==null?void 0:l.getDocumentData().body)==null?void 0:U.dataStream)!=null?z:""))});return()=>h==null?void 0:h.unsubscribe()},[(L=f.current)==null?void 0:L.selectionChange$]);const Z=c.useMemo(()=>({keyCodes:[{keyCode:m.KeyCode.ENTER}],handler:h=>{h===m.KeyCode.ENTER&&D.executeCommand(se.BreakLineCommand.id)}}),[D]);c.useImperativeHandle(e,()=>({reply(h){var I,T;if(!f.current)return;_.focus((I=f.current.getEditorId())!=null?I:"");const p=Ie(h);(T=f.current)==null||T.setDocumentData(p,[{startOffset:p.body.dataStream.length-2,endOffset:p.body.dataStream.length-2,collapsed:!0}])}}));const x=()=>{if(f.current){const h=s.Tools.deepClone(f.current.getDocumentData().body);$(!1),n==null||n({...t,text:h}),f.current.replaceText(""),setTimeout(()=>{var p,I;(p=f.current)==null||p.setSelectionRanges([]),(I=f.current)==null||I.blur()},10)}};return i.jsxs("div",{onClick:h=>h.preventDefault(),children:[i.jsx(se.RichTextEditor,{className:"univer-w-full",editorRef:f,editorId:s.DOCS_COMMENT_EDITOR_UNIT_ID_KEY,autoFocus:v,keyboardEventConfig:Z,placeholder:k.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&Ie(t.text),onFocusChange:h=>h&&$(h),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{_.focus(C)},30)}}),W?i.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2",children:[i.jsx(N.Button,{onClick:()=>{var h;a==null||a(),$(!1),(h=f.current)==null||h.replaceText("",!0),D.executeCommand(F.id)},children:k.t("threadCommentUI.editor.cancel")}),i.jsx(N.Button,{variant:"primary",disabled:!M,onClick:x,children:k.t(o?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Be=r=>{const{dataStream:e,customRanges:t}=r,n=e.endsWith(`\r
|
|
2
|
-
`)?
|
|
3
|
-
`,{textRuns:[],paragraphs:[{startIndex:
|
|
4
|
-
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/ui`),require(`rxjs`),require(`@univerjs/thread-comment`),require(`@univerjs/design`),require(`react`),require(`@univerjs/docs-ui`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/ui`,`rxjs`,`@univerjs/thread-comment`,`@univerjs/design`,`react`,`@univerjs/docs-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadCommentUi={},e.UniverCore,e.UniverUi,e.rxjs,e.UniverThreadComment,e.UniverDesign,e.React,e.UniverDocsUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}function u(e,t){if(l(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(l(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function d(e){var t=u(e,`string`);return l(t)==`symbol`?t:t+``}function f(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(n,r){t(n,r,e)}}function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let h=class extends t.Disposable{constructor(e,t){super(),this._sidebarService=e,this._univerInstanceService=t,f(this,`_panelVisible`,!1),f(this,`_panelVisible$`,new r.BehaviorSubject(!1)),f(this,`_activeCommentId`,void 0),f(this,`_activeCommentId$`,new r.BehaviorSubject(void 0)),f(this,`panelVisible$`,this._panelVisible$.asObservable()),f(this,`activeCommentId$`,this._activeCommentId$.asObservable()),this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,r.filter)(e=>!e)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(e){this._panelVisible=e,this._panelVisible$.next(e)}setActiveComment(e){this._activeCommentId=e,this._activeCommentId$.next(e)}};h=m([p(0,(0,t.Inject)(n.ISidebarService)),p(1,t.IUniverInstanceService)],h);let g=`thread-comment-panel`,_={id:`thread-comment-ui.operation.toggle-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(n.ISidebarService),r=e.get(h);return r.panelVisible?(t.close(),r.setPanelVisible(!1)):(t.open({header:{title:`threadCommentUI.panel.title`},children:{label:g},width:360}),r.setPanelVisible(!0)),!0}},v={id:`thread-comment-ui.operation.set-active-comment`,type:t.CommandType.OPERATION,handler(e,t){return e.get(h).setActiveComment(t),!0}};var y=`@univerjs/thread-comment-ui`,b=`0.18.0`;let x=`thread-comment-ui.config`;Symbol(x);let S={},C=class extends t.Plugin{constructor(e=S,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},S,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(x,o)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[h]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[_,v].forEach(e=>{this._commandService.registerCommand(e)})}};f(C,`pluginName`,`UNIVER_THREAD_COMMENT_UI_PLUGIN`),f(C,`packageName`,y),f(C,`version`,b),f(C,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),C=m([(0,t.DependentOn)(i.UniverThreadCommentPlugin),p(1,(0,t.Inject)(t.Injector)),p(2,t.ICommandService),p(3,t.IConfigService)],C);function w({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${O()}`);return T(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function T(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...E(e,n,i),...r},(D(e,n).children||[]).map((r,a)=>T(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function E(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function D(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function O(){return Math.random().toString(36).substring(2,8)}w.displayName=`UniverIcon`;let k={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},A=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`delete-icon`,ref:t,icon:k}))});A.displayName=`DeleteIcon`;let j={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},M=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`increase-icon`,ref:t,icon:j}))});M.displayName=`IncreaseIcon`;let N={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z`}}]},P=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`more-horizontal-icon`,ref:t,icon:N}))});P.displayName=`MoreHorizontalIcon`;let F={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.76813`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8.91626 6.1311H9.27424`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M3.90454 6.1311H4.26252`,strokeLinecap:`round`,strokeWidth:1.2}}]},I=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`reply-to-comment-icon`,ref:t,icon:F}))});I.displayName=`ReplyToCommentIcon`;let L={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},R=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`resolved-icon`,ref:t,icon:L}))});R.displayName=`ResolvedIcon`;let z={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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}}]},B=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(w,Object.assign({},e,{id:`solve-icon`,ref:t,icon:z}))});B.displayName=`SolveIcon`;function V(e){return{id:`d`,body:e,documentStyle:{}}}let H=(0,o.forwardRef)((e,r)=>{var i;let{comment:l,onSave:u,id:d,onCancel:f,autoFocus:p,unitId:m,type:h}=e,g=(0,n.useDependency)(t.ICommandService),_=(0,n.useDependency)(t.LocaleService),[y,b]=(0,o.useState)(!1),x=(0,n.useDependency)(s.IEditorService),S=(0,o.useRef)(null),C=h===t.UniverInstanceType.UNIVER_DOC?t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:m,[w,T]=(0,o.useState)(()=>{var e,n;return t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e)});(0,o.useEffect)(()=>{var e,n,r;T(t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e));let i=(r=S.current)==null?void 0:r.selectionChange$.subscribe(()=>{var e,n;T(t.BuildTextUtils.transform.getPlainText((e=(n=S.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e))});return()=>i==null?void 0:i.unsubscribe()},[(i=S.current)==null?void 0:i.selectionChange$]);let E=(0,o.useMemo)(()=>({keyCodes:[{keyCode:n.KeyCode.ENTER}],handler:e=>{e===n.KeyCode.ENTER&&g.executeCommand(s.BreakLineCommand.id)}}),[g]);return(0,o.useImperativeHandle)(r,()=>({reply(e){var t,n;if(!S.current)return;x.focus((t=S.current.getEditorId())==null?``:t);let r=V(e);(n=S.current)==null||n.setDocumentData(r,[{startOffset:r.body.dataStream.length-2,endOffset:r.body.dataStream.length-2,collapsed:!0}])}})),(0,c.jsxs)(`div`,{onClick:e=>e.preventDefault(),children:[(0,c.jsx)(s.RichTextEditor,{className:`univer-w-full`,editorRef:S,editorId:t.DOCS_COMMENT_EDITOR_UNIT_ID_KEY,autoFocus:p,keyboardEventConfig:E,placeholder:_.t(`threadCommentUI.editor.placeholder`),initialValue:(l==null?void 0:l.text)&&V(l.text),onFocusChange:e=>e&&b(e),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{x.focus(C)},30)}}),y?(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[(0,c.jsx)(a.Button,{onClick:()=>{var e;f==null||f(),b(!1),(e=S.current)==null||e.replaceText(``,!0),g.executeCommand(v.id)},children:_.t(`threadCommentUI.editor.cancel`)}),(0,c.jsx)(a.Button,{variant:`primary`,disabled:!w,onClick:()=>{if(S.current){let e=t.Tools.deepClone(S.current.getDocumentData().body);b(!1),u==null||u({...l,text:e}),S.current.replaceText(``),setTimeout(()=>{var e,t;(e=S.current)==null||e.setSelectionRanges([]),(t=S.current)==null||t.blur()},10)}},children:_.t(d?`threadCommentUI.editor.save`:`threadCommentUI.editor.reply`)})]}):null]})}),U=e=>{let{dataStream:t,customRanges:n}=e,r=t.endsWith(`\r
|
|
2
|
+
`)?t.length-2:t.length,i=[],a=0;return n==null||n.forEach(e=>{a<e.startIndex&&i.push({type:`text`,content:t.slice(a,e.startIndex)}),i.push({type:`mention`,content:{label:t.slice(e.startIndex,e.endIndex+1),id:e.rangeId}}),a=e.endIndex+1}),i.push({type:`text`,content:t.slice(a,r)}),i},W=e=>{if(!e)return[];let{paragraphs:n=[]}=e;return n.map((r,i)=>U((0,t.getBodySlice)(e,i===0?0:n[i-1].startIndex+1,r.startIndex)))},G=e=>{let n=``,r=[];return e.forEach(e=>{switch(e.type){case`text`:n+=e.content;break;case`mention`:{let i=n.length;n+=e.content.label;let a=n.length-1;r.push({rangeId:e.content.id,rangeType:t.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}default:break}}),n+=`\r
|
|
3
|
+
`,{textRuns:[],paragraphs:[{startIndex:n.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:n.length-1}],dataStream:n,customRanges:r}},K=`__mock__`,q=e=>{let{item:r,unitId:s,subUnitId:l,editing:u,onEditingChange:d,onReply:f,resolved:p,isRoot:m,onClose:h,onDeleteComment:g,type:_}=e,v=(0,n.useDependency)(t.ICommandService),y=(0,n.useDependency)(t.LocaleService),b=(0,n.useDependency)(t.UserManagerService),x=b.getUser(r.personId),S=(0,n.useObservable)(b.currentUser$),C=(S==null?void 0:S.userID)===r.personId,w=r.id===K,[T,E]=(0,o.useState)(!1),D=(0,n.useConfigValue)(n.UI_PLUGIN_CONFIG_KEY),O=D==null?void 0:D.avatarFallback;return(0,c.jsxs)(`div`,{className:`univer-relative univer-mb-3 univer-pl-[30px]`,onMouseLeave:()=>E(!1),onMouseEnter:()=>E(!0),children:[(0,c.jsx)(`div`,{className:`
|
|
4
|
+
univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover
|
|
5
|
+
univer-bg-center univer-bg-no-repeat
|
|
6
|
+
`,style:{backgroundImage:`url(${(x==null?void 0:x.avatar)||O})`}}),x?(0,c.jsxs)(`div`,{className:`univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between`,children:[(0,c.jsx)(`div`,{className:`univer-text-sm univer-font-medium univer-leading-5`,children:(x==null?void 0:x.name)||` `}),(0,c.jsxs)(`div`,{children:[w||p?null:T&&x?(0,c.jsx)(`div`,{className:`
|
|
7
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
8
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
9
|
+
univer-text-base
|
|
10
|
+
hover:univer-bg-gray-50
|
|
11
|
+
`,onClick:()=>f(x),children:(0,c.jsx)(I,{})}):null,C&&!w&&!p?(0,c.jsx)(a.Dropdown,{overlay:(0,c.jsx)(`div`,{className:`univer-rounded-lg`,children:(0,c.jsxs)(`ul`,{className:`
|
|
12
|
+
univer-m-0 univer-box-border univer-grid univer-list-none
|
|
13
|
+
univer-p-1.5 univer-text-sm
|
|
14
|
+
[&_a]:univer-block [&_a]:univer-cursor-pointer
|
|
15
|
+
[&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
|
|
16
|
+
[&_a]:univer-transition-colors
|
|
17
|
+
`,children:[(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>d==null?void 0:d(!0),children:y.t(`threadCommentUI.item.edit`)})}),(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>{(g==null?void 0:g(r))!==!1&&(v.executeCommand(m?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{unitId:s,subUnitId:l,commentId:r.id}),m&&(h==null||h()))},children:y.t(`threadCommentUI.item.delete`)})})]})}),children:(0,c.jsx)(`div`,{className:`
|
|
18
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
19
|
+
univer-items-center univer-justify-center univer-rounded-sm
|
|
20
|
+
univer-text-base
|
|
21
|
+
hover:univer-bg-gray-50
|
|
22
|
+
`,children:(0,c.jsx)(P,{})})}):null]})]}):null,(0,c.jsx)(`time`,{className:`
|
|
23
|
+
univer-mb-1 univer-text-xs/normal univer-text-gray-600
|
|
24
|
+
dark:!univer-text-gray-200
|
|
25
|
+
`,children:r.dT}),u?(0,c.jsx)(H,{type:_,id:r.id,comment:r,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:s,subUnitId:l,onSave:({text:e,attachments:t})=>{d==null||d(!1),v.executeCommand(i.UpdateCommentCommand.id,{unitId:s,subUnitId:l,payload:{commentId:r.id,text:e,attachments:t}})}}):(0,c.jsx)(`div`,{className:`
|
|
26
|
+
univer-text-sm univer-text-gray-900
|
|
27
|
+
dark:!univer-text-white
|
|
28
|
+
`,children:W(r.text).map((e,t)=>(0,c.jsx)(`div`,{className:`univer-break-words`,children:e.map((e,t)=>{switch(e.type){case`mention`:return(0,c.jsxs)(`a`,{className:`univer-text-primary-600`,children:[e.content.label,` `]},t);default:return e.content}})},t))})]})},J=e=>{var s,l,u;let{id:d,unitId:f,subUnitId:p,refStr:m,showEdit:h=!0,onClick:g,showHighlight:_,onClose:y,getSubUnitName:b,prefix:x,autoFocus:S,onMouseEnter:C,onMouseLeave:w,onAddComment:T,onDeleteComment:E,onResolve:D,type:O,style:k,full:j}=e,M=(0,n.useDependency)(i.ThreadCommentModel),[N,P]=(0,o.useState)(!1),[F,I]=(0,o.useState)(``);(0,n.useObservable)((0,o.useMemo)(()=>M.commentUpdate$.pipe((0,r.debounceTime)(16)),[M]));let L=d?M.getCommentWithChildren(f,p,d):null,z=(0,n.useDependency)(t.ICommandService),V=(0,n.useDependency)(t.UserManagerService),U=L==null?void 0:L.root.resolved,W=(0,n.useObservable)(V.currentUser$),J=(0,o.useRef)(null),Y=[...L?[L.root]:[{id:K,text:{dataStream:`
|
|
29
|
+
\r`},personId:(s=W==null?void 0:W.userID)==null?``:s,ref:m==null?``:m,dT:``,unitId:f,subUnitId:p,threadId:``}],...(l=L==null?void 0:L.children)==null?[]:l],X=(0,o.useRef)(null),Z=e=>{e.stopPropagation(),U?z.executeCommand(v.id,{unitId:f,subUnitId:p,commentId:d}):z.executeCommand(v.id),z.executeCommand(i.ResolveCommentCommand.id,{unitId:f,subUnitId:p,commentId:d,resolved:!U}),D==null||D(!U)},ee=e=>{e.stopPropagation(),z.executeCommand(v.id),!(L!=null&&L.root&&(E==null?void 0:E(L.root))===!1)&&(z.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:f,subUnitId:p,commentId:d}),y==null||y())};(0,o.useEffect)(()=>w==null?void 0:w(),[]);let Q=b((u=L==null?void 0:L.root.subUnitId)==null?p:u),te=h&&!F&&!U,$=`${m||(L==null?void 0:L.root.ref)||``}${Q?` · `:``}${Q}`;return(0,c.jsxs)(`div`,{id:`${x}-${f}-${p}-${d}`,className:(0,a.clsx)(`
|
|
30
|
+
univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4
|
|
31
|
+
dark:!univer-bg-gray-900 dark:!univer-text-white
|
|
32
|
+
`,a.borderClassName,{"univer-w-[278px]":!j,"univer-w-full":j,"univer-shadow":!U&&(_||N||x===`cell`)}),style:k,onClick:g,onMouseEnter:()=>{C==null||C(),P(!0)},onMouseLeave:()=>{w==null||w(),P(!1)},children:[!U&&_&&(0,c.jsx)(`div`,{className:`
|
|
33
|
+
univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
|
|
34
|
+
univer-bg-yellow-400
|
|
35
|
+
`}),(0,c.jsxs)(`div`,{className:`
|
|
36
|
+
univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm
|
|
37
|
+
univer-leading-5
|
|
38
|
+
`,children:[(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`
|
|
39
|
+
univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
|
|
40
|
+
univer-rounded-sm univer-bg-yellow-500
|
|
41
|
+
`}),(0,c.jsx)(a.Tooltip,{showIfEllipsis:!0,title:$,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:$})})]}),!!L&&(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row`,children:[(0,c.jsx)(`div`,{className:(0,a.clsx)(`
|
|
42
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center
|
|
43
|
+
univer-justify-center univer-rounded-[3px] univer-text-base
|
|
44
|
+
hover:univer-bg-gray-50
|
|
45
|
+
dark:hover:!univer-bg-gray-800
|
|
46
|
+
`,{"univer-text-green-500":U}),onClick:Z,children:U?(0,c.jsx)(R,{}):(0,c.jsx)(B,{})}),(W==null?void 0:W.userID)===L.root.personId?(0,c.jsx)(`div`,{className:`
|
|
47
|
+
univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer
|
|
48
|
+
univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base
|
|
49
|
+
hover:univer-bg-gray-50
|
|
50
|
+
dark:hover:!univer-bg-gray-800
|
|
51
|
+
`,onClick:ee,children:(0,c.jsx)(A,{})}):null]})]}),(0,c.jsx)(`div`,{ref:X,className:(0,a.clsx)(`univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden`,a.scrollbarClassName),children:Y.map(e=>(0,c.jsx)(q,{unitId:f,subUnitId:p,item:e,isRoot:e.id===(L==null?void 0:L.root.id),editing:F===e.id,resolved:L==null?void 0:L.root.resolved,type:O,onClose:y,onEditingChange:t=>{I(t?e.id:``)},onReply:e=>{e&&requestAnimationFrame(()=>{var t;(t=J.current)==null||t.reply(G([{type:`mention`,content:{id:e.userID,label:`@${e.name}`}},{type:`text`,content:` `}]))})},onAddComment:T,onDeleteComment:E},e.id))}),te&&(0,c.jsx)(`div`,{children:(0,c.jsx)(H,{ref:J,type:O,unitId:f,subUnitId:p,onSave:async({text:e,attachments:n})=>{if(!(W!=null&&W.userID)||!(L!=null&&L.root))throw Error(`[ThreadCommentTree] No current user or root comment found`);let r={text:e,attachments:n,dT:(0,i.getDT)(),id:(0,t.generateRandomId)(),ref:m,personId:W==null?void 0:W.userID,parentId:L==null?void 0:L.root.id,unitId:f,subUnitId:p,threadId:L==null?void 0:L.root.threadId};(T==null?void 0:T(r))!==!1&&(await z.executeCommand(i.AddCommentCommand.id,{unitId:f,subUnitId:p,comment:r}),X.current&&(X.current.scrollTop=X.current.scrollHeight))},autoFocus:S||!L,onCancel:()=>{L||y==null||y()}},`${S}`)})]})};e.SetActiveCommentOperation=v,e.THREAD_COMMENT_PANEL=g,e.ThreadCommentPanel=e=>{let{unitId:r,subUnitId$:s,type:l,onAdd:u,getSubUnitName:d,onResolve:f,sortComments:p,onItemLeave:m,onItemEnter:g,disableAdd:_,tempComment:y,onAddComment:b,onDeleteComment:x,showComments:S}=e,[C,w]=(0,o.useState)(`all`),[T,E]=(0,o.useState)(`all`),D=(0,n.useDependency)(t.LocaleService),O=(0,n.useDependency)(t.UserManagerService),k=(0,n.useDependency)(i.ThreadCommentModel),[A,j]=(0,o.useState)(()=>k.getUnit(r)),N=(0,n.useObservable)((0,n.useDependency)(h).activeCommentId$),P=(0,n.useObservable)(k.commentUpdate$),F=(0,n.useDependency)(t.ICommandService),I=(0,n.useObservable)(s),L=(0,o.useRef)(!0),R=`panel`,z=(0,n.useObservable)(O.currentUser$),B=(0,o.useMemo)(()=>{var e;let t=C===`all`?A:(e=A.filter(e=>e.subUnitId===I))==null?[]:e,n=p==null?(e=>e):p,r=t.map(e=>{var t;return{...e.root,children:(t=e.children)==null?[]:t,users:e.relativeUsers}});if(S){let e=new Map;return r.forEach(t=>{e.set(t.id,t)}),[...S,``].map(t=>e.get(t)).filter(Boolean)}else return n(r)},[S,C,A,p,I]),V=(0,o.useMemo)(()=>[...B.filter(e=>!e.resolved),...B.filter(e=>e.resolved)],[B]),H=(0,o.useMemo)(()=>T===`resolved`?V.filter(e=>e.resolved):T===`unsolved`?V.filter(e=>!e.resolved):T===`concern_me`&&z!=null&&z.userID?V.filter(e=>e==null?void 0:e.users.has(z.userID)):V,[V,z==null?void 0:z.userID,T]),U=y?[y,...H]:H,W=U.filter(e=>!e.resolved),G=U.filter(e=>e.resolved),K=T!==`all`||C!==`all`,q=()=>{E(`all`),w(`all`)};(0,o.useEffect)(()=>{r&&j(k.getUnit(r))},[r,k,P]),(0,o.useEffect)(()=>{var e;if(!N)return;if(!L.current){L.current=!0;return}let{unitId:t,subUnitId:n,commentId:r}=N,i=`${R}-${t}-${n}-${r}`;(e=document.getElementById(i))==null||e.scrollIntoView({block:`center`})},[N]);let Y=e=>(0,c.jsx)(J,{prefix:R,getSubUnitName:d,id:e.id,unitId:e.unitId,subUnitId:e.subUnitId,refStr:e.ref,type:l,showEdit:(N==null?void 0:N.commentId)===e.id,showHighlight:(N==null?void 0:N.commentId)===e.id,onClick:()=>{L.current=!1,e.resolved?F.executeCommand(v.id):F.executeCommand(v.id,{unitId:e.unitId,subUnitId:e.subUnitId,commentId:e.id,temp:!1})},onMouseEnter:()=>g==null?void 0:g(e),onMouseLeave:()=>m==null?void 0:m(e),onAddComment:b,onDeleteComment:x,onResolve:t=>f==null?void 0:f(e.id,t)},e.id);return(0,c.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col univer-pb-3`,children:[(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-between`,children:[l===t.UniverInstanceType.UNIVER_SHEET?(0,c.jsx)(a.Select,{borderless:!0,value:C,options:[{value:`current`,label:D.t(`threadCommentUI.filter.sheet.current`)},{value:`all`,label:D.t(`threadCommentUI.filter.sheet.all`)}],onChange:w}):null,(0,c.jsx)(a.Select,{borderless:!0,value:T,options:[{value:`all`,label:D.t(`threadCommentUI.filter.status.all`)},{value:`resolved`,label:D.t(`threadCommentUI.filter.status.resolved`)},{value:`unsolved`,label:D.t(`threadCommentUI.filter.status.unsolved`)},{value:`concern_me`,label:D.t(`threadCommentUI.filter.status.concernMe`)}],onChange:E})]}),U.length===0?(0,c.jsxs)(`div`,{className:`
|
|
52
|
+
univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center
|
|
53
|
+
univer-text-sm univer-text-gray-600
|
|
54
|
+
dark:!univer-text-gray-200
|
|
55
|
+
`,children:[D.t(`threadCommentUI.panel.empty`),K?(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsx)(a.Button,{onClick:q,children:D.t(`threadCommentUI.panel.reset`)})}):_?null:(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsxs)(a.Button,{onClick:u,children:[(0,c.jsx)(M,{className:`univer-mr-1.5`}),D.t(`threadCommentUI.panel.addComment`)]})})]}):(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-col univer-gap-3`,children:[W.map(Y),G.length>0&&(0,c.jsx)(`div`,{className:`univer-text-xs`,children:D.t(`threadCommentUI.panel.solved`)}),G.map(Y)]})]})},Object.defineProperty(e,`ThreadCommentPanelService`,{enumerable:!0,get:function(){return h}}),e.ThreadCommentTree=J,e.ToggleSheetCommentPanelOperation=_,Object.defineProperty(e,`UniverThreadCommentUIPlugin`,{enumerable:!0,get:function(){return C}})});
|
package/lib/umd/locale/ca-ES.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiCaES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestió de comentaris`,empty:`Encara no hi ha comentaris`,filterEmpty:`Cap resultat coincident`,reset:`Restableix el filtre`,addComment:`Afegeix un comentari`,solved:`Resolut`},editor:{placeholder:`Respon o afegeix altres amb @`,reply:`Comenta`,cancel:`Cancel·la`,save:`Desa`},item:{edit:`Edita`,delete:`Elimina aquest comentari`},filter:{sheet:{all:`Tots els fulls`,current:`Full actual`},status:{all:`Tots els comentaris`,resolved:`Resolts`,unsolved:`No resolts`,concernMe:`Em concerneix`}}}}});
|
package/lib/umd/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEnUS=t())})(this,function(){return{threadCommentUI:{panel:{title:`Comment Management`,empty:`No comments yet`,filterEmpty:`No match result`,reset:`Reset Filter`,addComment:`Add Comment`,solved:`Solved`},editor:{placeholder:`Reply or add others with @`,reply:`Comment`,cancel:`Cancel`,save:`Save`},item:{edit:`Edit`,delete:`Delete This Comment`},filter:{sheet:{all:`All sheet`,current:`Current sheet`},status:{all:`All comments`,resolved:`Resolved`,unsolved:`Not resolved`,concernMe:`Concern me`}}}}});
|
package/lib/umd/locale/es-ES.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEsES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestión de comentarios`,empty:`Aún no hay comentarios`,filterEmpty:`Sin resultados coincidentes`,reset:`Restablecer filtro`,addComment:`Añadir comentario`,solved:`Resuelto`},editor:{placeholder:`Responde o añade a otros con @`,reply:`Comentar`,cancel:`Cancelar`,save:`Guardar`},item:{edit:`Editar`,delete:`Eliminar este comentario`},filter:{sheet:{all:`Todas las hojas`,current:`Hoja actual`},status:{all:`Todos los comentarios`,resolved:`Resueltos`,unsolved:`No resueltos`,concernMe:`Me concierne`}}}}});
|
package/lib/umd/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFaIR=t())})(this,function(){return{threadCommentUI:{panel:{title:`مدیریت نظرات`,empty:`هنوز نظری وجود ندارد`,filterEmpty:`نتیجه ای یافت نشد`,reset:`بازنشانی فیلتر`,addComment:`افزودن نظر`,solved:`حل شده`},editor:{placeholder:`پاسخ یا اضافه کردن دیگران با @`,reply:`نظر`,cancel:`انصراف`,save:`ذخیره`},item:{edit:`ویرایش`,delete:`حذف این نظر`},filter:{sheet:{all:`همه برگهها`,current:`برگه فعلی`},status:{all:`همه نظرات`,resolved:`حل شده`,unsolved:`حل نشده`,concernMe:`موضوع مربوط به من`}}}}});
|
package/lib/umd/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFrFR=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestion des commentaires`,empty:`Pas encore de commentaires`,filterEmpty:`Aucun résultat correspondant`,reset:`Réinitialiser le filtre`,addComment:`Ajouter un commentaire`,solved:`Résolu`},editor:{placeholder:`Répondre ou ajouter d'autres avec @`,reply:`Commenter`,cancel:`Annuler`,save:`Enregistrer`},item:{edit:`Modifier`,delete:`Supprimer ce commentaire`},filter:{sheet:{all:`Toutes les feuilles`,current:`Feuille actuelle`},status:{all:`Tous les commentaires`,resolved:`Résolu`,unsolved:`Non résolu`,concernMe:`Me concerne`}}}}});
|
package/lib/umd/locale/ja-JP.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiJaJP=t())})(this,function(){return{threadCommentUI:{panel:{title:`コメント管理`,empty:`まだコメントはありません`,filterEmpty:`一致する結果がありません`,reset:`フィルタをリセット`,addComment:`コメントを追加`,solved:`解決済み`},editor:{placeholder:`返信または@で他のユーザーを追加`,reply:`返信`,cancel:`キャンセル`,save:`保存`},item:{edit:`編集`,delete:`コメントを削除`},filter:{sheet:{all:`すべてのシート`,current:`現在のシート`},status:{all:`すべてのコメント`,resolved:`解決済み`,unsolved:`未解決`,concernMe:`自分に関連`}}}}});
|
package/lib/umd/locale/ko-KR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiKoKR=t())})(this,function(){return{threadCommentUI:{panel:{title:`댓글 관리`,empty:`아직 댓글이 없습니다`,filterEmpty:`일치하는 결과가 없습니다`,reset:`필터 초기화`,addComment:`댓글 추가`,solved:`해결됨`},editor:{placeholder:`답변 또는 @로 다른 사람 추가`,reply:`댓글`,cancel:`취소`,save:`저장`},item:{edit:`편집`,delete:`댓글 삭제`},filter:{sheet:{all:`모든 시트`,current:`현재 시트`},status:{all:`모든 댓글`,resolved:`해결됨`,unsolved:`해결되지 않음`,concernMe:`나에게 관련됨`}}}}});
|
package/lib/umd/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiRuRU=t())})(this,function(){return{threadCommentUI:{panel:{title:`Управление комментариями`,empty:`Комментариев пока нет`,filterEmpty:`Нет совпадений`,reset:`Сбросить фильтр`,addComment:`Добавить комментарий`,solved:`Решено`},editor:{placeholder:`Отметьте пользователей через @`,reply:`Добавить комментарий`,cancel:`Отмена`,save:`Сохранить`},item:{edit:`Редактировать`,delete:`Удалить`},filter:{sheet:{all:`Все листы`,current:`Текущий лист`},status:{all:`Все комментарии`,resolved:`Решено`,unsolved:`Не решено`,concernMe:`Относящиеся ко мне`}}}}});
|
package/lib/umd/locale/sk-SK.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiSkSK=t())})(this,function(){return{threadCommentUI:{panel:{title:`Správa komentárov`,empty:`Zatiaľ žiadne komentáre`,filterEmpty:`Žiadne zodpovedajúce výsledky`,reset:`Obnoviť filter`,addComment:`Pridať komentár`,solved:`Vyriešené`},editor:{placeholder:`Odpovedzte alebo pridajte ostatných pomocou @`,reply:`Komentovať`,cancel:`Zrušiť`,save:`Uložiť`},item:{edit:`Upraviť`,delete:`Odstrániť tento komentár`},filter:{sheet:{all:`Všetky hárky`,current:`Aktuálny hárok`},status:{all:`Všetky komentáre`,resolved:`Vyriešené`,unsolved:`Nevyriešené`,concernMe:`Týka sa ma`}}}}});
|
package/lib/umd/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiViVN=t())})(this,function(){return{threadCommentUI:{panel:{title:`Quản lý Bình luận`,empty:`Chưa có bình luận`,filterEmpty:`Không có kết quả phù hợp`,reset:`Đặt lại`,addComment:`Thêm bình luận`,solved:`Đã giải quyết`},editor:{placeholder:`Phản hồi`,reply:`Phản hồi`,cancel:`Hủy`,save:`Lưu`},item:{edit:`Chỉnh sửa`,delete:`Xóa`},filter:{sheet:{all:`Tất cả bảng`,current:`Bảng hiện tại`},status:{all:`Tất cả bình luận`,resolved:`Đã giải quyết`,unsolved:`Chưa giải quyết`,concernMe:`Liên quan đến tôi`}}}}});
|
package/lib/umd/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhCN=t())})(this,function(){return{threadCommentUI:{panel:{title:`评论管理`,empty:`暂无评论`,filterEmpty:`没有匹配的结果`,reset:`重置`,addComment:`添加评论`,solved:`已解决`},editor:{placeholder:`回复`,reply:`回复`,cancel:`取消`,save:`保存`},item:{edit:`编辑`,delete:`删除`},filter:{sheet:{all:`所有表格`,current:`当前表格`},status:{all:`所有评论`,resolved:`已解决`,unsolved:`未解决`,concernMe:`与我有关`}}}}});
|
package/lib/umd/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhTW=t())})(this,function(){return{threadCommentUI:{panel:{title:`評論管理`,empty:`暫無評論`,filterEmpty:`沒有符合的結果`,reset:`重置`,addComment:`新增評論`,solved:`已解決`},editor:{placeholder:`回覆`,reply:`回覆`,cancel:`取消`,save:`儲存`},item:{edit:`編輯`,delete:`刪除`},filter:{sheet:{all:`所有表格`,current:`當前表格`},status:{all:`所有評論`,resolved:`已解決`,unsolved:`未解決`,concernMe:`與我有關`}}}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/thread-comment-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Univer common thread comment UI plugin",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@univerjs/icons": "^1.1.1",
|
|
56
|
-
"@univerjs/core": "0.
|
|
57
|
-
"@univerjs/design": "0.
|
|
58
|
-
"@univerjs/docs-ui": "0.
|
|
59
|
-
"@univerjs/thread-comment": "0.
|
|
60
|
-
"@univerjs/ui": "0.
|
|
56
|
+
"@univerjs/core": "0.18.0",
|
|
57
|
+
"@univerjs/design": "0.18.0",
|
|
58
|
+
"@univerjs/docs-ui": "0.18.0",
|
|
59
|
+
"@univerjs/thread-comment": "0.18.0",
|
|
60
|
+
"@univerjs/ui": "0.18.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"postcss": "^8.5.8",
|
|
@@ -65,16 +65,17 @@
|
|
|
65
65
|
"rxjs": "^7.8.2",
|
|
66
66
|
"tailwindcss": "3.4.18",
|
|
67
67
|
"typescript": "^5.9.3",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"@univerjs-infra/shared": "0.17.0"
|
|
68
|
+
"vitest": "^4.1.0",
|
|
69
|
+
"@univerjs-infra/shared": "0.18.0"
|
|
71
70
|
},
|
|
72
71
|
"scripts": {
|
|
73
72
|
"test": "vitest run",
|
|
74
73
|
"test:watch": "vitest",
|
|
75
74
|
"coverage": "vitest run --coverage",
|
|
76
75
|
"typecheck": "tsc --noEmit",
|
|
77
|
-
"build": "univer-cli build"
|
|
76
|
+
"build:bundle": "univer-cli build",
|
|
77
|
+
"build:types": "tsc -p tsconfig.node.json",
|
|
78
|
+
"build": "pnpm run build:bundle && pnpm run build:types"
|
|
78
79
|
},
|
|
79
80
|
"module": "./lib/es/index.js"
|
|
80
81
|
}
|