@labelbee/lb-components 1.20.0-alpha.1 → 1.20.0-alpha.10
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/dist/assets/annotation/video/icon_timePoint.svg.js +1 -0
- package/dist/assets/annotation/video/icon_videoCut.svg.js +1 -0
- package/dist/assets/annotation/video/icon_videoCutting.svg.js +1 -0
- package/dist/components/LLMToolView/sidebar/components/answerList/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.js +2 -1
- package/dist/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -0
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -1
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.module.scss.js +1 -0
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/audioAnnotate/textInput/index.js +1 -1
- package/dist/components/latexEditor/constant/config.js +1 -0
- package/dist/components/latexEditor/index.js +1 -0
- package/dist/components/latexEditor/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/index.js +1 -1
- package/dist/components/videoAnnotate/videoClipTool/VideoClipToolContext.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/ToolTipForClip.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/annotatedList/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/annotatedList/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/components/videoTrack/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/constant.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.js +1 -0
- package/dist/components/videoAnnotate/videoClipTool/index.module.scss.js +1 -0
- package/dist/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -0
- package/dist/components/videoAnnotate/videoTextTool/index.js +1 -0
- package/dist/components/videoPlayer/VideoTagLayer.js +1 -1
- package/dist/components/videoPlayer/VideoTextLayer.js +2 -0
- package/dist/components/videoPlayer/components/controller/index.js +1 -1
- package/dist/components/videoPlayer/index.js +1 -1
- package/dist/components/videoPlayer/utils.js +1 -1
- package/dist/index.css +367 -2
- package/dist/index.js +1 -1
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/types/App.d.ts +2 -2
- package/dist/types/components/LLMToolView/sidebar/components/textEditor/index.d.ts +1 -0
- package/dist/types/components/LLMToolView/types.d.ts +1 -0
- package/dist/types/components/audioAnnotate/index.d.ts +1 -1
- package/dist/types/components/latexEditor/constant/config.d.ts +18 -0
- package/dist/types/components/latexEditor/index.d.ts +12 -0
- package/dist/types/components/pointCloudView/PointCloud2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloud3DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudBackView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudListener.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegment.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegment2DView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSegmentListener.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudSideView.d.ts +1 -1
- package/dist/types/components/pointCloudView/PointCloudTopView.d.ts +3 -3
- package/dist/types/components/pointCloudView/index.d.ts +3 -3
- package/dist/types/components/videoAnnotate/index.d.ts +18 -7
- package/dist/types/components/videoAnnotate/videoClipTool/VideoClipToolContext.d.ts +27 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/ToolTipForClip.d.ts +8 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/annotatedList/index.d.ts +7 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.d.ts +14 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.d.ts +18 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.d.ts +6 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.d.ts +3 -0
- package/dist/types/components/videoAnnotate/videoClipTool/components/videoTrack/index.d.ts +11 -0
- package/dist/types/components/videoAnnotate/videoClipTool/constant.d.ts +26 -0
- package/dist/types/components/videoAnnotate/videoClipTool/index.d.ts +131 -0
- package/dist/types/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptor.d.ts +6 -10
- package/dist/types/components/videoAnnotate/videoTextTool/index.d.ts +56 -0
- package/dist/types/components/videoPlayer/VideoTagLayer.d.ts +1 -0
- package/dist/types/components/videoPlayer/VideoTextLayer.d.ts +2 -0
- package/dist/types/components/videoPlayer/components/controller/index.d.ts +4 -2
- package/dist/types/components/videoPlayer/index.d.ts +11 -0
- package/dist/types/components/videoPlayer/utils.d.ts +6 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/views/MainView/sidebar/TextToolSidebar/index.d.ts +2 -1
- package/dist/utils/audio.js +1 -1
- package/dist/views/MainView/LLMLayout/index.js +1 -1
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/es/assets/annotation/video/icon_timePoint.svg.js +1 -0
- package/es/assets/annotation/video/icon_videoCut.svg.js +1 -0
- package/es/assets/annotation/video/icon_videoCutting.svg.js +1 -0
- package/es/components/LLMToolView/sidebar/components/answerList/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.js +2 -1
- package/es/components/LLMToolView/sidebar/components/textEditor/index.module.scss.js +1 -0
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -1
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.module.scss.js +1 -0
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/audioAnnotate/textInput/index.js +1 -1
- package/es/components/latexEditor/constant/config.js +1 -0
- package/es/components/latexEditor/index.js +1 -0
- package/es/components/latexEditor/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/index.js +1 -1
- package/es/components/videoAnnotate/videoClipTool/VideoClipToolContext.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/ToolTipForClip.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/annotatedList/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/annotatedList/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/resizableSnippet/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/timeSliceRange/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoClipToolHotkey/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTimeSlicesOverVideo/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTrack/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/components/videoTrack/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/constant.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.js +1 -0
- package/es/components/videoAnnotate/videoClipTool/index.module.scss.js +1 -0
- package/es/components/videoAnnotate/videoTagTool/TagToolInstanceAdaptor.js +1 -0
- package/es/components/videoAnnotate/videoTextTool/index.js +1 -0
- package/es/components/videoPlayer/VideoTagLayer.js +1 -1
- package/es/components/videoPlayer/VideoTextLayer.js +2 -0
- package/es/components/videoPlayer/components/controller/index.js +1 -1
- package/es/components/videoPlayer/index.js +1 -1
- package/es/components/videoPlayer/utils.js +1 -1
- package/es/index.css +367 -2
- package/es/index.js +1 -1
- package/es/store/annotation/reducer.js +1 -1
- package/es/utils/audio.js +1 -1
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/TextToolSidebar/index.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/package.json +6 -4
- package/dist/components/videoPlayer/TagToolInstanceAdaptor.js +0 -1
- package/es/components/videoPlayer/TagToolInstanceAdaptor.js +0 -1
- /package/dist/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.js +0 -0
- /package/dist/types/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.d.ts +0 -0
- /package/es/components/{videoPlayer → videoAnnotate/videoTagTool}/TagToolInstanceAdaptorI18nProvider.js +0 -0
package/es/index.css
CHANGED
|
@@ -24,6 +24,350 @@
|
|
|
24
24
|
.index-module_imgView__wmxDk .index-module_item__-80YI .index-module_image__V49oW .ant-image {
|
|
25
25
|
display: flex;
|
|
26
26
|
}
|
|
27
|
+
.index-module_latexEditor__0fK8G {
|
|
28
|
+
line-height: 32px;
|
|
29
|
+
background-color: #ededed;
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
position: relative;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.index-module_latexHeaderTitle__JIpOj {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
padding: 0px 12px;
|
|
37
|
+
display: inline-block;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.index-module_dropContent__XVBYH {
|
|
41
|
+
display: flex;
|
|
42
|
+
box-shadow: 0px 2px 14px 2px rgba(204, 204, 204, 0.5);
|
|
43
|
+
min-width: 400px;
|
|
44
|
+
overflow: auto;
|
|
45
|
+
min-height: 300px;
|
|
46
|
+
max-height: 600px;
|
|
47
|
+
background: #fff;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.index-module_itemList__Y3q0e {
|
|
51
|
+
height: 100%;
|
|
52
|
+
border-right: 1px solid #eee;
|
|
53
|
+
}
|
|
54
|
+
.index-module_itemList__Y3q0e .index-module_item__q4v2V {
|
|
55
|
+
padding: 6px 12px;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.index-module_itemActive__a5EPl {
|
|
63
|
+
background: #e6f7ff;
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.index-module_lastNode__TXbWG {
|
|
68
|
+
width: 380px;
|
|
69
|
+
display: flex;
|
|
70
|
+
padding: 4px;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
}
|
|
73
|
+
.index-module_lastNode__TXbWG .index-module_markdownItem__AkW22 {
|
|
74
|
+
padding: 2px 4px;
|
|
75
|
+
margin: 4px;
|
|
76
|
+
min-width: 40px;
|
|
77
|
+
height: auto;
|
|
78
|
+
background-color: #ebebeb;
|
|
79
|
+
}
|
|
80
|
+
.index-module_lastNode__TXbWG .index-module_markdownItem__AkW22 .markdown-body {
|
|
81
|
+
background-color: #ebebeb;
|
|
82
|
+
}
|
|
83
|
+
.index-module_form__IypXc {
|
|
84
|
+
margin-bottom: 16px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.index-module_outputDisplay__5dS48 .index-module_title__vhMCp {
|
|
88
|
+
line-height: 32px;
|
|
89
|
+
margin-bottom: 8px;
|
|
90
|
+
}
|
|
91
|
+
.index-module_outputDisplay__5dS48 .index-module_content__Iml6l {
|
|
92
|
+
border: 1px solid #d9d9d9;
|
|
93
|
+
min-height: 100px;
|
|
94
|
+
overflow: auto;
|
|
95
|
+
max-height: 200px;
|
|
96
|
+
background-color: #ffffff;
|
|
97
|
+
padding: 4px 12px;
|
|
98
|
+
}
|
|
99
|
+
.index-module_outputDisplay__5dS48 .index-module_content__Iml6l .markdown-body {
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
}
|
|
102
|
+
.index-module_form__rwjRm {
|
|
103
|
+
margin-bottom: 16px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.index-module_outputDisplay__hCLyn .index-module_title__vPA3N {
|
|
107
|
+
line-height: 32px;
|
|
108
|
+
margin-bottom: 8px;
|
|
109
|
+
}
|
|
110
|
+
.index-module_outputDisplay__hCLyn .index-module_content__dl4N9 {
|
|
111
|
+
min-height: 100px;
|
|
112
|
+
overflow: auto;
|
|
113
|
+
max-height: 200px;
|
|
114
|
+
background-color: #ffffff;
|
|
115
|
+
padding: 4px 12px;
|
|
116
|
+
border: 1px solid #d9d9d9;
|
|
117
|
+
}
|
|
118
|
+
.index-module_outputDisplay__hCLyn .index-module_content__dl4N9 .markdown-body {
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.index-module_textTitle__o8hrm {
|
|
123
|
+
font-size: 16px;
|
|
124
|
+
line-height: 22px;
|
|
125
|
+
font-weight: 500;
|
|
126
|
+
color: #333333;
|
|
127
|
+
margin-bottom: 8px;
|
|
128
|
+
white-space: pre-wrap;
|
|
129
|
+
word-break: break-all;
|
|
130
|
+
}
|
|
131
|
+
.index-module_timeSliceInputContainer__579hr {
|
|
132
|
+
height: 120px;
|
|
133
|
+
padding: 16px;
|
|
134
|
+
}
|
|
135
|
+
.index-module_timeSliceInputContainer__579hr .index-module_title__9kdsk {
|
|
136
|
+
margin-bottom: 16px;
|
|
137
|
+
margin-bottom: 8px;
|
|
138
|
+
color: rgba(0, 0, 0, 0.85);
|
|
139
|
+
font-weight: 500;
|
|
140
|
+
font-size: 14px;
|
|
141
|
+
font-family: SourceHanSansCN-Medium;
|
|
142
|
+
}
|
|
143
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputWrapper__uXmv- {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
align-items: center;
|
|
147
|
+
}
|
|
148
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputWrapper__uXmv- .index-module_getCurr__-dchP {
|
|
149
|
+
margin-top: 8px;
|
|
150
|
+
color: #666fff;
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputWrapper__uXmv- .index-module_getCurr__-dchP.index-module_disabled__j6aK6 {
|
|
155
|
+
color: #ccc;
|
|
156
|
+
cursor: not-allowed;
|
|
157
|
+
}
|
|
158
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputContainer__PqtI8 {
|
|
159
|
+
display: flex;
|
|
160
|
+
}
|
|
161
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputContainer__PqtI8 .index-module_inputWrapper__uXmv- {
|
|
162
|
+
width: 92px;
|
|
163
|
+
}
|
|
164
|
+
.index-module_timeSliceInputContainer__579hr .index-module_inputContainer__PqtI8 .index-module_spliter__wXZhC {
|
|
165
|
+
flex: 1;
|
|
166
|
+
}
|
|
167
|
+
.index-module_textOverflow__HcSP3 {
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
text-overflow: ellipsis;
|
|
171
|
+
}
|
|
172
|
+
.index-module_videoTrackContainer__0oBy3 {
|
|
173
|
+
position: absolute;
|
|
174
|
+
bottom: 0px;
|
|
175
|
+
width: 100%;
|
|
176
|
+
overflow-x: hidden;
|
|
177
|
+
overflow-y: auto;
|
|
178
|
+
background-color: #333333;
|
|
179
|
+
}
|
|
180
|
+
.index-module_videoTrackContainer__0oBy3 .index-module_timeTrack__f--CU {
|
|
181
|
+
height: 24px;
|
|
182
|
+
border-bottom: 1px solid #555555;
|
|
183
|
+
box-sizing: border-box;
|
|
184
|
+
}
|
|
185
|
+
.index-module_videoTrackContainer__0oBy3 .index-module_videoTrack__auEud {
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column-reverse;
|
|
188
|
+
height: 90px;
|
|
189
|
+
overflow-x: hidden;
|
|
190
|
+
overflow-y: auto;
|
|
191
|
+
}
|
|
192
|
+
.index-module_videoTrackContainer__0oBy3 .index-module_videoTrack__auEud .index-module_track__N8mLd {
|
|
193
|
+
position: relative;
|
|
194
|
+
flex: 0 0 45px;
|
|
195
|
+
border-bottom: 1px solid #555555;
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
}
|
|
198
|
+
.index-module_videoTrackContainer__0oBy3 .index-module_timeline__GppcX {
|
|
199
|
+
position: absolute;
|
|
200
|
+
top: 50%;
|
|
201
|
+
transform: translateY(-50%);
|
|
202
|
+
display: inline-block;
|
|
203
|
+
height: 100%;
|
|
204
|
+
top: 0;
|
|
205
|
+
left: 0;
|
|
206
|
+
width: 2px;
|
|
207
|
+
z-index: 10;
|
|
208
|
+
height: 100%;
|
|
209
|
+
}
|
|
210
|
+
.index-module_videoTrackContainer__0oBy3 .index-module_displayTime__h0Lg7 {
|
|
211
|
+
position: absolute;
|
|
212
|
+
top: 0;
|
|
213
|
+
left: -1;
|
|
214
|
+
z-index: 11;
|
|
215
|
+
width: 68px;
|
|
216
|
+
padding: 5px;
|
|
217
|
+
color: black;
|
|
218
|
+
font-size: 14px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.index-module_textOverflow__jf6jA {
|
|
222
|
+
white-space: nowrap;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
}
|
|
226
|
+
.index-module_clipToolbar__amC2X {
|
|
227
|
+
display: flex;
|
|
228
|
+
vertical-align: middle;
|
|
229
|
+
}
|
|
230
|
+
.index-module_clipToolbar__amC2X .index-module_buttonWrapper__o1C44 {
|
|
231
|
+
display: flex;
|
|
232
|
+
margin-left: 16px;
|
|
233
|
+
}
|
|
234
|
+
.index-module_clipToolbar__amC2X .index-module_cutButton__M6mOs,
|
|
235
|
+
.index-module_clipToolbar__amC2X .index-module_localButton__6D1-H {
|
|
236
|
+
display: inline-block;
|
|
237
|
+
align-self: center;
|
|
238
|
+
width: 20px;
|
|
239
|
+
height: 20px;
|
|
240
|
+
margin-right: 5px;
|
|
241
|
+
color: #bbbbbb;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
}
|
|
244
|
+
.index-module_clipToolbar__amC2X .index-module_cutButton__M6mOs {
|
|
245
|
+
margin-left: 20px;
|
|
246
|
+
}
|
|
247
|
+
.index-module_clipToolbar__amC2X .index-module_localButton__6D1-H {
|
|
248
|
+
margin-left: 10px;
|
|
249
|
+
}
|
|
250
|
+
.index-module_timeSliceListContent__gvFHy {
|
|
251
|
+
height: 224px;
|
|
252
|
+
overflow-y: auto;
|
|
253
|
+
font-size: 12px;
|
|
254
|
+
background-color: #fafafa;
|
|
255
|
+
}
|
|
256
|
+
.index-module_timeSliceListContent__gvFHy.index-module_empty__wcFM6 {
|
|
257
|
+
display: flex;
|
|
258
|
+
justify-content: center;
|
|
259
|
+
}
|
|
260
|
+
.index-module_timeSliceListContent__gvFHy.index-module_empty__wcFM6 .index-module_noContent__zjGb0 {
|
|
261
|
+
align-self: center;
|
|
262
|
+
color: #999999;
|
|
263
|
+
}
|
|
264
|
+
.index-module_timeSliceListContent__gvFHy.index-module_empty__wcFM6 .index-module_noContent__zjGb0 > div {
|
|
265
|
+
margin-bottom: 10px;
|
|
266
|
+
text-align: center;
|
|
267
|
+
}
|
|
268
|
+
.index-module_timeSliceListContent__gvFHy.index-module_empty__wcFM6 .index-module_noContent__zjGb0 .index-module_hotkey__dDkgv {
|
|
269
|
+
display: inline-block;
|
|
270
|
+
width: 20px;
|
|
271
|
+
height: 20px;
|
|
272
|
+
margin-right: 5px;
|
|
273
|
+
line-height: 20px;
|
|
274
|
+
text-align: center;
|
|
275
|
+
border: 1px #ccc solid;
|
|
276
|
+
}
|
|
277
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ {
|
|
278
|
+
display: flex;
|
|
279
|
+
padding: 12px;
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
}
|
|
282
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ.index-module_timeSliceItemActivated__Zlb3b {
|
|
283
|
+
color: #666fff;
|
|
284
|
+
background-color: #ebecfb;
|
|
285
|
+
}
|
|
286
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ .index-module_timeSliceAttribute__Q5E-f {
|
|
287
|
+
overflow: hidden;
|
|
288
|
+
white-space: nowrap;
|
|
289
|
+
text-overflow: ellipsis;
|
|
290
|
+
}
|
|
291
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ .index-module_timeSliceItemContent__Aqa8l {
|
|
292
|
+
flex: 1;
|
|
293
|
+
white-space: nowrap;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
text-overflow: ellipsis;
|
|
296
|
+
}
|
|
297
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ .index-module_timeSliceItemDeleteIcon__nlQ6B {
|
|
298
|
+
align-self: center;
|
|
299
|
+
padding: 5px;
|
|
300
|
+
opacity: 0;
|
|
301
|
+
transition: opacity 0.3s ease-in-out;
|
|
302
|
+
}
|
|
303
|
+
.index-module_timeSliceListContent__gvFHy .index-module_timeSliceItem__Xa-cQ:hover .index-module_timeSliceItemDeleteIcon__nlQ6B {
|
|
304
|
+
opacity: 1;
|
|
305
|
+
}
|
|
306
|
+
.index-module_clipContainer__L8DlL {
|
|
307
|
+
width: 100%;
|
|
308
|
+
height: 100%;
|
|
309
|
+
position: relative;
|
|
310
|
+
display: flex;
|
|
311
|
+
flex-direction: column;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.index-module_containerWrapper__49TNa {
|
|
315
|
+
position: relative;
|
|
316
|
+
flex: 1;
|
|
317
|
+
overflow: hidden;
|
|
318
|
+
display: flex;
|
|
319
|
+
flex-direction: column;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.video-tool-spinner {
|
|
323
|
+
height: calc(100vh - 60px);
|
|
324
|
+
}
|
|
325
|
+
.video-tool-spinner .ant-spin-container {
|
|
326
|
+
height: 100%;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.index-module_clipping__M-9B2 {
|
|
330
|
+
position: absolute;
|
|
331
|
+
top: 80px;
|
|
332
|
+
left: 56px;
|
|
333
|
+
width: 72px;
|
|
334
|
+
height: 24px;
|
|
335
|
+
}
|
|
336
|
+
.index-module_videoTimeSlices__v-2k1 {
|
|
337
|
+
position: absolute;
|
|
338
|
+
top: 0;
|
|
339
|
+
right: 0;
|
|
340
|
+
max-height: calc(100% - 80px - 90px - 24px);
|
|
341
|
+
padding-right: 4px;
|
|
342
|
+
overflow: auto;
|
|
343
|
+
z-index: 22;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.index-module_timeSliceWrapper__kebC3 {
|
|
347
|
+
height: 80px;
|
|
348
|
+
margin-bottom: 8px;
|
|
349
|
+
transition: opacity 0.4s ease-in-out;
|
|
350
|
+
opacity: 0.3;
|
|
351
|
+
}
|
|
352
|
+
.index-module_timeSliceWrapper__kebC3.index-module_active__cIGVq {
|
|
353
|
+
opacity: 1;
|
|
354
|
+
}
|
|
355
|
+
.index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH,
|
|
356
|
+
.index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 {
|
|
357
|
+
height: 40px;
|
|
358
|
+
font-size: 16px;
|
|
359
|
+
color: white;
|
|
360
|
+
}
|
|
361
|
+
.index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemText__FJFwH {
|
|
362
|
+
background-color: #CCC;
|
|
363
|
+
padding: 8px 24px;
|
|
364
|
+
}
|
|
365
|
+
.index-module_timeSliceWrapper__kebC3 .index-module_timeSliceItemAttribute__--3E1 span {
|
|
366
|
+
display: inline-block;
|
|
367
|
+
height: 40px;
|
|
368
|
+
line-height: 40px;
|
|
369
|
+
padding: 0 24px;
|
|
370
|
+
}
|
|
27
371
|
.index-module_speedControllerWrap__aFz7r {
|
|
28
372
|
display: flex;
|
|
29
373
|
color: white;
|
|
@@ -1650,6 +1994,13 @@
|
|
|
1650
1994
|
overflow-y: scroll;
|
|
1651
1995
|
}
|
|
1652
1996
|
|
|
1997
|
+
.textToolSwitchItem {
|
|
1998
|
+
display: flex;
|
|
1999
|
+
justify-content: space-between;
|
|
2000
|
+
margin-top: 20px;
|
|
2001
|
+
font-size: 12px;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
1653
2004
|
.textareaContainer {
|
|
1654
2005
|
position: relative;
|
|
1655
2006
|
padding: 0;
|
|
@@ -1874,11 +2225,20 @@
|
|
|
1874
2225
|
flex-direction: column;
|
|
1875
2226
|
background-color: black;
|
|
1876
2227
|
overflow: hidden;
|
|
2228
|
+
flex: 1 1;
|
|
1877
2229
|
}
|
|
1878
2230
|
.bee-video-wrapper .bee-video-container {
|
|
1879
|
-
|
|
2231
|
+
height: calc(100% - 80px);
|
|
1880
2232
|
overflow: hidden;
|
|
1881
2233
|
position: relative;
|
|
2234
|
+
display: flex;
|
|
2235
|
+
flex-direction: column;
|
|
2236
|
+
}
|
|
2237
|
+
.bee-video-wrapper .bee-video-container .bee-video {
|
|
2238
|
+
flex: 1 1;
|
|
2239
|
+
}
|
|
2240
|
+
.bee-video-wrapper .bee-video-container .bee-video-track {
|
|
2241
|
+
height: calc(100% - 90px - 24px);
|
|
1882
2242
|
}
|
|
1883
2243
|
|
|
1884
2244
|
.bee-video-progress {
|
|
@@ -1926,7 +2286,10 @@
|
|
|
1926
2286
|
}
|
|
1927
2287
|
|
|
1928
2288
|
.bee-video-controller__wrapper {
|
|
1929
|
-
position:
|
|
2289
|
+
position: absolute;
|
|
2290
|
+
bottom: 0px;
|
|
2291
|
+
left: 0px;
|
|
2292
|
+
right: 0px;
|
|
1930
2293
|
}
|
|
1931
2294
|
|
|
1932
2295
|
.bee-video-controller {
|
|
@@ -2454,6 +2817,8 @@
|
|
|
2454
2817
|
font-weight: 500;
|
|
2455
2818
|
font-size: 18px;
|
|
2456
2819
|
margin-bottom: 24px;
|
|
2820
|
+
display: flex;
|
|
2821
|
+
align-items: center;
|
|
2457
2822
|
}
|
|
2458
2823
|
.bee-LLMView__content {
|
|
2459
2824
|
font-weight: 500;
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";import{i18n as c}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import n,{useState as d,useImperativeHandle as m}from"react";import{I18nextProvider as f}from"react-i18next";import{Provider as u}from"react-redux";import w from"./App.js";import x from"./configureStore.js";import{PageBackward as
|
|
1
|
+
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";import{i18n as c}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import n,{useState as d,useImperativeHandle as m}from"react";import{I18nextProvider as f}from"react-i18next";import{Provider as u}from"react-redux";import w from"./App.js";import x from"./configureStore.js";import{PageBackward as g,PageForward as P,PageJump as v}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as _}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as T}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var j=Object.defineProperty,V=Object.defineProperties,b=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,s=(o,e,t)=>e in o?j(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,A=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&s(o,t,e[t]);if(p)for(var t of p(e))O.call(e,t)&&s(o,t,e[t]);return o},E=(o,e)=>V(o,b(e));const r=x(),y=(o,e)=>{const[t,l]=d();return m(e,()=>({toolInstance:t,annotationEngine:r.getState().annotation.annotationEngine,pageBackwardActions:()=>r.dispatch(g()),pageForwardActions:()=>r.dispatch(P()),pageJump:a=>{const i=~~a-1;r.dispatch(v(i))},hello:()=>alert("hello labelBee!!!")}),[t]),n.createElement(u,{store:r,context:T},n.createElement(f,{i18n:c},n.createElement(_,null,n.createElement(w,E(A({},o),{setToolInstance:a=>{var i;l(a),(i=o.onLoad)==null||i.call(o,{toolInstance:a})}})))))};var C=n.forwardRef(y);export{C as default,r as store};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFormatSize as Et}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import St from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as U}from"../../utils/index.js";import W from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as At}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as lt,composeResult as Y}from"../../utils/data.js";import N from"../../utils/StepUtils.js";import J from"../../utils/ToolUtils.js";import{MathUtils as it,CommonToolUtils as Dt,AnnotationEngine as vt,ImgUtils as yt}from"@labelbee/lb-annotation";import{PointCloudUtils as rt,i18n as F}from"@labelbee/lb-utils";import{Modal as ut}from"antd";import{message as at}from"antd/es";import ct from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as dt}from"../../data/enums/ToolType.js";var Rt=Object.defineProperty,Pt=Object.defineProperties,Ct=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,gt=(t,e,r)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n=(t,e)=>{for(var r in e||(e={}))ht.call(e,r)&>(t,r,e[r]);if(pt)for(var r of pt(e))Ot.call(e,r)&>(t,r,e[r]);return t},l=(t,e)=>Pt(t,Ct(e)),_t=(t,e,r)=>new Promise((E,d)=>{var f=m=>{try{A(r.next(m))}catch(y){d(y)}},S=m=>{try{A(r.throw(m))}catch(y){d(y)}},A=m=>m.done?E(m.value):Promise.resolve(m.value).then(f,S);A((r=r.apply(t,e)).next())});const B=(t,e)=>t.find(r=>r.step===e),It={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},bt=t=>{const{imgList:e,imgPageSize:r}=t;return Math.ceil(e.length/r)},mt=(t,e)=>t.reduce((r,E)=>{if(E){const d=E.result;if(U(d)[`step_${e}`])return r+1}return r},0)/t.length,Ut=(t,e)=>{const{step:r,stepList:E}=t,d=N.getCurrentStepInfo(r,E),f=At.jsonParser(d.config);if(J.isVideoTool(d==null?void 0:d.tool)||J.isAudioTool(d==null?void 0:d.tool)||J.isPointCloudTool(d==null?void 0:d.tool)||dt.LLM===(d==null?void 0:d.tool))return;const S=document.getElementById("toolContainer");if(!S)throw"Not exist dom named id-toolContainer";const A=Et({width:window.innerWidth,height:window.innerHeight}),m=new vt({container:S,toolName:d.tool,size:A,imgNode:e,config:f,style:JSON.parse(St)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},Nt=(t,e)=>(r,E)=>_t(void 0,null,function*(){var d;const{stepList:f,step:S}=E().annotation,A=N.currentToolIsVideo(S,f),m=N.currentToolIsPointCloud(S,f),y=((d=N.getCurrentStepInfo(S,f))==null?void 0:d.tool)===dt.LLM,h=N.currentToolIsAudio(S,f);if($(r,!0),yield r(Bt(t)),A||m||y||h){r(wt(t));return}r(xt(t,e))}),Bt=t=>(e,r)=>_t(void 0,null,function*(){const{getFileData:E,imgList:d}=r().annotation;if(E){const f=yield E(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:f,index:t}})}}),wt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},xt=(t,e)=>(r,E)=>{var d;const{toolInstance:f,imgList:S}=E().annotation,A=(d=S==null?void 0:S[t])==null?void 0:d.url;yt.load(A).then(m=>{$(r,!1),r({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),f==null||f.setErrorImg(),r({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ft=({toolInstance:t,imgList:e,imgIndex:r,stepList:E,step:d=1})=>{var f,S,A,m;const y=((f=e[r])==null?void 0:f.result)||"",[h,j,G]=(S=t==null?void 0:t.exportData())!=null?S:[],V=(m=(A=t==null?void 0:t.exportCustomData)==null?void 0:A.call(t))!=null?m:{},M=lt(y,j),k=Y(M,{step:d,stepList:E},{rect:h},V);return e.map((w,H)=>H===r?n(l(n({},w),{result:k}),G):n({},w))},jt=(t=n({},It),e)=>{var r,E,d,f,S,A,m,y,h,j,G,V,M,k,w,H,X,q,Z,Q,tt,et,ot;switch(e.type){case i.INIT_ALL_STATE:return n(n({},t),It);case i.UPDATE_TOOL_INSTANCE:return l(n({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return l(n({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:o,step:s}=t,u=mt(o,s);return l(n({},t),{stepProgress:u})}case i.SUBMIT_FILE_DATA:{const{imgList:o,imgIndex:s,step:u,stepList:a,toolInstance:p,onSubmit:c,resultList:T}=t;if(!p||!o[s])return t;const _=((r=o[s])==null?void 0:r.result)||"",[,g,I]=(E=p==null?void 0:p.exportData())!=null?E:[],L=(f=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?f:{},D=lt(_,g),R=Y(D,{step:u,stepList:a},{rect:T},L),v=t.imgList.map((C,P)=>{if(P===s){const x=W.dataCorrection(R,_,u,a);return n(l(n({},C),{result:x}),I)}return C});if(((S=e.payload)==null?void 0:S.submitType)===K.SyncImgList)return l(n({},t),{imgList:v});c&&c([v[s]],(A=e.payload)==null?void 0:A.submitType,s,v);const O=mt(v,u);return l(n({},t),{stepProgress:O,imgList:v})}case i.SAVE_RESULT:{const{imgList:o,imgIndex:s,onSave:u}=t;return u==null||u(o[s],s,o),n({},t)}case i.SUBMIT_RESULT:{const{imgList:o,basicIndex:s,resultList:u,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(m=a==null?void 0:a.exportData())!=null?m:[];let T=c;if((p==null?void 0:p.length)>0){const _=(y=p[s])==null?void 0:y.id,g=c.map(I=>l(n({},I),{sourceID:_}));T=ct.cloneDeep(u).filter(I=>I.sourceID!==_),T.push(...g)}return l(n({},t),{resultList:T,imgList:o})}case i.SET_BASIC_INDEX:{const{toolInstance:o,step:s,imgList:u,imgIndex:a,stepList:p,annotationEngine:c,resultList:T,basicResultList:_}=t;if(!o||!c)return t;const g=e.payload.basicIndex,I=(h=_[g])==null?void 0:h.id,L=U((j=u[a])==null?void 0:j.result),D=(T||[]).filter(x=>x.sourceID===I),R=B(p,s),{dataSourceStep:v,tool:O}=R,C=B(p,v);let P=[];return v&&O&&(P=(G=L[`step_${v}`])==null?void 0:G.result,(P==null?void 0:P.length)>0?(c==null||c.setBasicInfo(C.tool,P[g]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),at.info(F.t("NoDependency")))),o==null||o.setResult(D),o==null||o.history.initRecord(D,!0),l(n({},t),{basicIndex:g})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:o}=e.payload;return l(n({},t),{triggerEventAfterIndexChanged:!!o})}case i.LOAD_FILE_DATA:{const{imgList:o,step:s,toolInstance:u,annotationEngine:a,stepList:p}=t;if(!u)return l(n({},t),{imgIndex:e.payload.nextIndex});const c=N.getCurrentStepInfo(s,p),{nextIndex:T,imgNode:_,nextBasicIndex:g,imgError:I}=e.payload,L=g!=null?g:0,D=U((V=o[T])==null?void 0:V.result),R=D[`step_${c.step}`],v=!R,O={rotate:(M=D.rotate)!=null?M:0,valid:(k=D.valid)!=null?k:!0};_&&I!==!0?a==null||a.setImgNode(_,O):u==null||u.setValid(O.valid);const C=B(p,c.step),{dataSourceStep:P,tool:x}=C,nt=B(p,P),st=P&&x,b=(H=(w=D[`step_${P}`])==null?void 0:w.result)!=null?H:[],z=W.getInitialResultList(R==null?void 0:R.result,u,C,b,v);if(a==null||a.launchOperation(),st&&((b==null?void 0:b.length)>0?a==null||a.setBasicInfo(nt.tool,b[L]):(a==null||a.setBasicInfo(nt.tool),a==null||a.forbidOperation(),at.info(F.t("NoDependency")))),c.tool!=="check"){const ft=(q=(X=b[L])==null?void 0:X.id)!=null?q:"",Tt=st?z.filter(Lt=>Dt.isSameSourceID(Lt.sourceID,ft)):z;u==null||u.history.initRecord(z,!0),u==null||u.setResult(Tt)}return l(n({},t),{imgIndex:T,basicIndex:L,basicResultList:b,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return l(n({},t),{config:(Z=e.payload.config)!=null?Z:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:o}=e.payload;return l(n({},t),{stepList:o})}case i.SET_TASK_CONFIG:{const{stepList:o,step:s}=e.payload;return l(n({},t),{stepList:o,step:s})}case i.INIT_TOOL:{const{imgNode:o}=t,s=Ut(t,o);if(s){const{toolInstance:u,annotationEngine:a}=s;return l(n({},t),{toolInstance:u,annotationEngine:a})}return n({},t)}case i.SET_TOOL:{const o=(Q=e.payload)==null?void 0:Q.instance;return o?l(n({},t),{toolInstance:o}):n({},t)}case i.UPDATE_ON_SUBMIT:return l(n({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return l(n({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return l(n({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return l(n({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return l(n({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return l(n({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return l(n({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return l(n({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return l(n({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return l(n({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return l(n({},t),{preDataProcess:e.payload.preDataProcess});case i.SKIP_BEFORE_PAGE_TURNING:return l(n({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:o,index:s}=e.payload,{imgList:u}=t,a=[...u];return a[s]=n(n({},a[s]),o),l(n({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:o,beforeRotate:s}=t;return s&&s()===!1||o==null||o.updateRotate(),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:o}=t,s=(tt=o==null?void 0:o.valid)!=null?tt:!0;return ut.destroyAll(),ut.confirm({content:F.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{o==null||o.setValid(!s)},okText:F.t("Confirm"),cancelText:F.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:o,imgIndex:s,imgList:u,step:a}=t;if(!o)return t;if(s===0||s>=u.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const p=u[s-1].result;if(!p)return t;const c=W.copyResultChange(p,a,(et=u[s].result)!=null?et:"");u[s]=l(n({},u[s]),{result:c});const _=U(c)[`step_${a}`],g=(_==null?void 0:_.result)||[];return o==null||o.setResult(g),o==null||o.history.pushHistory(g),(ot=o==null?void 0:o.asyncData)==null||ot.call(o,u[s]),l(n({},t),{imgList:[...u]})}case i.SET_STEP:{const{stepList:o,annotationEngine:s}=t,{toStep:u}=e.payload;if(!s)return t;const a=B(o,u);return s==null||s.setToolName(a.tool,a.config),l(n({},t),{step:u,toolInstance:s==null?void 0:s.toolInstance})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:o}=e.payload;return l(n({},t),{loadPCDFileLoading:!!o})}case i.SET_LOADING:{const{loading:o}=e.payload;return l(n({},t),{loading:!!o})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:o}=e.payload;return l(n({},t),{pointCloudLoading:!!o})}case i.SET_CHECK_MODE:{const{checkMode:o}=e.payload;return l(n({},t),{checkMode:!!o})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:o}=e.payload;return l(n({},t),{highlightAttribute:o})}case i.BATCH_UPDATE_TRACK_ID:{const{id:o,newID:s,rangeIndex:u,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(n({},g),{result:rt.batchUpdateTrackID({id:o,newID:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[p]],K.BatchUpdateTrackID,p,_,{updateImgList:T}),l(n({},t),{imgList:_})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:o,newData:s,rangeIndex:u}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,T=[],_=a.map((g,I)=>{if(it.isInRange(I,u)){const L=l(n({},g),{result:rt.batchUpdateResultByTrackID({id:o,newData:s,result:g.result})});return T.push({imgIndex:I,newInfo:L}),L}return g});return c&&c([_[p]],K.BatchUpdateTrackID,p,_,{updateImgList:T}),l(n({},t),{imgList:_})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:o,imgList:s,stepList:u,step:a,predictionResult:p}=t,c={};p.forEach(I=>{const{index:L}=I;c[L]=ct.pick(I,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const T=`step_${a}`,_=[],g=s.map((I,L)=>{if(c[L]){const D=I.result==="{}"?U(Y("",{step:a,stepList:u},{rect:[]},{})):U(I.result);D[T].result.push(c[L]);const R=l(n({},I),{result:JSON.stringify(D)});return _.push({imgIndex:L,newInfo:R}),R}return I});return o==null||o(g,K.BatchUpdateImgList,-1,g,{updateImgList:_}),l(n({},t),{imgList:g})}default:return t}};export{Nt as LoadFileAndFileData,jt as annotationReducer,Ft as composeResultByToolInstance,B as getStepConfig,bt as getTotalPage};
|
|
1
|
+
import{getFormatSize as At}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import Dt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as U}from"../../utils/index.js";import W from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as vt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as rt,composeResult as Y}from"../../utils/data.js";import N from"../../utils/StepUtils.js";import J from"../../utils/ToolUtils.js";import{MathUtils as ut,CommonToolUtils as yt,AnnotationEngine as Rt,ImgUtils as Pt}from"@labelbee/lb-annotation";import{PointCloudUtils as at,i18n as F}from"@labelbee/lb-utils";import{Modal as ct}from"antd";import{message as dt}from"antd/es";import pt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as _t}from"../../data/enums/ToolType.js";var Ct=Object.defineProperty,ht=Object.defineProperties,Ot=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,It=(t,e,r)=>e in t?Ct(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,n=(t,e)=>{for(var r in e||(e={}))bt.call(e,r)&&It(t,r,e[r]);if(gt)for(var r of gt(e))Ut.call(e,r)&&It(t,r,e[r]);return t},l=(t,e)=>ht(t,Ot(e)),mt=(t,e,r)=>new Promise((E,d)=>{var f=m=>{try{A(r.next(m))}catch(y){d(y)}},S=m=>{try{A(r.throw(m))}catch(y){d(y)}},A=m=>m.done?E(m.value):Promise.resolve(m.value).then(f,S);A((r=r.apply(t,e)).next())});const B=(t,e)=>t.find(r=>r.step===e),ft={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},Nt=t=>{const{imgList:e,imgPageSize:r}=t;return Math.ceil(e.length/r)},Tt=(t,e)=>t.reduce((r,E)=>{if(E){const d=E.result;if(U(d)[`step_${e}`])return r+1}return r},0)/t.length,Bt=(t,e)=>{const{step:r,stepList:E}=t,d=N.getCurrentStepInfo(r,E),f=vt.jsonParser(d.config);if(J.isVideoTool(d==null?void 0:d.tool)||J.isAudioTool(d==null?void 0:d.tool)||J.isPointCloudTool(d==null?void 0:d.tool)||_t.LLM===(d==null?void 0:d.tool))return;const S=document.getElementById("toolContainer");if(!S)throw"Not exist dom named id-toolContainer";const A=At({width:window.innerWidth,height:window.innerHeight}),m=new Rt({container:S,toolName:d.tool,size:A,imgNode:e,config:f,style:JSON.parse(Dt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},wt=(t,e)=>(r,E)=>mt(void 0,null,function*(){var d;const{stepList:f,step:S}=E().annotation,A=N.currentToolIsVideo(S,f),m=N.currentToolIsPointCloud(S,f),y=((d=N.getCurrentStepInfo(S,f))==null?void 0:d.tool)===_t.LLM,h=N.currentToolIsAudio(S,f);if($(r,!0),yield r(xt(t)),A||m||y||h){r(Ft(t));return}r(jt(t,e))}),xt=t=>(e,r)=>mt(void 0,null,function*(){const{getFileData:E,imgList:d}=r().annotation;if(E){const f=yield E(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:f,index:t}})}}),Ft=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},jt=(t,e)=>(r,E)=>{var d;const{toolInstance:f,imgList:S}=E().annotation,A=(d=S==null?void 0:S[t])==null?void 0:d.url;Pt.load(A).then(m=>{$(r,!1),r({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(r,!1),f==null||f.setErrorImg(),r({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Gt=({toolInstance:t,imgList:e,imgIndex:r,stepList:E,step:d=1})=>{var f,S,A,m;const y=((f=e[r])==null?void 0:f.result)||"",[h,j,G]=(S=t==null?void 0:t.exportData())!=null?S:[],V=(m=(A=t==null?void 0:t.exportCustomData)==null?void 0:A.call(t))!=null?m:{},M=rt(y,j),k=Y(M,{step:d,stepList:E},{rect:h},V);return e.map((w,H)=>H===r?n(l(n({},w),{result:k}),G):n({},w))},Vt=(t=n({},ft),e)=>{var r,E,d,f,S,A,m,y,h,j,G,V,M,k,w,H,X,q,Z,Q,tt,et,ot,nt,st;switch(e.type){case i.INIT_ALL_STATE:return n(n({},t),ft);case i.UPDATE_TOOL_INSTANCE:return l(n({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return l(n({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:o,step:s}=t,u=Tt(o,s);return l(n({},t),{stepProgress:u})}case i.SUBMIT_FILE_DATA:{const{imgList:o,imgIndex:s,step:u,stepList:a,toolInstance:p,onSubmit:c,resultList:T}=t;if(!p||!o[s])return t;const g=((r=o[s])==null?void 0:r.result)||"",[,_,I]=(E=p==null?void 0:p.exportData())!=null?E:[],L=(f=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?f:{},D=rt(g,_),R=Y(D,{step:u,stepList:a},{rect:T},L),v=t.imgList.map((C,P)=>{if(P===s){const x=W.dataCorrection(R,g,u,a);return n(l(n({},C),{result:x}),I)}return C});if(((S=e.payload)==null?void 0:S.submitType)===K.SyncImgList)return l(n({},t),{imgList:v});c&&c([v[s]],(A=e.payload)==null?void 0:A.submitType,s,v);const O=Tt(v,u);return l(n({},t),{stepProgress:O,imgList:v})}case i.SAVE_RESULT:{const{imgList:o,imgIndex:s,onSave:u}=t;return u==null||u(o[s],s,o),n({},t)}case i.SUBMIT_RESULT:{const{imgList:o,basicIndex:s,resultList:u,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(m=a==null?void 0:a.exportData())!=null?m:[];let T=c;if((p==null?void 0:p.length)>0){const g=(y=p[s])==null?void 0:y.id,_=c.map(I=>l(n({},I),{sourceID:g}));T=pt.cloneDeep(u).filter(I=>I.sourceID!==g),T.push(..._)}return l(n({},t),{resultList:T,imgList:o})}case i.SET_BASIC_INDEX:{const{toolInstance:o,step:s,imgList:u,imgIndex:a,stepList:p,annotationEngine:c,resultList:T,basicResultList:g}=t;if(!o||!c)return t;const _=e.payload.basicIndex,I=(h=g[_])==null?void 0:h.id,L=U((j=u[a])==null?void 0:j.result),D=(T||[]).filter(x=>x.sourceID===I),R=B(p,s),{dataSourceStep:v,tool:O}=R,C=B(p,v);let P=[];return v&&O&&(P=(G=L[`step_${v}`])==null?void 0:G.result,(P==null?void 0:P.length)>0?(c==null||c.setBasicInfo(C.tool,P[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),dt.info(F.t("NoDependency")))),o==null||o.setResult(D),o==null||o.history.initRecord(D,!0),l(n({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:o}=e.payload;return l(n({},t),{triggerEventAfterIndexChanged:!!o})}case i.LOAD_FILE_DATA:{const{imgList:o,step:s,toolInstance:u,annotationEngine:a,stepList:p}=t;if(!u)return l(n({},t),{imgIndex:e.payload.nextIndex});const c=N.getCurrentStepInfo(s,p),{nextIndex:T,imgNode:g,nextBasicIndex:_,imgError:I}=e.payload,L=_!=null?_:0,D=U((V=o[T])==null?void 0:V.result),R=D[`step_${c.step}`],v=!R,O={rotate:(M=D.rotate)!=null?M:0,valid:(k=D.valid)!=null?k:!0};g&&I!==!0?a==null||a.setImgNode(g,O):u==null||u.setValid(O.valid);const C=B(p,c.step),{dataSourceStep:P,tool:x}=C,lt=B(p,P),it=P&&x,b=(H=(w=D[`step_${P}`])==null?void 0:w.result)!=null?H:[],z=W.getInitialResultList(R==null?void 0:R.result,u,C,b,v);if(a==null||a.launchOperation(),it&&((b==null?void 0:b.length)>0?a==null||a.setBasicInfo(lt.tool,b[L]):(a==null||a.setBasicInfo(lt.tool),a==null||a.forbidOperation(),dt.info(F.t("NoDependency")))),c.tool!=="check"){const Lt=(q=(X=b[L])==null?void 0:X.id)!=null?q:"",Et=it?z.filter(St=>yt.isSameSourceID(St.sourceID,Lt)):z;(Z=u==null?void 0:u.history)==null||Z.initRecord(z,!0),u==null||u.setResult(Et)}return l(n({},t),{imgIndex:T,basicIndex:L,basicResultList:b,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return l(n({},t),{config:(Q=e.payload.config)!=null?Q:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:o}=e.payload;return l(n({},t),{stepList:o})}case i.SET_TASK_CONFIG:{const{stepList:o,step:s}=e.payload;return l(n({},t),{stepList:o,step:s})}case i.INIT_TOOL:{const{imgNode:o}=t,s=Bt(t,o);if(s){const{toolInstance:u,annotationEngine:a}=s;return l(n({},t),{toolInstance:u,annotationEngine:a})}return n({},t)}case i.SET_TOOL:{const o=(tt=e.payload)==null?void 0:tt.instance;return o?l(n({},t),{toolInstance:o}):n({},t)}case i.UPDATE_ON_SUBMIT:return l(n({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return l(n({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return l(n({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return l(n({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return l(n({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return l(n({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return l(n({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return l(n({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return l(n({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return l(n({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return l(n({},t),{preDataProcess:e.payload.preDataProcess});case i.SKIP_BEFORE_PAGE_TURNING:return l(n({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:o,index:s}=e.payload,{imgList:u}=t,a=[...u];return a[s]=n(n({},a[s]),o),l(n({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:o,beforeRotate:s}=t;return s&&s()===!1||(et=o==null?void 0:o.updateRotate)==null||et.call(o),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:o}=t,s=(ot=o==null?void 0:o.valid)!=null?ot:!0;return ct.destroyAll(),ct.confirm({content:F.t(s?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{o==null||o.setValid(!s)},okText:F.t("Confirm"),cancelText:F.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:o,imgIndex:s,imgList:u,step:a}=t;if(!o)return t;if(s===0||s>=u.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const p=u[s-1].result;if(!p)return t;const c=W.copyResultChange(p,a,(nt=u[s].result)!=null?nt:"");u[s]=l(n({},u[s]),{result:c});const g=U(c)[`step_${a}`],_=(g==null?void 0:g.result)||[];return o==null||o.setResult(_),o==null||o.history.pushHistory(_),(st=o==null?void 0:o.asyncData)==null||st.call(o,u[s]),l(n({},t),{imgList:[...u]})}case i.SET_STEP:{const{stepList:o,annotationEngine:s}=t,{toStep:u}=e.payload;if(!s)return t;const a=B(o,u);return s==null||s.setToolName(a.tool,a.config),l(n({},t),{step:u,toolInstance:s==null?void 0:s.toolInstance})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:o}=e.payload;return l(n({},t),{loadPCDFileLoading:!!o})}case i.SET_LOADING:{const{loading:o}=e.payload;return l(n({},t),{loading:!!o})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:o}=e.payload;return l(n({},t),{pointCloudLoading:!!o})}case i.SET_CHECK_MODE:{const{checkMode:o}=e.payload;return l(n({},t),{checkMode:!!o})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:o}=e.payload;return l(n({},t),{highlightAttribute:o})}case i.BATCH_UPDATE_TRACK_ID:{const{id:o,newID:s,rangeIndex:u,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,T=[],g=a.map((_,I)=>{if(ut.isInRange(I,u)){const L=l(n({},_),{result:at.batchUpdateTrackID({id:o,newID:s,result:_.result})});return T.push({imgIndex:I,newInfo:L}),L}return _});return c&&c([g[p]],K.BatchUpdateTrackID,p,g,{updateImgList:T}),l(n({},t),{imgList:g})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:o,newData:s,rangeIndex:u}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,T=[],g=a.map((_,I)=>{if(ut.isInRange(I,u)){const L=l(n({},_),{result:at.batchUpdateResultByTrackID({id:o,newData:s,result:_.result})});return T.push({imgIndex:I,newInfo:L}),L}return _});return c&&c([g[p]],K.BatchUpdateTrackID,p,g,{updateImgList:T}),l(n({},t),{imgList:g})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:o,imgList:s,stepList:u,step:a,predictionResult:p}=t,c={};p.forEach(I=>{const{index:L}=I;c[L]=pt.pick(I,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const T=`step_${a}`,g=[],_=s.map((I,L)=>{if(c[L]){const D=I.result==="{}"?U(Y("",{step:a,stepList:u},{rect:[]},{})):U(I.result);D[T].result.push(c[L]);const R=l(n({},I),{result:JSON.stringify(D)});return g.push({imgIndex:L,newInfo:R}),R}return I});return o==null||o(_,K.BatchUpdateImgList,-1,_,{updateImgList:g}),l(n({},t),{imgList:_})}default:return t}};export{wt as LoadFileAndFileData,Vt as annotationReducer,Gt as composeResultByToolInstance,B as getStepConfig,Nt as getTotalPage};
|
package/es/utils/audio.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"antd";import{cStyle as b}from"@labelbee/lb-annotation";import"lodash";import
|
|
1
|
+
import"antd";import{cStyle as b}from"@labelbee/lb-annotation";import"lodash";import s from"decimal.js";import c from"moment";const{COLORS_ARRAY:a,ICON_ARRAY:F,INVALID_ICON:k,NULL_COLOR:d,NULL_ICON:D,WHITE_FONT_COLOR_ARRAY:h}=b,p={label:"\u6587\u672C",key:"text",required:!1,default:"",maxLength:1e3},C=(t,e)=>{var r,n;try{const o=i(t,e);return(n=(r=e[o])==null?void 0:r.key)!=null?n:t}catch(o){return t}},i=(t,e)=>{try{return e.findIndex(n=>n.value===t)}catch(r){return-1}},m=(t,e)=>{try{const r=i(t,e);return r===-1?d:a[r%a.length]}catch(r){return d}},I=(t,e)=>{try{const r=m(t,e);return h.includes(r)?"#fff":"#333"}catch(r){return"#333"}},g=(t,e)=>{var r;try{const n=((r=t.match(/\((.*)\)/))==null?void 0:r[1].split(","))||[];return n.splice(3,1,e.toString()),`rgba(${n.join(",")})`}catch(n){return t}},v=(t,e)=>new s(Number(t)||0).minus(Number(e)||0).toNumber(),A=(t,e)=>new s(t).add(e).toNumber(),_=t=>{let e=null;return n=>e?n.target===(e==null?void 0:e.target):(e=n,setTimeout(()=>{e=null},t),!1)},N=_(300),O=t=>{const e=Math.floor(t*1e3),r=c.duration(e);return`${Math.floor(r.asMinutes())}:${c.utc(e).format("ss")}`},x=(t,e="ss.S")=>{const r=Math.floor(t*1e3),n=c.duration(r);return`${y(Math.floor(n.asMinutes()))}:${c.utc(r).format(e)}`},y=t=>t<10?`0${t}`:t,E=(t,e)=>{let r=null,n=null;const o=t.length;if(o===0)return{min:r,max:n};let u=0;return e<t[u]?n=t[u]:(t.forEach((l,f)=>{e>l&&(r=l,u=f)}),r&&u<o-1&&(n=t[u+1])),{min:r,max:n}},R=()=>{const t=document.createEvent("Event");t.initEvent("resize",!0,!0),window.dispatchEvent(t)};function L(t){try{const e=JSON.parse(t);return typeof e.valid=="boolean"?e.valid:!0}catch(e){return!0}}export{p as DEFAULT_TEXT_CONFIG_ITEM,R as dispatchResizeEvent,O as formatTime,m as getAttributeColor,I as getAttributeFontColor,i as getAttributeIndex,C as getAttributeShowText,E as getCanMoveRange,N as isDoubleClick,L as isImageValue,A as precisionAdd,v as precisionMinus,x as timeFormat,g as updateColorOpacity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ViewportProvider as
|
|
1
|
+
import{ViewportProvider as S}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as b}from"antd";import{Layout as v}from"antd/es";import t,{useState as A}from"react";import O from"./annotationOperation/index.js";import M from"./annotationTips/index.js";import V from"./sidebar/index.js";import h from"./toolFooter/index.js";import k from"./toolHeader/index.js";import{getStepConfig as _}from"../../store/annotation/reducer.js";import F from"../../components/videoAnnotate/index.js";import{connect as I}from"react-redux";import y from"../../utils/ToolUtils.js";import $ from"../../components/pointCloudView/index.js";import{getClassName as H}from"../../utils/dom.js";import{classnames as R}from"../../utils/index.js";import W from"../../components/predictTracking/previewResult/index.js";import{LabelBeeContext as B}from"../../store/ctx.js";import{EToolName as E}from"../../data/enums/ToolType.js";import D from"./LLMLayout/index.js";import U from"../../components/audioAnnotate/index.js";import{LoadingOutlined as p}from"@ant-design/icons";import{useTranslation as z}from"react-i18next";import{EPointCloudName as q}from"@labelbee/lb-annotation";var G=Object.defineProperty,T=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,x=(e,o,n)=>o in e?G(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,a=(e,o)=>{for(var n in o||(o={}))J.call(o,n)&&x(e,n,o[n]);if(T)for(var n of T(o))K.call(o,n)&&x(e,n,o[n]);return e};const{Sider:Q,Content:X}=v,s=`${C}-layout`,Y=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(M,{path:e.path,tips:e.tips}),t.createElement(O,a({},e)),t.createElement(h,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},Z=e=>{var o;return t.createElement(t.Fragment,null,t.createElement($,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit}),t.createElement(h,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},ee=e=>{var o;const{stepList:n,step:i}=e,r=(o=_(n,i))==null?void 0:o.tool,d=y.isPointCloudTool(r),l=y.isVideoTool(r);return d?t.createElement(Z,a({},e)):l?t.createElement(F,{drawLayerSlot:e.drawLayerSlot,footer:e.footer}):t.createElement(Y,a({},e))},L=e=>{var o,n,i;const{t:r}=z(),{stepList:d,step:l}=e,m=(o=_(d,l))==null?void 0:o.tool,c=![E.LLM].includes(m),u=![E.LLM].includes(m),f=[q.PointCloud].includes(m);return t.createElement(S,null,t.createElement(b,{spinning:e.loading,indicator:t.createElement(p,null),tip:t.createElement("span",{style:{marginTop:200}},r("LoadingTips")),delay:500},t.createElement(v,{className:R([s,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${s}__header`,style:(i=e.style)==null?void 0:i.header},t.createElement(k,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:c,hasHeaderOption:u,hasPredictTrackingIcon:f})),e.children)))},te=e=>{var o,n,i,r,d,l,m;const[c,u]=A(void 0),f=(n=(o=e.style)==null?void 0:o.sider)==null?void 0:n.width,{stepList:w,step:j}=e,g=(i=_(w,j))==null?void 0:i.tool,P=E.LLM===g,N=y.isAudioTool(g);return P?t.createElement(L,a({},e),t.createElement(D,a({},e))):N?t.createElement(L,a({},e),t.createElement(U,a({},e))):t.createElement(L,a({},e),t.createElement(v,{className:H("layout","container")},e==null?void 0:e.leftSider,t.createElement(X,{className:`${s}__content`},t.createElement(ee,a({},e)),t.createElement(W,null)),t.createElement(Q,{className:`${s}__side`,width:(r=c!=null?c:f)!=null?r:240,style:(d=e.style)==null?void 0:d.sider},t.createElement(V,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:u,propsSiderWidth:(m=(l=e.style)==null?void 0:l.sider)==null?void 0:m.width}))))},oe=({annotation:e})=>{var o,n,i;const{imgList:r,loading:d}=e,l=(o=r[e.imgIndex])!=null?o:{};return{path:(i=(n=l==null?void 0:l.path)!=null?n:l==null?void 0:l.url)!=null?i:"",loading:d}};var ne=I(oe,null,null,{context:B})(te);export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t,{useState as u,useEffect as F,useRef as U}from"react";import{connect as V}from"react-redux";import{cloneDeep as M}from"lodash";import{classnames as C}from"../../../../utils/index.js";import{Switch as z,Input as W}from"antd/es";import{cKeyCode as G,cTool as H}from"@labelbee/lb-annotation";import{PageForward as J}from"../../../../store/annotation/actionCreators.js";import{ConfigUtils as Q}from"../../../../utils/ConfigUtils.js";import{useTranslation as A}from"react-i18next";import{LabelBeeContext as X}from"../../../../store/ctx.js";var Y=Object.defineProperty,I=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,K=(e,o,n)=>o in e?Y(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,te=(e,o)=>{for(var n in o||(o={}))Z.call(o,n)&&K(e,n,o[n]);if(I)for(var n of I(o))ee.call(o,n)&&K(e,n,o[n]);return e};const R=G.default,{EVideoToolName:oe}=H,j=e=>{e.stopPropagation(),e.nativeEvent.stopPropagation(),e.nativeEvent.stopImmediatePropagation()},D=e=>{const{textareaProps:o,footer:n}=e;return t.createElement(t.Fragment,null,t.createElement(W.TextArea,te({bordered:!1,rows:6,onKeyDown:j,onKeyUp:j},o)),t.createElement("div",{className:C({textAreaLength:!0})},n))},$=e=>{var o;const n=U(null),[g,m]=u(!1),[N,v]=u(!1),{t:d}=A(),{disabled:i,config:s,result:c,updateText:T,index:E,switchToNextTextarea:h,hasMultiple:P,onNext:w}=e,{maxLength:p}=s,f=c?c[s.key]:"",b=(o=f==null?void 0:f.length)!=null?o:0,x=a=>{T&&(T(a,s.key),s.required&&v(!a))},y=P&&h,_={id:`textInput-${E}`,ref:n,disabled:i,value:f,maxLength:p,autoSize:{minRows:2,maxRows:6},onChange:a=>{const S=a.target.value;x(S)},onFocus:()=>{m(!0)},onBlur:a=>{m(!1),s.required&&v(!a.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:a=>{a.ctrlKey&&a.keyCode===R.Enter&&(w&&w(),a.preventDefault()),a.keyCode===R.Tab&&y&&(a.preventDefault(),a.nativeEvent.stopImmediatePropagation(),h(E)),a.nativeEvent.stopPropagation()}},L=t.createElement("div",{className:"textAreaFooter"},t.createElement("div",{className:"hotkeyTip"},y&&t.createElement("span",null,`[${d("Switch")}]Tab`),t.createElement("span",null,`[${d("TurnPage")}]Ctrl+Enter`)),t.createElement("div",{className:"wordCount"},t.createElement("span",{className:b>=p?"warning":""},b),"/",t.createElement("span",null,p)));return F(()=>{i&&m(!1)},[i]),t.createElement("div",{className:"textField"},t.createElement("div",{className:"label"},t.createElement("span",{className:C({required:s.required})},s.label),t.createElement("i",{className:C({clearText:!0,disabled:i}),onClick:()=>{i||x("")}})),t.createElement("div",{className:C({disabled:i,"textarea-outline":!0,"ant-input-focused":g,textareaContainer:!0,focus:g,invalid:N})},t.createElement(D,{footer:L,textareaProps:_})))},ne=({toolInstance:e,imgIndex:o,dispatch:n,triggerEventAfterIndexChanged:g,step:m,stepList:N,basicResultList:v})=>{var d,i,s;const[c,T]=u([]),[E,h]=u(0),[P,w]=u(!0),[,p]=u(0),{t:f}=A(),b=r=>{const l=(r+1)%c.length;x(l)},x=r=>{setTimeout(()=>{const l=document.getElementById(`textInput-${r}`);l&&(h(r),l.focus(),l.select(),l.scrollIntoView({behavior:"smooth",block:"center"}))})};F(()=>{e&&(T(M(e.config.configList)),e.singleOn("valueUpdated",()=>{p(r=>r+1)}))},[e]);const y=(s=(i=(d=e==null?void 0:e.textList)==null?void 0:d[0])==null?void 0:i.value)!=null?s:{},_=(r,l)=>{var k,O;(O=e==null?void 0:e.updateTextValue)==null||O.call(e,l,r,(k=e==null?void 0:e.textList)==null?void 0:k[0])};F(()=>{o>-1&&g&&x(0)},[o]);const L=()=>{n(J(!0))},a=r=>{w(r),e==null||e.toggleShowText(r)},S=Q.getStepConfig(N,m),q=S.dataSourceStep>0&&v.length===0,B=S.tool===oe.VideoTextTool;return e&&t.createElement("div",{className:"textToolOperationMenu"},c.map((r,l)=>t.createElement($,{config:r,key:r.key,index:l,result:y,updateText:_,switchToNextTextarea:b,hasMultiple:c.length>1,focus:E===l,onNext:L,disabled:q})),B&&t.createElement("div",{className:"textToolSwitchItem"},f("toggleShowText"),t.createElement(z,{style:{alignSelf:"center"},checked:P,onChange:r=>{a(r)}})))};function ae(e){return{toolInstance:e.annotation.toolInstance,imgIndex:e.annotation.imgIndex,step:e.annotation.step,basicResultList:e.annotation.basicResultList,stepList:e.annotation.stepList,triggerEventAfterIndexChanged:e.annotation.triggerEventAfterIndexChanged}}var re=V(ae,null,null,{context:X})(ne);export{$ as SingleTextInput,D as TextareaWithFooter,re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{prefix as
|
|
1
|
+
import{prefix as F}from"../../../constant/index.js";import{EToolName as o}from"../../../data/enums/ToolType.js";import K from"../../../utils/StepUtils.js";import{Collapse as d}from"antd/es";import e,{useState as R}from"react";import{useTranslation as z}from"react-i18next";import D from"./AnnotationText/index.js";import G from"./ClearIcon/index.js";import U,{PointCloudOperation as N}from"./GeneralOperation/index.js";import q from"./ImgAttributeInfo/index.js";import H from"./SwitchAttributeList/index.js";import u,{expandIconFuc as j}from"./TagSidebar/index.js";import p from"./TextToolSidebar/index.js";import _ from"./PointCloudToolSidebar/index.js";import J from"./ToolStyle/index.js";import{cTool as Q}from"@labelbee/lb-annotation";import W from"./ScribbleSidebar/index.js";import{ToolIcons as X}from"./ToolIcons.js";import{useSelector as Y}from"../../../store/ctx.js";import{Tabs as $}from"antd";import{classnames as Z}from"../../../utils/index.js";import I from"../../../assets/annotation/common/icon_menu_fold.svg.js";import ee from"../../../components/LLMToolView/sidebar/index.js";import te from"../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js";const{EVideoToolName:f,EPointCloudName:ne}=Q,{Panel:L}=d,t=`${F}-sidebar`,oe=({sider:i,enableColorPicker:A,setSiderWidth:E,propsSiderWidth:re,checkMode:P})=>{const b=Y(r=>K.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[s,w]=R(!0),n=b==null?void 0:b.tool,{t:x}=z();if(!n)return null;const V=r=>{const c=e.createElement(J,null);return e.createElement(L,{header:x("Style"),className:"panel",key:r},c)},T=e.createElement(X,{toolName:n,onChange:()=>{}}),a=e.createElement(H,null),S=e.createElement(D,null),g=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:j},V("1")),h=e.createElement(d,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:j},e.createElement(L,{header:e.createElement("div",null,x("Adjust"),e.createElement(G,null)),className:"panel",key:"imgAttribute"},e.createElement(q,null))),l=e.createElement(U,null),k=e.createElement(u,null),B=e.createElement(p,null),v=e.createElement(W,{onChange:(r,c)=>{}}),C=e.createElement(te,null),y=e.createElement(ee,{checkMode:P}),m=e.createElement("div",{className:`${t}__horizontal`}),M=e.createElement(_,{enableColorPicker:A}),O=e.createElement(N,null);if(i)return typeof i=="function"?e.createElement("div",{className:`${t}`},i({toolIcon:T,attributeList:a,annotationText:S,toolStyle:g,imageAttributeInfo:h,operation:l,tagToolSideBar:k,textToolSideBar:B,horizontal:m,pointCloudToolSidebar:M,pointCloudOperation:O,scribbleSidebar:v,LLMSidebar:y,videoClipSidebar:C})):i;if([o.Rect,o.Point,o.Line,o.Rect,o.Polygon,o.Cuboid].includes(n))return e.createElement("div",{className:`${t}`},T,m,a,S,m,e.createElement("div",{className:`${t}__content`},g,h),l);if(n===o.Tag)return e.createElement("div",{className:`${t}`},e.createElement(u,null));if(n===f.VideoClipTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},C,a),l);if(n===f.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(u,null)),l);if(n===f.VideoTextTool)return e.createElement("div",{className:`${t}`},e.createElement(p,null));if(n===o.Text)return e.createElement("div",{className:`${t}`},e.createElement(p,null));if(n===ne.PointCloud){const r=()=>{w(!s),E&&E(s?48:void 0)},c=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:I})));return s?e.createElement($,{type:"card",activeKey:"1",className:Z({[`${t}`]:!0,[`${t}__pointCloud`]:!0}),tabBarExtraContent:{left:e.createElement("span",{onClick:()=>r(),style:{padding:"0px 4px"}},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:I}))}},e.createElement($.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement(_,null)),e.createElement(N,null))):c}return n===o.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},v,a),l):n===o.LLM?y:null};export{oe as default,t as sidebarCls};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.20.0-alpha.
|
|
3
|
+
"version": "1.20.0-alpha.10",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,27 +43,29 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.24.0-alpha.
|
|
47
|
-
"@labelbee/lb-utils": "1.16.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.24.0-alpha.7",
|
|
47
|
+
"@labelbee/lb-utils": "1.16.0-alpha.4",
|
|
48
48
|
"@labelbee/wavesurfer": "1.0.0",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|
|
50
|
+
"@types/react-transition-group": "^4.4.9",
|
|
50
51
|
"ahooks": "^3.4.0",
|
|
51
52
|
"classnames": "^2.3.0",
|
|
52
53
|
"decimal.js": "^10.4.3",
|
|
53
54
|
"github-markdown-css": "^5.2.0",
|
|
54
55
|
"lodash": "^4.17.21",
|
|
55
56
|
"postcss-url": "^10.1.3",
|
|
57
|
+
"re-resizable": "^6.9.9",
|
|
56
58
|
"react-colorful": "^5.6.1",
|
|
57
59
|
"react-i18next": "^11.12.0",
|
|
58
60
|
"react-markdown": "^8.0.7",
|
|
59
61
|
"react-redux": "^7.2.3",
|
|
60
62
|
"react-syntax-highlighter": "^15.5.0",
|
|
63
|
+
"react-transition-group": "^4.4.5",
|
|
61
64
|
"redux": "^4.0.5",
|
|
62
65
|
"redux-actions": "^2.6.5",
|
|
63
66
|
"redux-thunk": "^2.3.0",
|
|
64
67
|
"rehype-katex": "^6.0.3",
|
|
65
68
|
"diff-match-patch": "^1.0.5",
|
|
66
|
-
"re-resizable": "^6.9.9",
|
|
67
69
|
"remark-math": "^5.1.1",
|
|
68
70
|
"remark-gfm": "^3.0.1",
|
|
69
71
|
"resize-observer-polyfill": "^1.5.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),lbAnnotation=require("@labelbee/lb-annotation"),StepUtils=require("../../utils/StepUtils.js"),index=require("../../utils/index.js"),index$1=require("./index.js"),VideoTagLayer=require("./VideoTagLayer.js"),_=require("lodash"),utils=require("./utils.js");function _interopDefaultLegacy(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var React__default=_interopDefaultLegacy(React),___default=_interopDefaultLegacy(_);class TagToolInstanceAdaptor extends React__default.default.Component{constructor(i){super(i);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const s=e?this.state.tagResult.map(l=>((l==null?void 0:l.result[e])&&delete l.result[e],l)):[];this.setState({tagResult:s},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e,s,l,o,n,r;const a=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0,d=(s=this.videoRef)==null?void 0:s.getVideoPlaybackQuality(),u=d==null?void 0:d.totalVideoFrames,c=(o=(l=this.videoRef)==null?void 0:l.videoWidth)!=null?o:0,v=(r=(n=this.videoRef)==null?void 0:n.videoHeight)!=null?r:0;return[this.state.tagResult,{valid:this.state.valid,duration:a,frames:u,videoWidth:c,videoHeight:v}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var s,l;const{isMulti:o}=t,{key:n,value:r}=t.value;if(o){let a=(l=(s=e[n])==null?void 0:s.split(";"))!=null?l:[];a.includes(r)?a=a.filter(u=>u!==r):a.push(r);const d=new Set(a);return e[n]=Array.from(d).join(";"),___default.default.pickBy(e,u=>u)}return e[n]=e[n]===r?void 0:r,___default.default.pickBy(e,a=>a)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{const e=utils.getKeyCodeNumber(t.keyCode);if(e){const s=e-1;if(this.config.inputList.length===1){this.labelSelectedList=[0,s],this.setLabel(0,s),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],s],this.setLabel(this.labelSelectedList[0],s),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[s],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e;const{imgList:s,imgIndex:l,step:o}=t;if(!s[l])return;const n=index.jsonParser(s[l].result),r=n[`step_${o}`];this.setState({tagResult:(e=r==null?void 0:r.result)!=null?e:[],valid:(n==null?void 0:n.valid)===void 0?!0:n.valid})},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){const i=StepUtils.getCurrentStepInfo(this.props.step,this.props.stepList);return index.jsonParser(i==null?void 0:i.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var i;return(i=this.state.tagResult[0])!=null?i:{}}get valid(){return this.state.valid}singleOn(i,t){this.fns[i]=t}on(i,t){this.singleOn(i,t)}getTagResultByCode(i,t){var e,s,l;try{const o=(s=(e=this.config)==null?void 0:e.inputList)!=null?s:[],n=o.length>1,r=t!==void 0?i:0,a=t!==void 0?t:i,d=n?o[r]:o[0],u=((l=d.subSelected)!=null?l:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(o){return}}setLabelBySelectedList(i,t){var e,s,l,o;const n=this.getTagResultByCode(i,t);if(n){const r=this.combineResult(n,(s=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?s:{}),a=[{sourceID:lbAnnotation.CommonToolUtils.getSourceID(),id:(o=(l=this.currentTagResult)==null?void 0:l.id)!=null?o:lbAnnotation.uuid(8,62),result:r}];this.setState({tagResult:a},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(i){return i.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(i),!0}render(){var i;const{imgIndex:t,imgList:e,pageForward:s,pageJump:l,pageBackward:o}=this.props,{tagResult:n,valid:r}=this.state;return React__default.default.createElement("div",{style:{height:"100%",width:"100%",position:"relative"}},React__default.default.createElement(index$1.VideoPlayer,{imgIndex:t,imgList:e,pageBackward:o,pageForward:s,pageJump:l,valid:r,setVideoRef:a=>{this.videoRef=a}}),React__default.default.createElement(VideoTagLayer.VideoTagLayer,{result:n,inputList:(i=this.config)==null?void 0:i.inputList}))}}exports.TagToolInstanceAdaptor=TagToolInstanceAdaptor;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import h from"react";import{CommonToolUtils as p,uuid as f}from"@labelbee/lb-annotation";import y from"../../utils/StepUtils.js";import{jsonParser as c}from"../../utils/index.js";import{VideoPlayer as L}from"./index.js";import{VideoTagLayer as R}from"./VideoTagLayer.js";import g from"lodash";import{getKeyCodeNumber as b}from"./utils.js";class S extends h.Component{constructor(i){super(i);this.fns={},this.labelSelectedList=[],this.clearResult=(t=!0,e)=>{const s=e?this.state.tagResult.map(l=>((l==null?void 0:l.result[e])&&delete l.result[e],l)):[];this.setState({tagResult:s},()=>this.emitEvent("render"))},this.exportData=()=>{var t,e,s,l,r,n,o;const a=(e=(t=this.videoRef)==null?void 0:t.duration)!=null?e:0,d=(s=this.videoRef)==null?void 0:s.getVideoPlaybackQuality(),u=d==null?void 0:d.totalVideoFrames,m=(r=(l=this.videoRef)==null?void 0:l.videoWidth)!=null?r:0,v=(o=(n=this.videoRef)==null?void 0:n.videoHeight)!=null?o:0;return[this.state.tagResult,{valid:this.state.valid,duration:a,frames:u,videoWidth:m,videoHeight:v}]},this.emitEvent=t=>{this.fns[t]&&this.fns[t]()},this.combineResult=(t,e={})=>{var s,l;const{isMulti:r}=t,{key:n,value:o}=t.value;if(r){let a=(l=(s=e[n])==null?void 0:s.split(";"))!=null?l:[];a.includes(o)?a=a.filter(u=>u!==o):a.push(o);const d=new Set(a);return e[n]=Array.from(d).join(";"),g.pickBy(e,u=>u)}return e[n]=e[n]===o?void 0:o,g.pickBy(e,a=>a)},this.setResult=t=>{this.setState({tagResult:t}),this.fns.render&&this.fns.render()},this.setLabel=(t,e)=>{this.setLabelBySelectedList(t,e)},this.keydown=t=>{const e=b(t.keyCode);if(e){const s=e-1;if(this.config.inputList.length===1){this.labelSelectedList=[0,s],this.setLabel(0,s),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],s],this.setLabel(this.labelSelectedList[0],s),setTimeout(()=>{this.labelSelectedList=[],this.emitEvent("render")},500)):(this.labelSelectedList=[s],this.emitEvent("expend"))}},this.setValid=t=>{this.setState({valid:t}),t===!1&&this.setState({tagResult:[]}),this.emitEvent("render")},this.setResultFromImgList=t=>{var e;const{imgList:s,imgIndex:l,step:r}=t;if(!s[l])return;const n=c(s[l].result),o=n[`step_${r}`];this.setState({tagResult:(e=o==null?void 0:o.result)!=null?e:[],valid:(n==null?void 0:n.valid)===void 0?!0:n.valid})},this.state={tagResult:[],labelSelectedList:[],valid:!0}}get config(){const i=y.getCurrentStepInfo(this.props.step,this.props.stepList);return c(i==null?void 0:i.config)}get history(){return{initRecord:()=>{},pushHistory:()=>{}}}get currentTagResult(){var i;return(i=this.state.tagResult[0])!=null?i:{}}get valid(){return this.state.valid}singleOn(i,t){this.fns[i]=t}on(i,t){this.singleOn(i,t)}getTagResultByCode(i,t){var e,s,l;try{const r=(s=(e=this.config)==null?void 0:e.inputList)!=null?s:[],n=r.length>1,o=t!==void 0?i:0,a=t!==void 0?t:i,d=n?r[o]:r[0],u=((l=d.subSelected)!=null?l:[])[a];if(d&&u)return{value:{key:d.value,value:u.value},isMulti:d.isMulti}}catch(r){return}}setLabelBySelectedList(i,t){var e,s,l,r;const n=this.getTagResultByCode(i,t);if(n){const o=this.combineResult(n,(s=(e=this.state.tagResult[0])==null?void 0:e.result)!=null?s:{}),a=[{sourceID:p.getSourceID(),id:(r=(l=this.currentTagResult)==null?void 0:l.id)!=null?r:f(8,62),result:o}];this.setState({tagResult:a},()=>this.emitEvent("render"))}}componentDidMount(){document.addEventListener("keydown",this.keydown),this.props.onMounted(this),this.setResultFromImgList(this.props)}componentWillUnmount(){document.addEventListener("keydown",this.keydown),this.props.onUnmounted()}shouldComponentUpdate(i){return i.imgIndex!==this.props.imgIndex&&this.setResultFromImgList(i),!0}render(){var i;const{imgIndex:t,imgList:e,pageForward:s,pageJump:l,pageBackward:r}=this.props,{tagResult:n,valid:o}=this.state;return h.createElement("div",{style:{height:"100%",width:"100%",position:"relative"}},h.createElement(L,{imgIndex:t,imgList:e,pageBackward:r,pageForward:s,pageJump:l,valid:o,setVideoRef:a=>{this.videoRef=a}}),h.createElement(R,{result:n,inputList:(i=this.config)==null?void 0:i.inputList}))}}export{S as TagToolInstanceAdaptor};
|