@univerjs/thread-comment-ui 0.5.5-nightly.202501220324 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/lib/cjs/index.js +12 -4
- package/lib/cjs/locale/en-US.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/ru-RU.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 +592 -573
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/views/thread-comment-panel/index.d.ts +2 -1
- package/lib/types/views/thread-comment-tree/index.d.ts +2 -1
- package/lib/umd/index.js +12 -4
- package/lib/umd/locale/en-US.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/ru-RU.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 +7 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),threadComment$2=require("@univerjs/thread-comment"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),jsxRuntime=require("react/jsx-runtime"),design=require("@univerjs/design"),react=require("react"),docsUi=require("@univerjs/docs-ui");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1"),_a;exports.ThreadCommentPanelService=(_a=class extends core.Disposable{constructor(_sidebarService,_univerInstanceService){super();__publicField(this,"_panelVisible",!1);__publicField(this,"_panelVisible$",new rxjs.BehaviorSubject(!1));__publicField(this,"_activeCommentId");__publicField(this,"_activeCommentId$",new rxjs.BehaviorSubject(void 0));__publicField(this,"panelVisible$",this._panelVisible$.asObservable());__publicField(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=_sidebarService,this._univerInstanceService=_univerInstanceService,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(opt=>{opt.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(core.UniverInstanceType.UNIVER_SHEET).pipe(rxjs.filter(sheet=>!sheet)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(visible){this._panelVisible=visible,this._panelVisible$.next(visible)}setActiveComment(commentInfo){this._activeCommentId=commentInfo,this._activeCommentId$.next(commentInfo)}},__name(_a,"ThreadCommentPanelService"),_a);exports.ThreadCommentPanelService=__decorateClass$1([__decorateParam$1(0,core.Inject(ui.ISidebarService)),__decorateParam$1(1,core.IUniverInstanceService)],exports.ThreadCommentPanelService);const THREAD_COMMENT_PANEL="thread-comment-panel",PLUGIN_NAME="UNIVER_THREAD_COMMENT_UI_PLUGIN",ToggleSheetCommentPanelOperation={id:"thread-comment-ui.operation.toggle-panel",type:core.CommandType.OPERATION,handler(accessor){const sidebarService=accessor.get(ui.ISidebarService),panelService=accessor.get(exports.ThreadCommentPanelService);return panelService.panelVisible?(sidebarService.close(),panelService.setPanelVisible(!1)):(sidebarService.open({header:{title:"threadCommentUI.panel.title"},children:{label:THREAD_COMMENT_PANEL},width:330}),panelService.setPanelVisible(!0)),!0}},SetActiveCommentOperation={id:"thread-comment-ui.operation.set-active-comment",type:core.CommandType.OPERATION,handler(accessor,params){return accessor.get(exports.ThreadCommentPanelService).setActiveComment(params),!0}},THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY="thread-comment-ui.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField"),_a2;exports.UniverThreadCommentUIPlugin=(_a2=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_commandService,_configService){super(),this._config=_config,this._injector=_injector,this._commandService=_commandService,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){var _a3;core.mergeOverrideWithDependencies([[exports.ThreadCommentPanelService]],(_a3=this._config)==null?void 0:_a3.overrides).forEach(dep=>{this._injector.add(dep)}),[ToggleSheetCommentPanelOperation,SetActiveCommentOperation].forEach(command=>{this._commandService.registerCommand(command)})}},__name(_a2,"UniverThreadCommentUIPlugin"),_a2);__publicField2(exports.UniverThreadCommentUIPlugin,"pluginName",PLUGIN_NAME);__publicField2(exports.UniverThreadCommentUIPlugin,"type",core.UniverInstanceType.UNIVER_UNKNOWN);exports.UniverThreadCommentUIPlugin=__decorateClass([core.DependentOn(threadComment$2.UniverThreadCommentPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.ICommandService),__decorateParam(3,core.IConfigService)],exports.UniverThreadCommentUIPlugin);var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=react.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return react.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a3){var key=_a3[0],value=_a3[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a3,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a3=node.children)===null||_a3===void 0)&&_a3.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},DeleteSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"delete-single",ref,icon:element$5}))});DeleteSingle.displayName="DeleteSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},IncreaseSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"increase-single",ref,icon:element$4}))});IncreaseSingle.displayName="IncreaseSingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},MoreHorizontalSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"more-horizontal-single",ref,icon:element$3}))});MoreHorizontalSingle.displayName="MoreHorizontalSingle";var element$2={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ReplyToCommentSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"reply-to-comment-single",ref,icon:element$2}))});ReplyToCommentSingle.displayName="ReplyToCommentSingle";var element$1={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ResolvedSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"resolved-single",ref,icon:element$1}))});ResolvedSingle.displayName="ResolvedSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},SolveSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"solve-single",ref,icon:element}))});SolveSingle.displayName="SolveSingle";function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}__name(r,"r");function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}__name(clsx,"clsx");const threadCommentEditorButtons="univer-thread-comment-editor-buttons",threadCommentEditorSuggestion="univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive="univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon="univer-thread-comment-editor-suggestion-icon",styles$2={threadCommentEditorButtons,threadCommentEditorSuggestion,threadCommentEditorSuggestionActive,threadCommentEditorSuggestionIcon};function getSnapshot(body){return{id:"d",body,documentStyle:{}}}__name(getSnapshot,"getSnapshot");const ThreadCommentEditor=react.forwardRef((props,ref)=>{var _a3;const{comment,onSave,id,onCancel,autoFocus,unitId,type}=props,commandService=core.useDependency(core.ICommandService),localeService=core.useDependency(core.LocaleService),[editing,setEditing]=react.useState(!1),editorService=core.useDependency(docsUi.IEditorService),editor=react.useRef(null),rootEditorId=type===core.UniverInstanceType.UNIVER_SHEET?core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:unitId,[canSubmit,setCanSubmit]=react.useState(()=>{var _a4,_b,_c;return core.BuildTextUtils.transform.getPlainText((_c=(_b=(_a4=editor.current)==null?void 0:_a4.getDocumentData().body)==null?void 0:_b.dataStream)!=null?_c:"")});react.useEffect(()=>{var _a4,_b,_c,_d;setCanSubmit(core.BuildTextUtils.transform.getPlainText((_c=(_b=(_a4=editor.current)==null?void 0:_a4.getDocumentData().body)==null?void 0:_b.dataStream)!=null?_c:""));const sub=(_d=editor.current)==null?void 0:_d.selectionChange$.subscribe(()=>{var _a5,_b2,_c2;setCanSubmit(core.BuildTextUtils.transform.getPlainText((_c2=(_b2=(_a5=editor.current)==null?void 0:_a5.getDocumentData().body)==null?void 0:_b2.dataStream)!=null?_c2:""))});return()=>sub==null?void 0:sub.unsubscribe()},[(_a3=editor.current)==null?void 0:_a3.selectionChange$]);const keyboardEventConfig=react.useMemo(()=>({keyCodes:[{keyCode:ui.KeyCode.ENTER}],handler:__name(keyCode=>{keyCode===ui.KeyCode.ENTER&&commandService.executeCommand(docsUi.BreakLineCommand.id)},"handler")}),[commandService]);react.useImperativeHandle(ref,()=>({reply(text){var _a4,_b;(_a4=editor.current)==null||_a4.focus(),(_b=editor.current)==null||_b.setDocumentData(getSnapshot(text))}}));const handleSave=__name(()=>{if(editor.current){const newText=core.Tools.deepClone(editor.current.getDocumentData().body);setEditing(!1),onSave==null||onSave({...comment,text:newText}),editor.current.replaceText(""),setTimeout(()=>{var _a4,_b;(_a4=editor.current)==null||_a4.setSelectionRanges([]),(_b=editor.current)==null||_b.blur()},10)}},"handleSave");return jsxRuntime.jsxs("div",{className:styles$2.threadCommentEditor,onClick:__name(e=>e.preventDefault(),"onClick"),children:[jsxRuntime.jsx(docsUi.RichTextEditor,{ref:editor,autoFocus,style:{width:"100%"},keyboardEventConfig,placeholder:localeService.t("threadCommentUI.editor.placeholder"),initialValue:(comment==null?void 0:comment.text)&&getSnapshot(comment.text),onFocusChange:__name(isFocus=>isFocus&&setEditing(isFocus),"onFocusChange"),isSingle:!1,maxHeight:64,onClickOutside:__name(()=>{setTimeout(()=>{editorService.focus(rootEditorId)},30)},"onClickOutside")}),editing?jsxRuntime.jsxs("div",{className:styles$2.threadCommentEditorButtons,children:[jsxRuntime.jsx(design.Button,{style:{marginRight:12},onClick:__name(()=>{var _a4;onCancel==null||onCancel(),setEditing(!1),(_a4=editor.current)==null||_a4.replaceText("",!0),commandService.executeCommand(SetActiveCommentOperation.id)},"onClick"),children:localeService.t("threadCommentUI.editor.cancel")}),jsxRuntime.jsx(design.Button,{type:"primary",disabled:!canSubmit,onClick:handleSave,children:localeService.t(id?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),transformDocument2TextNodesInParagraph=__name(doc=>{const{dataStream,customRanges}=doc,end=dataStream.endsWith(`\r
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
\r`},personId:(_a3=currentUser==null?void 0:currentUser.userID)!=null?_a3:"",ref:refStr!=null?refStr:"",dT:"",unitId,subUnitId,threadId:""}],...(_b=comments==null?void 0:comments.children)!=null?_b:[]],scroller=react.useRef(null),handleResolve=__name(e=>{e.stopPropagation(),resolved?commandService.executeCommand(SetActiveCommentOperation.id,{unitId,subUnitId,commentId:id}):commandService.executeCommand(SetActiveCommentOperation.id),commandService.executeCommand(threadComment$2.ResolveCommentCommand.id,{unitId,subUnitId,commentId:id,resolved:!resolved}),onResolve==null||onResolve(!resolved)},"handleResolve"),handleDeleteRoot=__name(e=>{e.stopPropagation(),commandService.executeCommand(SetActiveCommentOperation.id),!(comments!=null&&comments.root&&(onDeleteComment==null?void 0:onDeleteComment(comments.root))===!1)&&(commandService.executeCommand(threadComment$2.DeleteCommentTreeCommand.id,{unitId,subUnitId,commentId:id}),onClose==null||onClose())},"handleDeleteRoot");react.useEffect(()=>onMouseLeave==null?void 0:onMouseLeave(),[]);const subUnitName=getSubUnitName((_c=comments==null?void 0:comments.root.subUnitId)!=null?_c:subUnitId),editorVisible=showEdit&&!editingId&&!resolved,title=`${refStr||(comments==null?void 0:comments.root.ref)||""}${subUnitName?" · ":""}${subUnitName}`;return jsxRuntime.jsxs("div",{className:clsx(styles$1.threadComment,{[styles$1.threadCommentActive]:!resolved&&(showHighlight||isHover||prefix==="cell")}),onClick,id:`${prefix}-${unitId}-${subUnitId}-${id}`,onMouseEnter:__name(()=>{onMouseEnter==null||onMouseEnter(),setIsHover(!0)},"onMouseEnter"),onMouseLeave:__name(()=>{onMouseLeave==null||onMouseLeave(),setIsHover(!1)},"onMouseLeave"),children:[!resolved&&showHighlight?jsxRuntime.jsx("div",{className:styles$1.threadCommentHighlight}):null,jsxRuntime.jsxs("div",{className:styles$1.threadCommentTitle,children:[jsxRuntime.jsxs("div",{className:styles$1.threadCommentTitlePosition,children:[jsxRuntime.jsx("div",{className:styles$1.threadCommentTitleHighlight}),jsxRuntime.jsx(design.Tooltip,{showIfEllipsis:!0,title,children:jsxRuntime.jsx("div",{className:styles$1.threadCommentTitlePositionText,children:title})})]}),comments?jsxRuntime.jsxs("div",{className:styles$1.threadCommentIconContainer,children:[jsxRuntime.jsx("div",{onClick:handleResolve,className:styles$1.threadCommentIcon,style:{color:resolved?"rgb(var(--green-500))":""},children:resolved?jsxRuntime.jsx(ResolvedSingle,{}):jsxRuntime.jsx(SolveSingle,{})}),(currentUser==null?void 0:currentUser.userID)===comments.root.personId?jsxRuntime.jsx("div",{className:styles$1.threadCommentIcon,onClick:handleDeleteRoot,children:jsxRuntime.jsx(DeleteSingle,{})}):null]}):null]}),jsxRuntime.jsx("div",{className:styles$1.threadCommentContent,ref:scroller,children:renderComments.map(item=>jsxRuntime.jsx(ThreadCommentItem,{onClose,unitId,subUnitId,item,isRoot:item.id===(comments==null?void 0:comments.root.id),editing:editingId===item.id,resolved:comments==null?void 0:comments.root.resolved,type,onEditingChange:__name(editing=>{setEditingId(editing?item.id:"")},"onEditingChange"),onReply:__name(user=>{user&&requestAnimationFrame(()=>{var _a4;(_a4=editorRef.current)==null||_a4.reply(transformTextNodes2Document([{type:"mention",content:{id:user.userID,label:user.name}}]))})},"onReply"),onAddComment,onDeleteComment},item.id))}),editorVisible?jsxRuntime.jsx("div",{children:jsxRuntime.jsx(ThreadCommentEditor,{ref:editorRef,type,unitId,subUnitId,onSave:__name(async({text,attachments})=>{const comment={text,attachments,dT:threadComment$2.getDT(),id:core.generateRandomId(),ref:refStr,personId:currentUser==null?void 0:currentUser.userID,parentId:comments==null?void 0:comments.root.id,unitId,subUnitId,threadId:comments==null?void 0:comments.root.threadId};(onAddComment==null?void 0:onAddComment(comment))!==!1&&(await commandService.executeCommand(threadComment$2.AddCommentCommand.id,{unitId,subUnitId,comment}),scroller.current&&(scroller.current.scrollTop=scroller.current.scrollHeight))},"onSave"),autoFocus:autoFocus||!comments,onCancel:__name(()=>{comments||onClose==null||onClose()},"onCancel")},`${autoFocus}`)}):null]})},"ThreadCommentTree"),threadCommentPanel="univer-thread-comment-panel",threadComment="univer-thread-comment",threadCommentPanelForms="univer-thread-comment-panel-forms",select="univer-select",threadCommentPanelEmpty="univer-thread-comment-panel-empty",threadCommentPanelAdd="univer-thread-comment-panel-add",threadCommentPanelSolved="univer-thread-comment-panel-solved",styles={threadCommentPanel,threadComment,threadCommentPanelForms,select,threadCommentPanelEmpty,threadCommentPanelAdd,threadCommentPanelSolved},ThreadCommentPanel=__name(props=>{const{unitId,subUnitId$,type,onAdd,getSubUnitName,onResolve,sortComments,onItemLeave,onItemEnter,disableAdd,tempComment,onAddComment,onDeleteComment,showComments}=props,[unit,setUnit]=react.useState("all"),[status,setStatus]=react.useState("all"),localeService=core.useDependency(core.LocaleService),userService=core.useDependency(core.UserManagerService),threadCommentModel=core.useDependency(threadComment$2.ThreadCommentModel),[unitComments,setUnitComments]=react.useState(()=>threadCommentModel.getUnit(unitId)),panelService=core.useDependency(exports.ThreadCommentPanelService),activeCommentId=ui.useObservable(panelService.activeCommentId$),update=ui.useObservable(threadCommentModel.commentUpdate$),commandService=core.useDependency(core.ICommandService),subUnitId=ui.useObservable(subUnitId$),shouldScroll=react.useRef(!0),prefix="panel",currentUser=ui.useObservable(userService.currentUser$),comments=react.useMemo(()=>{var _a3;const allComments=unit==="all"?unitComments:(_a3=unitComments.filter(i=>i.subUnitId===subUnitId))!=null?_a3:[],sort=sortComments!=null?sortComments:a=>a,res=allComments.map(i=>{var _a4;return{...i.root,children:(_a4=i.children)!=null?_a4:[],users:i.relativeUsers}});if(showComments){const map=new Map;return res.forEach(comment=>{map.set(comment.id,comment)}),[...showComments,""].map(id=>map.get(id)).filter(Boolean)}else return sort(res)},[showComments,unit,unitComments,sortComments,subUnitId]),commentsSorted=react.useMemo(()=>[...comments.filter(comment=>!comment.resolved),...comments.filter(comment=>comment.resolved)],[comments]),statuedComments=react.useMemo(()=>status==="resolved"?commentsSorted.filter(comment=>comment.resolved):status==="unsolved"?commentsSorted.filter(comment=>!comment.resolved):status==="concern_me"&¤tUser!=null&¤tUser.userID?commentsSorted.filter(comment=>comment==null?void 0:comment.users.has(currentUser.userID)):commentsSorted,[commentsSorted,currentUser==null?void 0:currentUser.userID,status]),renderComments=tempComment?[tempComment,...statuedComments]:statuedComments,unSolvedComments=renderComments.filter(comment=>!comment.resolved),solvedComments=renderComments.filter(comment=>comment.resolved),isFiltering=status!=="all"||unit!=="all",onReset=__name(()=>{setStatus("all"),setUnit("all")},"onReset");react.useEffect(()=>{unitId&&setUnitComments(threadCommentModel.getUnit(unitId))},[unitId,threadCommentModel,update]),react.useEffect(()=>{var _a3;if(!activeCommentId)return;if(!shouldScroll.current){shouldScroll.current=!0;return}const{unitId:unitId2,subUnitId:subUnitId2,commentId}=activeCommentId,id=`${prefix}-${unitId2}-${subUnitId2}-${commentId}`;(_a3=document.getElementById(id))==null||_a3.scrollIntoView({block:"center"})},[activeCommentId]);const renderComment=__name(comment=>jsxRuntime.jsx(ThreadCommentTree,{prefix,getSubUnitName,id:comment.id,unitId:comment.unitId,subUnitId:comment.subUnitId,refStr:comment.ref,type,showEdit:(activeCommentId==null?void 0:activeCommentId.commentId)===comment.id,showHighlight:(activeCommentId==null?void 0:activeCommentId.commentId)===comment.id,onClick:__name(()=>{shouldScroll.current=!1,comment.resolved?commandService.executeCommand(SetActiveCommentOperation.id):commandService.executeCommand(SetActiveCommentOperation.id,{unitId:comment.unitId,subUnitId:comment.subUnitId,commentId:comment.id,temp:!1})},"onClick"),onMouseEnter:__name(()=>onItemEnter==null?void 0:onItemEnter(comment),"onMouseEnter"),onMouseLeave:__name(()=>onItemLeave==null?void 0:onItemLeave(comment),"onMouseLeave"),onAddComment,onDeleteComment,onResolve:__name(resolved=>onResolve==null?void 0:onResolve(comment.id,resolved),"onResolve")},comment.id),"renderComment");return jsxRuntime.jsxs("div",{className:styles.threadCommentPanel,children:[jsxRuntime.jsxs("div",{className:styles.threadCommentPanelForms,children:[type===core.UniverInstanceType.UNIVER_SHEET?jsxRuntime.jsx(design.Select,{borderless:!0,value:unit,onChange:__name(e=>setUnit(e),"onChange"),options:[{value:"current",label:localeService.t("threadCommentUI.filter.sheet.current")},{value:"all",label:localeService.t("threadCommentUI.filter.sheet.all")}]}):null,jsxRuntime.jsx(design.Select,{borderless:!0,value:status,onChange:__name(e=>setStatus(e),"onChange"),options:[{value:"all",label:localeService.t("threadCommentUI.filter.status.all")},{value:"resolved",label:localeService.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:localeService.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:localeService.t("threadCommentUI.filter.status.concernMe")}]})]}),unSolvedComments.map(renderComment),solvedComments.length?jsxRuntime.jsx("div",{className:styles.threadCommentPanelSolved,children:"已解决"}):null,solvedComments.map(renderComment),renderComments.length?null:jsxRuntime.jsxs("div",{className:styles.threadCommentPanelEmpty,children:[isFiltering?localeService.t("threadCommentUI.panel.filterEmpty"):localeService.t("threadCommentUI.panel.empty"),isFiltering?jsxRuntime.jsx(design.Button,{onClick:onReset,type:"link",children:localeService.t("threadCommentUI.panel.reset")}):jsxRuntime.jsxs(design.Button,{id:"thread-comment-add",className:styles.threadCommentPanelAdd,type:"primary",onClick:onAdd,disabled:disableAdd,children:[jsxRuntime.jsx(IncreaseSingle,{}),localeService.t("threadCommentUI.panel.addComment")]})]})]})},"ThreadCommentPanel");exports.SetActiveCommentOperation=SetActiveCommentOperation;exports.THREAD_COMMENT_PANEL=THREAD_COMMENT_PANEL;exports.ThreadCommentPanel=ThreadCommentPanel;exports.ThreadCommentTree=ThreadCommentTree;exports.ToggleSheetCommentPanelOperation=ToggleSheetCommentPanelOperation;
|
|
1
|
+
"use strict";var Oe=Object.defineProperty;var Re=(n,e,t)=>e in n?Oe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var F=(n,e,t)=>Re(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),A=require("@univerjs/thread-comment"),H=require("@univerjs/ui"),ae=require("rxjs"),m=require("react"),L=require("@univerjs/design"),se=require("@univerjs/docs-ui");var De=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(n,e,t,r)=>{for(var o=r>1?void 0:r?Me(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(o=(r?c(e,t,o):c(o))||o);return r&&o&&De(e,t,o),o},me=(n,e)=>(t,r)=>e(t,r,n);exports.ThreadCommentPanelService=class extends a.Disposable{constructor(t,r){super();F(this,"_panelVisible",!1);F(this,"_panelVisible$",new ae.BehaviorSubject(!1));F(this,"_activeCommentId");F(this,"_activeCommentId$",new ae.BehaviorSubject(void 0));F(this,"panelVisible$",this._panelVisible$.asObservable());F(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,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$(a.UniverInstanceType.UNIVER_SHEET).pipe(ae.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)}};exports.ThreadCommentPanelService=we([me(0,a.Inject(H.ISidebarService)),me(1,a.IUniverInstanceService)],exports.ThreadCommentPanelService);const ve="thread-comment-panel",$e="UNIVER_THREAD_COMMENT_UI_PLUGIN",pe={id:"thread-comment-ui.operation.toggle-panel",type:a.CommandType.OPERATION,handler(n){const e=n.get(H.ISidebarService),t=n.get(exports.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:ve},width:330}),t.setPanelVisible(!0)),!0}},B={id:"thread-comment-ui.operation.set-active-comment",type:a.CommandType.OPERATION,handler(n,e){return n.get(exports.ThreadCommentPanelService).setActiveComment(e),!0}},He="thread-comment-ui.config",ce={};var ge=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,ke=(n,e,t)=>e in n?ge(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ae=(n,e,t,r)=>{for(var o=r>1?void 0:r?Le(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(o=(r?c(e,t,o):c(o))||o);return r&&o&&ge(e,t,o),o},de=(n,e)=>(t,r)=>e(t,r,n),Ie=(n,e,t)=>ke(n,typeof e!="symbol"?e+"":e,t);exports.UniverThreadCommentUIPlugin=class extends a.Plugin{constructor(e=ce,t,r,o){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=o;const{menu:d,...c}=a.merge({},ce,this._config);d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(He,c)}onStarting(){var e;a.mergeOverrideWithDependencies([[exports.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[pe,B].forEach(t=>{this._commandService.registerCommand(t)})}};Ie(exports.UniverThreadCommentUIPlugin,"pluginName",$e);Ie(exports.UniverThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_UNKNOWN);exports.UniverThreadCommentUIPlugin=Ae([a.DependentOn(A.UniverThreadCommentPlugin),de(1,a.Inject(a.Injector)),de(2,a.ICommandService),de(3,a.IConfigService)],exports.UniverThreadCommentUIPlugin);var le={exports:{}},X={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var ue;function Ve(){if(ue)return X;ue=1;var n=m,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function c(f,h,b){var v,E={},y=null,_=null;b!==void 0&&(y=""+b),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(_=h.ref);for(v in h)r.call(h,v)&&!d.hasOwnProperty(v)&&(E[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)E[v]===void 0&&(E[v]=h[v]);return{$$typeof:e,type:f,key:y,ref:_,props:E,_owner:o.current}}return X.Fragment=t,X.jsx=c,X.jsxs=c,X}var he;function Be(){return he||(he=1,le.exports=Ve()),le.exports}var i=Be(),M=function(){return M=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},M.apply(this,arguments)},qe=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]]);return t},W=m.forwardRef(function(n,e){var t=n.icon,r=n.id,o=n.className,d=n.extend,c=qe(n,["icon","id","className","extend"]),f="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),h=m.useRef("_".concat(ze()));return xe(t,"".concat(r),{defIds:t.defIds,idSuffix:h.current},M({ref:e,className:f},c),d)});function xe(n,e,t,r,o){return m.createElement(n.tag,M(M({key:e},Fe(n,t,o)),r),(We(n,t).children||[]).map(function(d,c){return xe(d,"".concat(e,"-").concat(n.tag,"-").concat(c),t,void 0,o)}))}function Fe(n,e,t){var r=M({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var o=e.defIds;return!o||o.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var c=d[0],f=d[1];typeof f=="string"&&(r[c]=f.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function We(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?M(M({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?M(M({},o),{attrs:M(M({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):n}function ze(){return Math.random().toString(36).substring(2,8)}W.displayName="UniverIcon";var Ke={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Se=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"delete-single",ref:e,icon:Ke}))});Se.displayName="DeleteSingle";var Ze={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},be=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"increase-single",ref:e,icon:Ze}))});be.displayName="IncreaseSingle";var Je={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},ye=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Je}))});ye.displayName="MoreHorizontalSingle";var Ge={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},_e=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Ge}))});_e.displayName="ReplyToCommentSingle";var Ye={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Te=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"resolved-single",ref:e,icon:Ye}))});Te.displayName="ResolvedSingle";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},je=m.forwardRef(function(n,e){return m.createElement(W,Object.assign({},n,{id:"solve-single",ref:e,icon:Qe}))});je.displayName="SolveSingle";function Ee(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(e=0;e<o;e++)n[e]&&(t=Ee(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Xe(){for(var n,e,t=0,r="",o=arguments.length;t<o;t++)(n=arguments[t])&&(e=Ee(n))&&(r&&(r+=" "),r+=e);return r}const et="univer-thread-comment-editor-buttons",tt="univer-thread-comment-editor-suggestion",nt="univer-thread-comment-editor-suggestionActive",rt="univer-thread-comment-editor-suggestion-icon",Ce={threadCommentEditorButtons:et,threadCommentEditorSuggestion:tt,threadCommentEditorSuggestionActive:nt,threadCommentEditorSuggestionIcon:rt};function fe(n){return{id:"d",body:n,documentStyle:{}}}const Ue=m.forwardRef((n,e)=>{var k;const{comment:t,onSave:r,id:o,onCancel:d,autoFocus:c,unitId:f,type:h}=n,b=a.useDependency(a.ICommandService),v=a.useDependency(a.LocaleService),[E,y]=m.useState(!1),_=a.useDependency(se.IEditorService),C=m.useRef(null),x=h===a.UniverInstanceType.UNIVER_SHEET?a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:f,[R,U]=m.useState(()=>{var u,p,S;return a.BuildTextUtils.transform.getPlainText((S=(p=(u=C.current)==null?void 0:u.getDocumentData().body)==null?void 0:p.dataStream)!=null?S:"")});m.useEffect(()=>{var p,S,l,g;U(a.BuildTextUtils.transform.getPlainText((l=(S=(p=C.current)==null?void 0:p.getDocumentData().body)==null?void 0:S.dataStream)!=null?l:""));const u=(g=C.current)==null?void 0:g.selectionChange$.subscribe(()=>{var z,P,j;U(a.BuildTextUtils.transform.getPlainText((j=(P=(z=C.current)==null?void 0:z.getDocumentData().body)==null?void 0:P.dataStream)!=null?j:""))});return()=>u==null?void 0:u.unsubscribe()},[(k=C.current)==null?void 0:k.selectionChange$]);const w=m.useMemo(()=>({keyCodes:[{keyCode:H.KeyCode.ENTER}],handler:u=>{u===H.KeyCode.ENTER&&b.executeCommand(se.BreakLineCommand.id)}}),[b]);m.useImperativeHandle(e,()=>({reply(u){var p,S;(p=C.current)==null||p.focus(),(S=C.current)==null||S.setDocumentData(fe(u))}}));const T=()=>{if(C.current){const u=a.Tools.deepClone(C.current.getDocumentData().body);y(!1),r==null||r({...t,text:u}),C.current.replaceText(""),setTimeout(()=>{var p,S;(p=C.current)==null||p.setSelectionRanges([]),(S=C.current)==null||S.blur()},10)}};return i.jsxs("div",{className:Ce.threadCommentEditor,onClick:u=>u.preventDefault(),children:[i.jsx(se.RichTextEditor,{ref:C,autoFocus:c,style:{width:"100%"},keyboardEventConfig:w,placeholder:v.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&fe(t.text),onFocusChange:u=>u&&y(u),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{_.focus(x)},30)}}),E?i.jsxs("div",{className:Ce.threadCommentEditorButtons,children:[i.jsx(L.Button,{style:{marginRight:12},onClick:()=>{var u;d==null||d(),y(!1),(u=C.current)==null||u.replaceText("",!0),b.executeCommand(B.id)},children:v.t("threadCommentUI.editor.cancel")}),i.jsx(L.Button,{type:"primary",disabled:!R,onClick:T,children:v.t(o?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),ot=n=>{const{dataStream:e,customRanges:t}=n,r=e.endsWith(`\r
|
|
10
|
+
`)?e.length-2:e.length,o=[];let d=0;return t==null||t.forEach(c=>{d<c.startIndex&&o.push({type:"text",content:e.slice(d,c.startIndex)}),o.push({type:"mention",content:{label:e.slice(c.startIndex,c.endIndex+1),id:c.rangeId}}),d=c.endIndex+1}),o.push({type:"text",content:e.slice(d,r)}),o},it=n=>{const{paragraphs:e=[]}=n;let t=0;return e.map(r=>{const o=a.getBodySlice(n,t,r.startIndex);return t=r.startIndex+1,ot(o)})},at=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const o=e.length;e+=r.content.label;const d=e.length-1;t.push({rangeId:r.content.id,rangeType:a.CustomRangeType.MENTION,startIndex:o,endIndex:d,properties:{}});break}}}),e+=`
|
|
11
|
+
\r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},st="univer-thread-comment",dt="univer-thread-comment-active",lt="univer-thread-comment-content",mt="univer-thread-comment-highlight",ct="univer-thread-comment-icon-container",ut="univer-thread-comment-icon",ht="univer-thread-comment-title",Ct="univer-thread-comment-title-position",ft="univer-thread-comment-title-highlight",vt="univer-thread-comment-title-position-text",pt="univer-thread-comment-username",gt="univer-thread-comment-item",It="univer-thread-comment-item-head",xt="univer-thread-comment-item-title",St="univer-thread-comment-item-title-position",bt="univer-thread-comment-item-title-highlight",yt="univer-thread-comment-item-time",_t="univer-thread-comment-item-content",Tt="univer-thread-comment-item-at",I={threadComment:st,threadCommentActive:dt,threadCommentContent:lt,threadCommentHighlight:mt,threadCommentIconContainer:ct,threadCommentIcon:ut,threadCommentTitle:ht,threadCommentTitlePosition:Ct,threadCommentTitleHighlight:ft,threadCommentTitlePositionText:vt,threadCommentUsername:pt,threadCommentItem:gt,threadCommentItemHead:It,threadCommentItemTitle:xt,threadCommentItemTitlePosition:St,threadCommentItemTitleHighlight:bt,threadCommentItemTime:yt,threadCommentItemContent:_t,threadCommentItemAt:Tt},Pe="__mock__",jt=n=>{const{item:e,unitId:t,subUnitId:r,editing:o,onEditingChange:d,onReply:c,resolved:f,isRoot:h,onClose:b,onDeleteComment:v,type:E}=n,y=a.useDependency(a.ICommandService),_=a.useDependency(a.LocaleService),C=a.useDependency(a.UserManagerService),x=C.getUser(e.personId),R=H.useObservable(C.currentUser$),U=(R==null?void 0:R.userID)===e.personId,w=e.id===Pe,[T,k]=m.useState(!1),u=()=>{(v==null?void 0:v(e))!==!1&&(y.executeCommand(h?A.DeleteCommentTreeCommand.id:A.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),h&&(b==null||b()))};return i.jsxs("div",{className:I.threadCommentItem,onMouseLeave:()=>k(!1),onMouseEnter:()=>k(!0),children:[i.jsx("img",{className:I.threadCommentItemHead,src:x==null?void 0:x.avatar}),i.jsxs("div",{className:I.threadCommentItemTitle,children:[i.jsx("div",{className:I.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),i.jsxs("div",{children:[w||f?null:T?i.jsx("div",{className:I.threadCommentIcon,onClick:()=>c(x),children:i.jsx(_e,{})}):null,U&&!w&&!f?i.jsx(L.DropdownLegacy,{overlay:i.jsxs(L.Menu,{children:[i.jsx(L.MenuItem,{onClick:()=>d==null?void 0:d(!0),children:_.t("threadCommentUI.item.edit")},"edit"),i.jsx(L.MenuItem,{onClick:u,children:_.t("threadCommentUI.item.delete")},"delete")]}),children:i.jsx("div",{className:I.threadCommentIcon,children:i.jsx(ye,{})})}):null]})]}),i.jsx("div",{className:I.threadCommentItemTime,children:e.dT}),o?i.jsx(Ue,{type:E,id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:p,attachments:S})=>{d==null||d(!1),y.executeCommand(A.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:p,attachments:S}})}}):i.jsx("div",{className:I.threadCommentItemContent,children:it(e.text).map((p,S)=>i.jsx("div",{children:p.map((l,g)=>{switch(l.type){case"mention":return i.jsxs("a",{className:I.threadCommentItemAt,children:[l.content.label," "]},g);default:return l.content}})},S))})]})},Ne=n=>{var Y,Q,re;const{id:e,unitId:t,subUnitId:r,refStr:o,showEdit:d=!0,onClick:c,showHighlight:f,onClose:h,getSubUnitName:b,prefix:v,autoFocus:E,onMouseEnter:y,onMouseLeave:_,onAddComment:C,onDeleteComment:x,onResolve:R,type:U}=n,w=a.useDependency(A.ThreadCommentModel),[T,k]=m.useState(!1),[u,p]=m.useState(""),S=m.useMemo(()=>w.commentUpdate$.pipe(ae.debounceTime(16)),[w]);H.useObservable(S);const l=e?w.getCommentWithChildren(t,r,e):null,g=a.useDependency(a.ICommandService),z=a.useDependency(a.UserManagerService),P=l==null?void 0:l.root.resolved,j=H.useObservable(z.currentUser$),K=m.useRef(null),te=[...l?[l.root]:[{id:Pe,text:{dataStream:`
|
|
12
|
+
\r`},personId:(Y=j==null?void 0:j.userID)!=null?Y:"",ref:o!=null?o:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(Q=l==null?void 0:l.children)!=null?Q:[]],D=m.useRef(null),Z=N=>{N.stopPropagation(),P?g.executeCommand(B.id,{unitId:t,subUnitId:r,commentId:e}):g.executeCommand(B.id),g.executeCommand(A.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!P}),R==null||R(!P)},V=N=>{N.stopPropagation(),g.executeCommand(B.id),!(l!=null&&l.root&&(x==null?void 0:x(l.root))===!1)&&(g.executeCommand(A.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),h==null||h())};m.useEffect(()=>_==null?void 0:_(),[]);const J=b((re=l==null?void 0:l.root.subUnitId)!=null?re:r),G=d&&!u&&!P,ne=`${o||(l==null?void 0:l.root.ref)||""}${J?" · ":""}${J}`;return i.jsxs("div",{className:Xe(I.threadComment,{[I.threadCommentActive]:!P&&(f||T||v==="cell")}),onClick:c,id:`${v}-${t}-${r}-${e}`,onMouseEnter:()=>{y==null||y(),k(!0)},onMouseLeave:()=>{_==null||_(),k(!1)},children:[!P&&f?i.jsx("div",{className:I.threadCommentHighlight}):null,i.jsxs("div",{className:I.threadCommentTitle,children:[i.jsxs("div",{className:I.threadCommentTitlePosition,children:[i.jsx("div",{className:I.threadCommentTitleHighlight}),i.jsx(L.Tooltip,{showIfEllipsis:!0,title:ne,children:i.jsx("div",{className:I.threadCommentTitlePositionText,children:ne})})]}),l?i.jsxs("div",{className:I.threadCommentIconContainer,children:[i.jsx("div",{onClick:Z,className:I.threadCommentIcon,style:{color:P?"rgb(var(--green-500))":""},children:P?i.jsx(Te,{}):i.jsx(je,{})}),(j==null?void 0:j.userID)===l.root.personId?i.jsx("div",{className:I.threadCommentIcon,onClick:V,children:i.jsx(Se,{})}):null]}):null]}),i.jsx("div",{className:I.threadCommentContent,ref:D,children:te.map(N=>i.jsx(jt,{onClose:h,unitId:t,subUnitId:r,item:N,isRoot:N.id===(l==null?void 0:l.root.id),editing:u===N.id,resolved:l==null?void 0:l.root.resolved,type:U,onEditingChange:s=>{p(s?N.id:"")},onReply:s=>{s&&requestAnimationFrame(()=>{var $;($=K.current)==null||$.reply(at([{type:"mention",content:{id:s.userID,label:s.name}}]))})},onAddComment:C,onDeleteComment:x},N.id))}),G?i.jsx("div",{children:i.jsx(Ue,{ref:K,type:U,unitId:t,subUnitId:r,onSave:async({text:N,attachments:s})=>{const $={text:N,attachments:s,dT:A.getDT(),id:a.generateRandomId(),ref:o,personId:j==null?void 0:j.userID,parentId:l==null?void 0:l.root.id,unitId:t,subUnitId:r,threadId:l==null?void 0:l.root.threadId};(C==null?void 0:C($))!==!1&&(await g.executeCommand(A.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:$}),D.current&&(D.current.scrollTop=D.current.scrollHeight))},autoFocus:E||!l,onCancel:()=>{l||h==null||h()}},`${E}`)}):null]})},Et="univer-thread-comment-panel",Ut="univer-thread-comment",Pt="univer-thread-comment-panel-forms",Nt="univer-select",Ot="univer-thread-comment-panel-empty",Rt="univer-thread-comment-panel-add",Dt="univer-thread-comment-panel-solved",ee={threadCommentPanel:Et,threadComment:Ut,threadCommentPanelForms:Pt,select:Nt,threadCommentPanelEmpty:Ot,threadCommentPanelAdd:Rt,threadCommentPanelSolved:Dt},Mt=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:o,getSubUnitName:d,onResolve:c,sortComments:f,onItemLeave:h,onItemEnter:b,disableAdd:v,tempComment:E,onAddComment:y,onDeleteComment:_,showComments:C}=n,[x,R]=m.useState("all"),[U,w]=m.useState("all"),T=a.useDependency(a.LocaleService),k=a.useDependency(a.UserManagerService),u=a.useDependency(A.ThreadCommentModel),[p,S]=m.useState(()=>u.getUnit(e)),l=a.useDependency(exports.ThreadCommentPanelService),g=H.useObservable(l.activeCommentId$),z=H.useObservable(u.commentUpdate$),P=a.useDependency(a.ICommandService),j=H.useObservable(t),K=m.useRef(!0),te="panel",D=H.useObservable(k.currentUser$),Z=m.useMemo(()=>{var ie;const s=x==="all"?p:(ie=p.filter(O=>O.subUnitId===j))!=null?ie:[],$=f!=null?f:O=>O,oe=s.map(O=>{var q;return{...O.root,children:(q=O.children)!=null?q:[],users:O.relativeUsers}});if(C){const O=new Map;return oe.forEach(q=>{O.set(q.id,q)}),[...C,""].map(q=>O.get(q)).filter(Boolean)}else return $(oe)},[C,x,p,f,j]),V=m.useMemo(()=>[...Z.filter(s=>!s.resolved),...Z.filter(s=>s.resolved)],[Z]),J=m.useMemo(()=>U==="resolved"?V.filter(s=>s.resolved):U==="unsolved"?V.filter(s=>!s.resolved):U==="concern_me"&&D!=null&&D.userID?V.filter(s=>s==null?void 0:s.users.has(D.userID)):V,[V,D==null?void 0:D.userID,U]),G=E?[E,...J]:J,ne=G.filter(s=>!s.resolved),Y=G.filter(s=>s.resolved),Q=U!=="all"||x!=="all",re=()=>{w("all"),R("all")};m.useEffect(()=>{e&&S(u.getUnit(e))},[e,u,z]),m.useEffect(()=>{var O;if(!g)return;if(!K.current){K.current=!0;return}const{unitId:s,subUnitId:$,commentId:oe}=g,ie=`${te}-${s}-${$}-${oe}`;(O=document.getElementById(ie))==null||O.scrollIntoView({block:"center"})},[g]);const N=s=>i.jsx(Ne,{prefix:te,getSubUnitName:d,id:s.id,unitId:s.unitId,subUnitId:s.subUnitId,refStr:s.ref,type:r,showEdit:(g==null?void 0:g.commentId)===s.id,showHighlight:(g==null?void 0:g.commentId)===s.id,onClick:()=>{K.current=!1,s.resolved?P.executeCommand(B.id):P.executeCommand(B.id,{unitId:s.unitId,subUnitId:s.subUnitId,commentId:s.id,temp:!1})},onMouseEnter:()=>b==null?void 0:b(s),onMouseLeave:()=>h==null?void 0:h(s),onAddComment:y,onDeleteComment:_,onResolve:$=>c==null?void 0:c(s.id,$)},s.id);return i.jsxs("div",{className:ee.threadCommentPanel,children:[i.jsxs("div",{className:ee.threadCommentPanelForms,children:[r===a.UniverInstanceType.UNIVER_SHEET?i.jsx(L.Select,{borderless:!0,value:x,onChange:s=>R(s),options:[{value:"current",label:T.t("threadCommentUI.filter.sheet.current")},{value:"all",label:T.t("threadCommentUI.filter.sheet.all")}]}):null,i.jsx(L.Select,{borderless:!0,value:U,onChange:s=>w(s),options:[{value:"all",label:T.t("threadCommentUI.filter.status.all")},{value:"resolved",label:T.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:T.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:T.t("threadCommentUI.filter.status.concernMe")}]})]}),ne.map(N),Y.length?i.jsx("div",{className:ee.threadCommentPanelSolved,children:"已解决"}):null,Y.map(N),G.length?null:i.jsxs("div",{className:ee.threadCommentPanelEmpty,children:[Q?T.t("threadCommentUI.panel.filterEmpty"):T.t("threadCommentUI.panel.empty"),Q?i.jsx(L.Button,{onClick:re,type:"link",children:T.t("threadCommentUI.panel.reset")}):i.jsxs(L.Button,{id:"thread-comment-add",className:ee.threadCommentPanelAdd,type:"primary",onClick:o,disabled:v,children:[i.jsx(be,{}),T.t("threadCommentUI.panel.addComment")]})]})]})};exports.SetActiveCommentOperation=B;exports.THREAD_COMMENT_PANEL=ve;exports.ThreadCommentPanel=Mt;exports.ThreadCommentTree=Ne;exports.ToggleSheetCommentPanelOperation=pe;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={threadCommentUI:{panel:{title:"Comment Management",empty:"No comments yet",filterEmpty:"No match result",reset:"Reset Filter",addComment:"Add Comment"},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"}}}};module.exports=e;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={threadCommentUI:{panel:{title:"مدیریت نظرات",empty:"هنوز نظری وجود ندارد",filterEmpty:"نتیجه ای یافت نشد",reset:"بازنشانی فیلتر",addComment:"افزودن نظر"},editor:{placeholder:"پاسخ یا اضافه کردن دیگران با @",reply:"نظر",cancel:"انصراف",save:"ذخیره"},item:{edit:"ویرایش",delete:"حذف این نظر"},filter:{sheet:{all:"همه برگهها",current:"برگه فعلی"},status:{all:"همه نظرات",resolved:"حل شده",unsolved:"حل نشده",concernMe:"موضوع مربوط به من"}}}};module.exports=e;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={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"},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"}}}};module.exports=e;
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={threadCommentUI:{panel:{title:"Comment Management",empty:"No comments yet",filterEmpty:"No match result",reset:"Reset Filter",addComment:"Add Comment"},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"}}}};module.exports=e;
|
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={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"},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"}}}};module.exports=e;
|
package/lib/cjs/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={threadCommentUI:{panel:{title:"评论管理",empty:"暂无评论",filterEmpty:"没有匹配的结果",reset:"重置",addComment:"添加评论"},editor:{placeholder:"回复",reply:"回复",cancel:"取消",save:"保存"},item:{edit:"编辑",delete:"删除"},filter:{sheet:{all:"所有表格",current:"当前表格"},status:{all:"所有评论",resolved:"已解决",unsolved:"未解决",concernMe:"与我有关"}}}};module.exports=e;
|
package/lib/cjs/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e={threadCommentUI:{panel:{title:"評論管理",empty:"暫無評論",filterEmpty:"沒有符合的結果",reset:"重置",addComment:"新增評論"},editor:{placeholder:"回覆",reply:"回覆",cancel:"取消",save:"儲存"},item:{edit:"編輯",delete:"刪除"},filter:{sheet:{all:"所有表格",current:"當前表格"},status:{all:"所有評論",resolved:"已解決",unsolved:"未解決",concernMe:"與我有關"}}}};module.exports=e;
|